mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 00:47:04 +02:00
feat(common): Release version 2.0.0-beta.1 (#173)
This commit is contained in:
parent
19767d668c
commit
7b6ee00be6
189 changed files with 3110 additions and 3023 deletions
|
@ -0,0 +1,56 @@
|
|||
{{- /*
|
||||
Returns the value for annotations
|
||||
*/ -}}
|
||||
{{- define "bjw-s.common.lib.pod.metadata.annotations" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $controllerObject := .controllerObject -}}
|
||||
|
||||
{{- /* Default annotations */ -}}
|
||||
{{- $annotations := dict -}}
|
||||
|
||||
{{- /* Set to the default if it is set */ -}}
|
||||
{{- $defaultOption := get $rootContext.Values.defaultPodOptions "annotations" -}}
|
||||
{{- if not (empty $defaultOption) -}}
|
||||
{{- $annotations = merge $defaultOption $annotations -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* See if a pod-specific override is set */ -}}
|
||||
{{- if hasKey $controllerObject "pod" -}}
|
||||
{{- $podOption := get $controllerObject.pod "annotations" -}}
|
||||
{{- if not (empty $podOption) -}}
|
||||
{{- $annotations = merge $podOption $annotations -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Add configMaps checksum */ -}}
|
||||
{{- $configMapsFound := dict -}}
|
||||
{{- range $name, $configmap := $rootContext.Values.configMaps -}}
|
||||
{{- if $configmap.enabled -}}
|
||||
{{- $_ := set $configMapsFound $name (toYaml $configmap.data | sha256sum) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $configMapsFound -}}
|
||||
{{- $annotations = merge
|
||||
(dict "checksum/configMaps" (toYaml $configMapsFound | sha256sum))
|
||||
$annotations
|
||||
-}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Add Secrets checksum */ -}}
|
||||
{{- $secretsFound := dict -}}
|
||||
{{- range $name, $secret := $rootContext.Values.secrets -}}
|
||||
{{- if $secret.enabled -}}
|
||||
{{- $_ := set $secretsFound $name (toYaml $secret.stringData | sha256sum) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if $secretsFound -}}
|
||||
{{- $annotations = merge
|
||||
(dict "checksum/secrets" (toYaml $secretsFound | sha256sum))
|
||||
$annotations
|
||||
-}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (empty $annotations) -}}
|
||||
{{- $annotations | toYaml -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
36
charts/library/common/templates/lib/pod/metadata/_labels.tpl
Normal file
36
charts/library/common/templates/lib/pod/metadata/_labels.tpl
Normal file
|
@ -0,0 +1,36 @@
|
|||
{{- /*
|
||||
Returns the value for labels
|
||||
*/ -}}
|
||||
{{- define "bjw-s.common.lib.pod.metadata.labels" -}}
|
||||
{{- $rootContext := .rootContext -}}
|
||||
{{- $controllerObject := .controllerObject -}}
|
||||
|
||||
{{- /* Default labels */ -}}
|
||||
{{- $labels := merge
|
||||
(dict "app.kubernetes.io/component" $controllerObject.identifier)
|
||||
-}}
|
||||
|
||||
{{- /* Fetch the Pod selectorLabels */ -}}
|
||||
{{- $selectorLabels := include "bjw-s.common.lib.metadata.selectorLabels" $rootContext | fromYaml -}}
|
||||
{{- if not (empty $selectorLabels) -}}
|
||||
{{- $labels = merge $selectorLabels $labels -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Set to the default if it is set */ -}}
|
||||
{{- $defaultOption := get $rootContext.Values.defaultPodOptions "labels" -}}
|
||||
{{- if not (empty $defaultOption) -}}
|
||||
{{- $labels = merge $defaultOption $labels -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- /* See if a pod-specific override is set */ -}}
|
||||
{{- if hasKey $controllerObject "pod" -}}
|
||||
{{- $podOption := get $controllerObject.pod "labels" -}}
|
||||
{{- if not (empty $podOption) -}}
|
||||
{{- $labels = merge $podOption $labels -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if not (empty $labels) -}}
|
||||
{{- $labels | toYaml -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
Loading…
Add table
Add a link
Reference in a new issue