Skip to content

Commit 7c19cf5

Browse files
authored
align config map, operator config, helm chart values and templates (zalando#595)
* align config map, operator config, helm chart values and templates * follow helm chart conventions also in CRD templates * split up values files and add comments * avoid yaml confusion in postgres manifests * bump spilo version and use example for logical_backup_s3_bucket * add ConfigTarget switch to values
1 parent 3a914f9 commit 7c19cf5

16 files changed

+653
-291
lines changed
Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.configTarget "ConfigMap" }}
12
apiVersion: v1
23
kind: ConfigMap
34
metadata:
@@ -13,21 +14,14 @@ data:
1314
{{- else }}
1415
{{ .Values.serviceAccount.name }}
1516
{{- end }}
16-
api_port: "{{ .Values.configLoggingRestApi.api_port }}"
17-
cluster_history_entries: "{{ .Values.configLoggingRestApi.cluster_history_entries }}"
18-
docker_image: {{ .Values.docker_image }}
19-
debug_logging: "{{ .Values.configDebug.debug_logging }}"
20-
enable_database_access: "{{ .Values.configDebug.enable_database_access }}"
21-
enable_shm_volume: "{{ .Values.enable_shm_volume }}"
22-
repair_period: {{ .Values.repair_period }}
23-
resync_period: {{ .Values.resync_period }}
24-
ring_log_lines: "{{ .Values.configLoggingRestApi.ring_log_lines }}"
25-
spilo_privileged: "{{ .Values.spilo_privileged }}"
26-
workers: "{{ .Values.workers }}"
27-
{{ toYaml .Values.configMap | indent 2 }}
17+
{{ toYaml .Values.configGeneral | indent 2 }}
2818
{{ toYaml .Values.configUsers | indent 2 }}
2919
{{ toYaml .Values.configKubernetes | indent 2 }}
3020
{{ toYaml .Values.configTimeouts | indent 2 }}
3121
{{ toYaml .Values.configLoadBalancer | indent 2 }}
3222
{{ toYaml .Values.configAwsOrGcp | indent 2 }}
23+
{{ toYaml .Values.configLogicalBackup | indent 2 }}
24+
{{ toYaml .Values.configDebug | indent 2 }}
25+
{{ toYaml .Values.configLoggingRestApi | indent 2 }}
3326
{{ toYaml .Values.configTeamsApi | indent 2 }}
27+
{{- end }}

charts/postgres-operator/templates/customrresourcedefinition.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ apiVersion: apiextensions.k8s.io/v1beta1
22
kind: CustomResourceDefinition
33
metadata:
44
name: postgresqls.acid.zalan.do
5+
labels:
6+
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
7+
helm.sh/chart: {{ template "postgres-operator.chart" . }}
8+
app.kubernetes.io/managed-by: {{ .Release.Service }}
9+
app.kubernetes.io/instance: {{ .Release.Name }}
510
annotations:
611
"helm.sh/hook": crd-install
712
spec:
@@ -22,6 +27,11 @@ apiVersion: apiextensions.k8s.io/v1beta1
2227
kind: CustomResourceDefinition
2328
metadata:
2429
name: operatorconfigurations.acid.zalan.do
30+
labels:
31+
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
32+
helm.sh/chart: {{ template "postgres-operator.chart" . }}
33+
app.kubernetes.io/managed-by: {{ .Release.Service }}
34+
app.kubernetes.io/instance: {{ .Release.Name }}
2535
annotations:
2636
"helm.sh/hook": crd-install
2737
spec:

charts/postgres-operator/templates/deployment.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: apps/v1beta2
1+
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
labels:
@@ -16,9 +16,11 @@ spec:
1616
template:
1717
metadata:
1818
annotations:
19+
{{- if eq .Values.configTarget "ConfigMap" }}
1920
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
20-
# In order to use the checksum of CRD OperatorConfiguration instead, use the following line instead
21-
# {{ include (print $.Template.BasePath "/operatorconfiguration.yaml") . | sha256sum }}
21+
{{- else }}
22+
checksum/config: {{ include (print $.Template.BasePath "/operatorconfiguration.yaml") . | sha256sum }}
23+
{{- end }}
2224
{{- if .Values.podAnnotations }}
2325
{{ toYaml .Values.podAnnotations | indent 8 }}
2426
{{- end }}
@@ -39,11 +41,13 @@ spec:
3941
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
4042
imagePullPolicy: {{ .Values.image.pullPolicy }}
4143
env:
44+
{{- if eq .Values.configTarget "ConfigMap" }}
4245
- name: CONFIG_MAP_NAME
4346
value: {{ template "postgres-operator.fullname" . }}
44-
# In order to use the CRD OperatorConfiguration instead, uncomment these lines and comment out the two lines above
45-
# - name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT
46-
# value: {{ template "postgres-operator.fullname" . }}
47+
{{- else }}
48+
- name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT
49+
value: {{ template "postgres-operator.fullname" . }}
50+
{{- end }}
4751
resources:
4852
{{ toYaml .Values.resources | indent 10 }}
4953
{{- if .Values.imagePullSecrets }}
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if eq .Values.configTarget "OperatorConfigurationCRD" }}
12
apiVersion: "acid.zalan.do/v1"
23
kind: OperatorConfiguration
34
metadata:
@@ -8,35 +9,29 @@ metadata:
89
app.kubernetes.io/managed-by: {{ .Release.Service }}
910
app.kubernetes.io/instance: {{ .Release.Name }}
1011
configuration:
11-
docker_image: {{ .Values.docker_image }}
12-
enable_shm_volume: {{ .Values.enable_shm_volume }}
13-
repair_period: {{ .Values.repair_period }}
14-
resync_period: {{ .Values.resync_period }}
15-
workers: {{ .Values.workers }}
16-
{{ toYaml .Values.configCRD | indent 2 }}
12+
{{ toYaml .Values.configGeneral | indent 2 }}
1713
users:
1814
{{ toYaml .Values.configUsers | indent 4 }}
1915
kubernetes:
2016
oauth_token_secret_name: {{ template "postgres-operator.fullname" . }}
2117
pod_service_account_name: operator
22-
spilo_privileged: {{ .Values.spilo_privileged }}
2318
{{ toYaml .Values.configKubernetes | indent 4 }}
24-
{{ toYaml .Values.configKubernetesCRD | indent 4 }}
2519
postgres_pod_resources:
2620
{{ toYaml .Values.configPostgresPodResources | indent 4 }}
2721
timeouts:
2822
{{ toYaml .Values.configTimeouts | indent 4 }}
2923
load_balancer:
30-
{{ toYaml .Values.configLoadBalancerCRD | indent 4 }}
24+
{{ toYaml .Values.configLoadBalancer | indent 4 }}
3125
aws_or_gcp:
3226
{{ toYaml .Values.configAwsOrGcp | indent 4 }}
3327
logical_backup:
3428
{{ toYaml .Values.configLogicalBackup | indent 4 }}
3529
debug:
3630
{{ toYaml .Values.configDebug | indent 4 }}
3731
teams_api:
38-
{{ toYaml .Values.configTeamsApiCRD | indent 4 }}
32+
{{ toYaml .Values.configTeamsApi | indent 4 }}
3933
logging_rest_api:
4034
{{ toYaml .Values.configLoggingRestApi | indent 4 }}
4135
scalyr:
4236
{{ toYaml .Values.configScalyr | indent 4 }}
37+
{{- end }}

0 commit comments

Comments
 (0)