Skip to content

Commit

Permalink
Fix bug where ArgoCD removes nodePlacement stanza from configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Rizwana777 <[email protected]>
  • Loading branch information
Rizwana777 committed Jul 4, 2024
1 parent df6c4d9 commit 2b100a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions controllers/gitopsservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,15 @@ func (r *ReconcileGitopsService) reconcileDefaultArgoCDInstance(instance *pipeli
changed = true
}

if !reflect.DeepEqual(existingArgoCD.Spec.NodePlacement, defaultArgoCDInstance.Spec.NodePlacement) {
existingArgoCD.Spec.NodePlacement = defaultArgoCDInstance.Spec.NodePlacement
changed = true
// Checking if default nodePlacement is nil to verify whether the patch is done using GitopService CR or ArgoCD CR
// if user is patching nodePlacement through GitopsService CR, then the above written logic for GitopsService will add custom values to defaultArgoCDInstance's nodePlacement,
// if user is patching nodePlacement through ArgoCD CR, defaultArgoCDInstance's nodePlacement will be nil and it will
// enter the if condition below and update the existing nodePlacement as nil which is a bug.
if defaultArgoCDInstance.Spec.NodePlacement != nil {
if !reflect.DeepEqual(existingArgoCD.Spec.NodePlacement, defaultArgoCDInstance.Spec.NodePlacement) {
existingArgoCD.Spec.NodePlacement = defaultArgoCDInstance.Spec.NodePlacement
changed = true
}
}

if changed {
Expand Down

0 comments on commit 2b100a1

Please sign in to comment.