Skip to content

Commit

Permalink
edit flag name
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Tay <[email protected]>
  • Loading branch information
Ryan Tay committed Jan 8, 2025
1 parent 2254d8d commit 20274ab
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion admiral/cmd/admiral/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func GetRootCmd(args []string) *cobra.Command {
rootCmd.PersistentFlags().BoolVar(&params.EnableIsOnlyReplicaCountChangedCheck, "enable_replica_count_check", false, "Enable/Disable Replica Count Check")
rootCmd.PersistentFlags().BoolVar(&params.ClientInitiatedProcessingEnabled, "client_initiated_processing_enabled", true, "Enable/Disable Client Initiated Processing")
rootCmd.PersistentFlags().BoolVar(&params.PreventSplitBrain, "prevent_split_brain", true, "Enable/Disable Explicit Split Brain prevention logic")
rootCmd.PersistentFlags().StringSliceVar(&params.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(&params.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(&params.AdmiralOperatorMode, "admiral_operator_mode", false, "Enable/Disable admiral operator functionality")
Expand Down
2 changes: 1 addition & 1 deletion admiral/pkg/clusters/virtualservice_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
10 changes: 5 additions & 5 deletions admiral/pkg/clusters/virtualservice_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions admiral/pkg/controller/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions admiral/pkg/controller/common/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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())
}
}

Expand Down
2 changes: 1 addition & 1 deletion admiral/pkg/controller/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ type AdmiralParams struct {
EnableGenerationCheck bool
EnableIsOnlyReplicaCountChangedCheck bool
PreventSplitBrain bool
IgnoreLabelsAnnotationsList []string
IgnoreLabelsAnnotationsVSCopyList []string

// Cartographer specific params
TrafficConfigPersona bool
Expand Down

0 comments on commit 20274ab

Please sign in to comment.