add ConfigTarget switch to values

This commit is contained in:
Felix Kunde 2019-07-04 12:47:27 +02:00
parent 3d241aee23
commit d7b8f16fa4
6 changed files with 21 additions and 11 deletions

View File

@ -19,5 +19,3 @@
.project
.idea/
*.tmproj
# ConfigMap
# templates/configmap.yaml

View File

@ -1,3 +1,4 @@
{{- if eq .Values.configTarget "ConfigMap" }}
apiVersion: v1
kind: ConfigMap
metadata:
@ -23,3 +24,4 @@ data:
{{ toYaml .Values.configDebug | indent 2 }}
{{ toYaml .Values.configLoggingRestApi | indent 2 }}
{{ toYaml .Values.configTeamsApi | indent 2 }}
{{- end }}

View File

@ -1,4 +1,4 @@
apiVersion: apps/v1beta2
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
@ -16,9 +16,11 @@ spec:
template:
metadata:
annotations:
{{- if eq .Values.configTarget "ConfigMap" }}
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
# In order to use the checksum of CRD OperatorConfiguration instead, use the following line instead
# {{ include (print $.Template.BasePath "/operatorconfiguration.yaml") . | sha256sum }}
{{- else }}
checksum/config: {{ include (print $.Template.BasePath "/operatorconfiguration.yaml") . | sha256sum }}
{{- end }}
{{- if .Values.podAnnotations }}
{{ toYaml .Values.podAnnotations | indent 8 }}
{{- end }}
@ -39,11 +41,13 @@ spec:
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
{{- if eq .Values.configTarget "ConfigMap" }}
- name: CONFIG_MAP_NAME
value: {{ template "postgres-operator.fullname" . }}
# In order to use the CRD OperatorConfiguration instead, uncomment these lines and comment out the two lines above
# - name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT
# value: {{ template "postgres-operator.fullname" . }}
{{- else }}
- name: POSTGRES_OPERATOR_CONFIGURATION_OBJECT
value: {{ template "postgres-operator.fullname" . }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 10 }}
{{- if .Values.imagePullSecrets }}

View File

@ -1,3 +1,4 @@
{{- if eq .Values.configTarget "OperatorConfigurationCRD" }}
apiVersion: "acid.zalan.do/v1"
kind: OperatorConfiguration
metadata:
@ -33,3 +34,4 @@ configuration:
{{ toYaml .Values.configLoggingRestApi | indent 4 }}
scalyr:
{{ toYaml .Values.configScalyr | indent 4 }}
{{- end }}

View File

@ -13,6 +13,8 @@ image:
podAnnotations: {}
podLabels: {}
configTarget: "OperatorConfigurationCRD"
# general top-level configuration parameters
configGeneral:
# etcd connection string for Patroni. Empty uses K8s-native DCS.
@ -27,10 +29,10 @@ configGeneral:
repair_period: 5m
# period between consecutive sync requests
resync_period: 30m
# map of sidecar names to docker images
# can prevent certain cases of memory overcommitment
# set_memory_request_to_limit: false
# map of sidecar names to docker images
# sidecar_docker_images
# example: "exampleimage:exampletag"
@ -140,7 +142,7 @@ configLoadBalancer:
# defines the DNS name string template for the replica load balancer cluster
replica_dns_name_format: "{cluster}-repl.{team}.{hostedzone}"
# Options to aid debugging of the operator itself
# options to aid debugging of the operator itself
configDebug:
# toggles verbose debug logs from the operator
debug_logging: true

View File

@ -13,7 +13,9 @@ image:
podAnnotations: {}
podLabels: {}
# config shared from ConfigMap and CRD
configTarget: "ConfigMap"
# general configuration parameters
configGeneral:
# etcd connection string for Patroni. Empty uses K8s-native DCS.
etcd_host: ""