Skip to content

build: set kube version via debug.BuildInfo - #31296

Merged
gjenkins8 merged 1 commit into
helm:mainfrom
gjenkins8:gjenkins/runtime_kube_version
Dec 23, 2025
Merged

gjenkins8 merged 1 commit into
helm:mainfrom
gjenkins8:gjenkins/runtime_kube_version

Conversation

@gjenkins8

@gjenkins8 gjenkins8 commented Sep 15, 2025 •

Copy link
Copy Markdown
Member

What this PR does / why we need it:
Read the Kubernetes client version (the client-go library version) directly from from Go's internal runtime.DebugInfo. Rather than setting the link time build variables.

The PR is an update of #13180 with some (needed) changes

Thanks to @branchvincent for the idea and initial implementation

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

@pull-request-size pull-request-size Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 15, 2025
@gjenkins8
gjenkins8 force-pushed the gjenkins/runtime_kube_version branch 2 times, most recently from 20c5fac to a57ff51 Compare September 16, 2025 02:28
@gjenkins8
gjenkins8 marked this pull request as ready for review September 16, 2025 02:35
@gjenkins8
gjenkins8 force-pushed the gjenkins/runtime_kube_version branch 2 times, most recently from 498c39d to e4d28fe Compare September 16, 2025 03:07

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

I threw some prints in to validate because I'm not sure how else this might be displayed. Any thoughts on adding k8s version to helm version?

@gjenkins8

gjenkins8 commented Sep 16, 2025 •

Copy link
Copy Markdown
Member Author

/lgtm

I threw some prints in to validate because I'm not sure how else this might be displayed. Any thoughts on adding k8s version to helm version?

The way to validate today is to use a chart that templates out {{ .Capabilities.KubeVersion.Version }} (and .Capabilities.KubeVersion.{Minor,Major}Version ).

I was going to make a followup PR to expose in helm version (as that makes sense regardless)

@gjenkins8 gjenkins8 added the v4.x Issues and Pull Requests related to the major version v4 label Oct 2, 2025
@gjenkins8
gjenkins8 force-pushed the gjenkins/runtime_kube_version branch 2 times, most recently from 5d148ed to 44f861b Compare November 4, 2025 04:48

@TerryHowe TerryHowe left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

The more comprehensive tests suite pass for me. My understanding is helm version in a follow up:

version.BuildInfo{Version:"v4.0+unreleased", GitCommit:"44f861be29c9f161e97662707de91010e1a6dc54", GitTreeState:"clean", GoVersion:"go1.25.1", KubeClientVersion:"v."}

@gjenkins8
gjenkins8 force-pushed the gjenkins/runtime_kube_version branch from 7224997 to 8da96f0 Compare November 4, 2025 20:17
@gjenkins8

Copy link
Copy Markdown
Member Author

/lgtm

The more comprehensive tests suite pass for me. My understanding is helm version in a follow up:

version.BuildInfo{Version:"v4.0+unreleased", GitCommit:"44f861be29c9f161e97662707de91010e1a6dc54", GitTreeState:"clean", GoVersion:"go1.25.1", KubeClientVersion:"v."}

This was a mistake / bad merge. Now fixed

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

version.BuildInfo{Version:"v4.0+unreleased", GitCommit:"8da96f043b24d50f1312fe8f8c340fc14014d697", GitTreeState:"clean", GoVersion:"go1.25.3", KubeClientVersion:"v1.34"}

TerryHowe
TerryHowe previously approved these changes Nov 5, 2025
@TerryHowe TerryHowe added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 13, 2025
Signed-off-by: Branch Vincent <[email protected]>
Signed-off-by: George Jenkins <[email protected]>
@gjenkins8
gjenkins8 force-pushed the gjenkins/runtime_kube_version branch from 8da96f0 to c6d9a5b Compare December 20, 2025 05:14
@gjenkins8
gjenkins8 requested a review from TerryHowe December 20, 2025 05:23
@gjenkins8 gjenkins8 removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 20, 2025

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@gjenkins8
gjenkins8 merged commit f05c21b into helm:main Dec 23, 2025
@gjenkins8 gjenkins8 removed the v4.x Issues and Pull Requests related to the major version v4 label Dec 23, 2025
@scottrigby scottrigby added the needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. label Jan 12, 2026
@scottrigby scottrigby modified the milestones: 4.0.5, 4.1.0 Jan 12, 2026
@scottrigby scottrigby added feature and removed refactor needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. labels Jan 14, 2026
MD-Mushfiqur123 pushed a commit to MD-Mushfiqur123/helm that referenced this pull request May 29, 2026
…rride

Non-standard build toolchains (Bazel) cannot use debug.ReadBuildInfo(),
so add -X ldflags variables (kubeClientVersionMajorOverride,
kubeClientVersionMinorOverride) that take precedence when set.

This partially reverts the approach from PR helm#31296, allowing Bazel builds
to specify the client-go version without relying on debug.BuildInfo.

Signed-off-by: Md Mushfiqur Rahim <[email protected]>
Signed-off-by: Developer <[email protected]>
MD-Mushfiqur123 pushed a commit to MD-Mushfiqur123/helm that referenced this pull request Jun 15, 2026
…rride

Non-standard build toolchains (Bazel) cannot use debug.ReadBuildInfo(),
so add -X ldflags variables (kubeClientVersionMajorOverride,
kubeClientVersionMinorOverride) that take precedence when set.

This partially reverts the approach from PR helm#31296, allowing Bazel builds
to specify the client-go version without relying on debug.BuildInfo.

Signed-off-by: MD-Mushfiqur123 <[email protected]>
MD-Mushfiqur123 pushed a commit to MD-Mushfiqur123/helm that referenced this pull request Jun 15, 2026
…rride

Non-standard build toolchains (Bazel) cannot use debug.ReadBuildInfo(),
so add -X ldflags variables (kubeClientVersionMajorOverride,
kubeClientVersionMinorOverride) that take precedence when set.

This partially reverts the approach from PR helm#31296, allowing Bazel builds
to specify the client-go version without relying on debug.BuildInfo.

Signed-off-by: MD-Mushfiqur123 <[email protected]>
MD-Mushfiqur123 added a commit to MD-Mushfiqur123/helm that referenced this pull request Jun 15, 2026
…rride

Non-standard build toolchains (Bazel) cannot use debug.ReadBuildInfo(),
so add -X ldflags variables (kubeClientVersionMajorOverride,
kubeClientVersionMinorOverride) that take precedence when set.

This partially reverts the approach from PR helm#31296, allowing Bazel builds
to specify the client-go version without relying on debug.BuildInfo.

Signed-off-by: MD-Mushfiqur123 <[email protected]>
MD-Mushfiqur123 added a commit to MD-Mushfiqur123/helm that referenced this pull request Jun 15, 2026
…rride

Non-standard build toolchains (Bazel) cannot use debug.ReadBuildInfo(),
so add -X ldflags variables (kubeClientVersionMajorOverride,
kubeClientVersionMinorOverride) that take precedence when set.

This partially reverts the approach from PR helm#31296, allowing Bazel builds
to specify the client-go version without relying on debug.BuildInfo.

Signed-off-by: MD-Mushfiqur123 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants