Skip to content
This repository was archived by the owner on Jul 30, 2021. It is now read-only.

Generate kubeadm cloud init code #42

Merged
merged 2 commits into from
Aug 6, 2019

Conversation

chuckha
Copy link
Contributor

@chuckha chuckha commented Jul 18, 2019

Signed-off-by: Chuck Ha [email protected]

What this PR does / why we need it:
This PR generates the control-plane-init cloud init script, but it is incomplete. I just ran out of time this week and wanted to get some code out for folks to look at and think about.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Related to #18
Closes #16

Special notes for your reviewer:
Definitely not done. Please see TODOs

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

NONE

/cc @amy @vincepri @liztio @ncdc @detiber

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jul 18, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chuckha

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 18, 2019
@fabriziopandini
Copy link
Contributor

/cc

Copy link
Contributor

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

@chuckha my two cents.
Let me know if/how I can help in this effort

@chuckha chuckha force-pushed the control-plane-init branch from c8aa601 to 24e888f Compare July 22, 2019 18:25
@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. labels Jul 22, 2019
@chuckha chuckha force-pushed the control-plane-init branch from 1f5af57 to 970b205 Compare July 23, 2019 14:34
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 24, 2019
@ncdc
Copy link
Contributor

ncdc commented Aug 1, 2019

@chuckha do you need any help with this?

@fabriziopandini
Copy link
Contributor

@CHA if you need some help here, I'm happy to jump in

@chuckha chuckha force-pushed the control-plane-init branch from 970b205 to e2ce620 Compare August 5, 2019 14:32
@chuckha chuckha changed the title [WIP] Some general thoughts Some general thoughts Aug 5, 2019
@k8s-ci-robot k8s-ci-robot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Aug 5, 2019
@chuckha chuckha force-pushed the control-plane-init branch from e2ce620 to 20c32ba Compare August 5, 2019 14:42
@chuckha chuckha changed the title Some general thoughts Generate Control plane init code Aug 5, 2019
@chuckha
Copy link
Contributor Author

chuckha commented Aug 5, 2019

/assign @fabriziopandini

This is ready to unblock you!

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 5, 2019
Copy link
Contributor

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

@chuckha thanks!
I'm ok with this change as it is- TODOs for follow-up PRs:

  • implement "control-plane-ready: yes" or similar mechanism to orchestrate node joining orders (and possibly drop the init-lock mechanism)
  • define priority/how to handle overlapping values between CAPBK and CAPI
  • define sanity checks about machine spec and kubeadmConfig (e.g a machine that has label control plane should reject a kubeadmConfig with JoinConfiguration.ControlPlane == false)

// TODO: sub in things in the cluster configuration like the cluster name and other data we can extract from the cluster object
config.Spec.ClusterConfiguration.APIVersion = "v1beta1"
config.Spec.ClusterConfiguration.Kind = "ClusterConfiguration"
clusterdata, err := json.Marshal(config.Spec.ClusterConfiguration)
Copy link
Contributor

Choose a reason for hiding this comment

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

@chuckha
There is a potential overlap between network settings in CAPBK.v1alpha2.KubeadmConfig.ClusterConfiguration and network settings in CAPI.v1alpha2.Cluster. What is expected behavior here? (once I know the behavior, I can fix it also in a fallow PR)

Copy link
Contributor

Choose a reason for hiding this comment

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

Same goes e.g for the CAPBK.controlplaneEndpoint/ CAPI.APIEndpoints

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, you're right. I'll open a ticket to address this later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#78

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 5, 2019
@chuckha chuckha force-pushed the control-plane-init branch from 516dbee to eb761b6 Compare August 5, 2019 20:40
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 5, 2019
@chuckha chuckha force-pushed the control-plane-init branch from eb761b6 to fb04d9c Compare August 5, 2019 21:15
chuckha added 2 commits August 5, 2019 18:05
This PR generates the `kubeadm init` bootstrap data
It will wait unitl the infrastructure is ready before allowing anything
beyond the bootstrap control plane from joining the cluster.

Signed-off-by: Chuck Ha <[email protected]>
Signed-off-by: Chuck Ha <[email protected]>
@chuckha chuckha force-pushed the control-plane-init branch from fb04d9c to fcd7edf Compare August 5, 2019 22:05
@chuckha chuckha changed the title Generate Control plane init code Generate kubeadm cloud init code Aug 6, 2019
@fabriziopandini
Copy link
Contributor

Thanks! Let's get this merged and move on with the next iteration
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 6, 2019
@k8s-ci-robot k8s-ci-robot merged commit b60ec53 into kubernetes-retired:master Aug 6, 2019
return ctrl.Result{}, err
}

config.Status.BootstrapData = cloudInitData
Copy link
Contributor

Choose a reason for hiding this comment

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

I just noticed that BootstrapData is defined as []byte, does this have implications on serialization that we need to worry about?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. 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.

Implement the controller logic for cloud-init output
5 participants