From 2d15bb55ce98df3ae5de375e9de6ed6c6d2ff5f5 Mon Sep 17 00:00:00 2001 From: Tim Ramlot <42113979+inteon@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:12:27 +0100 Subject: [PATCH] add comments that explain the empty value trick Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> --- deploy/charts/cert-manager/templates/cainjector-deployment.yaml | 2 ++ deploy/charts/cert-manager/templates/deployment.yaml | 2 ++ deploy/charts/cert-manager/templates/webhook-deployment.yaml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/deploy/charts/cert-manager/templates/cainjector-deployment.yaml b/deploy/charts/cert-manager/templates/cainjector-deployment.yaml index 25bf475ce..a2f7243e8 100644 --- a/deploy/charts/cert-manager/templates/cainjector-deployment.yaml +++ b/deploy/charts/cert-manager/templates/cainjector-deployment.yaml @@ -16,6 +16,7 @@ metadata: {{- end }} spec: replicas: {{ .Values.cainjector.replicaCount }} + {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} {{- if not (has (quote .Values.global.revisionHistoryLimit) (list "" (quote ""))) }} revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }} {{- end }} @@ -61,6 +62,7 @@ spec: image: "{{ template "image" (tuple .Values.cainjector.image $.Chart.AppVersion) }}" imagePullPolicy: {{ .Values.cainjector.image.pullPolicy }} args: + {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }} - --v={{ .Values.global.logLevel }} {{- end }} diff --git a/deploy/charts/cert-manager/templates/deployment.yaml b/deploy/charts/cert-manager/templates/deployment.yaml index e673176bd..8e09f525e 100644 --- a/deploy/charts/cert-manager/templates/deployment.yaml +++ b/deploy/charts/cert-manager/templates/deployment.yaml @@ -15,6 +15,7 @@ metadata: {{- end }} spec: replicas: {{ .Values.replicaCount }} + {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} {{- if not (has (quote .Values.global.revisionHistoryLimit) (list "" (quote ""))) }} revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }} {{- end }} @@ -79,6 +80,7 @@ spec: image: "{{ template "image" (tuple .Values.image $.Chart.AppVersion) }}" imagePullPolicy: {{ .Values.image.pullPolicy }} args: + {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }} - --v={{ .Values.global.logLevel }} {{- end }} diff --git a/deploy/charts/cert-manager/templates/webhook-deployment.yaml b/deploy/charts/cert-manager/templates/webhook-deployment.yaml index 326a3ed1e..e55cd4361 100644 --- a/deploy/charts/cert-manager/templates/webhook-deployment.yaml +++ b/deploy/charts/cert-manager/templates/webhook-deployment.yaml @@ -15,6 +15,7 @@ metadata: {{- end }} spec: replicas: {{ .Values.webhook.replicaCount }} + {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} {{- if not (has (quote .Values.global.revisionHistoryLimit) (list "" (quote ""))) }} revisionHistoryLimit: {{ .Values.global.revisionHistoryLimit }} {{- end }} @@ -66,6 +67,7 @@ spec: image: "{{ template "image" (tuple .Values.webhook.image $.Chart.AppVersion) }}" imagePullPolicy: {{ .Values.webhook.image.pullPolicy }} args: + {{- /* The if statement below is equivalent to {{- if $value }} but will also return true for 0. */ -}} {{- if not (has (quote .Values.global.logLevel) (list "" (quote ""))) }} - --v={{ .Values.global.logLevel }} {{- end }}