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

Move control plane locker from CAPA #33

Merged
merged 1 commit into from
Jul 22, 2019

Conversation

SataQiu
Copy link
Contributor

@SataQiu SataQiu commented Jul 17, 2019

What this PR does / why we need it:
Move control plane locker from CAPA

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #29

Special notes for your reviewer:

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

Release note:

NONE

@k8s-ci-robot
Copy link
Contributor

Welcome @SataQiu!

It looks like this is your first PR to kubernetes-sigs/cluster-api-bootstrap-provider-kubeadm 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-bootstrap-provider-kubeadm has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 17, 2019
@k8s-ci-robot k8s-ci-robot requested review from luxas and timothysc July 17, 2019 11:02
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 17, 2019
@chuckha
Copy link
Contributor

chuckha commented Jul 17, 2019

Hmm this linter is actually failing. I need to make an issue to look into that. In the meantime can you run ./hack/verify-all.sh locally and fix the issues?

@SataQiu
Copy link
Contributor Author

SataQiu commented Jul 17, 2019

OK, I will do that. Thanks @chuckha

@chuckha
Copy link
Contributor

chuckha commented Jul 17, 2019

Ping me in a comment when this is passing and ready for review! sorry about the bad signal with CI, I don't know what's going on there.

@ashish-amarnath
Copy link

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 17, 2019
@chuckha
Copy link
Contributor

chuckha commented Jul 17, 2019

/hold

This is failing the verify scripts.

@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 Jul 17, 2019
@ashish-amarnath
Copy link

This needs to be fixed. Automated tests are not catching this atm

Running golint...
cloudinit/cloudinit.go:32:6: exported type BaseUserData should have comment or be unexported
Found 1 lint suggestions; failing.
cloudinit/controlplane_certs.go:21:6: exported type Certificates should have comment or be unexported
Found 1 lint suggestions; failing.

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.

Background question:
Are we implementing init lock in this project because it is something really specific for kubeadm? (otherwise managing control plane init lock does not seem to be fitting in the scope of a bootstrap provider, that should be responsible for the cloud-init generation only ...)

}
}

func (l *controlPlaneInitLocker) Acquire(cluster *clusterv2.Cluster) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be I'm missing something, but I don't see the counterpart of Acquire (Release)

Copy link
Contributor

Choose a reason for hiding this comment

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

In the original codebase, the release part was done in the Cluster Actuator https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/master/pkg/cloud/actuators/cluster/actuator.go#L140-L159, we should move this as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reconcile is not complete yet. I think we can add this later. Right?

Copy link
Contributor

Choose a reason for hiding this comment

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

@SataQiu given that the Release code pointed out by @vincepri is well-scoped, IMO it would be great to include it in this PR so the control plane locker is consistent.
wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll move it over when I need it in the actual usage of this code. no worries here.

@vincepri
Copy link
Contributor

@fabriziopandini This codebase originally solved the problem of generating multiple Kubeadm control-plane init configurations when a user would create an HA cluster submitting multiple Machine instances at the same time.

I see how it may touch a little outside of its primary responsibility: generating cloud-init data. That said, without coordination, we might end up generating incorrect data. Happy to chat more in Zoom or on Slack if you want to talk more about it.

/cc @ncdc

@k8s-ci-robot k8s-ci-robot requested a review from ncdc July 17, 2019 21:07
@ncdc
Copy link
Contributor

ncdc commented Jul 17, 2019

Longer term, when we tackle control plane management (v1alpha3, perhaps), I'd expect this code to go away and be replaced by a new component that manages the full lifecycle of all control plane machines (init, scale up (join), scale down, upgrade, etc).

@ncdc
Copy link
Contributor

ncdc commented Jul 17, 2019

Also, we need to orchestrate when the infrastructure provider is allowed to create a server:

  1. If there is no control plane yet, we should only generate the bootstrap data for a machine if the machine is a control plane machine and we are able to acquire the control plane init lock
  2. If there is a control plane, we can generate the bootstrap data immediately

@k8s-ci-robot k8s-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jul 18, 2019
@fabriziopandini
Copy link
Contributor

@vincepri @ncdc thanks for the clarification! ok for me

@SataQiu
Copy link
Contributor Author

SataQiu commented Jul 22, 2019

I'm confused. Why did pull-cluster-api-bootstrap-provider-kubeadm-verify fail ?
Did I miss something? @chuckha

[*] Verifying whitespace...
[*] Verifying spelling...
[*] Verifying boilerplate...
[*] Verifying gofmt...
[*] Verifying golint...
[*] Verifying govet...
[*] Verifying deps...
[*] Verifying gotest...
[*] Verifying build...
All verify checks passed, congrats! 

@detiber
Copy link
Contributor

detiber commented Jul 22, 2019

/test pull-cluster-api-bootstrap-provider-kubeadm-verify

Copy link
Contributor

@chuckha chuckha 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 fine for now, I'll need this soon so I can do cleanups if necessary

I will probably be moving this to some directory other than controllers.

/lgtm

return true
}

func (l *controlPlaneInitLocker) Release(cluster *clusterv2.Cluster) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

interesting, golint doesn't fail this, presumably because controlPlaneInitLocker is not exported.

}
}

func (l *controlPlaneInitLocker) Acquire(cluster *clusterv2.Cluster) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll move it over when I need it in the actual usage of this code. no worries here.

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 22, 2019
@chuckha
Copy link
Contributor

chuckha commented Jul 22, 2019

/hold cancel
/approve

whoops, ignore the lgtm, this already had lgtm

@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 Jul 22, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chuckha, SataQiu

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 Jul 22, 2019
@chuckha
Copy link
Contributor

chuckha commented Jul 22, 2019

Thank you @SataQiu for your first PR into CABPK! Welcome aboard :) 🚂 🚀

@k8s-ci-robot k8s-ci-robot merged commit 1442654 into kubernetes-retired:master Jul 22, 2019
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/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.

Move control plane locker from CAPA
8 participants