Skip to content

Commit 50d68dd

Browse files
committed
Handle error and add comment mentioning the bug
1 parent a5a6cc3 commit 50d68dd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/manager/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,11 @@ func startOperator(ctx context.Context) error {
573573

574574
// configure the manager cache based on the number of managed namespaces
575575
var managedNamespaces []string
576-
viper.UnmarshalKey(operator.NamespacesFlag, &managedNamespaces)
576+
// do not use viper.GetStringSlice here as it suffers from https://github.com/spf13/viper/issues/380
577+
if err := viper.UnmarshalKey(operator.NamespacesFlag, &managedNamespaces); err != nil {
578+
log.Error(err, "Failed to parse managed namespaces flag")
579+
return err
580+
}
577581
switch {
578582
case len(managedNamespaces) == 0:
579583
log.Info("Operator configured to manage all namespaces")

0 commit comments

Comments
 (0)