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

Installing as a subchart fails on the second installation because of hardcoded webhook name #443

Closed
heruan opened this issue Nov 7, 2024 · 2 comments

Comments

@heruan
Copy link

heruan commented Nov 7, 2024

Having CNPG as a subchart, i.e.

dependencies:
  - name: cloudnative-pg
    version: ~0.22.0
    repository: https://cloudnative-pg.github.io/charts

if fails with this error when installing the chart a second time with a different release name:

$ helm install foo ./umbrella-chart -ns foo
$ helm install bar ./umbrella-chart -ns bar

Error: INSTALLATION FAILED: Unable to continue with install: MutatingWebhookConfiguration "cnpg-mutating-webhook-configuration"
in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error:
key "meta.helm.sh/release-name" must equal "bar": current value is "foo"; annotation validation error:
key "meta.helm.sh/release-namespace" must equal "bar": current value is "foo"

This would be fixed if the name of the webhook would be prefixed by the release name instead of being hardcoded in

apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: cnpg-mutating-webhook-configuration

as it happens for example for CertManager webhooks.

@heruan
Copy link
Author

heruan commented Nov 7, 2024

Same for the validating webhook:

apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: cnpg-validating-webhook-configuration

@itay-grudev
Copy link
Collaborator

You are not supposed to have two installations of the operator. You only need one operator per Kubernetes cluster. Even with the recent addition of namespace restricted installations, we don't support installing multiple operators.

I'd advise that you rework your infrastructure code to set up all the necessary operators required by your cluster before you install you application payload.

Including operators as part of the payload charts is a bad practice as they usually affect the whole cluster.

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

2 participants