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

feat: Delete machine #40

Merged
merged 2 commits into from
Dec 10, 2021
Merged

feat: Delete machine #40

merged 2 commits into from
Dec 10, 2021

Conversation

Callisto13
Copy link
Member

@Callisto13 Callisto13 commented Nov 30, 2021

What this PR does / why we need it:

Implements MicroVMMachine deletion reconcile.
Calls the flintlock API.

LMK if I have missed any CAPI-type things, was
mostly guessing.

Also removes finalizers from the Cluster controller
as we do not do any supporting infrastructure
creation there. We can add this back later if it changes.

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 #13

Special notes for your reviewer:

Successfully ran a manual create+delete on my local machine.

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@Callisto13 Callisto13 added the kind/feature New feature or request label Nov 30, 2021
@richardcase richardcase force-pushed the machine_controller branch 8 times, most recently from 3bad20a to ad1bbb3 Compare December 6, 2021 15:02
Base automatically changed from machine_controller to main December 6, 2021 15:08
@Callisto13 Callisto13 changed the title [WIP] feat: Delete machine feat: Delete machine Dec 6, 2021
Copy link
Member

@richardcase richardcase left a comment

Choose a reason for hiding this comment

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

This looks good and its good to remove the cluster finalizers.

api/v1alpha1/condition_consts.go Outdated Show resolved Hide resolved
controllers/microvmmachine_controller.go Show resolved Hide resolved
machineScope.SetNotReady(infrav1.MicrovmDeleteFailedReason, clusterv1.ConditionSeverityError, "")

return ctrl.Result{}, err
}
Copy link
Member

Choose a reason for hiding this comment

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

After the call to Delete should we requeue and on the next reconciliation check the status? Flintlock may have an issue itself reconciling the delete and so we should wait until its actually been deleted. wdyt?

We should check in flintlock that the Get has distinct state detrmination for deleting vs deleted.

Copy link
Member

Choose a reason for hiding this comment

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

And then only remove the finalizer when it gets to a deleted / not found state ?

Copy link
Member Author

Choose a reason for hiding this comment

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

👍 makes sense

Copy link
Member Author

Choose a reason for hiding this comment

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

Flintlock does not have any state of deleted or deleting. "Deleted" is unnecessary, because where would we record that after state is deleted. We could introduce a "deleting" phase and check that here, only issuing a Delete call if not already processing.

Flintlock does do its own "should I delete" check of course, but it's good to avoid redundant API calls if we can.

For now I am just going to requeue after the Delete call. If the FL delete fails and the requeue comes around again, flintlock should not make a second attempt in the plan.

I will add a ticket to Flintlock to discuss a "deleting" phase on the state.

@Callisto13 Callisto13 force-pushed the delete-machine branch 2 times, most recently from 4a55a12 to 26bbef2 Compare December 7, 2021 10:28
@github-actions github-actions bot added size/m and removed size/s labels Dec 7, 2021
jmickey
jmickey previously approved these changes Dec 9, 2021
Copy link

@jmickey jmickey left a comment

Choose a reason for hiding this comment

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

My understanding of CAPI stuff is pretty limited still, but this looks ok to me.

@Callisto13
Copy link
Member Author

Callisto13 commented Dec 9, 2021

Ty @jmickey. @yitsushi do you want to have a look (now that you have spent some time with capmvm)?

Not too bothered if we are all a bit " 🤷‍♀️ yolo" with this one, I mainly want to get the core lifecycle unblocked so we can work a bit more fluidly here.

yitsushi
yitsushi previously approved these changes Dec 9, 2021
Copy link
Contributor

@yitsushi yitsushi left a comment

Choose a reason for hiding this comment

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

lgtm (only that nested if that hurts my precious eyes a bit) :shipit:

controllers/microvmmachine_controller.go Outdated Show resolved Hide resolved
We do not currently create any supporting infrastructure for our
machines. We can add this back if we need it.
@Callisto13 Callisto13 merged commit cbc4042 into main Dec 10, 2021
@Callisto13 Callisto13 deleted the delete-machine branch December 10, 2021 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature New feature or request size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement deletion in MicrovmMachine controller
4 participants