cert-manager / trust-manager

trust-manager is an operator for distributing trust bundles across a Kubernetes cluster.
https://cert-manager.io/docs/projects/trust-manager/
Apache License 2.0
251 stars 66 forks source link

Issue with CRDs when having trust-manager as chart dependency #281

Open heruan opened 8 months ago

heruan commented 8 months ago

I'm building a Chart that has trust-manager as a dependency, since it has a template for Bundle:

dependencies:
  - name: cert-manager
    version: 1.13.3
    repository: https://charts.jetstack.io
    condition: cert-manager.enabled
  - name: trust-manager
    version: 0.8.0
    repository: https://charts.jetstack.io
    condition: trust-manager.enabled

but installation fails with:

Error: INSTALLATION FAILED: unable to build kubernetes objects from release manifest: resource mapping not found for name: "control-center-ca-bundle" namespace: "" from "": no matches for kind "Bundle" in version "trust.cert-manager.io/v1alpha1"
ensure CRDs are installed first

as if the CRDs for trust-manager are not installed automatically. So if I put the CRDs file in the crds directory of my Chart (as I'm doing with cert-manager) I get this other error:

Error: INSTALLATION FAILED: Unable to continue with install: CustomResourceDefinition "bundles.trust.cert-manager.io" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"

as if the CRDs are being installed this time.

I suppose CRDs of dependencies are installed after the templates of the Chart, but that means that I can't use Bundle in my templates and it kinda defeats the purpose of a dependency.

With cert-manager this does not happen since CRDs installation is disabled by default and I have the CRDs file in the crds directory.

Any suggestions on how to handle this?