From 16329f68e61d4a0d92fe080b7a20dc5ff027ba0f Mon Sep 17 00:00:00 2001 From: gitkvark Date: Thu, 21 Dec 2023 10:53:31 +0100 Subject: [PATCH] Using HELM chart for operator config --- helm/postgres-operator-config/Chart.yaml | 2 +- .../templates/pod-config.yaml | 2 +- .../postgres-operator-values.yaml | 28 +++++++++++++++++++ .../deployments/releases/postgres_operator.tf | 11 ++------ 4 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 terraform/deployments/releases/postgres-operator/postgres-operator-values.yaml diff --git a/helm/postgres-operator-config/Chart.yaml b/helm/postgres-operator-config/Chart.yaml index e88346f..4372dd3 100644 --- a/helm/postgres-operator-config/Chart.yaml +++ b/helm/postgres-operator-config/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.15 +version: 0.1.16 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/helm/postgres-operator-config/templates/pod-config.yaml b/helm/postgres-operator-config/templates/pod-config.yaml index 90dff8e..21be7d3 100644 --- a/helm/postgres-operator-config/templates/pod-config.yaml +++ b/helm/postgres-operator-config/templates/pod-config.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: pod-config + name: postgres-operator-pod-config data: # Backup definition WAL_S3_BUCKET: devops-boot-s3backup diff --git a/terraform/deployments/releases/postgres-operator/postgres-operator-values.yaml b/terraform/deployments/releases/postgres-operator/postgres-operator-values.yaml new file mode 100644 index 0000000..51e55b3 --- /dev/null +++ b/terraform/deployments/releases/postgres-operator/postgres-operator-values.yaml @@ -0,0 +1,28 @@ +configKubernetes: + pod_environment_configmap: "pod-config" +configAwsOrGcp: + aws_region: "us-east-1" +configGeneral: + sidecars: + - name: "exporter" + image: "quay.io/prometheuscommunity/postgres-exporter:latest" + ports: + - name: exporter + containerPort: 9187 + protocol: TCP + resources: + limits: + cpu: 500m + memory: 256M + requests: + cpu: 100m + memory: 200M + env: + - name: "DATA_SOURCE_URI" + value: "$(POD_NAME)/postgres?sslmode=require" + - name: "DATA_SOURCE_USER" + value: "$(POSTGRES_USER)" + - name: "DATA_SOURCE_PASS" + value: "$(POSTGRES_PASSWORD)" + - name: "PG_EXPORTER_AUTO_DISCOVER_DATABASES" + value: "true" diff --git a/terraform/deployments/releases/postgres_operator.tf b/terraform/deployments/releases/postgres_operator.tf index 005bcf5..534174c 100644 --- a/terraform/deployments/releases/postgres_operator.tf +++ b/terraform/deployments/releases/postgres_operator.tf @@ -4,14 +4,9 @@ resource "helm_release" "postgres_operator" { chart = "postgres-operator" version = "v1.10.1" depends_on = [helm_release.postgres_operator_config] - set { - name = "configKubernetes.pod_environment_configmap" - value = "pod-config" - } - set { - name = "configAwsOrGcp.aws_region" - value = "us-east-1" - } + values = [ + file("${path.module}/postgres-operator/postgres-operator-values.yaml") + ] } resource "helm_release" "postgres_operator_config" {