-
Notifications
You must be signed in to change notification settings - Fork 144
Add detached annotation proposal #168
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| <!-- | ||
| This work is licensed under a Creative Commons Attribution 3.0 | ||
| Unported License. | ||
|
|
||
| http://creativecommons.org/licenses/by/3.0/legalcode | ||
| --> | ||
|
|
||
| # Add support for Detached annotation | ||
|
|
||
| ## Status | ||
|
|
||
| implementable | ||
|
|
||
| ## Summary | ||
|
|
||
| Provide a way to prevent management of BaremetalHost resources | ||
| after provisioning is completed, to facilitate the pivot of | ||
| BaremetalHost resources in a multi-tier deployment. | ||
|
|
||
| ## Motivation | ||
|
|
||
| In a multi-tier deployment where one cluster deploys another, the "parent" | ||
| cluster will contain BMH resources for initial provisioning, | ||
| but the "child" cluster will later contain BMH resources that reference the | ||
| same physical hosts. | ||
|
|
||
| In this scenario it's necessary to prevent management operations from the | ||
| parent cluster such as asserting power state, or BMH actions on the child | ||
| cluster such as the [reboot annotation](reboot-interface.md) may fail due | ||
| to unwanted BMC interactions from the parent cluster. | ||
|
|
||
| There is an existing | ||
| [pause annotation](https://github.com/metal3-io/baremetal-operator/blob/master/docs/api.md#pausing-reconciliation) | ||
| which pauses reconciliation of the BMH resources, but this does not remove | ||
| the underlying Ironic host, so power management actions may be performed | ||
| even when the BMH is marked as `paused`. | ||
|
|
||
| ### Goals | ||
|
|
||
| * Add an API to disable management of a BMH on the parent cluster, including | ||
| all power management actions | ||
| * Make it possible to delete a BMH resource in this "detached" without | ||
| triggering deprovisioning | ||
| * Ensure it is possible to restart management of BMH resources (in the case | ||
| where they are not deleted from the parent cluster) | ||
| * Avoid changing behavior of the existing `paused` annotation since that | ||
| behavior is necessary as part of the CAPI pivot process. | ||
|
|
||
| ### Non-Goals | ||
|
|
||
| * Any coordination between the tiers of BMH resources, that has to be handled externally | ||
|
|
||
| ## Proposal | ||
|
|
||
| ### Expected workflow | ||
|
|
||
| * User creates BMH resource(s) in parent cluster | ||
| * Provisioning of BMH triggered, which results in a running child cluster | ||
| * Parent cluster BMH resources annotated as detached | ||
| * Child cluster BMH resources created, with BMC credentials, but marked | ||
| externallyProvisioned: true | ||
|
|
||
| At this point, the physical hosts are owned by the child cluster BMH, but the | ||
| inventory still exists in the parent cluster. | ||
|
|
||
| In the event that all of the child cluster hosts require reprovisioning, it | ||
| would be necessary to remove the detached annotation on the parent BMH resources, | ||
| so that management of those resources can resume, e.g for reprovisioning. | ||
|
|
||
| ### API changes | ||
|
|
||
| Add support for a new annotation, where the key is `baremetalhost.metal3.io/detached` | ||
|
|
||
| ```yaml | ||
| baremetalhost.metal3.io/detached: "" | ||
| ``` | ||
|
|
||
| The value is ignored, similar to the `paused` annotation and could optionally | ||
| include context from the system/user which applies the annotation. | ||
|
|
||
| This annotation will only be consumed while the BMH is in either `Provisioned` | ||
| or `ExternallyProvisioned` state, in all other cases it is ignored. | ||
|
|
||
| This annotation will be evaluated early in the `Reconcile()` loop, but after the | ||
| `paused` `status` and `hardwaredetails` annotations are evaluated. | ||
|
|
||
| When the `detached` annotation is set, we will check the `status.provisioning.ID` | ||
| and if necessary delete the corresponding host from Ironic (without triggering | ||
| deprovisioning) | ||
|
|
||
| When the `detached` annotation is removed, we will re-create the host in Ironic | ||
| via the existing `ensureRegistered` state machine logic. | ||
|
|
||
| If a BMH resource is deleted while the `detached` annotation is set, we will | ||
| move directly to the `Deleting` state, without performing any `Deprovisioning`. | ||
|
|
||
| ## Alternatives | ||
|
|
||
| It would be possible to modify the behavior of the | ||
| [pause annotation](https://github.com/metal3-io/baremetal-operator/blob/master/docs/api.md#pausing-reconciliation) | ||
| such that Ironic hosts are removed while paused, however | ||
| this means that we cannot reflect any error via the status | ||
| or increment the errorCount for the retry backoff. | ||
|
|
||
| We could add an API that sets the Ironic | ||
| [maintenance mode flag](https://docs.openstack.org/api-ref/baremetal/?expanded=set-maintenance-flag-detail#set-maintenance-flag) | ||
| but this means hosts could potentially permanently be in this state | ||
| and there are concerns about corner-cases such as adoption when an | ||
| ephemeral Ironic is used and a rechedule occurs. | ||
|
|
||
| ## References | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it could help to add that until the annotation remains then BMO will ignore any event for that resource (but the annotation removal for resuming the operations)?