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: add mgmt endpoint & cli command for infra machine reboot #826

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

utkuozdemir
Copy link
Member

Introduce a new mgmt endpoint to reboot an infra machine and wait for the reboot request to be processed by the respective infra provider. It does the heavy lifting of modifying/waiting for the resources.

Additionally:

  • In the InfraMachineController, to verify that the machine info was collected before powering it off, check the TalosVersion on the MachineStatus instead of SecureBootStatus. It is a more suitable field to check this.
  • Rename the infra provider label prefix format from being omni.sidero.dev/infra-provider[provider-id]/key=value to be omni.sidero.dev/infra-provider/provider-id/key=value.

Introduce a new mgmt endpoint to reboot an infra machine and wait for the reboot request to be processed by the respective infra provider. It does the heavy lifting of modifying/waiting for the resources.

Additionally:
- In the `InfraMachineController`, to verify that the machine info was collected before powering it off, check the `TalosVersion` on the `MachineStatus` instead of `SecureBootStatus`. It is a more suitable field to check this.
- Rename the infra provider label prefix format from being `omni.sidero.dev/infra-provider[provider-id]/key=value` to be `omni.sidero.dev/infra-provider/provider-id/key=value`.

Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>

ctx = actor.MarkContextAsInternalActor(ctx)

if _, err := safe.StateGetByID[*infra.Machine](ctx, s.omniState, req.MachineId); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a bit crazy idea, but we could make reboot work seamlessly for all kind of machines.
If the infra machine is not found we can fall back to the talos API call.
What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, we can do that. I'm just concerned with the fact that this endpoint does not block or report any status (like stream the phases back or something), so not sure how much value it actually brings.

Copy link
Member

Choose a reason for hiding this comment

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

Does it block in case of omnictl power reboot?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, none. It blocks until reboot is issued, not until machine comes back.

Copy link
Member

Choose a reason for hiding this comment

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

so it will be more or less consistent I guess

Copy link
Member

Choose a reason for hiding this comment

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

another crazy idea is to intercept talosctl reboot command and make it go through the infra provider 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants