zalando / postgres-operator

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

Postgres-operator doesn't let to create sidecars anymore #1206

Closed yanchenko-igor closed 3 years ago

yanchenko-igor commented 3 years ago

Please, answer some short questions which should help us to understand your problem / question better?

After upgrading to the latest image, I noticed that sidecars definition looks like this:

  sidecars:
  - env:
    - {}
    - {}
    - {}
    image: wrouesnel/postgres_exporter
    name: postgres-prometheus-exporter
    ports:
    - {}
    resources: {}

Even when I edit and insert proper values they get lost, I compared the crd definition with an older version and I see that preserveUnknownFields: true disappeared.

FxKu commented 3 years ago

We haven't set preserveUnknownFields: true when we were on betav1 as it was probably the default. Seems that with v1 we need to specify it. Although docs are not super clear to me where to put it. Can you provide a PR?

FxKu commented 3 years ago

@yanchenko-igor can you check if this fix #1212 solves your issues?

yanchenko-igor commented 3 years ago

@FxKu unfortunately no, it didn't fix the issue.

FxKu commented 3 years ago

@yanchenko-igor ok then maybe we have to add the x-kubernetes-preserve-unknown-fields: true flag wherever we allow additionalProperties (or maybe it's even a replacement). You want to test it with sidecars section? And if this then works I create another PR.

FxKu commented 3 years ago

second attempt: #1228 @yanchenko-igor

FxKu commented 3 years ago

I found a lot of issues in the CRD manifests which I have now fixed. I am now using x-kubernetes-preserve-unknown-fields: true wherever we have allowed K8s specs for our CRDs. Tested it with the sidecar in our complete manifest and it works now. Fields are preserved. Thanks again for raising this @yanchenko-igor !