Fixing custom command
This commit is contained in:
@@ -33,7 +33,7 @@ spec:
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.command }}
|
||||
command: ['{{ .Values.shell | default "/bin/sh" }}', {{ .Values.command | quote }}]
|
||||
command: ['{{ .Values.shell | default "/bin/sh" }}', "-c", {{ .Values.command | quote }}]
|
||||
{{- end }}
|
||||
envFrom:
|
||||
{{- if .Values.vars }}
|
||||
|
||||
@@ -5,16 +5,16 @@ templates:
|
||||
tests:
|
||||
- it: Should set command
|
||||
set:
|
||||
command: "while true; date; sleep 2; done"
|
||||
command: "while true; do date; sleep 2; done"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value: ['/bin/sh', 'while true; date; sleep 2; done']
|
||||
value: ['/bin/sh', '-c', 'while true; do date; sleep 2; done']
|
||||
- it: Should set shell and command
|
||||
set:
|
||||
command: "while true; date; sleep 2; done"
|
||||
command: "while true; do date; sleep 2; done"
|
||||
shell: "/bin/ash"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.template.spec.containers[0].command
|
||||
value: ['/bin/ash', 'while true; date; sleep 2; done']
|
||||
value: ['/bin/ash', '-c','while true; do date; sleep 2; done']
|
||||
|
||||
@@ -6,7 +6,7 @@ image:
|
||||
tag: stable-slim
|
||||
|
||||
command: |
|
||||
while true; date; sleep 2; done
|
||||
while true; do date; sleep 2; done
|
||||
```
|
||||
|
||||
Check the Kubernetes manifest:
|
||||
@@ -18,7 +18,7 @@ image:
|
||||
tag: stable-slim
|
||||
|
||||
command: |
|
||||
echo "hello"
|
||||
while true; do date; sleep 2; done
|
||||
EOF
|
||||
|
||||
helm template my-release onechart/onechart -f values.yaml
|
||||
@@ -33,7 +33,7 @@ image:
|
||||
tag: 3.12
|
||||
|
||||
command: |
|
||||
echo "hello"
|
||||
while true; do date; sleep 2; done
|
||||
shell: "/bin/ash"
|
||||
EOF
|
||||
|
||||
|
||||
Reference in New Issue
Block a user