From b4e25749f969d5a8ecfcbf43a7d685096dac09b3 Mon Sep 17 00:00:00 2001 From: Rizwana777 Date: Wed, 3 Jul 2024 16:43:01 +0530 Subject: [PATCH] Fix bug where ArgoCD removes nodePlacement stanza from configuration Signed-off-by: Rizwana777 --- controllers/gitopsservice_controller.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/controllers/gitopsservice_controller.go b/controllers/gitopsservice_controller.go index 33840081c..b490aacf8 100644 --- a/controllers/gitopsservice_controller.go +++ b/controllers/gitopsservice_controller.go @@ -472,9 +472,12 @@ 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 + // if user is patching nodePlacement through GitopsService CR, then existingArgoCD NodePlacement is updated. + if defaultArgoCDInstance.Spec.NodePlacement != nil { + if !reflect.DeepEqual(existingArgoCD.Spec.NodePlacement, defaultArgoCDInstance.Spec.NodePlacement) { + existingArgoCD.Spec.NodePlacement = defaultArgoCDInstance.Spec.NodePlacement + changed = true + } } if changed {