diff --git a/deployments/stacks/dpe-k8s-deployments/main.tf b/deployments/stacks/dpe-k8s-deployments/main.tf index 68e52ce0..9a80d775 100644 --- a/deployments/stacks/dpe-k8s-deployments/main.tf +++ b/deployments/stacks/dpe-k8s-deployments/main.tf @@ -64,7 +64,7 @@ module "postgres-cloud-native-operator" { module "postgres-cloud-native-database" { depends_on = [module.postgres-cloud-native-operator, module.airflow, module.argo-cd] source = "spacelift.io/sagebionetworks/postgres-cloud-native-database/aws" - version = "0.3.1" + version = "0.4.0" auto_deploy = true auto_prune = true git_revision = var.git_revision diff --git a/modules/main.tf b/modules/main.tf index b1df63ad..ec7ba9c6 100644 --- a/modules/main.tf +++ b/modules/main.tf @@ -151,7 +151,7 @@ locals { description = "Helm chart deployment for a postgres database instance using the postgres-cloud-native-operator." project_root = "modules/postgres-cloud-native" space_id = "root" - version_number = "0.3.1" + version_number = "0.4.0" } postgres-cloud-native-operator = { diff --git a/modules/postgres-cloud-native/main.tf b/modules/postgres-cloud-native/main.tf index 98d00bd2..adf0e24b 100644 --- a/modules/postgres-cloud-native/main.tf +++ b/modules/postgres-cloud-native/main.tf @@ -28,6 +28,23 @@ spec: - repoURL: 'https://github.com/Sage-Bionetworks-Workflows/eks-stack.git' targetRevision: ${var.git_revision} ref: values + - repoURL: 'https://github.com/Sage-Bionetworks-Workflows/eks-stack.git' + targetRevision: ${var.git_revision} + path: modules/postgres-cloud-native/resources + kustomize: + patches: + - target: + kind: Pooler + patch: |- + - op: replace + path: /spec/cluster/name + value: ${var.argo_deployment_name}-cluster + - op: replace + path: /spec/instances + value: 2 + - op: replace + path: /metadata/name + value: ${var.argo_deployment_name}-pooler-rw destination: server: 'https://kubernetes.default.svc' namespace: ${var.namespace} @@ -54,14 +71,14 @@ resource "kubernetes_secret" "connection-secret" { data = { "dbname" = "application-database" - "host" = "${var.argo_deployment_name}-cluster-rw.${var.namespace}" - "jdbc-uri" = "jdbc:postgresql://${var.argo_deployment_name}-cluster-rw.${var.namespace}:5432/application-database?password=${random_password.pg-password.result}&user=application-database" + "host" = "${var.argo_deployment_name}-pooler-rw.${var.namespace}" + "jdbc-uri" = "jdbc:postgresql://${var.argo_deployment_name}-pooler-rw.${var.namespace}:5432/application-database?password=${random_password.pg-password.result}&user=application-database" "password" = random_password.pg-password.result - "pgpass" = "${var.argo_deployment_name}-cluster-rw:5432:application-database:application-database:${random_password.pg-password.result}" + "pgpass" = "${var.argo_deployment_name}-pooler-rw:5432:application-database:application-database:${random_password.pg-password.result}" "port" = "5432" - "uri" = "postgresql://application-database:${random_password.pg-password.result}@${var.argo_deployment_name}-cluster-rw.${var.namespace}:5432/application-database" + "uri" = "postgresql://application-database:${random_password.pg-password.result}@${var.argo_deployment_name}-pooler-rw.${var.namespace}:5432/application-database" "user" = "application-database" "username" = "application-database" - "connection" = "postgresql://application-database:${random_password.pg-password.result}@${var.argo_deployment_name}-cluster-rw.${var.namespace}:5432/application-database" + "connection" = "postgresql://application-database:${random_password.pg-password.result}@${var.argo_deployment_name}-pooler-rw.${var.namespace}:5432/application-database" } } diff --git a/modules/postgres-cloud-native/resources/kustomization.yaml b/modules/postgres-cloud-native/resources/kustomization.yaml new file mode 100644 index 00000000..49294444 --- /dev/null +++ b/modules/postgres-cloud-native/resources/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- pooler.yaml diff --git a/modules/postgres-cloud-native/resources/pooler.yaml b/modules/postgres-cloud-native/resources/pooler.yaml new file mode 100644 index 00000000..3f2d8e1f --- /dev/null +++ b/modules/postgres-cloud-native/resources/pooler.yaml @@ -0,0 +1,15 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Pooler +metadata: + name: replaced-by-kustomize +spec: + cluster: + name: replaced-by-kustomize-2 + + instances: 2 + type: rw + pgbouncer: + poolMode: session + parameters: + max_client_conn: "1000" + default_pool_size: "20" \ No newline at end of file