I need to install the same helm Chart to different namespaces, so multiple times. The chart contains cluster scoped resources like ClusterRoles or CustomResourceDefinitions.
The problem is I can only install it once, the second time I have an "already exists not managed by helm" error.
What I've tried:
- Putting CRDs in a separate folder, works well, except that I can't since my CRDs contain helm values and the crds folder doesn't accept templates.
- Using something like this:
{{- $crds := lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" .Release.Namespace "path.to.new.crd" -}}
{{- if not $crds -}}
{{- end }}
But this isn't ideal either, because if I install the same helm to the same namespace twice, the resources get deleted, the third time they appear again, fourth they disappear, and so on.
Does anybody have a more elegant solution to this?