37 lines
1.3 KiB
Smarty
37 lines
1.3 KiB
Smarty
{{/*
|
|
Per-instance fully-qualified name. Used as the prefix for every K8s
|
|
object in the chart so instances in the same namespace can't collide.
|
|
*/}}
|
|
{{- define "instance.fullname" -}}
|
|
{{- .Values.instance.code | trunc 40 | trimSuffix "-" -}}
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Standard labels applied to every K8s object. Keeps `kubectl get -l`
|
|
queries by-instance trivial.
|
|
*/}}
|
|
{{- define "instance.labels" -}}
|
|
app.kubernetes.io/name: odoo
|
|
app.kubernetes.io/instance: {{ .Values.instance.code | quote }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
app.kubernetes.io/version: {{ .Values.odoo.tag | quote }}
|
|
odoosky.io/component: instance
|
|
{{- end -}}
|
|
|
|
{{/*
|
|
Postgres password. Looks up the existing Secret on upgrades; uses
|
|
.Values.postgres.password if set; otherwise generates a 32-char
|
|
random string on first install. The lookup ensures `helm upgrade`
|
|
does NOT silently rotate the password.
|
|
*/}}
|
|
{{- define "instance.pgPassword" -}}
|
|
{{- $existing := lookup "v1" "Secret" .Release.Namespace (printf "%s-pg" .Values.instance.code) -}}
|
|
{{- if and $existing $existing.data $existing.data.POSTGRES_PASSWORD -}}
|
|
{{- index $existing.data "POSTGRES_PASSWORD" | b64dec -}}
|
|
{{- else if .Values.postgres.password -}}
|
|
{{- .Values.postgres.password -}}
|
|
{{- else -}}
|
|
{{- randAlphaNum 32 -}}
|
|
{{- end -}}
|
|
{{- end -}}
|