Minimal MachinePool support#1506
Conversation
✅ Deploy Preview for kubernetes-sigs-cluster-api-gcp ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
This PR is WIP while I whittle down the unneeded code from cluster-api-provider-aws and generally make this reviewable. But I am uploading as this is a checkpoint that works (in a limited way!) |
428790f to
5906e99
Compare
|
Removing the WIP. I will still try to whittle down the code by extracting helpers etc, but it's already approaching the reviewable ballpark! |
|
So the linter is blowing up on the TODO comments. How do we want to track next steps in code? If we don't want to do |
6449078 to
2b81034
Compare
|
Could we get this reviewed / approved? |
|
Hey @justinsb I'm OOO but will prio this the first days of Jan as soon as I am back. |
There was a problem hiding this comment.
/hold
/lgtm
Thanks @justinsb. I hold it so @damdo and @chrischdi can have time for a final review.
We should have a follow-up PR with a new section in the provider's book on how to use MachinePools. I'll create a separate issue.
damdo
left a comment
There was a problem hiding this comment.
Thanks a lot Justin!
This is looking good, left a couple of comments but it looks like we are already in great shape! TY
| return nil, fmt.Errorf("creating instanceGroupManager %v: %w", selfLink, err) | ||
| } | ||
|
|
||
| actual, err = s.instanceGroupManagers.Get(ctx, igmKey) |
There was a problem hiding this comment.
Are you going to add the comment here or elsewhere? TY
| // ValidateCreate implements webhook.Validator so a webhook will be registered for the type. | ||
| func (*gcpMachinePoolWebhook) ValidateCreate(_ context.Context, obj runtime.Object) (admission.Warnings, error) { | ||
| r, ok := obj.(*GCPMachinePool) | ||
| if !ok { | ||
| return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a GCPMachinePool but got a %T", obj)) | ||
| } | ||
|
|
||
| gcpMachinePoolLog.Info("Validating GCPMachinePool create", "name", r.Name) | ||
|
|
||
| return nil, nil | ||
| } | ||
|
|
||
| // ValidateUpdate implements webhook.Validator so a webhook will be registered for the type. | ||
| func (*gcpMachinePoolWebhook) ValidateUpdate(_ context.Context, _, newObj runtime.Object) (admission.Warnings, error) { | ||
| r, ok := newObj.(*GCPMachinePool) | ||
| if !ok { | ||
| return nil, fmt.Errorf("expected a GCPMachinePool object but got %T", r) | ||
| } | ||
|
|
||
| gcpMachinePoolLog.Info("Validating GCPMachinePool update", "name", r.Name) | ||
|
|
||
| return nil, nil | ||
| } | ||
|
|
||
| // ValidateDelete implements webhook.Validator so a webhook will be registered for the type. | ||
| func (*gcpMachinePoolWebhook) ValidateDelete(_ context.Context, obj runtime.Object) (admission.Warnings, error) { | ||
| r, ok := obj.(*GCPMachinePool) | ||
| if !ok { | ||
| return nil, apierrors.NewBadRequest(fmt.Sprintf("expected a GCPMachinePool but got a %T", obj)) | ||
| } | ||
|
|
||
| gcpMachinePoolLog.Info("Validating GCPMachinePool delete", "name", r.Name) | ||
|
|
||
| return nil, nil | ||
| } |
There was a problem hiding this comment.
Are we planning to add in the validation logic at a later stage?
There was a problem hiding this comment.
I will add a few TODOs. I think we probably want to share logic with the machine validation. Does that work?
| // Requeue so that we can keep the spec.providerIDList and status in sync with the MIG. | ||
| // This is important for scaling up and down, as the CAPI MachinePool controller relies on | ||
| // the providerIDList to determine which machines belong to the MachinePool. | ||
| return ctrl.Result{RequeueAfter: 1 * time.Minute}, nil |
There was a problem hiding this comment.
How are other providers that have implemented MachinePools doing this?
Co-authored-by: Christian Schlotter <christi.schlotter@gmail.com> Co-authored-by: Carlos Salas <salash66@gmail.com>
In order for nodes to be associated to the MachinePool, we need to populate the spec.providerIDList field. This field is known to the MachinePool controller. Co-authored-by: Christian Schlotter <christi.schlotter@gmail.com>
|
So I think this looks pretty good (IMO) as a way to introduce the feature. I'm happy to split out InstanceNetworkInterfaceAliasIPRangesSpec into its own PR if we want more confidence that this is additive. I think cleanup/deletion is tricky, but I think that machinepool has some logic to ensure that the gcpmachinepool is deleted first: So it looks like we are OK here, though I agree it's not the most obvious logic. |
salasberryfin
left a comment
There was a problem hiding this comment.
Thanks @justinsb.
Overall this looks good to me as a first iteration of machine pools. I'll wait for others to resolve their comments but we're good to go in my opinion.
We should also create issues for all of the follow-up improvements, additions, etc. to keep track of what needs further refinement.
|
Awesome thank you all! I opened issues for the follow ups that I identified (though I have likely missed some, and I'm sure we'll find more) @salasberryfin I think you have a hold on this PR (which is why it is not merging) - is it OK to remove now? |
salasberryfin
left a comment
There was a problem hiding this comment.
Sure, thanks @justinsb!
/lgtm
/unhold
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: damdo, justinsb, salasberryfin The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Initial spike: GCPMachinePool
GCPMachinePool: generated code/manifests
This continues the work started by @BrennenMM7 in #901 . I also combined in the support from cluster-api-provider-aws to see what we want to borrow from that, and will whittle the code we don't need from cluster-api-provider-aws away.