Skip to content

Commit

Permalink
Merge branch 'master' of github.com:argoproj-labs/argocd-operator int…
Browse files Browse the repository at this point in the history
…o operator-redesign
  • Loading branch information
jaideepr97 committed Oct 10, 2023
2 parents e7362b5 + 64aa268 commit effb0dd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
15 changes: 12 additions & 3 deletions controllers/argocd/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ func getResourceHealthChecks(cr *argoproj.ArgoCD) map[string]string {
if cr.Spec.ResourceHealthChecks != nil {
resourceHealthChecks := cr.Spec.ResourceHealthChecks
for _, healthCustomization := range resourceHealthChecks {
subkey := "resource.customizations.health." + healthCustomization.Group + "_" + healthCustomization.Kind
if healthCustomization.Group != "" {
healthCustomization.Group += "_"
}
subkey := "resource.customizations.health." + healthCustomization.Group + healthCustomization.Kind
subvalue := healthCustomization.Check
healthCheck[subkey] = subvalue
}
Expand All @@ -181,7 +184,10 @@ func getResourceIgnoreDifferences(cr *argoproj.ArgoCD) (map[string]string, error
ignoreDiff[subkey] = subvalue
}
for _, ignoreDiffCustomization := range resourceIgnoreDiff.ResourceIdentifiers {
subkey := "resource.customizations.ignoreDifferences." + ignoreDiffCustomization.Group + "_" + ignoreDiffCustomization.Kind
if ignoreDiffCustomization.Group != "" {
ignoreDiffCustomization.Group += "_"
}
subkey := "resource.customizations.ignoreDifferences." + ignoreDiffCustomization.Group + ignoreDiffCustomization.Kind
bytes, err := yaml.Marshal(ignoreDiffCustomization.Customization)
if err != nil {
return ignoreDiff, err
Expand All @@ -199,7 +205,10 @@ func getResourceActions(cr *argoproj.ArgoCD) map[string]string {
if cr.Spec.ResourceActions != nil {
resourceAction := cr.Spec.ResourceActions
for _, actionCustomization := range resourceAction {
subkey := "resource.customizations.actions." + actionCustomization.Group + "_" + actionCustomization.Kind
if actionCustomization.Group != "" {
actionCustomization.Group += "_"
}
subkey := "resource.customizations.actions." + actionCustomization.Group + actionCustomization.Kind
subvalue := actionCustomization.Action
action[subkey] = subvalue
}
Expand Down
22 changes: 22 additions & 0 deletions controllers/argocd/configmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,11 @@ managedfieldsmanagers:
Kind: "healthBar",
Check: "healthBar",
},
{
Group: "",
Kind: "healthFooBar",
Check: "healthFooBar",
},
}
actions := []argoproj.ResourceAction{
{
Expand All @@ -717,6 +722,11 @@ managedfieldsmanagers:
Kind: "actionsBar",
Action: "actionsBar",
},
{
Group: "",
Kind: "actionsFooBar",
Action: "actionsFooBar",
},
}
ignoreDifferences := argoproj.ResourceIgnoreDifference{
All: &argoproj.IgnoreDifferenceCustomization{
Expand All @@ -734,6 +744,15 @@ managedfieldsmanagers:
ManagedFieldsManagers: []string{"a", "b"},
},
},
{
Group: "",
Kind: "ignoreDiffFoo",
Customization: argoproj.IgnoreDifferenceCustomization{
JqPathExpressions: []string{"a", "b"},
JsonPointers: []string{"a", "b"},
ManagedFieldsManagers: []string{"a", "b"},
},
},
},
}

Expand All @@ -757,10 +776,13 @@ managedfieldsmanagers:
desiredCM := make(map[string]string)
desiredCM["resource.customizations.health.healthFoo_healthFoo"] = "healthFoo"
desiredCM["resource.customizations.health.healthBar_healthBar"] = "healthBar"
desiredCM["resource.customizations.health.healthFooBar"] = "healthFooBar"
desiredCM["resource.customizations.actions.actionsFoo_actionsFoo"] = "actionsFoo"
desiredCM["resource.customizations.actions.actionsBar_actionsBar"] = "actionsBar"
desiredCM["resource.customizations.actions.actionsFooBar"] = "actionsFooBar"
desiredCM["resource.customizations.ignoreDifferences.all"] = desiredIgnoreDifferenceCustomization
desiredCM["resource.customizations.ignoreDifferences.ignoreDiffBar_ignoreDiffBar"] = desiredIgnoreDifferenceCustomization
desiredCM["resource.customizations.ignoreDifferences.ignoreDiffFoo"] = desiredIgnoreDifferenceCustomization

for k, v := range desiredCM {
if value, ok := cm.Data[k]; !ok || value != v {
Expand Down

0 comments on commit effb0dd

Please sign in to comment.