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 config add support for more than one APIEndpoint #67832

Merged

Conversation

fabriziopandini
Copy link
Member

@fabriziopandini fabriziopandini commented Aug 24, 2018

What this PR does / why we need it:
This PR completes the changes in kubeadm for management of more than one control plane instances introducing the possibility to configure more than one APIEndpoints

Which issue(s) this PR fixes :
refs kubernetes/kubeadm#911, refs kubernetes/kubeadm#963

Special notes for your reviewer:
Depends on:

Release note:

kubeadm: The kubeadm configuration now support definition of more than one control plane instances with their own APIEndpoint. The APIEndpoint for the "bootstrap" control plane instance should be defined using `InitConfiguration.APIEndpoint`, while the APIEndpoints for additional control plane instances should be added using `JoinConfiguration.APIEndpoint`.  

/cc @kubernetes/sig-cluster-lifecycle-pr-reviews
/sig cluster-lifecycle
/area kubeadm
/kind api-change
/kind enhancement
/assign @luxas
/assign @timothysc
/cc @chuckha @rosti @neolit123 @liztio

@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 Aug 24, 2018
@k8s-ci-robot k8s-ci-robot added the sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. label Aug 24, 2018
@k8s-ci-robot k8s-ci-robot added area/kubeadm size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Aug 24, 2018
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 24, 2018
@fabriziopandini
Copy link
Member Author

/hold
until #67830 merge

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 24, 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.

This doesn't look right.

Also perhaps I'm missing the [] or map

// API server will be installed only on nodes hosting an additional control plane instance.
AdvertiseAddress string
// APIEndpoint represents the endpoint of the instance of the API server eventually to be deployed on this node.
APIEndpoint APIEndpoint
Copy link
Member

Choose a reason for hiding this comment

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

The Naming is confusing here.

The APIEndpoint struct has an APIEndpoint member.

Copy link
Member Author

Choose a reason for hiding this comment

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

@timothysc Sorry but I don't understand you comment 😕

APIEndpoint struct has two attributes, AdvertiseAddress and BindPort:

Here we have an attribute that has the same name of its type. is that the thing you find confusing? Do you prefer naming the struct APIEndpointConfiguration

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, the way github collapsed this changeset made me misinterpret this. I expanded it looks ok.

Copy link
Member Author

@fabriziopandini fabriziopandini Aug 24, 2018

Choose a reason for hiding this comment

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

Or... are you looking for the "status" we discussed at the end of the call yesterday?

If this is the case, please consider that this PR implements only the "spec", while the status will be implemented the next PR (in the form of map[bindaddress]APIEndoint, but I'm figuring out details right now)

Copy link
Member

Choose a reason for hiding this comment

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

map[bindaddress]APIEndoint

i though more about this. we ideally need to map against the address the user provides instead of always defaulting to the address of the network interface, because we do have --apiserver-advertise-address.

if i understand this correctly this might result in an interesting situation, but i guess we can comment more in the next PR. :\

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 a lot @fabriziopandini
added some small comments LGTM!

},
APIEndpoint: kubeadmapiv1alpha3.APIEndpoint{
// GetAPIServerAltNames errors without an AdvertiseAddress; this is as good as any.
AdvertiseAddress: "127.0.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

@kad ^ FYI

Copy link
Member

Choose a reason for hiding this comment

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

Maybe in such scenarios where we don't have good IP address, it is better to skip it in cert generation phase, but having default to localhost doesn't really make sense, as it leads to non-functional control plane.

Copy link
Member Author

Choose a reason for hiding this comment

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

@kad @neolit123 this PR doesn't implemented/changed this bit, only refactored the API struct.
If something should be fixed, this should be address in a separated PR (this one is already XXL 😉)

Copy link
Member

Choose a reason for hiding this comment

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

yeah, i'm just pointing it out because we had a discussion about 127.0.0.1 earlier.

if err := SetBootstrapTokensDynamicDefaults(&cfg.BootstrapTokens); err != nil {
return err
}

Copy link
Member

Choose a reason for hiding this comment

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

just a nit: some of these empty new lines in the function can be removed.
please, live as is for now if you'd prefer.

// Default all the embedded ComponentConfig structs
componentconfigs.Known.Default(cfg)

ip := net.ParseIP(advertiseAddress)
Copy link
Member

Choose a reason for hiding this comment

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

this will probably conflict with:
#67397
either this or that PR will need a rebase.

@fabriziopandini fabriziopandini force-pushed the kubeadm-config-APIEndpoint branch from 6a3109f to 1b90e44 Compare August 25, 2018 08:44
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 25, 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.

looking good, but I think some the meta-data in your structs needs cleanup, otherwise LGTM. Please clean that up and we're good to go.

/approve

@@ -285,6 +285,10 @@ type JoinConfiguration struct {
// API server will be installed only on nodes hosting an additional control plane instance.
AdvertiseAddress string `json:"advertiseAddress,omitempty"`

// BindPort sets the secure port for the API Server to bind to.
// Defaults to 6443.
BindPort int32 `json:"bindPort"`
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be omitempty, b/c previous versions of v1alpha2 didn't have this field.


// APIEndpoints currently available in the cluster, one for each control plane/api server instance.
// The key of the map is the IP of the host's default interface
APIEndpoints map[string]APIEndpoint `json:"featureGates,`
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't appear correct json:"featureGates,

@fabriziopandini fabriziopandini force-pushed the kubeadm-config-APIEndpoint branch from 1b90e44 to 0add7f9 Compare August 27, 2018 07:01
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.

Looks OK to me. A few places were converted back to InitConfiguration (from ClusterConfiguration), but I assume, that this way the change is narrower and PR is much more easy to review.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 27, 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.

/lgtm
/approve

Thx @fabriziopandini

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fabriziopandini, 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

@timothysc timothysc removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 27, 2018
@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-github-robot k8s-github-robot merged commit ed3c32c into kubernetes:master Aug 27, 2018
@fabriziopandini fabriziopandini deleted the kubeadm-config-APIEndpoint branch September 6, 2018 10:30
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. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants