diff options
Diffstat (limited to 'kubernetes/common')
74 files changed, 280 insertions, 244 deletions
diff --git a/kubernetes/common/cassandra/templates/backup/configmap.yaml b/kubernetes/common/cassandra/templates/backup/configmap.yaml index e9e1012811..9bbc69ba04 100644 --- a/kubernetes/common/cassandra/templates/backup/configmap.yaml +++ b/kubernetes/common/cassandra/templates/backup/configmap.yaml @@ -22,7 +22,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/restore.sh").AsConfig . | indent 2 }} diff --git a/kubernetes/common/cassandra/templates/backup/cronjob.yaml b/kubernetes/common/cassandra/templates/backup/cronjob.yaml index 0d06318422..2edc8071f9 100644 --- a/kubernetes/common/cassandra/templates/backup/cronjob.yaml +++ b/kubernetes/common/cassandra/templates/backup/cronjob.yaml @@ -22,7 +22,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: schedule: {{ .Values.backup.cron | quote }} diff --git a/kubernetes/common/cassandra/templates/backup/pvc.yaml b/kubernetes/common/cassandra/templates/backup/pvc.yaml index dd7f3810a0..6fd53618bc 100644 --- a/kubernetes/common/cassandra/templates/backup/pvc.yaml +++ b/kubernetes/common/cassandra/templates/backup/pvc.yaml @@ -24,7 +24,7 @@ metadata: labels: app: {{ include "common.name" . }}-backup chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" {{- if .Values.persistence.annotations }} annotations: diff --git a/kubernetes/common/cassandra/templates/configmap.yaml b/kubernetes/common/cassandra/templates/configmap.yaml index abb8a7e65f..ab08c82fef 100644 --- a/kubernetes/common/cassandra/templates/configmap.yaml +++ b/kubernetes/common/cassandra/templates/configmap.yaml @@ -7,7 +7,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ toYaml .Values.configOverrides | indent 2 }} @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/docker-entrypoint.sh").AsConfig . | indent 2 }} diff --git a/kubernetes/common/cassandra/templates/pv.yaml b/kubernetes/common/cassandra/templates/pv.yaml index fbbb5ba105..fd0a758e63 100644 --- a/kubernetes/common/cassandra/templates/pv.yaml +++ b/kubernetes/common/cassandra/templates/pv.yaml @@ -20,13 +20,13 @@ apiVersion: v1 kind: PersistentVolume metadata: - name: {{ $global.Release.Name }}-{{ $global.Values.service.name }}-{{ $i }} + name: {{ include "common.release" $global }}-{{ $global.Values.service.name }}-{{ $i }} namespace: {{ $global.Release.Namespace }} labels: type: {{ $global.Values.persistence.storageType }} app: {{ $global.Values.service.name }} chart: {{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }} - release: {{ $global.Release.Name }} + release: {{ include "common.release" $global }} heritage: {{ $global.Release.Service }} spec: capacity: @@ -40,7 +40,7 @@ spec: persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} storageClassName: "{{ include "common.fullname" $global }}-data" hostPath: - path: {{ $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }} + path: {{ $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }} {{- end -}} {{- end -}} {{- end -}} diff --git a/kubernetes/common/cassandra/templates/service.yaml b/kubernetes/common/cassandra/templates/service.yaml index cda519115d..6cbddbea40 100644 --- a/kubernetes/common/cassandra/templates/service.yaml +++ b/kubernetes/common/cassandra/templates/service.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" @@ -45,5 +45,5 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} clusterIP: None diff --git a/kubernetes/common/cassandra/templates/statefulset.yaml b/kubernetes/common/cassandra/templates/statefulset.yaml index 72e886d4d1..2f262ca149 100644 --- a/kubernetes/common/cassandra/templates/statefulset.yaml +++ b/kubernetes/common/cassandra/templates/statefulset.yaml @@ -20,13 +20,13 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: selector: matchLabels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} serviceName: {{ include "common.servicename" . }} replicas: {{ .Values.replicaCount }} podManagementPolicy: {{ .Values.podManagementPolicy }} @@ -36,7 +36,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} name: {{ include "common.name" . }} spec: hostNetwork: {{ .Values.hostNetwork }} @@ -115,6 +115,14 @@ spec: value: {{ default "GossipingPropertyFileSnitch" .Values.config.endpoint_snitch | quote }} - name: CASSANDRA_AUTHENTICATOR value: {{ default "PasswordAuthenticator" .Values.config.authenticator | quote }} + {{- if (include "common.serviceMesh" .) }} + - name: CASSANDRA_LISTEN_ADDRESS + value: "127.0.0.1" + - name: CASSANDRA_BROADCAST_ADDRESS + valueFrom: + fieldRef: + fieldPath: status.podIP + {{- end }} - name: POD_IP valueFrom: fieldRef: @@ -160,7 +168,7 @@ spec: labels: name: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: accessModes: diff --git a/kubernetes/common/common/templates/_createPassword.tpl b/kubernetes/common/common/templates/_createPassword.tpl index 938b0ee514..8b2f1e274d 100644 --- a/kubernetes/common/common/templates/_createPassword.tpl +++ b/kubernetes/common/common/templates/_createPassword.tpl @@ -29,6 +29,9 @@ {{- printf "%d" .Values.global.masterPassword -}} {{ else if .Values.masterPassword }} {{- printf "%d" .Values.masterPassword -}} + {{ else if eq "testRelease" (include "common.release" .) }} + {{/* Special case for chart liniting. DON"T NAME YOUR PRODUCTION RELEASE testRelease */}} + {{- printf "testRelease" -}} {{ else }} {{ fail "masterPassword not provided" }} {{ end }} diff --git a/kubernetes/common/common/templates/_ingress.tpl b/kubernetes/common/common/templates/_ingress.tpl index b4afe6309d..7823c544f3 100644 --- a/kubernetes/common/common/templates/_ingress.tpl +++ b/kubernetes/common/common/templates/_ingress.tpl @@ -69,7 +69,7 @@ metadata: labels: app: {{ .Chart.Name }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: rules: diff --git a/kubernetes/common/common/templates/_mariadb.tpl b/kubernetes/common/common/templates/_mariadb.tpl index 15fb5a4225..df0e6b41c9 100644 --- a/kubernetes/common/common/templates/_mariadb.tpl +++ b/kubernetes/common/common/templates/_mariadb.tpl @@ -15,6 +15,43 @@ */}} {{/* + UID of mariadb root password +*/}} +{{- define "common.mariadb.secret.rootPassUID" -}} + {{- printf "db-root-password" }} +{{- end -}} + +{{/* + Name of mariadb secret +*/}} +{{- define "common.mariadb.secret._secretName" -}} + {{- $global := .dot }} + {{- $chartName := tpl .chartName $global -}} + {{- include "common.secret.genName" (dict "global" $global "uid" (include .uidTemplate $global) "chartName" $chartName) }} +{{- end -}} + +{{/* + Name of mariadb root password secret +*/}} +{{- define "common.mariadb.secret.rootPassSecretName" -}} + {{- include "common.mariadb.secret._secretName" (set . "uidTemplate" "common.mariadb.secret.rootPassUID") }} +{{- end -}} + +{{/* + UID of mariadb user credentials +*/}} +{{- define "common.mariadb.secret.userCredentialsUID" -}} + {{- printf "db-user-credentials" }} +{{- end -}} + +{{/* + Name of mariadb user credentials secret +*/}} +{{- define "common.mariadb.secret.userCredentialsSecretName" -}} + {{- include "common.mariadb.secret._secretName" (set . "uidTemplate" "common.mariadb.secret.userCredentialsUID") }} +{{- end -}} + +{{/* Choose the name of the mariadb service to use. */}} {{- define "common.mariadbService" -}} @@ -43,7 +80,7 @@ {{- if .Values.global.mariadbGalera.localCluster -}} {{ printf "%s-%s-db-user-credentials" (include "common.fullname" .) (index .Values "mariadb-galera" "nameOverride") -}} {{- else -}} - {{ printf "%s-%s" (.Release.Name) (index .Values "mariadb-init" "nameOverride") -}} + {{ printf "%s-%s-%s" ( include "common.release" .) (index .Values "mariadb-init" "nameOverride") (index .Values "mariadb-init" "config" "mysqlDatabase" ) -}} {{- end -}} {{- end -}} @@ -51,9 +88,5 @@ Choose the value of secret param to retrieve user value. */}} {{- define "common.mariadbSecretParam" -}} - {{- if .Values.global.mariadbGalera.localCluster -}} - {{ printf "password" -}} - {{- else -}} - {{ printf "db-user-password" -}} - {{- end -}} + {{ printf "password" -}} {{- end -}} diff --git a/kubernetes/common/common/templates/_name.tpl b/kubernetes/common/common/templates/_name.tpl index f84ca21f3a..7719cdbb9f 100644 --- a/kubernetes/common/common/templates/_name.tpl +++ b/kubernetes/common/common/templates/_name.tpl @@ -22,12 +22,22 @@ {{- end -}} {{/* + The same as common.full name but based on passed dictionary instead of trying to figure + out chart name on its own. +*/}} +{{- define "common.fullnameExplicit" -}} + {{- $dot := .dot }} + {{- $name := .chartName }} + {{- printf "%s-%s" (include "common.release" $dot) $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* Create a default fully qualified application name. Truncated at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "common.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} - {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} + {{- include "common.fullnameExplicit" (dict "dot" . "chartName" $name) }} {{- end -}} {{/* @@ -37,5 +47,5 @@ this function would answer back "toto". */}} {{- define "common.release" -}} - {{- regexReplaceAll "-[a-zA-Z0-9]*$" .Release.Name "" }} + {{- first (regexSplit "-" .Release.Name -1) }} {{- end -}} diff --git a/kubernetes/common/common/templates/_secret.yaml b/kubernetes/common/common/templates/_secret.yaml index 523d7880f0..e24a2e4ba7 100644 --- a/kubernetes/common/common/templates/_secret.yaml +++ b/kubernetes/common/common/templates/_secret.yaml @@ -37,7 +37,7 @@ metadata: labels: app: {{ include "common.name" $global }} chart: {{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }} - release: {{ $global.Release.Name }} + release: {{ include "common.release" $global }} heritage: {{ $global.Release.Service }} type: Opaque {{- end -}} @@ -76,8 +76,6 @@ type: Opaque {{/* - For internal use only! - Generate a secret name based on provided name or UID. If UID is provided then the name is generated by appending this UID right after the chart name. If name is provided, it overrides the name generation algorith @@ -90,11 +88,12 @@ type: Opaque - .name: string that can be used to override default name generation algorithm and provide a custom name for the secret */}} -{{- define "common.secret._genName" -}} +{{- define "common.secret.genName" -}} {{- $global := .global }} {{- $uid := tpl (default "" .uid) $global }} {{- $name := tpl (default "" .name) $global }} - {{- default (printf "%s-%s" (include "common.fullname" $global) $uid) $name }} + {{- $fullname := ne (default "" .chartName) "" | ternary (include "common.fullnameExplicit" (dict "dot" $global "chartName" .chartName)) (include "common.fullname" $global) }} + {{- default (printf "%s-%s" $fullname $uid) $name }} {{- end -}} {{/* @@ -115,10 +114,14 @@ type: Opaque */}} {{- define "common.secret.getSecretName" -}} {{- $global := .global }} - {{- $targetName := include "common.secret._genName" (dict "global" $global "uid" .uid "name" .name) }} + {{- $name := tpl (default "" .name) $global }} + {{- $uid := tpl (default "" .uid) $global }} + {{- $targetName := default (include "common.secret.genName" (dict "global" $global "uid" $uid "name" .name)) $name}} {{- range $secret := $global.Values.secrets }} - {{- $currName := include "common.secret._genName" (dict "global" $global "uid" $secret.uid "name" $secret.name) }} - {{- if eq $currName $targetName }} + {{- $givenName := tpl (default "" $secret.name) $global }} + {{- $currUID := tpl (default "" $secret.uid) $global }} + {{- $currName := default (include "common.secret.genName" (dict "global" $global "uid" $currUID "name" $secret.name)) $givenName }} + {{- if or (eq $uid $currUID) (eq $currName $targetName) }} {{- $externalSecret := tpl (default "" $secret.externalSecret) $global }} {{- default $currName $externalSecret }} {{- end }} @@ -234,7 +237,8 @@ valueFrom: {{- define "common.secret" -}} {{- $global := . }} {{- range $secret := .Values.secrets }} - {{- $name := include "common.secret._genName" (dict "global" $global "uid" $secret.uid "name" $secret.name) }} + {{- $uid := tpl (default "" $secret.uid) $global }} + {{- $name := include "common.secret.genName" (dict "global" $global "uid" $uid "name" $secret.name) }} {{- $type := default "generic" $secret.type }} {{- $externalSecret := tpl (default "" $secret.externalSecret) $global }} {{- if not $externalSecret }} diff --git a/kubernetes/common/dgbuilder/templates/configmap.yaml b/kubernetes/common/dgbuilder/templates/configmap.yaml index cef11f499b..24f61b5487 100644 --- a/kubernetes/common/dgbuilder/templates/configmap.yaml +++ b/kubernetes/common/dgbuilder/templates/configmap.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} @@ -33,7 +33,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/scripts/*").AsConfig . | indent 2 }} diff --git a/kubernetes/common/dgbuilder/templates/deployment.yaml b/kubernetes/common/dgbuilder/templates/deployment.yaml index 353c2314ac..495c4c6ab6 100644 --- a/kubernetes/common/dgbuilder/templates/deployment.yaml +++ b/kubernetes/common/dgbuilder/templates/deployment.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} @@ -28,7 +28,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: initContainers: - command: diff --git a/kubernetes/common/dgbuilder/templates/secrets.yaml b/kubernetes/common/dgbuilder/templates/secrets.yaml index 2781cca8aa..e00d7cfc03 100644 --- a/kubernetes/common/dgbuilder/templates/secrets.yaml +++ b/kubernetes/common/dgbuilder/templates/secrets.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} type: Opaque data: diff --git a/kubernetes/common/dgbuilder/templates/service.yaml b/kubernetes/common/dgbuilder/templates/service.yaml index 1e2f0a5f00..7a8f752a2d 100644 --- a/kubernetes/common/dgbuilder/templates/service.yaml +++ b/kubernetes/common/dgbuilder/templates/service.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: type: {{ .Values.service.type }} @@ -37,4 +37,4 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/etcd/templates/pv.yaml b/kubernetes/common/etcd/templates/pv.yaml index da8dfb8a22..ed1344d4c1 100644 --- a/kubernetes/common/etcd/templates/pv.yaml +++ b/kubernetes/common/etcd/templates/pv.yaml @@ -25,7 +25,7 @@ metadata: labels: app: {{ include "common.fullname" $global }} chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" - release: "{{ $global.Release.Name }}" + release: "{{ include "common.release" $global }}" heritage: "{{ $global.Release.Service }}" name: {{ include "common.fullname" $global }} spec: @@ -36,7 +36,7 @@ spec: persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} storageClassName: "{{ include "common.fullname" $global }}-data" hostPath: - path: {{ $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }} + path: {{ $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }} {{if ne $i (int $global.Values.replicaCount) }} --- {{- end -}} diff --git a/kubernetes/common/etcd/templates/service.yaml b/kubernetes/common/etcd/templates/service.yaml index 692faa9f2d..4268dd6d2c 100644 --- a/kubernetes/common/etcd/templates/service.yaml +++ b/kubernetes/common/etcd/templates/service.yaml @@ -21,7 +21,7 @@ metadata: name: {{ include "common.servicename" . }} labels: heritage: "{{ .Release.Service }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" app: {{ include "common.name" . }} spec: @@ -33,5 +33,5 @@ spec: clusterIP: None selector: app: {{ include "common.name" . }} - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" diff --git a/kubernetes/common/etcd/templates/statefulset.yaml b/kubernetes/common/etcd/templates/statefulset.yaml index cef1a48c2a..96cda89c1f 100644 --- a/kubernetes/common/etcd/templates/statefulset.yaml +++ b/kubernetes/common/etcd/templates/statefulset.yaml @@ -17,7 +17,7 @@ metadata: name: {{ include "common.fullname" . }} labels: heritage: "{{ .Release.Service }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" app: {{ include "common.name" . }} spec: @@ -27,7 +27,7 @@ spec: metadata: labels: heritage: "{{ .Release.Service }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" app: {{ include "common.name" . }} spec: @@ -216,7 +216,7 @@ spec: labels: name: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: accessModes: diff --git a/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml b/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml index 408bd1814c..c9e2ffe85c 100644 --- a/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml +++ b/kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml @@ -22,7 +22,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: schedule: {{ .Values.backup.cron | quote }} @@ -86,7 +86,7 @@ spec: echo "Backup Successful!!!" env: - name: DB_PASS - {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14}} + {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}} volumeMounts: - name: backup-dir mountPath: /backup @@ -96,7 +96,7 @@ spec: imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }} env: - name: MYSQL_ROOT_PASSWORD - {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14}} + {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}} command: - /bin/bash - -c diff --git a/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml b/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml index 06b590c7fd..807833ae93 100644 --- a/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml +++ b/kubernetes/common/mariadb-galera/templates/backup/pvc.yaml @@ -24,7 +24,7 @@ metadata: labels: app: {{ include "common.name" . }}-backup chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" {{- if .Values.persistence.annotations }} annotations: diff --git a/kubernetes/common/mariadb-galera/templates/configmap.yaml b/kubernetes/common/mariadb-galera/templates/configmap.yaml index ff6e119b0c..f143c3b679 100644 --- a/kubernetes/common/mariadb-galera/templates/configmap.yaml +++ b/kubernetes/common/mariadb-galera/templates/configmap.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: my_extra.cnf: | diff --git a/kubernetes/common/mariadb-galera/templates/pv.yaml b/kubernetes/common/mariadb-galera/templates/pv.yaml index 795ad3188b..6e53a9543d 100644 --- a/kubernetes/common/mariadb-galera/templates/pv.yaml +++ b/kubernetes/common/mariadb-galera/templates/pv.yaml @@ -25,7 +25,7 @@ metadata: labels: app: {{ include "common.fullname" $global }} chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" - release: "{{ $global.Release.Name }}" + release: "{{ include "common.release" $global }}" heritage: "{{ $global.Release.Service }}" name: {{ include "common.fullname" $global }} spec: @@ -36,7 +36,7 @@ spec: persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} storageClassName: "{{ include "common.fullname" $global }}-data" hostPath: - path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} + path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} {{if ne $i (int $global.Values.replicaCount) }} --- {{- end -}} diff --git a/kubernetes/common/mariadb-galera/templates/service.yaml b/kubernetes/common/mariadb-galera/templates/service.yaml index ae11a26629..71d1b0fe80 100644 --- a/kubernetes/common/mariadb-galera/templates/service.yaml +++ b/kubernetes/common/mariadb-galera/templates/service.yaml @@ -23,7 +23,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: ports: diff --git a/kubernetes/common/mariadb-galera/templates/statefulset.yaml b/kubernetes/common/mariadb-galera/templates/statefulset.yaml index a9f1fb37b7..a6260fae54 100644 --- a/kubernetes/common/mariadb-galera/templates/statefulset.yaml +++ b/kubernetes/common/mariadb-galera/templates/statefulset.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: serviceName: {{ .Values.service.name }} @@ -30,7 +30,7 @@ spec: labels: app: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" annotations: pod.alpha.kubernetes.io/initialized: "true" @@ -61,13 +61,13 @@ spec: apiVersion: v1 fieldPath: metadata.namespace - name: MYSQL_USER - {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-credentials" "key" "login") | indent 14}} + {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "login") | indent 14}} - name: MYSQL_PASSWORD - {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-credentials" "key" "password") | indent 14}} + {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.userCredentialsUID" .) "key" "password") | indent 14}} - name: MYSQL_DATABASE value: {{ default "" .Values.config.mysqlDatabase | quote }} - name: MYSQL_ROOT_PASSWORD - {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-root-password" "key" "password") | indent 14}} + {{- include "common.secret.envFromSecret" (dict "global" . "uid" (include "common.mariadb.secret.rootPassUID" .) "key" "password") | indent 14}} ports: - containerPort: {{ .Values.service.internalPort }} name: {{ .Values.service.portName }} @@ -119,7 +119,7 @@ spec: labels: name: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: accessModes: diff --git a/kubernetes/common/mariadb-galera/values.yaml b/kubernetes/common/mariadb-galera/values.yaml index a6dd1ca359..dabf21da79 100644 --- a/kubernetes/common/mariadb-galera/values.yaml +++ b/kubernetes/common/mariadb-galera/values.yaml @@ -17,11 +17,11 @@ # Secrets metaconfig ################################################################# secrets: - - uid: "db-root-password" + - uid: '{{ include "common.mariadb.secret.rootPassUID" . }}' type: password externalSecret: '{{ tpl (default "" .Values.config.mariadbRootPasswordExternalSecret) . }}' password: '{{ .Values.config.mariadbRootPassword }}' - - uid: "db-user-credentials" + - uid: '{{ include "common.mariadb.secret.userCredentialsUID" . }}' type: basicAuth externalSecret: '{{ tpl (default "" .Values.config.userCredentialsExternalSecret) . }}' login: '{{ .Values.config.userName }}' @@ -61,8 +61,8 @@ config: mariadbRootPassword: secretpassword # .userCredentialsExternalSecret: 'some-external-secret' userName: my-user - userPassword: my-password - mysqlDatabase: my-database + # userPassword: my-password + # mysqlDatabase: my-database # default number of instances in the StatefulSet replicaCount: 3 diff --git a/kubernetes/common/mariadb-init/templates/_mariadb.tpl b/kubernetes/common/mariadb-init/templates/_mariadb.tpl index fb3f7974b9..af9a4f5f02 100644 --- a/kubernetes/common/mariadb-init/templates/_mariadb.tpl +++ b/kubernetes/common/mariadb-init/templates/_mariadb.tpl @@ -18,9 +18,5 @@ Choose the name of the mariadb secret to use. */}} {{- define "mariadbInit.mariadbClusterSecret" -}} - {{- if (eq "default" .Values.global.mariadbGalera.userRootSecret) -}} - {{- printf "%s-mariadb-galera-%s-db-root-password" (include "common.release" .) .Values.global.mariadbGalera.nameOverride -}} - {{- else -}} - {{- .Values.global.mariadbGalera.userRootSecret -}} - {{- end -}} + {{- include "common.mariadb.secret.rootPassSecretName" (dict "dot" . "chartName" (default "mariadb-galera" .Values.global.mariadbGalera.nameOverride)) -}} {{- end -}} diff --git a/kubernetes/common/mariadb-init/templates/configmap.yaml b/kubernetes/common/mariadb-init/templates/configmap.yaml index 9da03668f5..0144ec1907 100644 --- a/kubernetes/common/mariadb-init/templates/configmap.yaml +++ b/kubernetes/common/mariadb-init/templates/configmap.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/kubernetes/common/mariadb-init/templates/job.yaml b/kubernetes/common/mariadb-init/templates/job.yaml index f3ff9934ab..5202d572a2 100644 --- a/kubernetes/common/mariadb-init/templates/job.yaml +++ b/kubernetes/common/mariadb-init/templates/job.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: backoffLimit: 20 @@ -29,7 +29,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} name: {{ include "common.name" . }} spec: initContainers: @@ -60,26 +60,17 @@ spec: - name: DB_PORT value: "{{ .Values.global.mariadbGalera.servicePort }}" - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "mariadbInit.mariadbClusterSecret" . }} - key: {{ .Values.global.mariadbGalera.userRootSecretKey }} + {{- include "common.secret.envFromSecret" (dict "global" . "uid" "root-password" "key" (default "password" .Values.global.mariadbGalera.userRootSecretKey)) | indent 10 }} - name: {{ printf "MYSQL_USER_%s" .Values.config.mysqlDatabase | upper }} - value: "{{ .Values.config.userName }}" + {{- include "common.secret.envFromSecret" (dict "global" . "uid" .Values.config.mysqlDatabase "key" "login") | indent 10 }} - name: {{ printf "MYSQL_PASSWORD_%s" .Values.config.mysqlDatabase | upper }} - valueFrom: - secretKeyRef: - name: {{ template "common.fullname" . }} - key: db-user-password + {{- include "common.secret.envFromSecret" (dict "global" . "uid" .Values.config.mysqlDatabase "key" "password") | indent 10 }} {{- $root := . }} -{{ range $db, $dbInfos := .Values.config.mysqlAdditionalDatabases }} +{{ range $db, $_values := .Values.config.mysqlAdditionalDatabases }} - name: {{ printf "MYSQL_USER_%s" $db | upper }} - value: {{ $dbInfos.user }} + {{- include "common.secret.envFromSecret" (dict "global" $root "uid" $db "key" "login") | indent 10 }} - name: {{ printf "MYSQL_PASSWORD_%s" $db | upper }} - valueFrom: - secretKeyRef: - name: {{ template "common.fullname" $root }}-secret - key: {{ printf "db-%s-user-password" $db }} + {{- include "common.secret.envFromSecret" (dict "global" $root "uid" $db "key" "password") | indent 10 }} {{ end }} volumeMounts: - mountPath: /etc/localtime diff --git a/kubernetes/common/mariadb-init/templates/secret.yaml b/kubernetes/common/mariadb-init/templates/secret.yaml index f30d582110..71a89d019b 100644 --- a/kubernetes/common/mariadb-init/templates/secret.yaml +++ b/kubernetes/common/mariadb-init/templates/secret.yaml @@ -12,19 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.name" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -type: Opaque -data: - db-user-password: {{ index .Values.config.userPassword | b64enc | quote }} -{{ range $db, $dbInfos := .Values.config.mysqlAdditionalDatabases }} - {{ printf "db-%s-user-password" $db}}: {{ $dbInfos.password | b64enc | quote }} -{{ end }} +{{- define "mariadb-init._update-secrets" -}} + {{ range $db, $dbInfos := .Values.config.mysqlAdditionalDatabases }} +{{ printf "- uid: %s" $db }} +{{ printf " type: basicAuth" }} + {{- if $dbInfos.externalSecret }} +{{ printf " externalSecret: %s" $dbInfos.externalSecret }} + {{- end }} +{{ printf " login: %s" $dbInfos.user }} +{{ printf " password: %s" $dbInfos.password }} +{{ printf " passwordPolicy: required" }} + {{- end -}} +{{- end -}} + +{{ $global := . }} +{{ $secretsString := .Values.secrets | toYaml | indent 2 }} +{{ $additionalSecretsString := (include "mariadb-init._update-secrets" .) | indent 2 }} +{{ $finalSecretsString := (cat "\nsecrets:\n" $secretsString $additionalSecretsString) | replace " -" " -" }} +{{ $finalSecrets := ($finalSecretsString | fromYaml).secrets }} + +{{ $newValues := set $global.Values "secrets" $finalSecrets }} +{{ $tmpGlobal := set $global "Values" $newValues }} + +{{ include "common.secret" $tmpGlobal }} diff --git a/kubernetes/common/mariadb-init/values.yaml b/kubernetes/common/mariadb-init/values.yaml index d148ba6888..cac6f79f16 100644 --- a/kubernetes/common/mariadb-init/values.yaml +++ b/kubernetes/common/mariadb-init/values.yaml @@ -23,8 +23,24 @@ global: nameOverride: mariadb-galera servicePort: 3306 # set these two values if you want to access an 'out of ONAP' mariadb - userRootSecret: default - userRootSecretKey: password + # userRootPassword: some-password + # userRootSecret: some-secret-name + # userRootSecretKey: password + +################################################################# +# Secrets metaconfig +################################################################# +secrets: + - uid: root-password + type: password + externalSecret: '{{ tpl (default (include "mariadbInit.mariadbClusterSecret" .) .Values.global.mariadbGalera.userRootSecret) . }}' + password: '{{ tpl (default "" .global.mariadbGalera.userRootPassword) . }}' + - uid: '{{ .Values.config.mysqlDatabase }}' + type: basicAuth + externalSecret: '{{ tpl (default "" .Values.config.mysqlExternalSecret) . }}' + login: '{{ .Values.config.userName }}' + password: '{{ .Values.config.userPassword }}' + passwordPolicy: required ################################################################# # Application configuration defaults. @@ -39,6 +55,8 @@ pullPolicy: IfNotPresent config: userPassword: Ci@shsOd3pky1Vji userName: u5WZ1GMSIS1wHZF + # set this value if you would like to use external secret instead of providing a password + # mysqlExternalsecret: some-secret-name mysqlDatabase: ynsaUCru6mUNwGal mysqlAdditionalDatabases: {} # add addtional dabases @@ -48,9 +66,11 @@ config: # dbOne: # user: one # password: pwd1 + # externalSecret: some-secret-name # dbTwo: # user: two # password: pwd2 + # externalSecret: some-secret-name config_map: default nodeSelector: {} diff --git a/kubernetes/common/mongo/templates/pv.yaml b/kubernetes/common/mongo/templates/pv.yaml index edc50aedea..9d40144ed5 100644 --- a/kubernetes/common/mongo/templates/pv.yaml +++ b/kubernetes/common/mongo/templates/pv.yaml @@ -26,7 +26,7 @@ metadata: labels: app: {{ include "common.fullname" $global }} chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" - release: "{{ $global.Release.Name }}" + release: "{{ include "common.release" $global }}" heritage: "{{ $global.Release.Service }}" name: {{ include "common.fullname" $global }} spec: @@ -37,7 +37,7 @@ spec: persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} storageClassName: "{{ include "common.fullname" $global }}-data" hostPath: - path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} + path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} {{if ne $i (int $global.Values.replicaCount) }} --- {{- end -}} diff --git a/kubernetes/common/mongo/templates/service.yaml b/kubernetes/common/mongo/templates/service.yaml index d59243f90d..e8894c2b59 100644 --- a/kubernetes/common/mongo/templates/service.yaml +++ b/kubernetes/common/mongo/templates/service.yaml @@ -22,7 +22,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: ports: @@ -30,7 +30,7 @@ spec: name: {{ .Values.service.portName }} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} clusterIP: None --- # Client service for connecting to any Mongo instance for reads. @@ -47,7 +47,7 @@ spec: name: {{ .Values.service.portName }} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} --- {{ if .Values.geoEnabled }} apiVersion: v1 @@ -70,5 +70,5 @@ spec: type: NodePort selector: statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0 - release: {{ .Release.Name }} + release: {{ include "common.release" . }} {{ end }} diff --git a/kubernetes/common/mongo/templates/statefulset.yaml b/kubernetes/common/mongo/templates/statefulset.yaml index 0c6c9f4fd5..ae373343d3 100644 --- a/kubernetes/common/mongo/templates/statefulset.yaml +++ b/kubernetes/common/mongo/templates/statefulset.yaml @@ -22,7 +22,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: serviceName: {{ .Values.service.name }} @@ -31,7 +31,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: containers: - name: {{ include "common.name" . }} @@ -84,7 +84,7 @@ spec: labels: name: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: accessModes: diff --git a/kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml b/kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml index 88f0c7465f..46310fb0fb 100644 --- a/kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml +++ b/kubernetes/common/music/charts/music-cassandra-job/templates/job.yaml @@ -22,14 +22,14 @@ metadata: labels: app: {{ include "common.name" . }}-job chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: template: metadata: labels: app: {{ include "common.name" . }}-job - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: restartPolicy: Never initContainers: diff --git a/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml b/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml index fb815400da..8399bff77d 100644 --- a/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml +++ b/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml @@ -26,7 +26,7 @@ metadata: labels: app: {{ include "common.fullname" $global }} chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" - release: "{{ $global.Release.Name }}" + release: "{{ include "common.release" $global }}" heritage: "{{ $global.Release.Service }}" name: {{ include "common.fullname" $global }} spec: @@ -37,7 +37,7 @@ spec: persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} storageClassName: "{{ include "common.fullname" $global }}-data" hostPath: - path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} + path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} {{if ne $i (int $global.Values.replicaCount) }} --- {{- end -}} diff --git a/kubernetes/common/music/charts/music-cassandra/templates/service.yaml b/kubernetes/common/music/charts/music-cassandra/templates/service.yaml index 818c70e8f3..5a26d6701c 100644 --- a/kubernetes/common/music/charts/music-cassandra/templates/service.yaml +++ b/kubernetes/common/music/charts/music-cassandra/templates/service.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" @@ -50,5 +50,5 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} clusterIP: None diff --git a/kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml b/kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml index c3c56f2282..58866495db 100644 --- a/kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml +++ b/kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml @@ -23,7 +23,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: podAntiAffinity: @@ -46,7 +46,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} name: {{ include "common.name" . }} spec: containers: @@ -120,7 +120,7 @@ spec: labels: name: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: accessModes: diff --git a/kubernetes/common/music/charts/music-tomcat/templates/deployment.yaml b/kubernetes/common/music/charts/music-tomcat/templates/deployment.yaml index 2a38a6aad0..dcbd4e2d88 100755 --- a/kubernetes/common/music/charts/music-tomcat/templates/deployment.yaml +++ b/kubernetes/common/music/charts/music-tomcat/templates/deployment.yaml @@ -22,7 +22,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} @@ -30,7 +30,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: initContainers: - name: {{ include "common.name" . }}-zookeeper-readiness @@ -54,7 +54,7 @@ spec: - /root/job_complete.py args: - -j - - "{{ .Release.Name }}-music-cassandra-job-config" + - "{{ include "common.release" . }}-music-cassandra-job-config" env: - name: NAMESPACE valueFrom: diff --git a/kubernetes/common/music/charts/music-tomcat/templates/service.yaml b/kubernetes/common/music/charts/music-tomcat/templates/service.yaml index f6a086cc99..d808bf957a 100755 --- a/kubernetes/common/music/charts/music-tomcat/templates/service.yaml +++ b/kubernetes/common/music/charts/music-tomcat/templates/service.yaml @@ -22,7 +22,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -39,4 +39,4 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/music/charts/zookeeper/templates/_helpers.tpl b/kubernetes/common/music/charts/zookeeper/templates/_helpers.tpl deleted file mode 100644 index 1ef5353fa1..0000000000 --- a/kubernetes/common/music/charts/zookeeper/templates/_helpers.tpl +++ /dev/null @@ -1,32 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "common.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "common.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "zookeeper.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} diff --git a/kubernetes/common/music/charts/zookeeper/templates/config-jmx-exporter.yaml b/kubernetes/common/music/charts/zookeeper/templates/config-jmx-exporter.yaml index aeb9a2c031..72fedbcbbb 100644 --- a/kubernetes/common/music/charts/zookeeper/templates/config-jmx-exporter.yaml +++ b/kubernetes/common/music/charts/zookeeper/templates/config-jmx-exporter.yaml @@ -2,11 +2,11 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ .Release.Name }}-jmx-exporter + name: {{ include "common.release" . }}-jmx-exporter labels: app: {{ template "common.name" . }} chart: {{ .Chart.Name }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: config.yml: |- diff --git a/kubernetes/common/music/charts/zookeeper/templates/job-chroots.yaml b/kubernetes/common/music/charts/zookeeper/templates/job-chroots.yaml index b5b97233a0..b857a0d7b1 100644 --- a/kubernetes/common/music/charts/zookeeper/templates/job-chroots.yaml +++ b/kubernetes/common/music/charts/zookeeper/templates/job-chroots.yaml @@ -12,7 +12,7 @@ metadata: labels: app: {{ template "common.name" . }} chart: {{ .Chart.Name }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} component: jobs job: chroots @@ -25,7 +25,7 @@ spec: metadata: labels: app: {{ template "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} component: jobs job: chroots spec: diff --git a/kubernetes/common/music/charts/zookeeper/templates/poddisruptionbudget.yaml b/kubernetes/common/music/charts/zookeeper/templates/poddisruptionbudget.yaml index 7a9f3fe105..a4bc322a31 100644 --- a/kubernetes/common/music/charts/zookeeper/templates/poddisruptionbudget.yaml +++ b/kubernetes/common/music/charts/zookeeper/templates/poddisruptionbudget.yaml @@ -5,13 +5,13 @@ metadata: labels: app: {{ template "common.name" . }} chart: {{ .Chart.Name }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} component: server spec: selector: matchLabels: app: {{ template "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} component: server {{ toYaml .Values.podDisruptionBudget | indent 2 }} diff --git a/kubernetes/common/music/charts/zookeeper/templates/pv.yaml b/kubernetes/common/music/charts/zookeeper/templates/pv.yaml index 795ad3188b..6e53a9543d 100644 --- a/kubernetes/common/music/charts/zookeeper/templates/pv.yaml +++ b/kubernetes/common/music/charts/zookeeper/templates/pv.yaml @@ -25,7 +25,7 @@ metadata: labels: app: {{ include "common.fullname" $global }} chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" - release: "{{ $global.Release.Name }}" + release: "{{ include "common.release" $global }}" heritage: "{{ $global.Release.Service }}" name: {{ include "common.fullname" $global }} spec: @@ -36,7 +36,7 @@ spec: persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} storageClassName: "{{ include "common.fullname" $global }}-data" hostPath: - path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} + path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} {{if ne $i (int $global.Values.replicaCount) }} --- {{- end -}} diff --git a/kubernetes/common/music/charts/zookeeper/templates/service-headless.yaml b/kubernetes/common/music/charts/zookeeper/templates/service-headless.yaml index 70ebf6013e..31475a1c76 100644 --- a/kubernetes/common/music/charts/zookeeper/templates/service-headless.yaml +++ b/kubernetes/common/music/charts/zookeeper/templates/service-headless.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ template "common.name" . }} chart: {{ .Chart.Name }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: clusterIP: None @@ -18,4 +18,4 @@ spec: {{- end }} selector: app: {{ template "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/music/charts/zookeeper/templates/service.yaml b/kubernetes/common/music/charts/zookeeper/templates/service.yaml index 6ac3066ecf..0ef3a28b27 100644 --- a/kubernetes/common/music/charts/zookeeper/templates/service.yaml +++ b/kubernetes/common/music/charts/zookeeper/templates/service.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ template "common.name" . }} chart: {{ .Chart.Name }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: {{- with .Values.service.annotations }} @@ -20,4 +20,4 @@ spec: {{- end }} selector: app: {{ template "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/music/charts/zookeeper/templates/statefulset.yaml b/kubernetes/common/music/charts/zookeeper/templates/statefulset.yaml index 580042d090..73224addef 100644 --- a/kubernetes/common/music/charts/zookeeper/templates/statefulset.yaml +++ b/kubernetes/common/music/charts/zookeeper/templates/statefulset.yaml @@ -5,7 +5,7 @@ metadata: labels: app: {{ template "common.name" . }} chart: {{ .Chart.Name }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} component: server spec: @@ -25,7 +25,7 @@ spec: selector: matchLabels: app: {{ template "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} component: server updateStrategy: {{ toYaml .Values.updateStrategy | indent 4 }} @@ -33,7 +33,7 @@ spec: metadata: labels: app: {{ template "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} component: server {{- if .Values.podLabels }} ## Custom pod labels @@ -160,7 +160,7 @@ spec: {{- if .Values.exporters.jmx.enabled }} - name: config-jmx-exporter configMap: - name: {{ .Release.Name }}-jmx-exporter + name: {{ include "common.release" . }}-jmx-exporter {{- end }} {{- end }} {{- if .Values.persistence.enabled }} @@ -170,7 +170,7 @@ spec: labels: name: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: accessModes: diff --git a/kubernetes/common/network-name-gen/templates/deployment.yaml b/kubernetes/common/network-name-gen/templates/deployment.yaml index dac4e0d4ce..2f9cd6a158 100644 --- a/kubernetes/common/network-name-gen/templates/deployment.yaml +++ b/kubernetes/common/network-name-gen/templates/deployment.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: replicas: {{ .Values.replicaCount }} @@ -28,7 +28,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: initContainers: - command: @@ -53,12 +53,9 @@ spec: - name: SPRING_PROFILE value: "{{ .Values.config.springProfile }}" - name: NENG_DB_USER - value: {{ index .Values "mariadb-galera" "config" "userName" }} + {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-creds" "key" "login") | indent 10}} - name: NENG_DB_PASS - valueFrom: - secretKeyRef: - name: {{ template "common.fullname" . }} - key: db-root-password + {{- include "common.secret.envFromSecret" (dict "global" . "uid" "db-user-creds" "key" "password") | indent 10}} - name: NENG_DB_URL value: {{ .Values.config.dbUrl }} - name: POL_CLIENT_AUTH @@ -97,6 +94,6 @@ spec: volumes: - name: certs secret: - secretName: {{ .Release.Name}}-aai-keystore + secretName: {{ include "common.release" . }}-aai-keystore imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/kubernetes/common/network-name-gen/templates/secrets.yaml b/kubernetes/common/network-name-gen/templates/secrets.yaml index c8630a2535..d5bdce3e04 100644 --- a/kubernetes/common/network-name-gen/templates/secrets.yaml +++ b/kubernetes/common/network-name-gen/templates/secrets.yaml @@ -12,30 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "common.fullname" . }} - namespace: {{ include "common.namespace" . }} - labels: - app: {{ include "common.fullname" . }} - chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} - heritage: {{ .Release.Service }} -type: Opaque -data: - db-root-password: {{ index .Values "mariadb-galera" "config" "mariadbRootPassword" | b64enc | quote }} +{{ include "common.secret" . }} --- apiVersion: v1 data: {{ tpl (.Files.Glob "resources/config/aai_keystore").AsSecrets . | indent 2 }} metadata: - name: {{ .Release.Name}}-aai-keystore + name: {{ include "common.release" . }}-aai-keystore namespace: {{ include "common.namespace" . }} labels: app: {{ include "common.fullname" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} kind: Secret -type: Opaque
\ No newline at end of file +type: Opaque diff --git a/kubernetes/common/network-name-gen/templates/service.yaml b/kubernetes/common/network-name-gen/templates/service.yaml index 0321be9f28..a4c5b05012 100644 --- a/kubernetes/common/network-name-gen/templates/service.yaml +++ b/kubernetes/common/network-name-gen/templates/service.yaml @@ -19,7 +19,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: type: {{ .Values.service.type }} @@ -36,4 +36,4 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/network-name-gen/values.yaml b/kubernetes/common/network-name-gen/values.yaml index b8a5dad170..d5897013c4 100644 --- a/kubernetes/common/network-name-gen/values.yaml +++ b/kubernetes/common/network-name-gen/values.yaml @@ -32,6 +32,17 @@ global: # image pull policy pullPolicy: IfNotPresent +################################################################# +# Secrets metaconfig +################################################################# +secrets: + - uid: "db-user-creds" + externalSecret: '{{- include "common.mariadb.secret.userCredentialsSecretName" (dict "dot" . "chartName" (index .Values "mariadb-galera" "nameOverride")) }}' + type: basicAuth + - uid: "db-root-pass" + externalSecret: '{{- include "common.mariadb.secret.rootPassSecretName" (dict "dot" . "chartName" (index .Values "mariadb-galera" "nameOverride")) }}' + type: password + # sub-chart config mariadb-galera: config: diff --git a/kubernetes/common/postgres-legacy/charts/pgpool/templates/configmap.yaml b/kubernetes/common/postgres-legacy/charts/pgpool/templates/configmap.yaml index e2c77ff910..099c8dd12e 100755 --- a/kubernetes/common/postgres-legacy/charts/pgpool/templates/configmap.yaml +++ b/kubernetes/common/postgres-legacy/charts/pgpool/templates/configmap.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "configs/*").AsConfig . | indent 2 }} diff --git a/kubernetes/common/postgres-legacy/charts/pgpool/templates/deployment.yaml b/kubernetes/common/postgres-legacy/charts/pgpool/templates/deployment.yaml index 15fa18d81d..7572d7f444 100644 --- a/kubernetes/common/postgres-legacy/charts/pgpool/templates/deployment.yaml +++ b/kubernetes/common/postgres-legacy/charts/pgpool/templates/deployment.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: replicas: 2 @@ -29,7 +29,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: containers: - image: "{{.Values.repository}}/{{.Values.image}}" diff --git a/kubernetes/common/postgres-legacy/charts/pgpool/templates/service.yaml b/kubernetes/common/postgres-legacy/charts/pgpool/templates/service.yaml index 86442a2740..8c066e5b7a 100644 --- a/kubernetes/common/postgres-legacy/charts/pgpool/templates/service.yaml +++ b/kubernetes/common/postgres-legacy/charts/pgpool/templates/service.yaml @@ -6,7 +6,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -23,4 +23,4 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/postgres-legacy/templates/pv.yaml b/kubernetes/common/postgres-legacy/templates/pv.yaml index bcd67d79cb..2ac5d979d5 100644 --- a/kubernetes/common/postgres-legacy/templates/pv.yaml +++ b/kubernetes/common/postgres-legacy/templates/pv.yaml @@ -25,7 +25,7 @@ metadata: labels: app: {{ include "common.fullname" $global }} chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}" - release: "{{ $global.Release.Name }}" + release: "{{ include "common.release" $global }}" heritage: "{{ $global.Release.Service }}" name: {{ include "common.fullname" $global }} spec: @@ -36,7 +36,7 @@ spec: persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }} storageClassName: "{{ include "common.fullname" $global }}-data" hostPath: - path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} + path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ include "common.release" $global }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}} {{if ne $i (int $global.Values.replicaCount) }} --- {{- end -}} diff --git a/kubernetes/common/postgres-legacy/templates/secrets.yaml b/kubernetes/common/postgres-legacy/templates/secrets.yaml index 29de3af260..db1bc5bb15 100644 --- a/kubernetes/common/postgres-legacy/templates/secrets.yaml +++ b/kubernetes/common/postgres-legacy/templates/secrets.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} type: Opaque data: diff --git a/kubernetes/common/postgres-legacy/templates/service.yaml b/kubernetes/common/postgres-legacy/templates/service.yaml index 2a4e369ef4..30d824bbd7 100644 --- a/kubernetes/common/postgres-legacy/templates/service.yaml +++ b/kubernetes/common/postgres-legacy/templates/service.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -38,7 +38,7 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} --- apiVersion: v1 kind: Service @@ -48,7 +48,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -65,7 +65,7 @@ spec: {{- end}} selector: name: "{{.Values.container.name.primary}}" - release: {{ .Release.Name }} + release: {{ include "common.release" . }} --- apiVersion: v1 kind: Service @@ -75,7 +75,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -92,4 +92,4 @@ spec: {{- end}} selector: name: "{{.Values.container.name.replica}}" - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/postgres-legacy/templates/statefulset.yaml b/kubernetes/common/postgres-legacy/templates/statefulset.yaml index 7c38d1d9d7..5333a0d310 100644 --- a/kubernetes/common/postgres-legacy/templates/statefulset.yaml +++ b/kubernetes/common/postgres-legacy/templates/statefulset.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: serviceName: {{ .Values.service.name }} @@ -30,7 +30,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: initContainers: - command: @@ -131,7 +131,7 @@ spec: labels: name: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" spec: accessModes: diff --git a/kubernetes/common/postgres/charts/pgpool/templates/configmap.yaml b/kubernetes/common/postgres/charts/pgpool/templates/configmap.yaml index e2c77ff910..099c8dd12e 100755 --- a/kubernetes/common/postgres/charts/pgpool/templates/configmap.yaml +++ b/kubernetes/common/postgres/charts/pgpool/templates/configmap.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "configs/*").AsConfig . | indent 2 }} diff --git a/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml b/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml index a4b0ca8657..c24916ad22 100644 --- a/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml +++ b/kubernetes/common/postgres/charts/pgpool/templates/deployment.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} spec: replicas: 2 @@ -29,7 +29,7 @@ spec: metadata: labels: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} spec: initContainers: - name: {{ include "common.name" . }}-job diff --git a/kubernetes/common/postgres/charts/pgpool/templates/secrets.yaml b/kubernetes/common/postgres/charts/pgpool/templates/secrets.yaml index b449faca92..3b89371ad4 100644 --- a/kubernetes/common/postgres/charts/pgpool/templates/secrets.yaml +++ b/kubernetes/common/postgres/charts/pgpool/templates/secrets.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" type: Opaque data: diff --git a/kubernetes/common/postgres/charts/pgpool/templates/service.yaml b/kubernetes/common/postgres/charts/pgpool/templates/service.yaml index 4306b264b2..696b22a80d 100644 --- a/kubernetes/common/postgres/charts/pgpool/templates/service.yaml +++ b/kubernetes/common/postgres/charts/pgpool/templates/service.yaml @@ -6,7 +6,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -23,4 +23,4 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/postgres/templates/configmap.yaml b/kubernetes/common/postgres/templates/configmap.yaml index 7abd39b9b9..26ba390040 100644 --- a/kubernetes/common/postgres/templates/configmap.yaml +++ b/kubernetes/common/postgres/templates/configmap.yaml @@ -20,7 +20,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} data: {{ tpl (.Files.Glob "configs/*").AsConfig . | indent 2 }} diff --git a/kubernetes/common/postgres/templates/deployment-primary.yaml b/kubernetes/common/postgres/templates/deployment-primary.yaml index 9cb3007400..b234dc2092 100644 --- a/kubernetes/common/postgres/templates/deployment-primary.yaml +++ b/kubernetes/common/postgres/templates/deployment-primary.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }}-primary chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} name: "{{ .Values.container.name.primary }}" spec: @@ -31,7 +31,7 @@ spec: metadata: labels: app: {{ include "common.name" . }}-primary - release: {{ .Release.Name }} + release: {{ include "common.release" . }} name: "{{ .Values.container.name.primary }}" spec: initContainers: diff --git a/kubernetes/common/postgres/templates/deployment-replica.yaml b/kubernetes/common/postgres/templates/deployment-replica.yaml index 8f09a2f48f..72a8736e17 100644 --- a/kubernetes/common/postgres/templates/deployment-replica.yaml +++ b/kubernetes/common/postgres/templates/deployment-replica.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }}-replica chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} name: "{{ .Values.container.name.replica }}" spec: @@ -31,7 +31,7 @@ spec: metadata: labels: app: {{ include "common.name" . }}-replica - release: {{ .Release.Name }} + release: {{ include "common.release" . }} name: "{{ .Values.container.name.replica }}" spec: initContainers: diff --git a/kubernetes/common/postgres/templates/pv-primary.yaml b/kubernetes/common/postgres/templates/pv-primary.yaml index 1764868ffc..e1ff1f9f4e 100644 --- a/kubernetes/common/postgres/templates/pv-primary.yaml +++ b/kubernetes/common/postgres/templates/pv-primary.yaml @@ -23,7 +23,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" name: {{ include "common.fullname" . }} spec: @@ -34,6 +34,6 @@ spec: storageClassName: "{{ include "common.fullname" . }}-primary" persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} hostPath: - path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}/primary + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.persistence.mountSubPath }}/primary {{- end -}} {{- end -}} diff --git a/kubernetes/common/postgres/templates/pv-replica.yaml b/kubernetes/common/postgres/templates/pv-replica.yaml index b67cac0c26..d553c36680 100644 --- a/kubernetes/common/postgres/templates/pv-replica.yaml +++ b/kubernetes/common/postgres/templates/pv-replica.yaml @@ -23,7 +23,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" name: {{ include "common.fullname" . }} spec: @@ -34,6 +34,6 @@ spec: storageClassName: "{{ include "common.fullname" . }}-replica" persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} hostPath: - path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}/replica + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ include "common.release" . }}/{{ .Values.persistence.mountSubPath }}/replica {{- end -}} {{- end -}} diff --git a/kubernetes/common/postgres/templates/pvc-primary.yaml b/kubernetes/common/postgres/templates/pvc-primary.yaml index e529da1bd5..fa25f19077 100644 --- a/kubernetes/common/postgres/templates/pvc-primary.yaml +++ b/kubernetes/common/postgres/templates/pvc-primary.yaml @@ -23,7 +23,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" name: {{ include "common.fullname" . }} {{- if .Values.persistence.annotations }} diff --git a/kubernetes/common/postgres/templates/pvc-replica.yaml b/kubernetes/common/postgres/templates/pvc-replica.yaml index 41199b6861..1e453fbcfd 100644 --- a/kubernetes/common/postgres/templates/pvc-replica.yaml +++ b/kubernetes/common/postgres/templates/pvc-replica.yaml @@ -23,7 +23,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" + release: "{{ include "common.release" . }}" heritage: "{{ .Release.Service }}" name: {{ include "common.fullname" . }} {{- if .Values.persistence.annotations }} diff --git a/kubernetes/common/postgres/templates/secrets.yaml b/kubernetes/common/postgres/templates/secrets.yaml index 29de3af260..db1bc5bb15 100644 --- a/kubernetes/common/postgres/templates/secrets.yaml +++ b/kubernetes/common/postgres/templates/secrets.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.fullname" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} type: Opaque data: diff --git a/kubernetes/common/postgres/templates/service-common.yaml b/kubernetes/common/postgres/templates/service-common.yaml index da0505cfa6..6e74a06616 100644 --- a/kubernetes/common/postgres/templates/service-common.yaml +++ b/kubernetes/common/postgres/templates/service-common.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }} chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -38,4 +38,4 @@ spec: {{- end}} selector: app: {{ include "common.name" . }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/postgres/templates/service-primary.yaml b/kubernetes/common/postgres/templates/service-primary.yaml index 501c01ecfe..2965b7df81 100644 --- a/kubernetes/common/postgres/templates/service-primary.yaml +++ b/kubernetes/common/postgres/templates/service-primary.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }}-primary chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -38,4 +38,4 @@ spec: {{- end}} selector: name: "{{.Values.container.name.primary}}" - release: {{ .Release.Name }} + release: {{ include "common.release" . }} diff --git a/kubernetes/common/postgres/templates/service-replica.yaml b/kubernetes/common/postgres/templates/service-replica.yaml index 34f76d125e..d92a0833af 100644 --- a/kubernetes/common/postgres/templates/service-replica.yaml +++ b/kubernetes/common/postgres/templates/service-replica.yaml @@ -21,7 +21,7 @@ metadata: labels: app: {{ include "common.name" . }}-replica chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} - release: {{ .Release.Name }} + release: {{ include "common.release" . }} heritage: {{ .Release.Service }} annotations: spec: @@ -38,4 +38,4 @@ spec: {{- end}} selector: name: "{{.Values.container.name.replica}}" - release: {{ .Release.Name }} + release: {{ include "common.release" . }} |