[bitnami/postgresql] Use common functions for tplValues (#3730)

* [bitnami/postgresql] Use common functions for tplValues

* Bump version
This commit is contained in:
Miguel Ángel Cabrera Miñagorri
2020-09-23 11:56:20 +02:00
committed by GitHub
parent 6da71b3660
commit af4ae62ab7
19 changed files with 27 additions and 40 deletions

View File

@@ -385,19 +385,6 @@ but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{/*
Renders a value that contains template.
Usage:
{{ include "postgresql.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }}
*/}}
{{- define "postgresql.tplValue" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
{{/* {{/*
Return the appropriate apiVersion for statefulset. Return the appropriate apiVersion for statefulset.
*/}} */}}

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
data: data:
{{- if (.Files.Glob "files/postgresql.conf") }} {{- if (.Files.Glob "files/postgresql.conf") }}

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
data: data:
{{- with .Files.Glob "files/conf.d/*.conf" }} {{- with .Files.Glob "files/conf.d/*.conf" }}

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
{{- with .Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz" }} {{- with .Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz" }}
binaryData: binaryData:

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
data: data:
custom-metrics.yaml: {{ toYaml .Values.metrics.customMetrics | quote }} custom-metrics.yaml: {{ toYaml .Values.metrics.customMetrics | quote }}

View File

@@ -7,7 +7,7 @@ metadata:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
annotations: annotations:
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
{{- toYaml .Values.metrics.service.annotations | nindent 4 }} {{- toYaml .Values.metrics.service.annotations | nindent 4 }}
spec: spec:

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
podSelector: podSelector:

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
privileged: false privileged: false

View File

@@ -12,7 +12,7 @@ metadata:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- with .Values.metrics.prometheusRule.rules }} {{- with .Values.metrics.prometheusRule.rules }}

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
rules: rules:
{{- if .Values.psp.create }} {{- if .Values.psp.create }}

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
roleRef: roleRef:
kind: Role kind: Role

View File

@@ -6,7 +6,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
type: Opaque type: Opaque
data: data:

View File

@@ -6,6 +6,6 @@ metadata:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
name: {{ template "postgresql.fullname" . }} name: {{ template "postgresql.fullname" . }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

@@ -12,7 +12,7 @@ metadata:
{{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }} {{- toYaml .Values.metrics.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }} {{- end }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
spec: spec:

View File

@@ -10,7 +10,7 @@ metadata:
{{- end }} {{- end }}
annotations: annotations:
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.slave.annotations }} {{- with .Values.slave.annotations }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
@@ -336,7 +336,7 @@ spec:
{{- toYaml .Values.slave.extraVolumeMounts | nindent 12 }} {{- toYaml .Values.slave.extraVolumeMounts | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.slave.sidecars }} {{- if .Values.slave.sidecars }}
{{- include "postgresql.tplValue" ( dict "value" .Values.slave.sidecars "context" $ ) | nindent 8 }} {{- include "common.tplvalues.render" ( dict "value" .Values.slave.sidecars "context" $ ) | nindent 8 }}
{{- end }} {{- end }}
volumes: volumes:
{{- if .Values.usePasswordFile }} {{- if .Values.usePasswordFile }}

View File

@@ -9,7 +9,7 @@ metadata:
{{- end }} {{- end }}
annotations: annotations:
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
{{- with .Values.master.annotations }} {{- with .Values.master.annotations }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
@@ -124,7 +124,7 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.master.extraInitContainers }} {{- if .Values.master.extraInitContainers }}
{{- include "postgresql.tplValue" ( dict "value" .Values.master.extraInitContainers "context" $ ) | nindent 8 }} {{- include "common.tplvalues.render" ( dict "value" .Values.master.extraInitContainers "context" $ ) | nindent 8 }}
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.master.priorityClassName }} {{- if .Values.master.priorityClassName }}
@@ -230,7 +230,7 @@ spec:
value: {{ (include "postgresql.database" .) | quote }} value: {{ (include "postgresql.database" .) | quote }}
{{- end }} {{- end }}
{{- if .Values.extraEnv }} {{- if .Values.extraEnv }}
{{- include "postgresql.tplValue" (dict "value" .Values.extraEnv "context" $) | nindent 12 }} {{- include "common.tplvalues.render" (dict "value" .Values.extraEnv "context" $) | nindent 12 }}
{{- end }} {{- end }}
- name: POSTGRESQL_ENABLE_LDAP - name: POSTGRESQL_ENABLE_LDAP
value: {{ ternary "yes" "no" .Values.ldap.enabled | quote }} value: {{ ternary "yes" "no" .Values.ldap.enabled | quote }}
@@ -423,7 +423,7 @@ spec:
{{- toYaml .Values.master.extraVolumeMounts | nindent 12 }} {{- toYaml .Values.master.extraVolumeMounts | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.master.sidecars }} {{- if .Values.master.sidecars }}
{{- include "postgresql.tplValue" ( dict "value" .Values.master.sidecars "context" $ ) | nindent 8 }} {{- include "common.tplvalues.render" ( dict "value" .Values.master.sidecars "context" $ ) | nindent 8 }}
{{- end }} {{- end }}
{{- if .Values.metrics.enabled }} {{- if .Values.metrics.enabled }}
- name: metrics - name: metrics
@@ -455,7 +455,7 @@ spec:
- name: DATA_SOURCE_USER - name: DATA_SOURCE_USER
value: {{ template "postgresql.username" . }} value: {{ template "postgresql.username" . }}
{{- if .Values.metrics.extraEnvVars }} {{- if .Values.metrics.extraEnvVars }}
{{- include "postgresql.tplValue" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }} {{- include "common.tplvalues.render" (dict "value" .Values.metrics.extraEnvVars "context" $) | nindent 12 }}
{{- end }} {{- end }}
{{- if .Values.livenessProbe.enabled }} {{- if .Values.livenessProbe.enabled }}
livenessProbe: livenessProbe:

View File

@@ -5,7 +5,7 @@ metadata:
labels: labels:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
annotations: {{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
type: ClusterIP type: ClusterIP

View File

@@ -13,10 +13,10 @@ metadata:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
annotations: annotations:
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
{{- if $serviceAnnotations }} {{- if $serviceAnnotations }}
{{- include "postgresql.tplValue" (dict "value" $serviceAnnotations "context" $) | nindent 4 }} {{- include "common.tplvalues.render" (dict "value" $serviceAnnotations "context" $) | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
type: {{ $serviceType }} type: {{ $serviceType }}
@@ -24,7 +24,7 @@ spec:
loadBalancerIP: {{ $serviceLoadBalancerIP }} loadBalancerIP: {{ $serviceLoadBalancerIP }}
{{- end }} {{- end }}
{{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }} {{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- include "postgresql.tplValue" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }} loadBalancerSourceRanges: {{- include "common.tplvalues.render" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }}
{{- end }} {{- end }}
{{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }} {{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }}
clusterIP: {{ $serviceClusterIP }} clusterIP: {{ $serviceClusterIP }}

View File

@@ -12,10 +12,10 @@ metadata:
{{- include "common.labels.standard" . | nindent 4 }} {{- include "common.labels.standard" . | nindent 4 }}
annotations: annotations:
{{- if .Values.commonAnnotations }} {{- if .Values.commonAnnotations }}
{{- include "postgresql.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }} {{- end }}
{{- if $serviceAnnotations }} {{- if $serviceAnnotations }}
{{- include "postgresql.tplValue" (dict "value" $serviceAnnotations "context" $) | nindent 4 }} {{- include "common.tplvalues.render" (dict "value" $serviceAnnotations "context" $) | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
type: {{ $serviceType }} type: {{ $serviceType }}
@@ -23,7 +23,7 @@ spec:
loadBalancerIP: {{ $serviceLoadBalancerIP }} loadBalancerIP: {{ $serviceLoadBalancerIP }}
{{- end }} {{- end }}
{{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }} {{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }}
loadBalancerSourceRanges: {{- include "postgresql.tplValue" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }} loadBalancerSourceRanges: {{- include "common.tplvalues.render" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }}
{{- end }} {{- end }}
{{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }} {{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }}
clusterIP: {{ $serviceClusterIP }} clusterIP: {{ $serviceClusterIP }}