kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.86k stars 921 forks source link

kubectl version --error-on-version-mismatch #1648

Open mblaschke-daimlertruck opened 2 months ago

mblaschke-daimlertruck commented 2 months ago

What would you like to be added?

add an flag for kubectl version which fails if the client version exceeds the supported minor version skew of +/-1

--warnings-as-errors isn't working as this only treats warnings as errors when received from the server. the kubectl version warning is a client side warning.

on the other side --match-server-version is too strict.

or add kubectl check-support or something similar

Why is this needed?

avoid running unsupported kubectl versions

k8s-ci-robot commented 2 months ago

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
neolit123 commented 2 months ago

/sig cli

ardaguclu commented 2 months ago

Doesn't this exist https://github.com/kubernetes/kubernetes/blob/32077a1c008a59d797e4f4ae8717a0dbbe3c3db7/staging/src/k8s.io/kubectl/pkg/cmd/version/version.go#L164-L167 prints warning if https://github.com/kubernetes/kubernetes/blob/32077a1c008a59d797e4f4ae8717a0dbbe3c3db7/staging/src/k8s.io/kubectl/pkg/cmd/version/skew_warning.go#L34-L54 detects skew?

Jefftree commented 2 months ago

Is the ask that there should be an option for kubectl to return an error instead of warning if the skew is greater than 1?

ardaguclu commented 1 month ago

Is the ask that there should be an option for kubectl to return an error instead of warning if the skew is greater than 1?

Yes, that is correct. I missed that part.

/transfer kubectl

mpuckett159 commented 1 month ago

/triage accepted /good-first-issue It seems like there were a few plugins to address this in the past that have gone missing.

k8s-ci-robot commented 1 month ago

@mpuckett159: This request has been marked as suitable for new contributors.

Guidelines

Please ensure that the issue body includes answers to the following questions:

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-good-first-issue command.

In response to [this](https://github.com/kubernetes/kubectl/issues/1648): >/triage accepted >/good-first-issue >It seems like there were a few plugins to address this in the past that have gone missing. Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
omerap12 commented 1 month ago

/assign