-
Notifications
You must be signed in to change notification settings - Fork 39.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kubeadm: simplify minimum Kubernetes version bumps #71946
kubeadm: simplify minimum Kubernetes version bumps #71946
Conversation
4379c6f
to
0f1f856
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this up @bart0sh !
We can cover a few more cases with this PR (all v1.12.x
cases).
A few of the spots don't depend on the current version. It's OK to keep them wired to a string as that may make code more readable.
@@ -334,6 +334,9 @@ const ( | |||
// CoreDNSVersion is the version of CoreDNS to be deployed if it is used | |||
CoreDNSVersion = "1.2.6" | |||
|
|||
// MinimumKubernetesVersion specifies minimum Kubernetes version supported by kubeadm | |||
MinimumKubernetesVersion = "v1.12.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably trim this to v1.12
, so we can cover more cases with this PR (like v1.12.5
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to do it in a follow-up PR as this one is already big and could cause rebase conflicts if not merged soon. wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to have it in the same PR, IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, will do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but i wonder what other cases we need to do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understood the idea. I don't understand why it has to be implemented as one PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my vote would be for:
MinimumKubernetesVersionWithoutPatch = ...
MinimumKubernetesVersion = ...
in terms of the example change in:
https://github.com/kubernetes/kubernetes/pull/68649/files
we might as well add more constants for the sake of making it more easy.
e.g. Minor + 1
that's my 2c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about having all changes, that involve 1.12.x
in a single PR (currently we replaced only 1.12.0
and left some 1.12.x
stuff, where x != 0, for another PR).
I am OK with moving 1.13
and 1.14
stuff in other PR(s). That way it will be more reviewable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currently we replaced only 1.12.0 and left some 1.12.x stuff
Nope, almost everything is covered with MinimumKubernetesVersion and MinimumKubernetesVersionWithoutPatch. You probably missed my updates.
Below is what's left currently. Can you point me out what of this should be included into this PR?
$ grep -r v1.12 . | grep -v ':\s*\/\/'
Binary file ./kubeadm matches
./app/constants/constants.go: MinimumKubernetesVersionWithoutPatch = "v1.12"
Binary file ./app/cmd/phases/phases.test matches
./app/cmd/phases/util_test.go: input: "v1.12.0",
./app/cmd/phases/util_test.go: output: "v1.12.0",
./app/cmd/config_test.go: ":v1.12.1",
./app/cmd/config_test.go: kubernetesVersion: v1.12.1
./app/componentconfigs/config_test.go: k8sVersion := version.MustParseGeneric("v1.12.0")
./app/phases/uploadconfig/uploadconfig_test.go: KubernetesVersion: "v1.12.10",
Binary file ./app/util/upgrade/upgrade.test matches
./app/util/config/testdata/conversion/master/v1alpha3.yaml:kubernetesVersion: v1.12.2
./app/util/config/testdata/conversion/master/v1alpha3.yaml:unifiedControlPlaneImage: "k8s.gcr.io/hyperkube:v1.12.2"
./app/util/config/testdata/conversion/master/v1beta1.yaml:kubernetesVersion: v1.12.2
./app/util/config/testdata/conversion/master/internal.yaml:KubernetesVersion: v1.12.2
./app/util/config/common.go: "kubeadm.k8s.io/v1alpha2": "v1.12",
./app/util/version_test.go: remoteVersion: "v1.12.0",
./app/util/version_test.go: remoteVersion: "v1.12.1",
./app/util/version_test.go: output: "v1.12.1",
./app/util/version_test.go: clientVersion: "v1.12.0",
./app/util/version_test.go: remoteVersion: "v1.12.0",
./app/util/etcd/etcd.go: klog.V(1).Infoln("etcd manifest created by kubeadm v1.12")
./app/apis/kubeadm/v1alpha3/conversion_test.go: KubernetesVersion: "v1.12.2",
./app/apis/kubeadm/v1alpha3/conversion_test.go: UnifiedControlPlaneImage: "k8s.gcr.io/hyperkube:v1.12.2",
./app/apis/kubeadm/v1alpha3/conversion_test.go: KubernetesVersion: "v1.12.0",
./app/apis/kubeadm/v1alpha3/conversion_test.go: UnifiedControlPlaneImage: "k8s.gcr.io/hyperkube:v1.12.2",
./app/apis/kubeadm/v1alpha3/conversion_test.go: KubernetesVersion: "v1.12.2",
./app/apis/kubeadm/v1alpha3/conversion_test.go: UnifiedControlPlaneImage: "k8s.gcr.io/hyperkube:v1.12.2",
./app/apis/kubeadm/v1alpha3/conversion_test.go: KubernetesVersion: "v1.12.2",
./app/apis/kubeadm/v1alpha3/conversion_test.go: UnifiedControlPlaneImage: "k8s.gcr.io/otherimage:v1.12.2",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @bart0sh , I missed the updates. Will take a look.
/priority important-longterm |
0f1f856
to
8b2bf33
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this is good.
thanks @bart0sh
/approve |
8b2bf33
to
9e8c9c5
Compare
/test pull-kubernetes-godeps |
2 similar comments
/test pull-kubernetes-godeps |
/test pull-kubernetes-godeps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bart0sh ! Just a single one missing:
kubernetes/cmd/kubeadm/test/cmd/init_test.go
Line 105 in 1c04caa
args: "--kubernetes-version=1.12.0", |
Then we are ready to LGTM the 1.12.x portion.
9e8c9c5
to
5d1cdfd
Compare
@rosti Thank you for the review. Updated. lgtm, please as I'm concerned about possible conflicts. |
7af175b
to
c6f5cca
Compare
@neolit123, @fabriziopandini, @rosti I've replaced string concatenations with using With* methods as @fabriziopandini suggested. Please, review again. Thanks. |
@bart0sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update @bart0sh !
Actually I like this approach better, but as @neolit123 we need to sell the idea to SIG API Machinery and that could take time or even not happen at all.
A few unnecessary String()
calls can be omitted, but I can live with them.
I give you LGTM on the kubeadm side of things.
/lgtm
@rosti, @neolit123 Thank you for the review! As for the change of Version API, I tried to avoid it in the previous version of this patch. Then @fabriziopandini suggested this approach and I reworked the patch. I still have previous version, so please suggest which way we want to go. In my opinion we should go faster way(previous patch) and submit Version API change as a separate PR. When/if it's accepted I'll be happy to submit new PR for kubeadm code that uses changed API. Thoughts? |
c6f5cca
to
f4e0eeb
Compare
Added WithMajor, WithMinor, WithPatch and WithPreRelease methods to the Version API. These methods return copy of the Version object with one changed property(Major, Minor, Patch or preRelease).
Replaced hardcoded "v0.12.0" strings with MinimumControlPlaneVersion and MinimumKubeletVersion global variables. This should help with a regular release version bumps.
f4e0eeb
to
b40018d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bart0sh thanks for this news version!
/approve
/lgtm
Let's wait for sig-api-machinery opinion
@fabriziopandini @neolit123 Is anything required from me? Should I contact someone or should we assign someone from sig-api-machinery to this PR? |
@bart0sh the likelyhood of this making it in before NY is minimal due to the api-machinery change. /assign @caesarxuchao |
@neolit123 so, should we wait or use previous version of this PR and make separate PR for api change as I proposed earlier? |
as per @fabriziopandini 's comment:
|
kubeadm alpha phase kubelet config download --kubelet-version v1.12.0 | ||
`) | ||
kubeadm alpha phase kubelet config download --kubelet-version %s | ||
`, constants.MinimumKubeletVersion)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabriziopandini @rosti @bart0sh @rojkov
instead of the usage of this constant here i think we should just have a CurrentKubernetesMinorVersion
(or a similar naming) that is v1.13.0
.
we can then use this version in such CLI examples and also have it as the current version for unit tests.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would that Current...
constant require manual updating on every release? that does not seem like a good idea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already bump these on each release:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/app/constants/constants.go#L380-L383
in an ideal world:
- an app runtime should fail if the build system did not add versioning to the binary.
- skew versions and current versions should be obtained in variables based of the client version.
- unit tests should not be bound to internet or client versioning functionality.
- a default version should not be fetched from the internet by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering that this PR IMO is already achieving the goals to simplify version bumps, which was the original scope of the underlying issue, I'm not sure it is a good idea to conflate in this PR other goals like fixing version discovery for unit test or shifting to a dynamic approach for handling version skew policy. Might be follow up PRs are more appropriate in this case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then again, using constants.MinimumKubeletVersion
as an example in the CLI might introduce problems. this is a version that is currently 1.12 instead of 1.13.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of CurrentKubernetesVersion
is good one, but outside of the scope of this PR. It can be done in some of the followup PRs though. For a start we can bump this version manually at the end of the release cycle, but ideally this should be done automatically by the build system.
The apimachinery change lgtm. /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bart0sh, caesarxuchao, fabriziopandini, neolit123 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I think, that we can safely cancel the hold now and let this merge. |
in my opinion it's ok to merge it. If there are any issues with it I'll fix it. It's reviewed and approved by many people already. |
/hold cancel |
/retest |
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Replaced hardcoded "v0.12.0" strings with new
MinimalKubernetesVersion constant.
This should help with a regular release version bumps.
Special notes for your reviewer:
This is a first step towards fixing kubernetes/kubeadm#1260
Does this PR introduce a user-facing change?: