aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common
diff options
context:
space:
mode:
Diffstat (limited to 'kubernetes/common')
-rw-r--r--kubernetes/common/common/templates/_ingress.tpl38
-rw-r--r--kubernetes/common/common/templates/_labels.tpl17
-rw-r--r--kubernetes/common/common/templates/_mariadb.tpl7
-rw-r--r--kubernetes/common/readinessCheck/templates/_readinessCheck.tpl15
4 files changed, 37 insertions, 40 deletions
diff --git a/kubernetes/common/common/templates/_ingress.tpl b/kubernetes/common/common/templates/_ingress.tpl
index e57d4bedaa..18f9bb1ba5 100644
--- a/kubernetes/common/common/templates/_ingress.tpl
+++ b/kubernetes/common/common/templates/_ingress.tpl
@@ -1,42 +1,18 @@
-{{- define "ingress.config.host" -}}
-{{- $dot := default . .dot -}}
-{{- $baseaddr := (required "'baseaddr' param, set to the specific part of the fqdn, is required." .baseaddr) -}}
-{{- $burl := (required "'baseurl' param, set to the generic part of the fqdn, is required." $dot.Values.global.ingress.virtualhost.baseurl) -}}
-{{ printf "%s.%s" $baseaddr $burl }}
-{{- end -}}
-
{{- define "ingress.config.port" -}}
{{- $dot := default . .dot -}}
-{{- if .Values.ingress -}}
-{{- if .Values.global.ingress -}}
-{{- if or (not .Values.global.ingress.virtualhost) (not .Values.global.ingress.virtualhost.enabled) -}}
- - http:
- paths:
-{{- range .Values.ingress.service }}
-{{ $baseaddr := required "baseaddr" .baseaddr }}
- - path: {{ include "ingress.config.host" (dict "dot" $dot "baseaddr" $baseaddr) }}
- backend:
- serviceName: {{ .name }}
- servicePort: {{ .port }}
-{{- end -}}
-{{- else if .Values.ingress.service -}}
+{{- $burl := (required "'baseurl' param, set to the generic part of the fqdn, is required." $dot.Values.global.ingress.virtualhost.baseurl) -}}
{{ range .Values.ingress.service }}
-{{ $baseaddr := required "baseaddr" .baseaddr }}
- - host: {{ include "ingress.config.host" (dict "dot" $dot "baseaddr" $baseaddr) }}
+{{- $baseaddr := (required "'baseaddr' param, set to the specific part of the fqdn, is required." .baseaddr) }}
+ - host: {{ printf "%s.%s" $baseaddr $burl }}
http:
paths:
- backend:
serviceName: {{ .name }}
servicePort: {{ .port }}
-{{- end -}}
-{{- else -}}
- - path: {{ printf "/%s" .Chart.Name }}
- backend:
- serviceName: {{ .Chart.Name }}
- servicePort: {{ .Values.service.externalPort }}
-{{- end -}}
-{{- end -}}
-{{- end -}}
+ {{- if .path }}
+ path: {{ .path }}
+ {{- end }}
+{{- end }}
{{- end -}}
diff --git a/kubernetes/common/common/templates/_labels.tpl b/kubernetes/common/common/templates/_labels.tpl
index 66727629ef..da8f00f3e4 100644
--- a/kubernetes/common/common/templates/_labels.tpl
+++ b/kubernetes/common/common/templates/_labels.tpl
@@ -30,7 +30,7 @@ app.kubernetes.io/instance: {{ include "common.release" $dot }}
app.kubernetes.io/managed-by: {{ $dot.Release.Service }}
{{ if .labels }}
{{- include "common.tplValue" (dict "value" .labels "context" $dot) }}
-{{- end -}}
+{{- end }}
{{- end -}}
{{/*
@@ -41,14 +41,15 @@ The function takes several arguments (inside a dictionary):
*/}}
{{- define "common.matchLabels" -}}
{{- $dot := default . .dot -}}
-{{- if not .matchLabels.nameNoMatch -}}
+{{- $matchLabels := default (dict) .matchLabels -}}
+{{- if not $matchLabels.nameNoMatch -}}
app.kubernetes.io/name: {{ include "common.name" $dot }}
{{- end }}
app.kubernetes.io/instance: {{ include "common.release" $dot }}
-{{ if .matchLabels }}
-{{$_ := unset .matchLabels "nameNoMatch"}}
-{{- include "common.tplValue" (dict "value" .matchLabels "context" $dot) }}
-{{- end -}}
+{{- if $matchLabels }}
+{{$_ := unset $matchLabels "nameNoMatch"}}
+{{- include "common.tplValue" (dict "value" $matchLabels "context" $dot) }}
+{{- end }}
{{- end -}}
{{/*
@@ -69,7 +70,7 @@ namespace: {{ include "common.namespace" $dot }}
labels: {{- include "common.labels" (dict "labels" $labels "dot" $dot ) | nindent 2 }}
{{- if $annotations }}
annotations: {{- include "common.tplValue" (dict "value" $annotations "context" $dot) | nindent 2}}
-{{- end -}}
+{{- end }}
{{- end -}}
{{/*
@@ -94,7 +95,7 @@ matchLabels: {{- include "common.matchLabels" (dict "matchLabels" $matchLabels "
{{- $dot := default . .dot -}}
{{- $labels := default (dict) .labels -}}
{{- if $dot.Values.podAnnotations }}
-annotations: {{- include "common.tplValue" (dict "value" $dot.Values.podAnnotations "context" $) | nindent 2 }}
+annotations: {{- include "common.tplValue" (dict "value" $dot.Values.podAnnotations "context" $dot) | nindent 2 }}
{{- end }}
labels: {{- include "common.labels" (dict "labels" $labels "dot" $dot) | nindent 2 }}
name: {{ include "common.name" $dot }}
diff --git a/kubernetes/common/common/templates/_mariadb.tpl b/kubernetes/common/common/templates/_mariadb.tpl
index df0e6b41c9..1be3e3b790 100644
--- a/kubernetes/common/common/templates/_mariadb.tpl
+++ b/kubernetes/common/common/templates/_mariadb.tpl
@@ -45,6 +45,13 @@
{{- end -}}
{{/*
+ UID of mariadb backup credentials
+*/}}
+{{- define "common.mariadb.secret.backupCredentialsUID" -}}
+ {{- printf "db-backup-credentials" }}
+{{- end -}}
+
+{{/*
Name of mariadb user credentials secret
*/}}
{{- define "common.mariadb.secret.userCredentialsSecretName" -}}
diff --git a/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl b/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl
index 6a1a1eb82a..aa03938d28 100644
--- a/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl
+++ b/kubernetes/common/readinessCheck/templates/_readinessCheck.tpl
@@ -35,6 +35,14 @@
- aaf-cm
- aaf-service
+ the powerful one allows also to wait for jobs with this:
+ wait_for:
+ name: myname
+ jobs:
+ - '{{ include "common.release" . }}-the-job'
+
+ Be careful, as on the example above, the job name may have a "non fixed" name
+ and thus don't forget to use templates if needed
The function can takes below arguments (inside a dictionary):
- .dot : environment (.)
@@ -55,16 +63,21 @@
{{- $wait_for := default $initRoot.wait_for .wait_for -}}
{{- $containers := index (ternary (dict "containers" $wait_for) $wait_for (kindIs "slice" $wait_for)) "containers" -}}
{{- $namePart := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "name" -}}
+{{- $jobs := index (ternary (dict) $wait_for (kindIs "slice" $wait_for)) "jobs" -}}
- name: {{ include "common.name" $dot }}{{ ternary "" (printf "-%s" $namePart) (empty $namePart) }}-readiness
image: "{{ include "common.repository" $subchartDot }}/{{ $subchartDot.Values.global.readinessImage }}"
imagePullPolicy: {{ $subchartDot.Values.global.pullPolicy | default $subchartDot.Values.pullPolicy }}
command:
- /app/ready.py
args:
- {{- range $container := $containers }}
+ {{- range $container := default (list) $containers }}
- --container-name
- {{ tpl $container $dot }}
{{- end }}
+ {{- range $job := $jobs }}
+ - --job-name
+ - {{ tpl $job $dot }}
+ {{- end }}
env:
- name: NAMESPACE
valueFrom: