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 .project
.idea/ .idea/
*.tmproj *.tmproj
# ConfigMap
# templates/configmap.yaml

View File

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

View File

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

View File

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

View File

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

View File

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