fix
This commit is contained in:
@@ -32,7 +32,46 @@ resource "kubectl_manifest" "prj_postgresql" {
|
||||
size: "${var.postgres.storage}"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pre_migrate_pg" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: "${var.instance}-remove-zalando-extensions"
|
||||
namespace: "${var.namespace}"
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
restartPolicy: OnFailure
|
||||
containers:
|
||||
- name: clean
|
||||
image: docker.io/postgres:15.3-bookworm
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: username
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
key: password
|
||||
name: postgres.${var.instance}-${var.component}.credentials.postgresql.acid.zalan.do
|
||||
- name: DBURL
|
||||
value: "${var.instance}-${var.component}"
|
||||
- name: DBNAME
|
||||
value: "${var.component}"
|
||||
command:
|
||||
- /bin/bash
|
||||
- "-c"
|
||||
- "echo -ne 'drop view if exists metric_helpers.pg_stat_statements;\ndrop function if exists metric_helpers.pg_stat_statements;\nDROP EXTENSION IF EXISTS pg_stat_statements;\nDROP EXTENSION IF EXISTS pg_stat_kcache;\nDROP EXTENSION IF EXISTS set_user;\n'| PGPASSWORD=\"$PASSWORD\" psql -U $USERNAME -d $DBNAME -h $DBURL"
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "prj_pg" {
|
||||
depends_on = [kubectl_manifest.prj_pre_migrate_pg]
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
|
||||
Reference in New Issue
Block a user