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

gitops check failing after kubectl --short flag deprecation #4157

Closed mjtrangoni closed 9 months ago

mjtrangoni commented 9 months ago

Describe the bug

Running gitops check return exit status 1 instead of skipping/handling the error.

Environment

gitops version
Current Version: 0.37.0
GitCommit: 3f850ced58c9fe9d593807e299058e0e06c735eb
BuildTime: 2023-11-22T13:24:19Z
Branch: releases/v0.37.0
 flux -v
flux version 2.1.2
kubectl version
Client Version: v1.28.4
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.3+k3s2

To Reproduce Steps to reproduce the behavior:

  1. Having a running flux and gitops installation
kubectl get po -n flux-system
NAME                                           READY   STATUS    RESTARTS   AGE
helm-controller-5f964c6579-kz2vg               1/1     Running   0          2d16h
kustomize-controller-9c588946c-nhrvf           1/1     Running   0          2d16h
notification-controller-76dc5d768-l8hqh        1/1     Running   0          2d16h
source-controller-6c49485888-jz5t6             1/1     Running   0          2d16h
image-reflector-controller-84c449dc57-vpqqj    1/1     Running   0          2d12h
image-automation-controller-7764f8957c-l7xll   1/1     Running   0          2d12h
ww-gitops-weave-gitops-5fcfdb67b4-6x2fg        1/1     Running   0          22h
  1. Run gitops check
gitops check
Error: unable to get kubernetes version: exit status 1

Expected behavior

To run without errors, maybe checking kubectl version compatibility?

Actual Behavior

gitops check
Error: unable to get kubernetes version: exit status 1

Additional Context (screenshots, logs, etc)

It seems this is related to kubectl --short flag used in this project, see here.

As it says in kubectl's CHANGELOG.md, --short is deprecated and changed kubectl version default output to be identical to what kubectl version --short printed

bigkevmcd commented 9 months ago

@makkes wanna take a look? :-)

makkes commented 9 months ago

I'm on it.

makkes commented 9 months ago

@mjtrangoni this should be fixed in the 0.38.0 CLI which we released today. Mind giving it a try?

mjtrangoni commented 9 months ago

@makkes thank you! It works now, see

 gitops version
Current Version: 0.38.0
GitCommit: 693dafd494f1027c4bc740be9ffef98e21cdcfb6
BuildTime: 2023-12-06T15:43:30Z
Branch: releases/v0.38.0
 gitops check
✔ Kubernetes 1.28.4+k3s1 >=1.26

Not related with this issue but I just wonder, the command says, Validate flux and kubernetes compatibility but the output is only about kubernetes. Is it working as intended?