Conversation
bigkevmcd
approved these changes
Dec 6, 2023
Contributor
bigkevmcd
left a comment
There was a problem hiding this comment.
I'm ok with this, it works when the previous version doesn't 😄
| } | ||
|
|
||
| return semver.NewVersion(version) | ||
| return fmt.Sprintf("✔ Kubernetes %s %s", sv.String(), kubernetesConstraints), nil |
Contributor
There was a problem hiding this comment.
Minor here, you don't need to use sv.String() just using sv will get .String() called on it by %s.
Contributor
There was a problem hiding this comment.
I appreciate that it's not in this PR, but the kubernetesContraints looks overly broad, I am not sure that Flux supports those versions (and they're not supported upstream)?
bigkevmcd
reviewed
Dec 6, 2023
|
|
||
| const ( | ||
| kubernetesConstraints = ">=1.20.6-0" | ||
| kubernetesConstraints = ">=1.26" |
bigkevmcd
approved these changes
Dec 6, 2023
Contributor
bigkevmcd
left a comment
There was a problem hiding this comment.
Thanks for fixing the K8s bits!
added 2 commits
December 6, 2023 14:56
The `--short` flag has been removed from `kubectl version` in 1.28 (https://github.com/kubernetes/kubernetes/blob/7fe31be11fbe9b44af262d5f5cffb1e73648aa96/CHANGELOG/CHANGELOG-1.28.md#L1718) so the command obviously fails now. This commit changes the behaviour of the `gitops check` command to create a client-go DiscoveryClient and use that to retrieve the server version. That way we don't have to rely on forking a `kubectl` process and the output being consistent. The code is now much cleaner, easier to read and properly tested. closes #4157 Signed-off-by: Max Jonas Werner <mail@makk.es>
The support policy of Weave GitOps is to "test Weave GitOps against the latest supported Kubernetes releases" which means that only 1.26, 1.27 and 1.28 are supported at this point. This change doesn't prevent Weave GitOps from being run on older versions of Kubernetes as the constraint is only used by the `gitops check` command which is purely informational. Signed-off-by: Max Jonas Werner <mail@makk.es>
Merged
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.
closes #4157
What changed?
gitops checkcommand works again.Why was this change made?
--shortflag has been removed fromkubectl versionin 1.28 (https://github.com/kubernetes/kubernetes/blob/7fe31be11fbe9b44af262d5f5cffb1e73648aa96/CHANGELOG/CHANGELOG-1.28.md#deprecation) so the command obviously fails now.How was this change implemented?
This commit changes the behaviour of the
gitops checkcommand to create a client-go DiscoveryClient and use that to retrieve the server version. That way we don't have to rely on forking akubectlprocess and the output being consistent.The code is now much cleaner, easier to read and properly tested.
How did you validate the change?
Unit tests and manual runs.
Release notes
gitops checkcommand with most recent version ofkubectl.gitops checkwill only yield a positive result if the Kubernetes version is at least 1.26.0.Documentation Changes
n/a