refactor: Restructure common init and additional container layout to dicts (#950)
* refactor: Restructure common init and additional container layout to dicts BREAKING CHANGE
This commit is contained in:
@@ -18,4 +18,4 @@ maintainers:
|
||||
name: common
|
||||
sources: null
|
||||
type: library
|
||||
version: 6.14.0
|
||||
version: 7.0.0
|
||||
|
||||
@@ -5,9 +5,6 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
||||
{{- /* Merge the local chart values and the common chart defaults */ -}}
|
||||
{{- include "common.values.setup" . }}
|
||||
|
||||
{{- /* Build the templates */ -}}
|
||||
{{- include "common.pvc" . }}
|
||||
|
||||
{{- /* Enable code-server add-on if required */ -}}
|
||||
{{- if .Values.addons.codeserver.enabled }}
|
||||
{{- include "common.addon.codeserver" . }}
|
||||
@@ -28,6 +25,9 @@ Main entrypoint for the common library chart. It will render all underlying temp
|
||||
{{- include "common.addon.netshoot" . }}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Build the templates */ -}}
|
||||
{{- include "common.pvc" . }}
|
||||
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
{{- include "common.serviceAccount" . }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -7,8 +7,7 @@ It will include / inject the required templates based on the given values.
|
||||
{{/* Append the code-server container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.codeserver.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $additionalContainers := append .Values.additionalContainers $container -}}
|
||||
{{- $_ := set .Values "additionalContainers" $additionalContainers -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-codeserver" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Include the deployKeySecret if not empty */}}
|
||||
|
||||
@@ -7,8 +7,7 @@ It will include / inject the required templates based on the given values.
|
||||
{{/* Append the netshoot container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.netshoot.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $additionalContainers := append .Values.additionalContainers $container -}}
|
||||
{{- $_ := set .Values "additionalContainers" $additionalContainers -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-netshoot" $container -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -7,8 +7,7 @@ It will include / inject the required templates based on the given values.
|
||||
{{/* Append the promtail container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.promtail.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $additionalContainers := append .Values.additionalContainers $container -}}
|
||||
{{- $_ := set .Values "additionalContainers" $additionalContainers -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-promtail" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Include the configmap if not empty */}}
|
||||
|
||||
@@ -6,8 +6,7 @@ and add a credentials secret if speciffied.
|
||||
{{/* Append the openVPN container to the additionalContainers */}}
|
||||
{{- $container := include "common.addon.openvpn.container" . | fromYaml -}}
|
||||
{{- if $container -}}
|
||||
{{- $additionalContainers := append .Values.additionalContainers $container -}}
|
||||
{{- $_ := set .Values "additionalContainers" $additionalContainers -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-openvpn" $container -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Include the secret if not empty */}}
|
||||
|
||||
@@ -6,7 +6,6 @@ Template to render Wireguard addon. It will add the container to the list of add
|
||||
{{/* Append the Wireguard container to the additionalContainers */}}
|
||||
{{- $container := fromYaml (include "common.addon.wireguard.container" .) -}}
|
||||
{{- if $container -}}
|
||||
{{- $additionalContainers := append .Values.additionalContainers $container -}}
|
||||
{{- $_ := set .Values "additionalContainers" $additionalContainers -}}
|
||||
{{- $_ := set .Values.additionalContainers "addon-wireguard" $container -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{{/*
|
||||
Return the name of the primary port for a given Service object.
|
||||
Return the primary port for a given Service object.
|
||||
*/}}
|
||||
{{- define "common.classes.service.ports.primary" -}}
|
||||
{{- $enabledPorts := dict -}}
|
||||
|
||||
@@ -102,7 +102,8 @@
|
||||
- secretRef:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
{{- end }}
|
||||
{{- include "common.controller.ports" . | trim | nindent 2 }}
|
||||
ports:
|
||||
{{- include "common.controller.ports" . | trim | nindent 4 }}
|
||||
{{- with (include "common.controller.volumeMounts" . | trim) }}
|
||||
volumeMounts:
|
||||
{{ nindent 4 . }}
|
||||
|
||||
@@ -39,14 +39,30 @@ enableServiceLinks: {{ .Values.enableServiceLinks }}
|
||||
terminationGracePeriodSeconds: {{ . }}
|
||||
{{- end }}
|
||||
initContainers:
|
||||
{{- include "common.controller.autopermissions" . | nindent 2 }}
|
||||
{{- with .Values.initContainers }}
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- include "common.controller.autopermissions" . | nindent 2 }}
|
||||
{{- if .Values.initContainers }}
|
||||
{{- $initContainers := list }}
|
||||
{{- range $index, $key := (keys .Values.initContainers | uniq | sortAlpha) }}
|
||||
{{- $container := get $.Values.initContainers $key }}
|
||||
{{- if not $container.name -}}
|
||||
{{- $_ := set $container "name" $key }}
|
||||
{{- end }}
|
||||
{{- $initContainers = append $initContainers $container }}
|
||||
{{- end }}
|
||||
{{- tpl (toYaml $initContainers) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
|
||||
containers:
|
||||
{{- include "common.controller.mainContainer" . | nindent 2 }}
|
||||
{{- with .Values.additionalContainers }}
|
||||
{{- tpl (toYaml .) $ | nindent 2 }}
|
||||
{{- $additionalContainers := list }}
|
||||
{{- range $name, $container := . }}
|
||||
{{- if not $container.name -}}
|
||||
{{- $_ := set $container "name" $name }}
|
||||
{{- end }}
|
||||
{{- $additionalContainers = append $additionalContainers $container }}
|
||||
{{- end }}
|
||||
{{- tpl (toYaml $additionalContainers) $ | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with (include "common.controller.volumes" . | trim) }}
|
||||
volumes:
|
||||
@@ -64,6 +80,10 @@ nodeSelector:
|
||||
affinity:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
|
||||
@@ -14,7 +14,6 @@ Ports included by the controller.
|
||||
|
||||
{{/* export/render the list of ports */}}
|
||||
{{- if $ports -}}
|
||||
ports:
|
||||
{{- range $_ := $ports }}
|
||||
{{- if .enabled }}
|
||||
- name: {{ .name }}
|
||||
|
||||
@@ -205,11 +205,13 @@ securityContext:
|
||||
# -- Configure the lifecycle for the main container
|
||||
lifecycle: {}
|
||||
|
||||
# -- Specify any initContainers here. Yaml will be passed in to the Pod as-is.
|
||||
initContainers: []
|
||||
# -- Specify any initContainers here as dictionary items. Each initContainer should have its own key.
|
||||
# The dictionary item key will determine the order. Helm templates can be used.
|
||||
initContainers: {}
|
||||
|
||||
# -- Specify any additional containers here. Yaml will be passed in to the Pod as-is.
|
||||
additionalContainers: []
|
||||
# -- Specify any additional containers here as dictionary items. Each additional container should have its own key.
|
||||
# Helm templates can be used.
|
||||
additionalContainers: {}
|
||||
|
||||
# -- Probe configuration
|
||||
# -- [[ref]](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/)
|
||||
@@ -589,6 +591,14 @@ nodeSelector: {}
|
||||
# [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity)
|
||||
affinity: {}
|
||||
|
||||
# -- Defines topologySpreadConstraint rules.
|
||||
# [[ref]](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/)
|
||||
topologySpreadConstraints: []
|
||||
# - maxSkew: <integer>
|
||||
# topologyKey: <string>
|
||||
# whenUnsatisfiable: <string>
|
||||
# labelSelector: <object>
|
||||
|
||||
# -- Specify taint tolerations
|
||||
# [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/)
|
||||
tolerations: []
|
||||
|
||||
Reference in New Issue
Block a user