k8ssandra / k8ssandra-operator

The Kubernetes operator for K8ssandra
https://k8ssandra.io/
Apache License 2.0
174 stars 79 forks source link

Helm Chart v1.10.3: template for k8ssandraclusters CustomResourceDefinition has uninterpolated strings / missing Helm templating #1135

Open frimik opened 11 months ago

frimik commented 11 months ago

What happened?

After helm install of k8ssandra-operator v1.10.3, the k8ssandraclusters CRD contains the following annotation: cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE_K8S)/$(CERTIFICATE_NAME_K8S)

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE_K8S)/$(CERTIFICATE_NAME_K8S)
    controller-gen.kubebuilder.io/version: v0.12.0

How to reproduce it (as minimally and precisely as possible):

helm install --version 1.10.3 k8ssandra-operator k8ssandra/k8ssandra-operator -n k8ssandra-operator --set global.clusterScoped=true --create-namespace

kubectl get crd k8ssandraclusters.k8ssandra.io -o jsonpath='{.metadata.annotations}'
# {"cert-manager.io/inject-ca-from":"$(CERTIFICATE_NAMESPACE_K8S)/$(CERTIFICATE_NAME_K8S)","controller-gen.kubebuilder.io/version":"v0.12.0"}%                                                                                                                                                                                                                                           

┆Issue is synchronized with this Jira Story by Unito ┆Issue Number: K8OP-60

gadiener commented 1 month ago

Hello I have the same issue, did you find a workaround?

burmanm commented 1 month ago

Annotations can be added and removed. Although it shouldn't have any effect.

gadiener commented 1 month ago

It does have an effect in this case, with this annotation the cert manager cainjector will print the following log in loop

E1016 08:59:10.670334       1 sources.go:106] "unable to fetch associated certificate" err="Certificate.cert-manager.io \"$(CERTIFICATE_NAME_K8S)\" not
found" logger="cert-manager" kind="customresourcedefinition" kind="customresourcedefinition" name="k8ssandraclusters.k8ssandra.io" certificate="$(CERTIF
ICATE_NAMESPACE_K8S)/$(CERTIFICATE_NAME_K8S)"
gadiener commented 1 month ago

If the annotation is not needed I can create a quick pr to remove it

burmanm commented 1 month ago

The annotation is only used in the Kustomize installation (as that's a kustomize replacement directive), but since the CRD is copied from there it's in the Helm chart also. To remove would require a modification to the prepare-helm-release.sh to remove it after it was generated. A sed command would probably be enough..

gadiener commented 1 month ago

Thanks @burmanm I'll create a PR as soon as I have time