Skip to content

Commit

Permalink
Merge pull request #209 from LeoColomb/fix/value-2
Browse files Browse the repository at this point in the history
Streamline rendering for `resources`, `initContainers` and `sidecars`
  • Loading branch information
RangerRick committed May 13, 2024
2 parents aabfead + 4234df5 commit 7c90e07
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion charts/netbox/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: netbox
version: 5.0.0-beta11
version: 5.0.0-beta12
appVersion: "v4.0.0"
type: application
kubeVersion: ^1.25.0-0
Expand Down
9 changes: 4 additions & 5 deletions charts/netbox/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,8 @@ spec:
{{- if .Values.housekeeping.podSecurityContext.enabled }}
securityContext: {{- omit .Values.housekeeping.podSecurityContext "enabled" | toYaml | nindent 12 }}
{{- end }}
{{- with .Values.housekeeping.initContainers }}
initContainers:
{{- toYaml . | nindent 10 }}
{{- if .Values.housekeeping.initContainers }}
{{- include "common.tplvalues.render" (dict "value" .Values.housekeeping.initContainers "context" $) | trim | nindent 10 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-housekeeping
Expand Down Expand Up @@ -96,8 +95,8 @@ spec:
{{- else if ne .Values.housekeeping.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.housekeeping.resourcesPreset) | nindent 14 }}
{{- end }}
{{- with .Values.housekeeping.sidecars }}
{{- toYaml . | nindent 10 }}
{{- if .Values.housekeeping.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.housekeeping.sidecars "context" $) | nindent 10 }}
{{- end }}
volumes:
- name: config
Expand Down
4 changes: 2 additions & 2 deletions charts/netbox/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ spec:
{{- else if ne .Values.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.resourcesPreset) | nindent 10 }}
{{- end }}
{{- with .Values.sidecars }}
{{- toYaml . | nindent 6 }}
{{- if .Values.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 6 }}
{{- end }}
volumes:
- name: config
Expand Down
5 changes: 3 additions & 2 deletions charts/netbox/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ spec:
command: ['wget']
args: ['{{ include "common.names.fullname" . }}:{{ .Values.service.port }}']
{{- if .Values.test.resources }}
resources:
{{- toYaml .Values.test.resources | nindent 6 }}
resources: {{ toYaml .Values.test.resources | nindent 6 }}
{{- else if ne .Values.test.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.test.resourcesPreset) | nindent 6 }}
{{- end }}
{{- if .Values.test.securityContext.enabled }}
securityContext: {{- omit .Values.test.securityContext "enabled" | toYaml | nindent 12 }}
Expand Down
7 changes: 3 additions & 4 deletions charts/netbox/templates/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ spec:
securityContext: {{- omit .Values.worker.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
{{- with .Values.worker.initContainers }}
initContainers:
{{- toYaml . | nindent 6 }}
{{- include "common.tplvalues.render" (dict "value" .Values.worker.initContainers "context" $) | trim | nindent 6 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}-worker
Expand Down Expand Up @@ -104,8 +103,8 @@ spec:
{{- else if ne .Values.worker.resourcesPreset "none" }}
resources: {{- include "common.resources.preset" (dict "type" .Values.worker.resourcesPreset) | nindent 10 }}
{{- end }}
{{- with .Values.worker.sidecars }}
{{- toYaml . | nindent 6 }}
{{- if .Values.worker.sidecars }}
{{- include "common.tplvalues.render" (dict "value" .Values.worker.sidecars "context" $) | nindent 6 }}
{{- end }}
volumes:
- name: config
Expand Down

0 comments on commit 7c90e07

Please sign in to comment.