Skip to content

fix: correct LDFLAGS path for default Kubernetes version - #31512

Merged
gjenkins8 merged 1 commit into
helm:mainfrom
benoittgt:31508-client-go
Nov 15, 2025
Merged

gjenkins8 merged 1 commit into
helm:mainfrom
benoittgt:31508-client-go

Conversation

@benoittgt

@benoittgt benoittgt commented Nov 14, 2025 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The Makefile LDFLAGS were pointing to an incorrect package path (helm.sh/helm/v4/pkg/chart/common/util) where variables don't exist, causing the k8sVersionMajor and k8sVersionMinor variables to silently fail to be set. This left the hardcoded defaults (1.20 from capabilities.go) in place.

After this fix, helm template for example 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:

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
# success

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

Special notes for your reviewer:

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

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]>
@pull-request-size pull-request-size Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 14, 2025
@gjenkins8 gjenkins8 added the bug Categorizes issue or PR as related to a bug. label Nov 15, 2025
@gjenkins8 gjenkins8 added this to the 4.0.1 milestone Nov 15, 2025
@gjenkins8
gjenkins8 merged commit 3e06a8a into helm:main Nov 15, 2025
@benoittgt
benoittgt deleted the 31508-client-go branch November 17, 2025 09:02
@crabique

Copy link
Copy Markdown

Can we get a patch release with this fix please? This is a big regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Categorizes issue or PR as related to a bug. picked Indicates that a PR has been cherry-picked into the next release candidate. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helm 4 template uses K8s 1.20 default instead of client-go version [Helm 4] "helm template" raises meaningless error

4 participants