cloudnative-pg / charts

CloudNativePG Helm Charts
Apache License 2.0
195 stars 96 forks source link

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

Open heruan opened 2 weeks ago

heruan commented 2 weeks ago

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 https://github.com/cloudnative-pg/charts/blob/238f826c51f48318af9162f0dc1f54d99bbf07fa/charts/cloudnative-pg/templates/mutatingwebhookconfiguration.yaml#L18-L21

as it happens for example for CertManager webhooks.

heruan commented 2 weeks ago

Same for the validating webhook: https://github.com/cloudnative-pg/charts/blob/238f826c51f48318af9162f0dc1f54d99bbf07fa/charts/cloudnative-pg/templates/validatingwebhookconfiguration.yaml#L18-L21