Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm template with custom podLabels failes #3145

Closed
luettmattenhas opened this issue Nov 2, 2023 · 2 comments · Fixed by #3153
Closed

Helm template with custom podLabels failes #3145

luettmattenhas opened this issue Nov 2, 2023 · 2 comments · Fixed by #3153
Labels
bug Something isn't working

Comments

@luettmattenhas
Copy link

What steps did you take and what happened:
Running helm template with custom .values.podLabels will result in an error:
Error: YAML parse error on gatekeeper/charts/gatekeeper/templates/gatekeeper-audit-deployment.yaml: error converting YAML to JSON: yaml: line 30: mapping values are not allowed in this context

What did you expect to happen:
Helm template will work just fine.

Anything else you would like to add:
I guess it is due to the change in the _helper.tpl
which removed the nindent 8 and cause now the error within the deployments using {{- include "gatekeeper.podLabels" . }}

Environment:

  • Gatekeeper Chart version: 3.14.0
  • Helm version: v3.13.1
@luettmattenhas luettmattenhas added the bug Something isn't working label Nov 2, 2023
@majewsky
Copy link

majewsky commented Nov 2, 2023

I am affected by this as well. This patch fixes the bug:

diff --git a/templates/gatekeeper-audit-deployment.yaml b/templates/gatekeeper-audit-deployment.yaml
index 1dc1ebac29..a9e3132848 100644
--- a/templates/gatekeeper-audit-deployment.yaml
+++ b/templates/gatekeeper-audit-deployment.yaml
@@ -33,7 +33,7 @@ spec:
         {{- toYaml .Values.auditPodAnnotations | trim | nindent 8 }}
         {{- end }}
       labels:
-{{- include "gatekeeper.podLabels" . }}
+        {{- include "gatekeeper.podLabels" . | nindent 8 }}
         app: '{{ template "gatekeeper.name" . }}'
         chart: '{{ template "gatekeeper.name" . }}'
         control-plane: audit-controller
diff --git a/templates/gatekeeper-controller-manager-deployment.yaml b/templates/gatekeeper-controller-manager-deployment.yaml
index 70c7571c2c..3d2c32a7b7 100644
--- a/templates/gatekeeper-controller-manager-deployment.yaml
+++ b/templates/gatekeeper-controller-manager-deployment.yaml
@@ -32,7 +32,7 @@ spec:
         {{- toYaml .Values.podAnnotations | trim | nindent 8 }}
         {{- end }}
       labels:
-{{- include "gatekeeper.podLabels" . }}
+        {{- include "gatekeeper.podLabels" . | nindent 8 }}
         app: '{{ template "gatekeeper.name" . }}'
         chart: '{{ template "gatekeeper.name" . }}'
         control-plane: controller-manager

However, there is some weird machinery going on for somehow autogenerating the Helm chart that I do not understand. Can someone that does please apply the above patch?

I don't think this patch is significant enough to warrant copyright, but if it is, I'm putting it in the public domain or, in legal domains where public domain does not exist, hereby publishing it under CC0 license.

majewsky added a commit to sapcc/helm-charts that referenced this issue Nov 2, 2023
This reverts commit 56d46ce.

Upgrade is broken because of open-policy-agent/gatekeeper#3145
@joaosilva15
Copy link
Contributor

This should fix the issue #3153

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants