weaveworks / weave-gitops

Weave GitOps provides insights into your application deployments, and makes continuous delivery with GitOps easier to adopt and scale across your teams.
https://docs.gitops.weave.works/
Apache License 2.0
905 stars 151 forks source link

Fix `gitops check` #4158

Closed makkes closed 9 months ago

makkes commented 9 months ago

closes #4157

What changed?

  1. The gitops check command works again.
  2. The oldest Kubernetes version yielding a positive result is bumped to 1.26.0.

Why was this change made?

  1. The --short flag has been removed from kubectl version in 1.28 (https://github.com/kubernetes/kubernetes/blob/7fe31be11fbe9b44af262d5f5cffb1e73648aa96/CHANGELOG/CHANGELOG-1.28.md#deprecation) so the command obviously fails now.
  2. We state in our docs that we only support K8s releases that are supported upstream.

How was this change implemented?

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.

How did you validate the change?

Unit tests and manual runs.

Release notes

Documentation Changes

n/a