Skip to content

Commit 2b100a1

Browse files
committed
Fix bug where ArgoCD removes nodePlacement stanza from configuration
Signed-off-by: Rizwana777 <[email protected]>
1 parent df6c4d9 commit 2b100a1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

controllers/gitopsservice_controller.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,9 +472,15 @@ func (r *ReconcileGitopsService) reconcileDefaultArgoCDInstance(instance *pipeli
472472
changed = true
473473
}
474474

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

480486
if changed {

0 commit comments

Comments
 (0)