Repository navigation
Conversation
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 <[email protected]>
3 tasks
benoittgt
added a commit
to benoittgt/helm
that referenced
this pull request
Nov 14, 2025
The Makefile LDFLAGS were pointing to an incorrect package path
(helm.sh/helm/v4/pkg/chart/common/util) that doesn't exist, causing
the k8sVersionMajor and k8sVersionMinor variables to silently fail
to be set. This left the hardcoded defaults (1.20) in place.
After this fix, `helm template` now correctly defaults to Kubernetes
v1.34.0 (matching the bundled client-go version) instead of v1.20.0,
ensuring charts render with current stable API versions.
Testing scenario:
```sh
cat > /tmp/test-chart-fail/Chart.yaml << 'EOF'
apiVersion: v2
name: test-chart-fail
version: 1.0.0
kubeVersion: ">= 1.35.0-0"
EOF
cat > /tmp/test-chart-fail/templates/deployment.yaml << 'EOF'
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-deployment
spec:
replicas: 1
selector:
matchLabels:
app: test
template:
metadata:
labels:
app: test
spec:
containers:
- name: nginx
image: nginx:latest
EOF
./bin/helm template test-release /tmp/test-chart-fail
Exit code 1
Error: chart requires kubeVersion: >= 1.35.0-0 which is incompatible with Kubernetes v1.34.0
```
Fixes helm#31508
Closes helm#31501
Closes helm#31502
Signed-off-by: Benoit Tigeot <[email protected]>
benoittgt
added a commit
to benoittgt/helm
that referenced
this pull request
Nov 14, 2025
The Makefile LDFLAGS were pointing to an incorrect package path (helm.sh/helm/v4/pkg/chart/common/util) that doesn't exist, causing the k8sVersionMajor and k8sVersionMinor variables to silently fail to be set. This left the hardcoded defaults (1.20) in place. After this fix, `helm template` now correctly defaults to Kubernetes v1.34.0 (matching the bundled client-go version) instead of v1.20.0, ensuring charts render with current stable API versions. Testing scenario: ```sh cat > /tmp/test-chart/Chart.yaml << 'EOF' apiVersion: v2 name: test-chart version: 1.0.0 kubeVersion: ">= 1.28.0-0" EOF ./bin/helm template test-release /tmp/test-chart cat > /tmp/test-chart-fail/Chart.yaml << 'EOF' apiVersion: v2 name: test-chart-fail version: 1.0.0 kubeVersion: ">= 1.35.0-0" EOF ./bin/helm template test-release /tmp/test-chart-fail Exit code 1 Error: chart requires kubeVersion: >= 1.35.0-0 which is incompatible with Kubernetes v1.34.0 ``` Fixes helm#31508 Closes helm#31501 Closes helm#31502 Signed-off-by: Benoit Tigeot <[email protected]>
3 tasks
Contributor
Author
|
I think that #31512 is a better approach. |
mattfarina
pushed a commit
that referenced
this pull request
Nov 24, 2025
The Makefile LDFLAGS were pointing to an incorrect package path (helm.sh/helm/v4/pkg/chart/common/util) that doesn't exist, causing the k8sVersionMajor and k8sVersionMinor variables to silently fail to be set. This left the hardcoded defaults (1.20) in place. After this fix, `helm template` now correctly defaults to Kubernetes v1.34.0 (matching the bundled client-go version) instead of v1.20.0, ensuring charts render with current stable API versions. Testing scenario: ```sh cat > /tmp/test-chart/Chart.yaml << 'EOF' apiVersion: v2 name: test-chart version: 1.0.0 kubeVersion: ">= 1.28.0-0" EOF ./bin/helm template test-release /tmp/test-chart cat > /tmp/test-chart-fail/Chart.yaml << 'EOF' apiVersion: v2 name: test-chart-fail version: 1.0.0 kubeVersion: ">= 1.35.0-0" EOF ./bin/helm template test-release /tmp/test-chart-fail Exit code 1 Error: chart requires kubeVersion: >= 1.35.0-0 which is incompatible with Kubernetes v1.34.0 ``` Fixes #31508 Closes #31501 Closes #31502 Signed-off-by: Benoit Tigeot <[email protected]> (cherry picked from commit b6a8c65)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it:
Closes: #31502
On Slack a user reported that he didn't understand why
helm templatewas reporting v1.20.0 incompatibility. 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:
After (with default):
After (with explicit --kube-version 1.27.0):
Testing:
Special notes for your reviewer:
🙇
If applicable:
docs neededlabel should be applied if so)