Skip to content

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 <[email protected]>

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 🙃

@@ -55,7 +55,7 @@ func (suite *InfraMachineControllerSuite) TestReconcile() {
})

machineStatus := omni.NewMachineStatus(resources.DefaultNamespace, "machine-1")
machineStatus.TypedSpec().Value.SecureBootStatus = &specs.SecureBootStatus{}
machineStatus.TypedSpec().Value.TalosVersion = "v1.9.1"

Choose a reason for hiding this comment

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

Any particular reason for v1.9.1?

Comment on lines +705 to +708
var (
machineStatus *infra.MachineStatus
event safe.WrappedStateEvent[*infra.MachineStatus]
)
Copy link

@DmitriyMV DmitriyMV Jan 28, 2025

Choose a reason for hiding this comment

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

No reason do declare those outside of for { ... } since they are not used outside. Actually if machineStatus, err = event.Resource(); err != nil { can be split and there will be no need to declare machineStatus.


if machineConfig == nil {
machineConfig = omnires.NewInfraMachineConfig(resources.DefaultNamespace, req.MachineId)

Choose a reason for hiding this comment

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

Empty line?

Copy link

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: On Hold
Development

Successfully merging this pull request may close these issues.

4 participants