helm-diff
helm-diff copied to clipboard
Helm Diff upgrade - Disable validation, use wrong kubernetes server version
While running a helm diff upgrade command with option --disable-validation to ignore the CRDs, when the chart has a Chart.yaml file with rule such as kubeVersion: ">=1.21.0-0", Even if my kubernetes cluster is using version 1.21, the helm diff command sees my cluster with version 1.20.0
Expected Behavior
helm diff upgrade --disable-validation Should take into account my kubernetes server version even with flag --disable-validation
Current Behavior
helm diff upgrade --disable-validation Above command fails to recognize my kubernetes cluster version with below error : Error: Failed to render chart: exit status 1: Error: chart requires kubeVersion: >=1.21.0-0 which is incompatible with Kubernetes v1.20.0
While my k8s cluster is using version 1.21 : { "clientVersion": { "major": "1", "minor": "21" }, "serverVersion": { "major": "1", "minor": "21+" } }
Steps to Reproduce
- Deploy a helm chart with KubeServer version constraint
- Make sure our kubernetes cluster meets the Chart k8s version requirement
- Run a helm diff upgrade --disable-validation command
Context (Environment)
k8s version : 1.21.5 kubectl client version 1.21 helm diff version 3.4.2
@Davidt-jia Hey! Unfortunately I think this is an issue in the upstream helm-template command that helm-diff uses internally to render the chart for diff. Would you mind confirming that and submitting a issue in the upstream helm repo? Thanks!
Hi @mumoshu , Indeed, I can reproduce the same issue using helm template command. However, when I look at the helm documentation, when disabling validation, the expected behaviour is to use a "fake" k8s version (in our case 1.20).
Meaning for k8s server > 1.20 with CRD and kubernetes version requirements, there is no way to use helm diff or helm template commands.
I'll create an issue on the helm template Git repo and tag this one for information. Thanks for your reply
@Davidt-jia Thanks for confirming! Have you ever used --kube-version
(I thought it was added back to helm-template in a recent version of helm 3, well perhaps 3.7.x or so?) I wonder if that works for this case(haven't really tried it due to the following reason... read on.
Also, I thought the use of .KubeVersion
in a helm chart template had been long deprecated in helm v3. As far as I can recall, the right way to change the API versions of certain resources rendered by a chart is to branch on .Capabilities.APIVersions
rather than .KubeVersion
. So perhaps this can also distill into an issue in the chart you use, even rather than helm.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.