kubernetes / client-go

Go client for Kubernetes.
Apache License 2.0
8.78k stars 2.9k forks source link

Provide non-development module versions #1287

Closed sfc-gh-kleonhard closed 11 months ago

sfc-gh-kleonhard commented 11 months ago

Hey folks! I noticed that my go.mod files always end up referencing the alpha version of the k8s.io/api, k8s.io/api-machinery and k8s.io/client-go modules, even when using go get in a new project: go get k8s.io/api: v0.28.0-alpha.0, for example.

This occurs because the modules provide only "in-development" versions. I.e. versions with a major-version of 0. https://go.dev/doc/modules/version-numbers#in-development

It's possible to reference one of the non-alpha versions but this works poorly with common upgrade flows: go get -u ./... which push the version back to the alpha one. In other words, go get will change the manually set, non-alpha version back to the latest alpha version, because it's the latest.

Can you provide a v1 major version of these modules or is the API still unstable that it warrants remaining "in-development"?

liggitt commented 11 months ago

The go api is not guaranteed, so v0 is still appropriate.

Separately, I'm surprised go get -u is selecting prerelease versions (v0 or not)… it should be selecting the "latest" version, not prerelease ones (see the "latest" version shown at https://pkg.go.dev/k8s.io/client-go, for example). Go docs say release versions are always preferred to prerelease ones.

If you have a reproducer I'd recommend filing an issue in the go repo.

sfc-gh-kleonhard commented 11 months ago

Thanks for the quick response, Jordan! go get k8s.io/client-go@latest works fine, of course. My best guess is that one of my dependencies is using the alpha version.