-
Notifications
You must be signed in to change notification settings - Fork 38.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose the version of Kustomize that Kubectl embeds #108817
Conversation
@KnVerey: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest |
/hold I think this approach might be problematic for CLIs that embed kubectl (and by extension kubectl kustomize). At minimum, I think (Note: I tried |
3dba87f
to
d1e805d
Compare
d1e805d
to
dff9b78
Compare
/test pull-kubernetes-node-e2e-containerd |
1 similar comment
/test pull-kubernetes-node-e2e-containerd |
/lgtm |
1e7c1db
to
90e4c10
Compare
90e4c10
to
d9c6980
Compare
@@ -328,12 +328,16 @@ kube::test::if_has_string() { | |||
local match=$2 | |||
|
|||
if grep -q "${match}" <<< "${message}"; then | |||
echo -n "${green}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When running the version tests, I noticed that some of the helpers it uses had nice colorization and others did not. This is in a separate commit, and I can easily remove it from the PR if it is unwanted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, those are usually handy :) Thank you!
) | ||
|
||
clientVersion := version.Get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got rid of the separate serverVersion and clientVersion variables in favour of having all usages rely on the same copy of the data, i.e. the one in versionInfo
hack/lib/version.sh
Outdated
@@ -26,6 +26,7 @@ | |||
# KUBE_GIT_VERSION - "vX.Y" used to indicate the last release version. | |||
# KUBE_GIT_MAJOR - The major part of the version | |||
# KUBE_GIT_MINOR - The minor component of the version | |||
# KUSTOMIZE_VERSION - The semantic version of kustomize embedded in kubectl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd really like to avoid this plumbing here, since the compiled in module info is in reach with go 1.18 and this build script services many binaries, not just kubectl
d9c6980
to
44e63e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
@@ -328,12 +328,16 @@ kube::test::if_has_string() { | |||
local match=$2 | |||
|
|||
if grep -q "${match}" <<< "${message}"; then | |||
echo -n "${green}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, those are usually handy :) Thank you!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: KnVerey, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
great to see this in the version output. It is a frequently asked question. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes kubernetes-sigs/kustomize#1424. This is the top feature request on Kustomize by upvotes and has also been requested directly on the kubectl and oc repos.
/cc @natasha41575
Special notes for your reviewer:
Updated to match the implementation agreed to at the Mar 23 SIG CLI meeting
This PR extracts the current Kustomize version from the root go.mod and sets an ldflag that embeds the version into Kustomize's Provenance code (the same code that drives standalone
kustomize version
). It then uses that information to expose Kustomize version info inkubectl version
. It also adds a sanity check to the Kustomize update script, ensuring that the version output matches what the update executor intended.Alternatives considered:
kubectl version
: [ALTERNATIVE] Expose the version of Kustomize that Kubectl embeds #108947kubectl version --kustomize
to expose this info specifically. Would be clean to implement, but not consistent with anything else I'm aware of, and probably unintuitive.kubectl kustomize version
(1e7c1db). It was pointed out at today's SIG meeting that the version also applies tokubectl apply -k
, not justkubectl kustomize
.Output
Expand to show output samples
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: