Repository navigation
Closed
Labels
kind/bugSomething isn't working
Description
Bug report
CLI fails to install Cilium if any of the serviceMonitors is enabled, even if correct CRDs are present in the cluster:
$ cilium install --helm-set prometheus.enabled=true --helm-set prometheus.serviceMonitor.enabled=true
🔮 Auto-detected Kubernetes kind: kind
✨ Running "kind" validation checks
✅ Detected kind version "0.17.0"
ℹ️ Using Cilium version 1.12.2
🔮 Auto-detected cluster name: kind-kind
🔮 Auto-detected datapath mode: tunnel
🔮 Auto-detected kube-proxy has been installed
ℹ️ helm template --namespace kube-system cilium cilium/cilium --version 1.12.2 --set cluster.id=0,cluster.name=kind-kind,encryption.nodeEncryption=false,ipam.mode=kubernetes,kubeProxyReplacement=disabled,operator.replicas=1,prometheus.enabled=true,prometheus.serviceMonitor.enabled=true,serviceAccounts.cilium.name=cilium,serviceAccounts.operator.name=cilium-operator,tunnel=vxlan
↩️ Rolling back installation...
Error: Unable to install Cilium: execution error at (cilium/templates/validate.yaml:21:9): Service Monitor requires monitoring.coreos.com/v1 CRDs. Please refer to https://github.com/prometheus-operator/prometheus-operator/blob/master/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml
$ kubectl get crd
NAME CREATED AT
alertmanagerconfigs.monitoring.coreos.com 2022-09-26T09:14:26Z
alertmanagers.monitoring.coreos.com 2022-09-26T09:14:26Z
podmonitors.monitoring.coreos.com 2022-09-26T09:14:26Z
probes.monitoring.coreos.com 2022-09-26T09:14:26Z
prometheuses.monitoring.coreos.com 2022-09-26T09:14:26Z
prometheusrules.monitoring.coreos.com 2022-09-26T09:14:26Z
servicemonitors.monitoring.coreos.com 2022-09-26T09:14:26Z
thanosrulers.monitoring.coreos.com 2022-09-26T09:14:26Z
The helm template command fails to pass Cilium chart validation checking .Capabilities.APIVersions:
{{- if and .Values.prometheus.enabled (or .Values.prometheus.serviceMonitor.enabled .Values.operator.prometheus.serviceMonitor.enabled) }}
{{- if not (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
{{ fail "Service Monitor requires monitoring.coreos.com/v1 CRDs. Please refer to https://github.com/prometheus-operator/prometheus-operator/blob/master/example/prometheus-operator-crd/monitoring.coreos.com_servicemonitors.yaml" }}
{{- end }}
{{- end }}
As it doesn't interact with k8s API, it's not surprising. Still a bug though.
helm template allows to pass API versions in --api-versions argument (see docs), so it could be used to trick the validation check.
General Information
- Cilium CLI v0.12.4
- Kubernetes v1.25.2
- kind
How to reproduce the issue
- create a fresh cluster
kind create cluster
- install prometheus-operator CRDs
helm template kube-prometheus prometheus-community/kube-prometheus-stack --include-crds \
| yq 'select(.kind == "CustomResourceDefinition") * {"metadata": {"annotations": {"meta.helm.sh/release-name": "kube-prometheus", "meta.helm.sh/release-namespace": "monitoring"}}}' \
| kubectl create -f - || true
- try to install Cilium
cilium install --helm-set prometheus.enabled=true --helm-set prometheus.serviceMonitor.enabled=true
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't working
Activity
install: Add auto-filled --api-versions parameter for helm capabilities
install: Add auto-filled --api-versions parameter for helm capabilities
install: Add auto-filled --api-versions parameter for helm capabilities
install: Add auto-filled --api-versions parameter for helm capabilities
install: Add auto-filled --api-versions parameter for helm capabilities