Skip to content

Instantly share code, notes, and snippets.

@nazarewk
Last active April 29, 2022 11:01
Show Gist options
  • Save nazarewk/954779d56c97c2ff72b56b78096807e7 to your computer and use it in GitHub Desktop.
Save nazarewk/954779d56c97c2ff72b56b78096807e7 to your computer and use it in GitHub Desktop.
Helm values cannot be overriden with null
apiVersion: v2
name: test-app
type: application
version: 0.0.0
+ helm version
version.BuildInfo{Version:"v3.8.1", GitCommit:"5cb9af4b1b271d11d7a97a71df3ac337dd94ad37", GitTreeState:"", GoVersion:"go1.17.9"}
+ helm template .
---
# Source: test-app/templates/cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: release-name-parent-test-cm
annotations:
values.yaml: |
test-value: null
test-value-2: false
+ helm template . -f values.yaml
---
# Source: test-app/templates/cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: release-name-parent-test-cm
annotations:
values.yaml: |
test-value-2: false
+ helm template . --set test-value=null
---
# Source: test-app/templates/cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: release-name-parent-test-cm
annotations:
values.yaml: |
test-value-2: false
++ helm template .
+ diff -C5 /dev/fd/63 /dev/fd/62
++ helm template . -f values.yaml
*** /dev/fd/63 2022-04-29 13:00:33.941032907 +0200
--- /dev/fd/62 2022-04-29 13:00:33.941032907 +0200
***************
*** 4,10 ****
kind: ConfigMap
metadata:
name: release-name-parent-test-cm
annotations:
values.yaml: |
- test-value: null
test-value-2: false
--- 4,9 ----
#!/usr/bin/env bash
set -eEuo pipefail
mkdir -p templates
cat <<'EOF' > templates/cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-parent-test-cm
annotations:
values.yaml: |
{{- .Values | toYaml | nindent 6 }}
EOF
exec >output.txt 2>&1
set -x
helm version
helm template .
helm template . -f values.yaml
helm template . --set test-value=null
diff -C5 <(helm template .) <(helm template . -f values.yaml)
test-value: null
test-value-2: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment