From 0a41aaa3e60354ac0e5cd86512006467d7f36e9a Mon Sep 17 00:00:00 2001 From: aimichelle Date: Thu, 20 Jul 2023 20:32:04 -0700 Subject: [PATCH] Fix default metadata namespaces (#1633) Summary: #1368 added the ability to limit the metadata service to specific namespaces. By default, if no namespaces are mentioned, the flag is supposed to choose all namespaces. However, if the environment variable is not specified, it is actually parsed as an empty list and the default is not properly chosen. Instead, we can assume no users actually want to watch 0 namespaces, and set it to all namespaces when that occurs. Relevant Issues: N/A Type of change: /kind bug Test Plan: Skaffold deploy metadata service Signed-off-by: Michelle Nguyen --- src/vizier/services/metadata/metadata_server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/vizier/services/metadata/metadata_server.go b/src/vizier/services/metadata/metadata_server.go index d2d77659833..d94ea9d810c 100644 --- a/src/vizier/services/metadata/metadata_server.go +++ b/src/vizier/services/metadata/metadata_server.go @@ -238,6 +238,9 @@ func main() { mdh := k8smeta.NewHandler(updateCh, k8sMds, k8sMds, nc) namespaces := viper.GetStringSlice("metadata_namespaces") + if len(namespaces) == 0 { + namespaces = []string{v1.NamespaceAll} + } k8sMc, err := k8smeta.NewController(namespaces, updateCh) defer k8sMc.Stop()