diff --git a/admiral/cmd/admiral/cmd/root.go b/admiral/cmd/admiral/cmd/root.go index a58ad70a1..75fac2f13 100644 --- a/admiral/cmd/admiral/cmd/root.go +++ b/admiral/cmd/admiral/cmd/root.go @@ -244,7 +244,7 @@ func GetRootCmd(args []string) *cobra.Command { rootCmd.PersistentFlags().BoolVar(¶ms.EnableIsOnlyReplicaCountChangedCheck, "enable_replica_count_check", false, "Enable/Disable Replica Count Check") rootCmd.PersistentFlags().BoolVar(¶ms.ClientInitiatedProcessingEnabled, "client_initiated_processing_enabled", true, "Enable/Disable Client Initiated Processing") rootCmd.PersistentFlags().BoolVar(¶ms.PreventSplitBrain, "prevent_split_brain", true, "Enable/Disable Explicit Split Brain prevention logic") - rootCmd.PersistentFlags().StringSliceVar(¶ms.IgnoreLabelsAnnotationsList, "ignore_labels_annotations_list", []string{"applications.argoproj.io/app-name", "app.kubernetes.io/instance", "argocd.argoproj.io/tracking-id"}, "Labels and annotations that should not be preserved during VS copy") + rootCmd.PersistentFlags().StringSliceVar(¶ms.IgnoreLabelsAnnotationsVSCopyList, "ignore_labels_annotations_vs_copy_list", []string{"applications.argoproj.io/app-name", "app.kubernetes.io/instance", "argocd.argoproj.io/tracking-id"}, "Labels and annotations that should not be preserved during VS copy") //Admiral 2.0 flags rootCmd.PersistentFlags().BoolVar(¶ms.AdmiralOperatorMode, "admiral_operator_mode", false, "Enable/Disable admiral operator functionality") diff --git a/admiral/pkg/clusters/virtualservice_handler.go b/admiral/pkg/clusters/virtualservice_handler.go index 63cb1b782..d1c8d7a33 100644 --- a/admiral/pkg/clusters/virtualservice_handler.go +++ b/admiral/pkg/clusters/virtualservice_handler.go @@ -530,7 +530,7 @@ func addUpdateVirtualService( } // remove ignored labels and annotations from NewCopy (deleting on nil map or nonexistent keys is a no-op) - for _, ignored := range common.GetIgnoreLabelsAnnotations() { + for _, ignored := range common.GetIgnoreLabelsAnnotationsVSCopy() { delete(newCopy.Labels, ignored) delete(newCopy.Annotations, ignored) } diff --git a/admiral/pkg/clusters/virtualservice_handler_test.go b/admiral/pkg/clusters/virtualservice_handler_test.go index f19d4fe49..8e345deee 100644 --- a/admiral/pkg/clusters/virtualservice_handler_test.go +++ b/admiral/pkg/clusters/virtualservice_handler_test.go @@ -1791,10 +1791,10 @@ func TestAddUpdateVirtualService(t *testing.T) { }, } admiralParams := common.AdmiralParams{ - LabelSet: &common.LabelSet{}, - SyncNamespace: "test-sync-ns", - EnableSWAwareNSCaches: true, - IgnoreLabelsAnnotationsList: []string{"applications.argoproj.io/app-name", "app.kubernetes.io/instance", "argocd.argoproj.io/tracking-id"}, + LabelSet: &common.LabelSet{}, + SyncNamespace: "test-sync-ns", + EnableSWAwareNSCaches: true, + IgnoreLabelsAnnotationsVSCopyList: []string{"applications.argoproj.io/app-name", "app.kubernetes.io/instance", "argocd.argoproj.io/tracking-id"}, } common.ResetSync() common.InitializeConfig(admiralParams) @@ -1827,7 +1827,7 @@ func TestAddUpdateVirtualService(t *testing.T) { if err != nil { t.Errorf("failed to get VS with error: %v", err) } - for _, ignored := range common.GetIgnoreLabelsAnnotations() { + for _, ignored := range common.GetIgnoreLabelsAnnotationsVSCopy() { if vs.Labels[ignored] != "" { t.Errorf("expected VS to not ignored labels, but got labels: %v", ignored) } diff --git a/admiral/pkg/controller/common/config.go b/admiral/pkg/controller/common/config.go index 867cd7eb2..807ea03f9 100644 --- a/admiral/pkg/controller/common/config.go +++ b/admiral/pkg/controller/common/config.go @@ -577,8 +577,8 @@ func GetOperatorSecretFilterTags() string { return wrapper.params.OperatorSecretFilterTags } -func GetIgnoreLabelsAnnotations() []string { +func GetIgnoreLabelsAnnotationsVSCopy() []string { wrapper.RLock() defer wrapper.RUnlock() - return wrapper.params.IgnoreLabelsAnnotationsList + return wrapper.params.IgnoreLabelsAnnotationsVSCopyList } diff --git a/admiral/pkg/controller/common/config_test.go b/admiral/pkg/controller/common/config_test.go index a018a8c27..981fd09f9 100644 --- a/admiral/pkg/controller/common/config_test.go +++ b/admiral/pkg/controller/common/config_test.go @@ -80,7 +80,7 @@ func setupForConfigTests() { AdditionalEndpointSuffixes: []string{"suffix1", "suffix2"}, AdditionalEndpointLabelFilters: []string{"label1", "label2"}, EnableWorkloadDataStorage: true, - IgnoreLabelsAnnotationsList: []string{"applications.argoproj.io/app-name", "app.kubernetes.io/instance", "argocd.argoproj.io/tracking-id"}, + IgnoreLabelsAnnotationsVSCopyList: []string{"applications.argoproj.io/app-name", "app.kubernetes.io/instance", "argocd.argoproj.io/tracking-id"}, } ResetSync() initHappened = true @@ -490,8 +490,8 @@ func TestConfigManagement(t *testing.T) { t.Errorf("Enable workload data storage mismatch, expected true, got %v", GetEnableWorkloadDataStorage()) } - if len(GetIgnoreLabelsAnnotations()) != 3 { - t.Errorf("ignored labels and annotations for VS copy mismatch, expected 3, got %v", GetIgnoreLabelsAnnotations()) + if len(GetIgnoreLabelsAnnotationsVSCopy()) != 3 { + t.Errorf("ignored labels and annotations for VS copy mismatch, expected 3, got %v", GetIgnoreLabelsAnnotationsVSCopy()) } } diff --git a/admiral/pkg/controller/common/types.go b/admiral/pkg/controller/common/types.go index c46d228ed..1159fbfe8 100644 --- a/admiral/pkg/controller/common/types.go +++ b/admiral/pkg/controller/common/types.go @@ -108,7 +108,7 @@ type AdmiralParams struct { EnableGenerationCheck bool EnableIsOnlyReplicaCountChangedCheck bool PreventSplitBrain bool - IgnoreLabelsAnnotationsList []string + IgnoreLabelsAnnotationsVSCopyList []string // Cartographer specific params TrafficConfigPersona bool