Skip to content

Commit b7b182a

Browse files
authored
fix: initcontainer indentation (#144)
Simple one-character indentation fix for `extraInitContainers` in the deployment template. Note, did not bump `Chart.yaml` on purpose.
1 parent 291e53f commit b7b182a

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

‎charts/athens-proxy/templates/deployment.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ spec:
8282
{{- end }}
8383
{{- end }}
8484
{{- if .Values.extraInitContainers }}
85-
{{- toYaml .Values.extraInitContainers | nindent 6 }}
85+
{{- toYaml .Values.extraInitContainers | nindent 8 }}
8686
{{- end }}
8787
{{- end }}
8888
containers:
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
templates:
2+
- deployment.yaml
3+
- config-upstream.yaml
4+
- config-ssh-git-servers.yaml
5+
- secret-ssh-git-servers.yaml
6+
7+
tests:
8+
- it: should not render initContainers by default
9+
template: deployment.yaml
10+
asserts:
11+
- hasDocuments:
12+
count: 1
13+
- notExists:
14+
path: spec.template.spec.initContainers
15+
16+
- it: should render extraInitContainers on their own
17+
template: deployment.yaml
18+
set:
19+
extraInitContainers:
20+
- name: init
21+
image: busybox:1.28
22+
command: ['sh', '-c', "echo 'hello world'"]
23+
asserts:
24+
- hasDocuments:
25+
count: 1
26+
- equal:
27+
path: spec.template.spec.initContainers
28+
value:
29+
- name: init
30+
image: busybox:1.28
31+
command: ['sh', '-c', "echo 'hello world'"]
32+
33+
# Regression: extraInitContainers used a different indentation than the
34+
# copy-key-files init container, producing invalid YAML when both were set.
35+
- it: should render extraInitContainers after the sshGitServers init container
36+
template: deployment.yaml
37+
set:
38+
sshGitServers:
39+
- host: git.example.com
40+
path: "/asd"
41+
user: git
42+
privateKey: |
43+
-----BEGIN RSA PRIVATE KEY-----
44+
-----END RSA PRIVATE KEY-----
45+
port: 22
46+
extraInitContainers:
47+
- name: init
48+
image: busybox:1.28
49+
command: ['sh', '-c', "echo 'hello world'"]
50+
asserts:
51+
- hasDocuments:
52+
count: 1
53+
- lengthEqual:
54+
path: spec.template.spec.initContainers
55+
count: 2
56+
- equal:
57+
path: spec.template.spec.initContainers[0].name
58+
value: copy-key-files
59+
- equal:
60+
path: spec.template.spec.initContainers[1]
61+
value:
62+
name: init
63+
image: busybox:1.28
64+
command: ['sh', '-c', "echo 'hello world'"]

0 commit comments

Comments
 (0)