Skip to content

Commit

Permalink
feat: implement infra machine reboot
Browse files Browse the repository at this point in the history
Implement reboot functionality.
The logic goes as follows:
- When a user wants to reboot a server, they set a new unique `requested_reboot_id` on the `InfraMachineConfig` resource (for example, a UUID).
- When the `InfraMachineStatus` resource gets updated with the `last_reboot_id` equal to the requested one, Omni knows that the reboot was processed.
- The `last_reboot_timestamp` is updated by the infra provider when a machine is actually rebooted.

The provider might or might not issue a reboot for each and every reboot request - if it had rebooted the machine too recently - but it will mark the request as "processed" by updating the `last_reboot_id`.

Signed-off-by: Utku Ozdemir <[email protected]>
  • Loading branch information
utkuozdemir committed Jan 8, 2025
1 parent edc47a0 commit 1c4f9af
Show file tree
Hide file tree
Showing 9 changed files with 364 additions and 105 deletions.
237 changes: 138 additions & 99 deletions client/api/omni/specs/infra.pb.go

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions client/api/omni/specs/infra.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package specs;
option go_package = "github.com/siderolabs/omni/client/api/omni/specs";

import "omni/specs/omni.proto";
import "google/protobuf/timestamp.proto";

message MachineRequestSpec {
string talos_version = 1;
Expand Down Expand Up @@ -46,6 +47,8 @@ message InfraMachineSpec {
string wipe_id = 5;

string extra_kernel_args = 6;

string requested_reboot_id = 7;
}

message InfraMachineStateSpec {
Expand All @@ -61,6 +64,8 @@ message InfraMachineStatusSpec {

MachinePowerState power_state = 1;
bool ready_to_use = 2;
string last_reboot_id = 3;
google.protobuf.Timestamp last_reboot_timestamp = 4;
}

message InfraProviderStatusSpec {
Expand Down
150 changes: 150 additions & 0 deletions client/api/omni/specs/infra_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions client/api/omni/specs/omni.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/api/omni/specs/omni.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1284,4 +1284,5 @@ message InfraMachineConfigSpec {
MachinePowerState power_state = 1;
AcceptanceStatus acceptance_status = 2;
string extra_kernel_args = 3;
string requested_reboot_id = 4;
}
47 changes: 47 additions & 0 deletions client/api/omni/specs/omni_vtproto.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1c4f9af

Please sign in to comment.