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: UnifiedControlPlaneImage string -> UseHyperKubeImage bool #70793

Merged
merged 1 commit into from
Nov 9, 2018

Conversation

rosti
Copy link
Contributor

@rosti rosti commented Nov 8, 2018

What type of PR is this?
/kind api-change

What this PR does / why we need it:

Up until now UnifiedControlPlaneImage existed as a string value as part of the ClusterConfiguration. This provided an override for the Kubernetes core component images with a single custom image. It is mostly used to override the control plane images with the hyperkube image. This saves both bandwidth and disk space on the control plane nodes.
Unfortunately, this specified an entire image string (complete with its prefix, image name and tag). This disables upgrades of setups that use hyperkube.
Therefore, to enable upgrades on hyperkube setups and to make configuration more convenient, the UnifiedControlPlaneImage option is replaced with a boolean option, called UseHyperKubeImage. If set to true, this option replaces the image name of any Kubernetes core components with hyperkube, thus allowing for upgrades and respecting the image repository and version, specified in the ClusterConfiguration.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Refs kubernetes/kubeadm#911

Special notes for your reviewer:

/cc @kubernetes/sig-cluster-lifecycle-pr-reviews
/area kubeadm
/assign @fabriziopandini
/assign @timothysc
/assign @luxas

Does this PR introduce a user-facing change?:

kubeadm: UnifiedControlPlaneImage is replaced by UseHyperKubeImage boolean value.

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 8, 2018
@k8s-ci-robot k8s-ci-robot added the sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. label Nov 8, 2018
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API area/kubeadm cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 8, 2018
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.

thanks @rosti
/priority important-soon

// used for all control plane components.
UnifiedControlPlaneImage string
// UseHyperKubeImage controls if hyperkube should be used for Kubernetes components instead of their respective separate images
UseHyperKubeImage bool
Copy link
Member

Choose a reason for hiding this comment

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

someone might decide to build a custom "unified control plane" image that is not called hyperkube.
in such a case they would have to name it "hyperkube" for kubeadm to be able to work with it.

this at least solves upgrade issues for us...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If some users override this with their own image, then it should be based on hyperkube. Hence tagging it appropriately and setting it up on their own repository is the way to go.
Definitely we should not allow users to put whatever image they see fit in here and the bool value is the best solution for me.

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Nov 8, 2018
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.

@rosti well done!
Only one small point to be addressed, then ready to go for me

@@ -103,6 +108,14 @@ func Convert_v1alpha3_ClusterConfiguration_To_kubeadm_ClusterConfiguration(in *C
return err
}

if len(in.UnifiedControlPlaneImage) == 0 {
out.UseHyperKubeImage = false
} else if strings.Contains(in.UnifiedControlPlaneImage, "/hyperkube:") {
Copy link
Member

Choose a reason for hiding this comment

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

This check is weak and can lead to unsupported behaviours:

What if the user is using a custom image repository? This will get switched to a different image repository
Same questions about image tag

However, from the other side I don't think we should make this check too complex, so I will be fine with whatever check we agree upon

@neolit123 @timothysc opinions?

Copy link
Member

Choose a reason for hiding this comment

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

the string "hypercube" has to be moved to constants.go.
the tag and repo conversation might be a bit too much, i think it's OK to have it like that.

we can also show a warning here too, right?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 9, 2018
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Nov 9, 2018
@rosti
Copy link
Contributor Author

rosti commented Nov 9, 2018

Added HyperKube constant and extended the check to print warning if there is a image repository or tag mismatch upon conversion.

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.

/lgtm
thanks for the update.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2018
return nil
}

if strings.Contains(in.UnifiedControlPlaneImage, "/"+constants.HyperKube+":") {
Copy link
Member

Choose a reason for hiding this comment

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

TBH I don't think this should be here. I think you should hard fail and force the user to adjust their config.


// start with core kubernetes images
if cfg.UseHyperKubeImage {
imgs = append(imgs, GetKubeControlPlaneImage("", cfg))
Copy link
Member

Choose a reason for hiding this comment

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

Why wouldn't this be the const for the hyperkube image?

if cfg.UnifiedControlPlaneImage != "" {
return cfg.UnifiedControlPlaneImage
actualImage := image
if cfg.UseHyperKubeImage {
Copy link
Member

Choose a reason for hiding this comment

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

If you change the line below I don't think this is necessary

Up until now UnifiedControlPlaneImage existed as a string value as part of the
ClusterConfiguration. This provided an override for the Kubernetes core
component images with a single custom image. It is mostly used to override the
control plane images with the hyperkube image. This saves both bandwith and
disk space on the control plane nodes.
Unfortunately, this specified an entire image string (complete with its prefix,
image name and tag). This disables upgrades of setups that use hyperkube.
Therefore, to enable upgrades on hyperkube setups and to make configuration
more convenient, the UnifiedControlPlaneImage option is replaced with a boolean
option, called UseHyperKubeImage. If set to true, this option replaces the
image name of any Kubernetes core components with hyperkube, thus allowing for
upgrades and respecting the image repository and version, specified in the
ClusterConfiguration.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 9, 2018
Copy link
Member

@timothysc timothysc left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rosti, timothysc

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 Nov 9, 2018
@rosti
Copy link
Contributor Author

rosti commented Nov 9, 2018

/test pull-kubernetes-verify
/test pull-kubernetes-e2e-kops-aws

@k8s-ci-robot k8s-ci-robot merged commit d90f868 into kubernetes:master Nov 9, 2018
ivan4th pushed a commit to ivan4th/kubeadm-dind-cluster that referenced this pull request Nov 14, 2018
Always use CoreDNS and remove the feature gate from config.
Add workaround for `unifiedControlPlaneImage` removal kubernetes/kubernetes#70793
Fixes kubernetes-retired#250
ivan4th pushed a commit to ivan4th/kubeadm-dind-cluster that referenced this pull request Nov 14, 2018
Always use CoreDNS and remove the feature gate from config.
Add workaround for `unifiedControlPlaneImage` removal kubernetes/kubernetes#70793
Fixes kubernetes-retired#250
ivan4th pushed a commit to ivan4th/kubeadm-dind-cluster that referenced this pull request Nov 14, 2018
Always use CoreDNS and remove the feature gate from config.
Add workaround for `unifiedControlPlaneImage` removal kubernetes/kubernetes#70793
Fixes kubernetes-retired#250
@rosti rosti deleted the use-hyperkube branch November 22, 2018 15:24
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/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. 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.

None yet

6 participants