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

Provide ability to deploy CRDs independently of application #280

Open
tylerauerbeck opened this issue May 7, 2024 · 4 comments
Open

Provide ability to deploy CRDs independently of application #280

tylerauerbeck opened this issue May 7, 2024 · 4 comments
Labels
chart( operator ) Related to the operator (cloudnative-pg) chart

Comments

@tylerauerbeck
Copy link

We have a need to be able to deploy the CRDs for the operator independently of the application itself (i.e. in some cases, we may just want to install CRDs, in other cases we may just want to deploy the operator without the CRDs, and in other cases we may want it all).

This has initially arisen because of the size of the CRDS themselves when attempting to install the CNPG operator chart inside of ArgoCD. As has been known to happen with other applications being kubectl applyd , the only option is to use the Replace=true option which resolves the problem. Currently (by having everything installed together) this causes everything to be replaced. However, if we were able to provide separate values files for this where we could control the deployment of the various sets of components independently, we wouldn't need to force a Replace on running components each time we synced.

@fouadsemaan
Copy link

fouadsemaan commented May 9, 2024

Chart: cloudnative-pg
Version: 0.21.2

Recreate also has to be called to avoid validation issues when used in conjunction with "validate=false".

This however is also not a long term solution as my fear is the recreation of the CRDs may in fact delete the CR instances.

Besides the server-side apply to solve the long CRDs, can we fix the validation issue? It also creates another issue whereby ArgoCD can't calculate the diff between the desired manifest and actual manifest.

Server side apply will suffice if validation is fixed.

@chgl
Copy link

chgl commented May 23, 2024

Would allowing to set annotations on the CRDs be another option (prometheus-community/helm-charts#3548 (comment)) ?

So something like:

crds:
  annotations:
    argocd.argoproj.io/sync-options: ServerSideApply=true

adds the annotation to https://github.com/cloudnative-pg/charts/blob/main/charts/cloudnative-pg/templates/crds/crds.yaml#L5.

@itay-grudev itay-grudev added the chart( operator ) Related to the operator (cloudnative-pg) chart label May 25, 2024
@Stevenpc3
Copy link
Contributor

We also need to be able to apply the CRD only once. We have a case where we need to install the CRD cluster wide on cluster creation. Then we will deploy the operator to limited namespaces via the charts and currently we can set a flag to not install crd, but the ability to install the CRD the first time remains an manual step, unless the operator chart can be in a CRD only mode like "--set operator.enabled=false" or something.

Honestly, the best bet would be to make the CRD it's own chart. Then make that CRD chart a dependency of the operator chart if crd.enabled=true.

This will allow the option to only install the CRD chart which just applies the crds.yaml and still can easily make use of the existing crd.create flag in the operator chart.

crds:
  # -- Specifies whether the CRDs should be created when installing the chart.
  create: true

@Stevenpc3
Copy link
Contributor

I likely will make a PR.

The best way to do this is how Elasitcsearch does their ECK operator.

They have the CRDs as a separate chart https://github.com/elastic/cloud-on-k8s/tree/main/deploy/eck-operator/charts/eck-operator-crds then the operator depends on this. https://github.com/elastic/cloud-on-k8s/blob/main/deploy/eck-operator/Chart.yaml#L34

This allows you to deploy normally or optionally deploy the CRDs alone separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chart( operator ) Related to the operator (cloudnative-pg) chart
Projects
None yet
Development

No branches or pull requests

5 participants