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: Reduce the usage of InitConfiguration #72111

Merged
merged 1 commit into from
Jan 29, 2019

Conversation

rosti
Copy link
Contributor

@rosti rosti commented Dec 17, 2018

What type of PR is this?
/kind cleanup

What this PR does / why we need it:

Back in the v1alpha1 we had a single flat MasterConfiguration and whenever some function needed something from it, it took a pointer to MasterConfiguration argument. In v1beta1 this configuration is no longer flat, but composite with InitConfiguration bearing the closest resemblance to the old MasterConfiguration. Most of kubeadm still works with InitConfiguration even though most functions need only a portion or even a single field from the config.
This change strives to reduce the unnecessary usage of InitConfiguration. The approach taken here is to switch APIs, that take InitConfiguration to some other type of argument (usually ClusterConfiguration).

Which issue(s) this PR fixes:

Refs kubernetes/kubeadm#1084

Special notes for your reviewer:

This PR is marked as a WIP as I want some feedback on the scope of changes and weather it is too broad.
The commits aren't squashed yet, as it would be easier to drop something upon feedback if needed. Also, it might be a lot easier to review this on a per commit basis (rather than as a whole).

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

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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Dec 17, 2018
@k8s-ci-robot k8s-ci-robot added sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. area/kubeadm size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 17, 2018
@rosti
Copy link
Contributor Author

rosti commented Dec 17, 2018

/priority backlog

@k8s-ci-robot k8s-ci-robot added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Dec 17, 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
did a pass over the diff and the change LGTM.

/lgtm
/assign @fabriziopandini
for approve.

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

@yagonobre yagonobre 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 @rosti

@yagonobre
Copy link
Member

/test pull-kubernetes-e2e-kops-aws

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 💯for this cleanup!
I have left some minor comments but this IMO can merge as soon as you remove WIP.

cmd/kubeadm/app/phases/kubelet/config.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/phases/controlplane/manifests.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/util/endpoint.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/util/endpoint.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/util/endpoint.go Outdated Show resolved Hide resolved
cmd/kubeadm/app/phases/etcd/local.go Outdated Show resolved Hide resolved
@@ -973,11 +973,11 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.JoinConfigura
}

// RunOptionalJoinNodeChecks executes all individual, applicable to node configuration dependant checks
func RunOptionalJoinNodeChecks(execer utilsexec.Interface, initCfg *kubeadmapi.InitConfiguration, ignorePreflightErrors sets.String) error {
func RunOptionalJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.ClusterConfiguration, ignorePreflightErrors sets.String) error {
Copy link
Member

Choose a reason for hiding this comment

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

what about changing ClusterConfiguration to KubeProxy configuration only?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have a couple of options for this one:

  1. Keep the func named RunOptionalJoinNodeChecks and use ClusterConfiguration.
  2. Rename the func to RunOptionalKubeProxyChecks and pass KubeProxy configuration.

I don't think it's expected and acceptable for the func to be named RunOptionalJoinNodeChecks and to accept KubeProxy configuration directly. This is unexpected for the reader of the code and is bound to raise questions.

Copy link
Member

Choose a reason for hiding this comment

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

we can keep this as is, as we might decide to add more checks in the function.
hopefully not, though.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 29, 2018
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 24, 2019
@rosti
Copy link
Contributor Author

rosti commented Jan 24, 2019

One of the commits (a9fd78dc49a) can probably be moved into a separate PR. Though I am not sure about this and it probably belongs here.

@timothysc
Copy link
Member

@rosti - please squash your commits.

@rosti
Copy link
Contributor Author

rosti commented Jan 25, 2019

@timothysc will do it, but just before I pull together the final version of things. Waiting for @fabriziopandini to review it.

@fabriziopandini
Copy link
Member

@rosti green light for me! let's get this in as soon as possible
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Jan 25, 2019
For historical reasons InitConfiguration is used almost everywhere in kubeadm
as a carrier of various configuration components such as ClusterConfiguration,
local API server endpoint, node registration settings, etc.

Since v1alpha2, InitConfiguration is meant to be used solely as a way to supply
the kubeadm init configuration from a config file. Its usage outside of this
context is caused by technical dept, it's clunky and requires hacks to fetch a
working InitConfiguration from the cluster (as it's not stored in the config
map in its entirety).

This change is a small step towards removing all unnecessary usages of
InitConfiguration. It reduces its usage by replacing it in some places with
some of the following:

- ClusterConfiguration only.
- APIEndpoint (as local API server endpoint).
- NodeRegistrationOptions only.
- Some combinations of the above types, or if single fields from them are used,
  only those field.

Signed-off-by: Rostislav M. Georgiev <rostislavg@vmware.com>
@rosti rosti changed the title [WIP] kubeadm: Reduce the usage of InitConfiguration kubeadm: Reduce the usage of InitConfiguration Jan 28, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 28, 2019
@rosti
Copy link
Contributor Author

rosti commented Jan 28, 2019

Commits squashed, WIP tag removed, this is finally ready.

@neolit123
Copy link
Member

/lgtm
/hold
/retest

@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. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Jan 28, 2019
@rosti
Copy link
Contributor Author

rosti commented Jan 28, 2019

/test pull-kubernetes-node-e2e

@neolit123
Copy link
Member

/retest

@rosti
Copy link
Contributor Author

rosti commented Jan 29, 2019

/test pull-kubernetes-node-e2e

@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 Jan 29, 2019
@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 or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit b8b689a into kubernetes:master Jan 29, 2019
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/backlog Higher priority than priority/awaiting-more-evidence. release-note-none Denotes a PR that doesn't merit a release note. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants