diff --git a/charts/onechart/templates/deployment.yaml b/charts/onechart/templates/deployment.yaml index 506f55d..14cf35d 100644 --- a/charts/onechart/templates/deployment.yaml +++ b/charts/onechart/templates/deployment.yaml @@ -90,14 +90,16 @@ spec: {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} - {{- if .Values.debugSidecarEnabled }} - - name: {{ template "robustName" .Release.Name }}-debug + {{- if .Values.sidecar }} + - name: {{ template "robustName" .Release.Name }}-sidecar securityContext: *securityContext - image: {{ .Values.debugSidecar.image }} + image: {{ .Values.sidecar.repository }}:{{ .Values.sidecar.tag }} + {{- if .Values.sidecar.command }} command: - - {{ .Values.debugSidecar.shell }} + - {{ .Values.sidecar.shell }} - -c - - {{ .Values.debugSidecar.command | quote }} + - {{ .Values.sidecar.command | quote }} + {{- end }} {{- if or (or (.Values.vars) (.Values.secretEnabled)) .Values.sealedSecrets }} envFrom: *envFrom {{- end }} diff --git a/charts/onechart/tests/deployment_debug_sidecar_test.yaml b/charts/onechart/tests/deployment_debug_sidecar_test.yaml deleted file mode 100644 index 09eec07..0000000 --- a/charts/onechart/tests/deployment_debug_sidecar_test.yaml +++ /dev/null @@ -1,12 +0,0 @@ -suite: test deployment -templates: - - deployment.yaml - - configmap.yaml -tests: - - it: Should add a debug sidecar - set: - debugSidecarEnabled: true - asserts: - - equal: - path: spec.template.spec.containers[1].image - value: debian:stable-slim diff --git a/charts/onechart/tests/deployment_sidecar_test.yaml b/charts/onechart/tests/deployment_sidecar_test.yaml new file mode 100644 index 0000000..e4c75f6 --- /dev/null +++ b/charts/onechart/tests/deployment_sidecar_test.yaml @@ -0,0 +1,25 @@ +suite: test deployment +templates: + - deployment.yaml + - configmap.yaml +tests: + - it: Should inject a sidecar if one is specified + set: + sidecar: + repository: debian + tag: stable-slim + asserts: + - equal: + path: spec.template.spec.containers[1].image + value: debian:stable-slim + - it: Should inject a debug sidecar with shell and command specified + set: + sidecar: + repository: debian + tag: stable-slim + shell: "/bin/bash" + command: "while true; do sleep 30; done;" + asserts: + - equal: + path: spec.template.spec.containers[1].image + value: debian:stable-slim \ No newline at end of file diff --git a/charts/onechart/values.yaml b/charts/onechart/values.yaml index a509bbb..d76547d 100644 --- a/charts/onechart/values.yaml +++ b/charts/onechart/values.yaml @@ -44,12 +44,6 @@ secretEnabled: false shell: "/bin/sh" -debugSidecarEnabled: false -debugSidecar: - image: debian:stable-slim - shell: "/bin/bash" - command: "while true; do sleep 30; done;" - podDisruptionBudgetEnabled: true spreadAcrossNodes: false diff --git a/values.yaml b/values.yaml index aa3061e..51e5ad0 100644 --- a/values.yaml +++ b/values.yaml @@ -9,3 +9,9 @@ fileSecrets: a multiline secret + +sidecar: + repository: debian + tag: stable-slim + shell: "/bin/bash" + command: "while true; do sleep 30; done;"