Skip to content

Commit 7c90e07

Browse files
authored
Merge pull request #209 from LeoColomb/fix/value-2
Streamline rendering for `resources`, `initContainers` and `sidecars`
2 parents aabfead + 4234df5 commit 7c90e07

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

charts/netbox/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: netbox
3-
version: 5.0.0-beta11
3+
version: 5.0.0-beta12
44
appVersion: "v4.0.0"
55
type: application
66
kubeVersion: ^1.25.0-0

charts/netbox/templates/cronjob.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ spec:
3939
{{- if .Values.housekeeping.podSecurityContext.enabled }}
4040
securityContext: {{- omit .Values.housekeeping.podSecurityContext "enabled" | toYaml | nindent 12 }}
4141
{{- end }}
42-
{{- with .Values.housekeeping.initContainers }}
43-
initContainers:
44-
{{- toYaml . | nindent 10 }}
42+
{{- if .Values.housekeeping.initContainers }}
43+
{{- include "common.tplvalues.render" (dict "value" .Values.housekeeping.initContainers "context" $) | trim | nindent 10 }}
4544
{{- end }}
4645
containers:
4746
- name: {{ .Chart.Name }}-housekeeping
@@ -96,8 +95,8 @@ spec:
9695
{{- else if ne .Values.housekeeping.resourcesPreset "none" }}
9796
resources: {{- include "common.resources.preset" (dict "type" .Values.housekeeping.resourcesPreset) | nindent 14 }}
9897
{{- end }}
99-
{{- with .Values.housekeeping.sidecars }}
100-
{{- toYaml . | nindent 10 }}
98+
{{- if .Values.housekeeping.sidecars }}
99+
{{- include "common.tplvalues.render" (dict "value" .Values.housekeeping.sidecars "context" $) | nindent 10 }}
101100
{{- end }}
102101
volumes:
103102
- name: config

charts/netbox/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ spec:
161161
{{- else if ne .Values.resourcesPreset "none" }}
162162
resources: {{- include "common.resources.preset" (dict "type" .Values.resourcesPreset) | nindent 10 }}
163163
{{- end }}
164-
{{- with .Values.sidecars }}
165-
{{- toYaml . | nindent 6 }}
164+
{{- if .Values.sidecars }}
165+
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 6 }}
166166
{{- end }}
167167
volumes:
168168
- name: config

charts/netbox/templates/tests/test-connection.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ spec:
1414
command: ['wget']
1515
args: ['{{ include "common.names.fullname" . }}:{{ .Values.service.port }}']
1616
{{- if .Values.test.resources }}
17-
resources:
18-
{{- toYaml .Values.test.resources | nindent 6 }}
17+
resources: {{ toYaml .Values.test.resources | nindent 6 }}
18+
{{- else if ne .Values.test.resourcesPreset "none" }}
19+
resources: {{- include "common.resources.preset" (dict "type" .Values.test.resourcesPreset) | nindent 6 }}
1920
{{- end }}
2021
{{- if .Values.test.securityContext.enabled }}
2122
securityContext: {{- omit .Values.test.securityContext "enabled" | toYaml | nindent 12 }}

charts/netbox/templates/worker-deployment.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ spec:
4848
securityContext: {{- omit .Values.worker.podSecurityContext "enabled" | toYaml | nindent 8 }}
4949
{{- end }}
5050
{{- with .Values.worker.initContainers }}
51-
initContainers:
52-
{{- toYaml . | nindent 6 }}
51+
{{- include "common.tplvalues.render" (dict "value" .Values.worker.initContainers "context" $) | trim | nindent 6 }}
5352
{{- end }}
5453
containers:
5554
- name: {{ .Chart.Name }}-worker
@@ -104,8 +103,8 @@ spec:
104103
{{- else if ne .Values.worker.resourcesPreset "none" }}
105104
resources: {{- include "common.resources.preset" (dict "type" .Values.worker.resourcesPreset) | nindent 10 }}
106105
{{- end }}
107-
{{- with .Values.worker.sidecars }}
108-
{{- toYaml . | nindent 6 }}
106+
{{- if .Values.worker.sidecars }}
107+
{{- include "common.tplvalues.render" (dict "value" .Values.worker.sidecars "context" $) | nindent 6 }}
109108
{{- end }}
110109
volumes:
111110
- name: config

0 commit comments

Comments
 (0)