Skip to content

Commit ffc906d

Browse files
authored
Streamline rendering for resources, initContainers and sidecars
1 parent e743739 commit ffc906d

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

charts/netbox/templates/cronjob.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ spec:
3838
automountServiceAccountToken: {{ .Values.housekeeping.automountServiceAccountToken }}
3939
securityContext:
4040
{{- toYaml .Values.housekeeping.podSecurityContext | nindent 12 }}
41-
{{- with .Values.housekeeping.initContainers }}
42-
initContainers:
43-
{{- toYaml . | nindent 10 }}
41+
{{- if .Values.housekeeping.initContainers }}
42+
{{- include "common.tplvalues.render" (dict "value" .Values.housekeeping.initContainers "context" $) | trim | nindent 10 }}
4443
{{- end }}
4544
containers:
4645
- name: {{ .Chart.Name }}-housekeeping
@@ -94,8 +93,8 @@ spec:
9493
{{- else if ne .Values.housekeeping.resourcesPreset "none" }}
9594
resources: {{- include "common.resources.preset" (dict "type" .Values.housekeeping.resourcesPreset) | nindent 14 }}
9695
{{- end }}
97-
{{- with .Values.housekeeping.sidecars }}
98-
{{- toYaml . | nindent 10 }}
96+
{{- if .Values.housekeeping.sidecars }}
97+
{{- include "common.tplvalues.render" (dict "value" .Values.housekeeping.sidecars "context" $) | nindent 10 }}
9998
{{- end }}
10099
volumes:
101100
- name: config

charts/netbox/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ spec:
159159
{{- else if ne .Values.resourcesPreset "none" }}
160160
resources: {{- include "common.resources.preset" (dict "type" .Values.resourcesPreset) | nindent 10 }}
161161
{{- end }}
162-
{{- with .Values.sidecars }}
163-
{{- toYaml . | nindent 6 }}
162+
{{- if .Values.sidecars }}
163+
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 6 }}
164164
{{- end }}
165165
volumes:
166166
- name: config

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ 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
restartPolicy: Never

charts/netbox/templates/worker-deployment.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ spec:
4646
automountServiceAccountToken: {{ .Values.worker.automountServiceAccountToken }}
4747
securityContext:
4848
{{- toYaml .Values.worker.podSecurityContext | nindent 8 }}
49-
{{- with .Values.worker.initContainers }}
50-
initContainers:
51-
{{- toYaml . | nindent 6 }}
49+
{{- if .Values.worker.initContainers }}
50+
{{- include "common.tplvalues.render" (dict "value" .Values.worker.initContainers "context" $) | trim | nindent 6 }}
5251
{{- end }}
5352
containers:
5453
- name: {{ .Chart.Name }}-worker
@@ -102,8 +101,8 @@ spec:
102101
{{- else if ne .Values.worker.resourcesPreset "none" }}
103102
resources: {{- include "common.resources.preset" (dict "type" .Values.worker.resourcesPreset) | nindent 10 }}
104103
{{- end }}
105-
{{- with .Values.worker.sidecars }}
106-
{{- toYaml . | nindent 6 }}
104+
{{- if .Values.worker.sidecars }}
105+
{{- include "common.tplvalues.render" (dict "value" .Values.worker.sidecars "context" $) | nindent 6 }}
107106
{{- end }}
108107
volumes:
109108
- name: config

0 commit comments

Comments
 (0)