Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem applying CRD postgres-operator.crunchydata.com_postgresclusters #3989

Open
EricGregMiller opened this issue Sep 11, 2024 · 3 comments

Comments

@EricGregMiller
Copy link

Overview

I get an error when I try to manually add the postgres-operator.crunchydata.com_postgresclusters CRD. The error is "The CustomResourceDefinition "postgresclusters.postgres-operator.crunchydata.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes"

Environment

  • Platform: Kubernetes using AWS EKS.
  • Platform Version: 1.3.0
  • PGO Image Tag: postgres-operator:ubi8-5.6.0-0 (Helm chart version 5.6.1)
  • Postgres Version 16
  • Storage: gp2

Steps to Reproduce

REPO

This is what it looks like. The following uses kubectl apply in an attempt to create the problem CRD.

kubectl apply -f postgres-crds/templates/postgres-operator.crunchydata.com_postgresclusters.yaml`
The CustomResourceDefinition "postgresclusters.postgres-operator.crunchydata.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes

The same error occurs if I try to load from a folder. Three of the CRDs are OK but postgres-operator.crunchydata.com_postgresclusters fails with the same error. The templates folder contains the four PGO CRD definitions.

kubectl apply -f templates
customresourcedefinition.apiextensions.k8s.io/crunchybridgeclusters.postgres-operator.crunchydata.com created
customresourcedefinition.apiextensions.k8s.io/pgadmins.postgres-operator.crunchydata.com created
customresourcedefinition.apiextensions.k8s.io/pgupgrades.postgres-operator.crunchydata.com created
The CustomResourceDefinition "postgresclusters.postgres-operator.crunchydata.com" is invalid: metadata.annotations: Too long: must have at most 262144 bytes

If I install with a helm chart all four CRDs install OK. For the following I have a simple helm chart in the postgres-crds folder with the four CRDs in the chart's templates folder.

$ helm install postgres-crds ./postgres-crds/
NAME: postgres-crds
LAST DEPLOYED: Tue Sep 10 23:32:17 2024
NAMESPACE: pg
STATUS: deployed
REVISION: 1
TEST SUITE: None
$ kubectl get crds | grep crunchy
crunchybridgeclusters.postgres-operator.crunchydata.com   2024-09-10T23:32:20Z
pgadmins.postgres-operator.crunchydata.com                2024-09-10T23:32:20Z
pgupgrades.postgres-operator.crunchydata.com              2024-09-10T23:32:20Z
postgresclusters.postgres-operator.crunchydata.com        2024-09-10T23:32:20Z

EXPECTED

No error for any postgres-operator.crunchydata.com_postgresclusters CRD creation scenario.

ACTUAL

Error when I use kubectl apply with either the individual manifest file or with a folder containing the manifest file.

I also get errors when I try to run using an in-house tool built upon ArgoCD. That's more complex and I don't expect you to deal with it. But it is why this bug is making my life difficult.

Logs

I am not sure what logs would help with this but just let me know what you'd like and I'll do my best to provide.

@andrewlecuyer
Copy link
Collaborator

Hi @EricGregMiller!

This is due to a limitation with kubectl apply, that can fortunately be addressed by using Server-Side Apply. More specifically, simply use the --server-side flag with kubectl apply:

$ kubectl apply --server-side -f postgres-operator.crunchydata.com_postgresclusters.yaml
customresourcedefinition.apiextensions.k8s.io/postgresclusters.postgres-operator.crunchydata.com serverside-applied

And you should then be able to successfully install the various CRD's.

@EricGregMiller
Copy link
Author

Thanks for your feedback. it really helps since now I at least know what is happening. I got pulled away but should be able to try this soon. For our setup we probably need ArgoCD to support server-side apply and it looks like they are working on it.

@tgruenert
Copy link

stumbled into same problem yet.
i can confirm that

  syncPolicy:
    syncOptions:
    - ServerSideApply=true 

will help you @EricGregMiller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants