-
Notifications
You must be signed in to change notification settings - Fork 164
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
Error when deploying helm chart with yaml anchors #372
Comments
We could update the kustomize packages to https://github.com/fluxcd/kustomize-controller/blob/main/go.mod#L38-L42 |
sorry, it is kustomize 4.4 that supports yaml anchors, i edited my comment. anyway, this error is related to the helmrelease resource, which i think is handled by the helm-controller, which currently has kustomize 4.0.5: |
Yes, what I wanted to say is that we should set the kustomize version in helm-controller go.mod to the same version used in kustomize-controller go.mod. |
ah yes i think that would be great, thanks 😊 |
@stefanprodan is this the required change to upgrade kustomize? |
using flux cli 0.24.0:
$ sudo docker run -it --entrypoint=sh -v /home/vagrant/.kube/config:/root/.kube/config ghcr.io/fluxcd/flux-cli:v0.24.0 / # flux version flux: v0.24.0 helm-controller: v0.14.0 image-automation-controller: v0.13.0 image-reflector-controller: v0.10.0 kustomize-controller: v0.18.1 notification-controller: v0.19.0 source-controller: v0.19.0
I was deploying the aerospike helm chart which contains yaml anchors in one of the templates. This is what I always get:
/ # flux get helmrelease aerospike -n aerospike NAME READY MESSAGE REVISION SUSPENDED aerospike False Helm upgrade failed: error while running post render on files: map[string]interface {}{"apiVersion":"apps/v1", "kind":"StatefulSet", "metadata":map[string]interface {}{"labels":map[string]interface {}{"app":"aerospike", "chart":"aerospike", "helm.toolkit.fluxcd.io/name":"aerospike", "helm.toolkit.fluxcd.io/namespace":"aerospike", "release":"aerospike", "unique-app":"aerospike-aerospike"}, "name":"aerospike-aerospike", "namespace":"aerospike"}, "spec":map[string]interface {}{"replicas":3, "selector":map[string]interface {}{"matchLabels":map[interface {}]interface {}{"app":"aerospike", "chart":"aerospike", "helm.toolkit.fluxcd.io/name":"aerospike", "helm.toolkit.fluxcd.io/namespace":"aerospike", "release":"aerospike", "unique-app":"aerospike-aerospike"}}, "serviceName":"aerospike-aerospike", "template":map[string]interface {}{"metadata":map[string]interface {}{"annotations":map[string]interface {}{"prometheus.io/port":"9145", "prometheus.io/scrape":"true"}, "labels":map[interface {}]interface {}{"app":"aerospike", "chart":"aerospike", "helm.toolkit.fluxcd.io/name":"aerospike", "helm.toolkit.fluxcd.io/namespace":"aerospike", "release":"aerospike", "unique-app":"aerospike-aerospike"}}, "spec":map[string]interface {}{"containers":[]interface {}{map[string]interface {}{"env":[]interface {}{map[string]interface {}{"name":"NAMESPACE", "value":"dev"}, map[string]interface {}{"name":"REPL_FACTOR", "value":"2"}, map[string]interface {}{"name":"MEM_GB", "value":"1"}, map[string]interface {}{"name":"DEFAULT_TTL", "value":"0"}, map[string]interface {}{"name":"SERVICE_PORT", "value":"3000"}, map[string]interface {}{"name":"HB_PORT", "value":"3002"}, map[string]interface {}{"name":"FABRIC_PORT", "value":"3001"}, map[string]interface {}{"name":"INFO_PORT", "value":"3003"}, map[string]interface {}{"name":"MY_POD_NAME", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"metadata.name"}}}, map[string]interface {}{"name":"MY_POD_NAMESPACE", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"metadata.namespace"}}}, map[string]interface {}{"name":"MY_POD_IP", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"status.podIP"}}}}, "image":"aerospike/aerospike-server:5.5.0.7", "lifecycle":map[string]interface {}{"preStop":map[string]interface {}{"exec":map[string]interface {}{"command":[]interface {}{"/bin/sh", "-c", "/etc/aerospike/aku-adm --operation pre-stop-community --log-level debug"}}}}, "livenessProbe":map[string]interface {}{"exec":map[string]interface {}{"command":[]interface {}{"/bin/sh", "-c", "/etc/aerospike/aku-adm --operation liveness --log-level debug"}}, "failureThreshold":3, "initialDelaySeconds":30, "periodSeconds":30, "successThreshold":1, "timeoutSeconds":1}, "name":"aerospike", "ports":[]interface {}{map[string]interface {}{"containerPort":3000, "name":"aero-client"}, map[string]interface {}{"containerPort":3002, "name":"aero-mesh"}, map[string]interface {}{"containerPort":3001, "name":"aero-fabric"}, map[string]interface {}{"containerPort":3003, "name":"aero-info"}}, "readinessProbe":map[string]interface {}{"failureThreshold":3, "initialDelaySeconds":30, "periodSeconds":10, "successThreshold":1, "tcpSocket":map[string]interface {}{"port":3000}, "timeoutSeconds":1}, "resources":map[string]interface {}{"limits":map[string]interface {}{"cpu":1, "memory":"1Gi"}, "requests":map[string]interface {}{"cpu":1, "memory":"1Gi"}}, "securityContext":map[string]interface {}{}, "volumeDevices":interface {}(nil), "volumeMounts":[]interface {}{map[string]interface {}{"mountPath":"/etc/aerospike", "name":"confdir"}, map[string]interface {}{"mountPath":"/opt/aerospike/data", "name":"datadir"}}}, map[string]interface {}{"args":[]interface {}{"aerospike-prometheus-exporter", "--config", "/etc/aerospike-prometheus-exporter/ape.toml"}, "env":[]interface {}{map[string]interface {}{"name":"MY_POD_NAME", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"metadata.name"}}}, map[string]interface {}{"name":"MY_POD_NAMESPACE", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"metadata.namespace"}}}, map[string]interface {}{"name":"MY_POD_IP", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"status.podIP"}}}, map[string]interface {}{"name":"AGENT_CERT_FILE", "value":""}, map[string]interface {}{"name":"AGENT_KEY_FILE", "value":""}, map[string]interface {}{"name":"METRIC_LABELS", "value":""}, map[string]interface {}{"name":"AGENT_BIND_HOST", "value":""}, map[string]interface {}{"name":"AGENT_BIND_PORT", "value":"9145"}, map[string]interface {}{"name":"AGENT_TIMEOUT", "value":"10"}, map[string]interface {}{"name":"AGENT_LOG_FILE", "value":""}, map[string]interface {}{"name":"AGENT_LOG_LEVEL", "value":"info"}, map[string]interface {}{"name":"BASIC_AUTH_USERNAME", "value":""}, map[string]interface {}{"name":"BASIC_AUTH_PASSWORD", "value":""}, map[string]interface {}{"name":"AS_HOST", "value":"localhost"}, map[string]interface {}{"name":"AS_PORT", "value":"3000"}, map[string]interface {}{"name":"TICKER_TIMEOUT", "value":"5"}, map[string]interface {}{"name":"NAMESPACE_METRICS_ALLOWLIST", "value":""}, map[string]interface {}{"name":"SET_METRICS_ALLOWLIST", "value":""}, map[string]interface {}{"name":"NODE_METRICS_ALLOWLIST", "value":""}, map[string]interface {}{"name":"XDR_METRICS_ALLOWLIST", "value":""}, map[string]interface {}{"name":"NAMESPACE_METRICS_BLOCKLIST", "value":""}, map[string]interface {}{"name":"SET_METRICS_BLOCKLIST", "value":""}, map[string]interface {}{"name":"NODE_METRICS_BLOCKLIST", "value":""}, map[string]interface {}{"name":"XDR_METRICS_BLOCKLIST", "value":""}}, "image":"aerospike/aerospike-prometheus-exporter:latest", "name":"aerospike-prometheus-exporter", "ports":[]interface {}{map[string]interface {}{"containerPort":9145, "name":"exporter"}}, "volumeMounts":[]interface {}{map[string]interface {}{"mountPath":"/etc/aerospike-prometheus-exporter", "name":"apeconfdir"}}}}, "initContainers":[]interface {}{map[string]interface {}{"env":[]interface {}{map[string]interface {}{"name":"POD_NAMESPACE", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"metadata.namespace"}}}, map[string]interface {}{"name":"SERVICE", "value":"aerospike-aerospike"}, map[string]interface {}{"name":"SERVICE_DNS_DOMAIN", "value":"cluster.local"}, map[string]interface {}{"name":"POD_NAME", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"metadata.name"}}}, map[string]interface {}{"name":"CLUSTER_NAME", "value":"aerospike-aerospike"}, map[string]interface {}{"name":"HOST_IP", "valueFrom":map[string]interface {}{"fieldRef":map[string]interface {}{"fieldPath":"status.hostIP"}}}, map[string]interface {}{"name":"HEARTBEAT_PORT", "value":"3002"}, map[string]interface {}{"name":"FABRIC_PORT", "value":"3001"}, map[string]interface {}{"name":"SERVICE_PORT", "value":"3000"}, map[string]interface {}{"name":"AUTO_GENERATE_NODE_IDS", "value":"true"}, map[string]interface {}{"name":"NODE_ID_PREFIX", "value":"a"}}, "image":"aerospike/aerospike-kubernetes-init:latest", "name":"aerospike-init", "volumeMounts":[]interface {}{map[string]interface {}{"mountPath":"/etc/aerospike", "name":"confdir"}, map[string]interface {}{"mountPath":"/configs", "name":"initconfigs"}, map[string]interface {}{"mountPath":"/etc/aerospike-prometheus-exporter", "name":"apeconfdir"}}}}, "securityContext":map[string]interface {}{}, "serviceAccountName":interface {}(nil), "terminationGracePeriodSeconds":600, "volumes":[]interface {}{map[string]interface {}{"emptyDir":map[string]interface {}{}, "name":"apeconfdir"}, map[string]interface {}{"emptyDir":map[string]interface {}{}, "name":"confdir"}, map[string]interface {}{"configMap":map[string]interface {}{"name":"aerospike-conf"}, "name":"initconfigs"}}}}, "volumeClaimTemplates":[]interface {}{map[string]interface {}{"metadata":map[string]interface {}{"labels":map[string]interface {}{"app":"aerospike", "chart":"aerospike", "helm.toolkit.fluxcd.io/name":"aerospike", "helm.toolkit.fluxcd.io/namespace":"aerospike", "release":"aerospike", "unique-app":"aerospike-aerospike"}, "name":"datadir"}, "spec":map[string]interface {}{"accessModes":[]interface {}{"ReadWriteOnce"}, "resources":map[string]interface {}{"requests":map[string]interface {}{"storage":"3Gi"}}, "storageClassName":"ssd", "volumeMode":"Filesystem"}}}}}: json: unsupported type: map[interface {}]interface {} False
I can trace that error back to where the yaml anchors are supposed to be rendered. And if I remove the anchors and try again it works fine.
I think that the error is related to the kustomize version present in the helm-controller:
https://github.com/fluxcd/helm-controller/blob/main/go.sum#L1319
line 1319:
sigs.k8s.io/kustomize/kustomize/v4 v4.0.5/go.mod h1:C7rYla7sI8EnxHE/xEhRBSHMNfcL91fx0uKmUlUhrBk=
kustomize 4.0 doesn't support yaml anchors, they restored it in 4.4.0 :
https://github.com/kubernetes-sigs/kustomize/releases/tag/kustomize%2Fv4.4.0
would upgrading helm-controller kustomize version to 4.4 solve this problem? if yes, is it possible to add the upgrade to the next release?
The text was updated successfully, but these errors were encountered: