zalando / postgres-operator

Postgres operator creates and manages PostgreSQL clusters running in Kubernetes
https://postgres-operator.readthedocs.io/
MIT License
4.15k stars 950 forks source link

CRDS managed with Terraform always want a recreate #2021

Open rhrytskiv opened 1 year ago

rhrytskiv commented 1 year ago

Which image of the operator are you using? e.g. registry.opensource.zalan.do/acid/postgres-operator:v1.8.2 Where do you run it - cloud or metal? Kubernetes or OpenShift? [Bare Metal K8s] Are you running Postgres Operator in production? [not yet] Type of issue? [feature requrest]

When managing your CRDS with Terraform via kubernetes_manifest resource, any change to postgresql resource after it has been created results in recreate action, which involves deletion and creation, which is obviously unnecessary and bad. Could you please fix this? I'm using many other CRDS (istio, cert-manager, rmq, redis) and all of them don't have this issue.

FxKu commented 1 year ago

I cannot follow. What is recreated? The replacement of the statefulset and pods triggered by the operator? Or you have to recreate manually. What's the sequence of events you do with terraform? I have no experience with that tool.

rhrytskiv commented 1 year ago

Ok so when I add a kubernetes_manifest for postgresql resource (which is required because it's a crd) it says 1 to add 0 to edit 0 to destroy. Then when I edit manifest, and let's say add sidecar to definition, or just env variable, or something else it says 1 to add 0 to edit 1 to destroy, which is bad, because what it does is basically kubectl delete postgresql ... , which leads to pvcs being deleted, along with secrets and services, and then adding new postgresql cluster with updated definition.