kubernetes-sigs / cluster-api

Home for Cluster API, a subproject of sig-cluster-lifecycle
https://cluster-api.sigs.k8s.io
Apache License 2.0
3.57k stars 1.31k forks source link

clusterctl version check #3466

Closed wfernandes closed 4 years ago

wfernandes commented 4 years ago

User Story

As a developer/user I would like to ensure that I'm using the latest version of clusterctl so that I don't run into unintended side effects.

Detailed Description

For example, when providers started using envsubst style vars (${var:=default}) in their templates, older versions of clusterctl would error out since it couldn't process these variables.

It would be nice to have something like the github cli where it checks if there are newer versions available.

$ gh
Work seamlessly with GitHub from the command line.
...<snip>...
A new release of gh is available: 0.10.0 → v0.10.1
https://github.com/cli/cli/releases/tag/v0.10.1

This solution would work since clusterctl is being shipped as part of CAPI releases. The output below is from a released version of clusterctl (v0.3.8)

$ ./clusterctl-darwin-amd64 version
clusterctl version: &version.Info{Major:"0", Minor:"3", GitVersion:"v0.3.8", GitCommit:"9e4e82aabd2dfe7a52ebd0b7d6b802a9be4ff93d", GitTreeState:"clean", BuildDate:"2020-07-31T20:50:54Z", GoVersion:"go1.13.14", Compiler:"gc", Platform:"darwin/amd64"}

Anything else you would like to add:

As extra credit, if clusterctl has a development version (v0.3.8 vs v0.3.8-24-76a9f1a2ce37cd), it can let the user know if there are newer commits to CAPI main branch.

$ ./dev-clusterctl version
clusterctl version: &version.Info{Major:"0", Minor:"3", GitVersion:"v0.3.8-24-76a9f1a2ce37cd", GitCommit:"76a9f1a2ce37cda2db6f1d137552d2b4c33a10dd", GitTreeState:"clean", BuildDate:"2020-08-06T22:08:53Z", GoVersion:"go1.13.14", Compiler:"gc", Platform:"darwin/amd64"}

This would mitigate recent issues regarding the CAPV pre-release. That is, clusterctl was updated with metadata for CAPV but older versions of clusterctl didn't know about it. However, this would cater specifically to the developer persona.

/kind feature /area clusterctl

vincepri commented 4 years ago

Let's do this please! It's super important, any idea if we can get this done in v1alpha3?

wfernandes commented 4 years ago

I can work on this next week. /assign

vincepri commented 4 years ago

/milestone v0.3.9

wfernandes commented 4 years ago

/lifecycle active