mirror of https://github.com/helm/helm
On Slack a user reported that he didn't understand why `helm template` was reporting v1.20.0. He had no Kubernetes cluster connection. This is because we fallback on default Kube version in capabilities.go. This change tracks whether the KubeVersion is a default fallback and adds a helpful hint to the error message only when the default is used (not when users explicitly set --kube-version). Before: ``` Error: chart requires kubeVersion: >= 1.28.0-0 which is incompatible with Kubernetes v1.20.0 ``` After (with default): ``` Error: chart requires kubeVersion: >= 1.28.0-0 which is incompatible with Kubernetes v1.20.0 (no cluster connected, using default version; specify target version with --kube-version) ``` After (with explicit --kube-version 1.27.0): ``` Error: chart requires kubeVersion: >= 1.28.0-0 which is incompatible with Kubernetes v1.27.0 ``` Testing: ```sh $ bin/helm template test-release /tmp/test-chart Error: chart requires kubeVersion: >= 1.28.0-0 which is incompatible with Kubernetes v1.20.0 (no cluster connected, using default version; specify target version with --kube-version) $ bin/helm template test-release /tmp/test-chart --kube-version 1.27.0 Error: chart requires kubeVersion: >= 1.28.0-0 which is incompatible with Kubernetes v1.27.0 $ bin/helm template test-release /tmp/test-chart --kube-version 1.20.0 Error: chart requires kubeVersion: >= 1.28.0-0 which is incompatible with Kubernetes v1.20.0 $ bin/helm template test-release /tmp/test-chart --kube-version 1.28.0 --- apiVersion: v1 kind: ConfigMap ... ``` Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>pull/31501/head
parent
1da2b0a6d4
commit
0f92ef3379
Loading…
Reference in new issue