From 06d2179f807ec575e47e898fd7cfc69747fbfbc8 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Fri, 13 Feb 2026 09:15:34 +0100 Subject: [PATCH] Fix initContainers variables It was rendering invalid yaml. Reported-By: gcardill@redhat.com --- templates/plumbing/argocd.yaml | 6 +++--- tests/argocd_test.yaml | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/templates/plumbing/argocd.yaml b/templates/plumbing/argocd.yaml index ad78379..89b69a2 100644 --- a/templates/plumbing/argocd.yaml +++ b/templates/plumbing/argocd.yaml @@ -72,6 +72,9 @@ spec: name: trusted-hub-bundle - mountPath: /tmp/ca-bundles name: ca-bundles +{{- if len $.Values.clusterGroup.argoCD.initContainers }} +{{ toYaml $.Values.clusterGroup.argoCD.initContainers | indent 4 }} +{{- end }} resources: limits: cpu: "1" @@ -96,9 +99,6 @@ spec: name: trusted-hub-bundle - emptyDir: {} name: ca-bundles -{{- if len $.Values.clusterGroup.argoCD.initContainers }} -{{ $.Values.clusterGroup.argoCD.initContainers | toPrettyJson }} -{{- end }} {{- if len $.Values.clusterGroup.argoCD.configManagementPlugins }} sidecarContainers: {{- range $cmp := $.Values.clusterGroup.argoCD.configManagementPlugins }} diff --git a/tests/argocd_test.yaml b/tests/argocd_test.yaml index f82a38a..249e525 100644 --- a/tests/argocd_test.yaml +++ b/tests/argocd_test.yaml @@ -180,3 +180,26 @@ tests: kinds: - Foo - Baz + + - it: should render custom initContainers correctly + set: + clusterGroup: + argoCD: + initContainers: + - command: + - bash + - -c + - echo + image: test + name: test + documentIndex: 0 + asserts: + - contains: + path: spec.repo.initContainers + content: + command: + - bash + - -c + - echo + image: test + name: test