From c7607c85814c63022e9279acd8c5b9eac0e615b9 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Mon, 15 Apr 2019 15:22:22 +0200 Subject: [PATCH] add helm template for CRD config --- .../templates/configmap.yaml | 9 +++ .../templates/deployment.yaml | 6 ++ .../templates/operator-configuration.yaml | 32 ++++++++ charts/postgres-operator/values.yaml | 77 +++++++++++-------- 4 files changed, 93 insertions(+), 31 deletions(-) create mode 100644 charts/postgres-operator/templates/operator-configuration.yaml diff --git a/charts/postgres-operator/templates/configmap.yaml b/charts/postgres-operator/templates/configmap.yaml index db8f0bda8..0e5ccf5c2 100644 --- a/charts/postgres-operator/templates/configmap.yaml +++ b/charts/postgres-operator/templates/configmap.yaml @@ -10,3 +10,12 @@ metadata: data: pod_service_account_name: {{ template "postgres-operator.fullname" . }} {{ toYaml .Values.config | indent 2 }} +{{ toYaml .Values.configUsers | indent 2 }} +{{ toYaml .Values.configKubernetes | indent 2 }} +{{ toYaml .Values.configPostgresPodResources | indent 2 }} +{{ toYaml .Values.configTimeouts | indent 2 }} +{{ toYaml .Values.configLoadBalancer | indent 2 }} +{{ toYaml .Values.configAwsOrGcp | indent 2 }} +{{ toYaml .Values.configDebug | indent 2 }} +{{ toYaml .Values.configTeamsApi | indent 2 }} +{{ toYaml .Values.configLoggingRestApi | indent 2 }} diff --git a/charts/postgres-operator/templates/deployment.yaml b/charts/postgres-operator/templates/deployment.yaml index 613e42f33..18068724c 100644 --- a/charts/postgres-operator/templates/deployment.yaml +++ b/charts/postgres-operator/templates/deployment.yaml @@ -33,6 +33,12 @@ spec: image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} env: + - 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" . }} + env: - name: CONFIG_MAP_NAME value: {{ template "postgres-operator.fullname" . }} resources: diff --git a/charts/postgres-operator/templates/operator-configuration.yaml b/charts/postgres-operator/templates/operator-configuration.yaml new file mode 100644 index 000000000..4bc8ac3b0 --- /dev/null +++ b/charts/postgres-operator/templates/operator-configuration.yaml @@ -0,0 +1,32 @@ +apiVersion: "acid.zalan.do/v1" +kind: OperatorConfiguration +metadata: + name: {{ template "postgres-operator.fullname" . }} + labels: + app.kubernetes.io/name: {{ template "postgres-operator.name" . }} + helm.sh/chart: {{ template "postgres-operator.chart" . }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + app.kubernetes.io/instance: {{ .Release.Name }} +configuration: + pod_service_account_name: operator +{{ toYaml .Values.config | indent 2 }} + users: +{{ toYaml .Values.configUsers | indent 4 }} + kubernetes: +{{ toYaml .Values.configKubernetes | indent 4 }} + postgres_pod_resources: +{{ toYaml .Values.configPostgresPodResources | indent 4 }} + timeouts: +{{ toYaml .Values.configTimeouts | indent 4 }} + load_balancer: +{{ toYaml .Values.configLoadBalancer | indent 4 }} + aws_or_gcp: +{{ toYaml .Values.configAwsOrGcp | indent 4 }} + debug: +{{ toYaml .Values.configDebug | indent 4 }} + teams_api: +{{ toYaml .Values.configTeamsApi | indent 4 }} + logging_rest_api: +{{ toYaml .Values.configLoggingRestApi | indent 4 }} + scalyr: +{{ toYaml .Values.configScalyr | indent 4 }} diff --git a/charts/postgres-operator/values.yaml b/charts/postgres-operator/values.yaml index 1f3397bad..10ca00686 100644 --- a/charts/postgres-operator/values.yaml +++ b/charts/postgres-operator/values.yaml @@ -1,4 +1,4 @@ -image: +postgreimage: registry: registry.opensource.zalan.do repository: acid/postgres-operator tag: v1.1.0 @@ -14,50 +14,65 @@ podAnnotations: {} podLabels: {} config: - watched_namespace: "*" # listen to all namespaces cluster_labels: application:spilo cluster_name_label: version - pod_role_label: spilo-role - - debug_logging: "true" + docker_image: registry.opensource.zalan.do/acid/spilo-cdp-11:1.5-p70 + resync_period: 5m workers: "4" - docker_image: registry.opensource.zalan.do/acid/spilo-cdp-10:1.5-p35 - secret_name_template: '{username}.{cluster}.credentials' + +configUsers: + replication_username: standby super_username: postgres - enable_teams_api: "false" - spilo_privileged: "false" - # set_memory_request_to_limit: "true" - # postgres_superuser_teams: "postgres_superusers" - # enable_team_superuser: "false" - # team_admin_role: "admin" - # teams_api_url: http://fake-teams-api.default.svc.cluster.local - # team_api_role_configuration: "log_statement:all" + +configKubernetes: + cluster_labels: application:spilo # infrastructure_roles_secret_name: postgresql-infrastructure-roles # oauth_token_secret_name: postgresql-operator - # pam_role_name: zalandos - # pam_configuration: | - # https://info.example.com/oauth2/tokeninfo?access_token= uid realm=/employees - aws_region: eu-central-1 - db_hosted_zone: db.example.com - master_dns_name_format: '{cluster}.{team}.staging.{hostedzone}' - replica_dns_name_format: '{cluster}-repl.{team}.staging.{hostedzone}' - enable_master_load_balancer: "true" - enable_replica_load_balancer: "false" - pdb_name_format: "postgres-{cluster}-pdb" - - api_port: "8080" - ring_log_lines: "100" - cluster_history_entries: "1000" + pod_role_label: spilo-role pod_terminate_grace_period: 5m + secret_name_template: '{username}.{cluster}.credentials' + spilo_privileged: "false" + watched_namespace: "*" # listen to all namespaces + +configPostgresPodResources: + # set_memory_request_to_limit: "true" + +configTimeouts: pod_deletion_wait_timeout: 10m pod_label_wait_timeout: 10m ready_wait_interval: 3s ready_wait_timeout: 30s - replication_username: standby resource_check_interval: 3s resource_check_timeout: 10m - resync_period: 5m + +configLoadBalancer: + enable_master_load_balancer: "false" + enable_replica_load_balancer: "false" + master_dns_name_format: '{cluster}.{team}.staging.{hostedzone}' + replica_dns_name_format: '{cluster}-repl.{team}.staging.{hostedzone}' + +configAwsOrGcp: + aws_region: eu-central-1 + db_hosted_zone: db.example.com + +configDebug: + debug_logging: "true" + +configTeamsApi: + enable_teams_api: "false" + # enable_team_superuser: "false" + # pam_configuration: https://info.example.com/oauth2/tokeninfo?access_token= uid realm=/employees + # pam_role_name: zalandos + # postgres_superuser_teams: "postgres_superusers" + # team_admin_role: "admin" + # team_api_role_configuration: "log_statement:all" + # teams_api_url: http://fake-teams-api.default.svc.cluster.local + +configLoggingRestApi: + api_port: "8080" + cluster_history_entries: "1000" + ring_log_lines: "100" rbac: # Specifies whether RBAC resources should be created