Skip to content
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

Conversation

bart0sh
Copy link
Contributor

@bart0sh bart0sh commented Dec 11, 2018

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?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Dec 11, 2018
@bart0sh bart0sh force-pushed the PR0045-kubeadm-1260-simplify-minimum-kubernetes-version-bumps branch from 4379c6f to 0f1f856 Compare December 11, 2018 10:41
Copy link
Contributor

@rosti rosti left a 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.

cmd/kubeadm/app/apis/kubeadm/v1alpha3/conversion_test.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/cmd/phases/util_test.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/componentconfigs/config_test.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/util/version_test.go Outdated Show resolved Hide resolved
@@ -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"
Copy link
Contributor

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).

Copy link
Contributor Author

@bart0sh bart0sh Dec 11, 2018

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?

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, will do

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rosti

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",

Copy link
Contributor

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.

@rosti
Copy link
Contributor

rosti commented Dec 11, 2018

/priority important-longterm
/assign @neolit123

@k8s-ci-robot k8s-ci-robot added priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Dec 11, 2018
@bart0sh bart0sh force-pushed the PR0045-kubeadm-1260-simplify-minimum-kubernetes-version-bumps branch from 0f1f856 to 8b2bf33 Compare December 11, 2018 14:12
Copy link
Member

@neolit123 neolit123 left a 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

@neolit123
Copy link
Member

/approve
/hold
/assign @fabriziopandini
for another set of eyes.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 11, 2018
@bart0sh bart0sh force-pushed the PR0045-kubeadm-1260-simplify-minimum-kubernetes-version-bumps branch from 8b2bf33 to 9e8c9c5 Compare December 11, 2018 15:07
@rosti
Copy link
Contributor

rosti commented Dec 13, 2018

/test pull-kubernetes-godeps

2 similar comments
@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 13, 2018

/test pull-kubernetes-godeps

@cblecker
Copy link
Member

/test pull-kubernetes-godeps

Copy link
Contributor

@rosti rosti left a 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:

args: "--kubernetes-version=1.12.0",

Then we are ready to LGTM the 1.12.x portion.

@bart0sh bart0sh force-pushed the PR0045-kubeadm-1260-simplify-minimum-kubernetes-version-bumps branch from 9e8c9c5 to 5d1cdfd Compare December 14, 2018 15:02
@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 14, 2018

@rosti Thank you for the review. Updated. lgtm, please as I'm concerned about possible conflicts.

@bart0sh bart0sh force-pushed the PR0045-kubeadm-1260-simplify-minimum-kubernetes-version-bumps branch 2 times, most recently from 7af175b to c6f5cca Compare December 19, 2018 15:13
@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 19, 2018

@neolit123, @fabriziopandini, @rosti I've replaced string concatenations with using With* methods as @fabriziopandini suggested. Please, review again. Thanks.

@neolit123
Copy link
Member

@bart0sh
the staging/src/k8s.io/apimachinery/pkg/util/version/version.go helper changes LGTM, but FYI this can drag this PR a lot in time as it enters the scope of another SIG.

Copy link
Contributor

@rosti rosti left a 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

cmd/kubeadm/app/cmd/alpha/kubelet.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/cmd/alpha/kubelet.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/cmd/config_test.go Outdated Show resolved Hide resolved
cmd/kubeadm/test/util.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 19, 2018
@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 19, 2018

@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?

@bart0sh bart0sh force-pushed the PR0045-kubeadm-1260-simplify-minimum-kubernetes-version-bumps branch from c6f5cca to f4e0eeb Compare December 19, 2018 17:37
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 19, 2018
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.
@bart0sh bart0sh force-pushed the PR0045-kubeadm-1260-simplify-minimum-kubernetes-version-bumps branch from f4e0eeb to b40018d Compare December 19, 2018 18:41
Copy link
Member

@fabriziopandini fabriziopandini left a 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

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 20, 2018
@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 20, 2018

@fabriziopandini @neolit123 Is anything required from me? Should I contact someone or should we assign someone from sig-api-machinery to this PR?

@neolit123
Copy link
Member

@bart0sh the likelyhood of this making it in before NY is minimal due to the api-machinery change.

/assign @caesarxuchao

@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 20, 2018

@neolit123 so, should we wait or use previous version of this PR and make separate PR for api change as I proposed earlier?

@neolit123
Copy link
Member

@bart0sh

as per @fabriziopandini 's comment:

Let's wait for sig-api-machinery opinion

kubeadm alpha phase kubelet config download --kubelet-version v1.12.0
`)
kubeadm alpha phase kubelet config download --kubelet-version %s
`, constants.MinimumKubeletVersion))
Copy link
Member

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?

Copy link
Member

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

Copy link
Member

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.

Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor

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.

@caesarxuchao
Copy link
Member

The apimachinery change lgtm.

/approve

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 21, 2018
@rosti
Copy link
Contributor

rosti commented Dec 21, 2018

I think, that we can safely cancel the hold now and let this merge.
@neolit123 @fabriziopandini WDYT?

@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 21, 2018

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.

@neolit123
Copy link
Member

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 21, 2018
@bart0sh
Copy link
Contributor Author

bart0sh commented Dec 21, 2018

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 190f6d8 into kubernetes:master Dec 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants