blob: 3b3c5b2e12c1e2aa9793a2f91eabdbb9de371790 [file] [log] [blame]
Serge Bazanski4abeb132022-10-11 11:32:19 +02001syntax = "proto3";
2package cloud.bmaas.server.api;
3option go_package = "source.monogon.dev/cloud/bmaas/server/api";
4
Lorenz Brun4bbd8b32023-03-27 15:43:28 +02005import "metropolis/proto/api/configuration.proto";
Jan Schär4cc3d4d2025-04-14 11:46:47 +00006import "metropolis/proto/api/management.proto";
Lorenz Brun4bbd8b32023-03-27 15:43:28 +02007import "cloud/agent/api/hwreport.proto";
8
Serge Bazanski4abeb132022-10-11 11:32:19 +02009// AgentCallback runs on the BMDB Server and exposes a gRPC interface to agents
10// running on machines. These APIs are served over TLS using component-style
11// server certificates, but clients are authenticated using ephemeral
12// certificates proving ownership of an agent keypair.
13service AgentCallback {
14 // Heartbeat is called by agents repeatedly to upload a hardware report, signal
Tim Windelschmidt9fbe8382023-04-24 19:05:10 +020015 // liveness and retrieve actions to be performed on a host.
Serge Bazanski4abeb132022-10-11 11:32:19 +020016 //
17 // This isn't a streaming RPC as the current server implementation actually
18 // isn't reactive, so it would have to do its own inner polling to create
19 // a stream of updates. To keep things simple, we instead let the agent decide
20 // on the cadence of updates it wants to keep up with.
Tim Windelschmidt5ffa6362025-01-28 19:20:06 +010021 rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse);
Serge Bazanski4abeb132022-10-11 11:32:19 +020022}
23
24message AgentHardwareReport {
Lorenz Brun4bbd8b32023-03-27 15:43:28 +020025 cloud.agent.api.Node report = 1;
26 // List of human-readable warnings which occurred during hardware report
27 // generation.
28 repeated string warning = 2;
Serge Bazanski4abeb132022-10-11 11:32:19 +020029}
30
Serge Bazanski6c9535b2023-01-03 13:17:42 +010031// OSInstallationReport is submitted from the agent to the BMDB server after
32// successful OS installation.
33message OSInstallationReport {
34 // generation must be set to the same value as 'generation' in the
35 // OSInstallation request which triggered the OS installation
36 int64 generation = 1;
Lorenz Brun4bbd8b32023-03-27 15:43:28 +020037
38 // Success is set by the agent when the installation request has been
39 // successfully fulfilled. It is currently empty but is specified as a
40 // message to allow it to be expanded in the future.
41 message Success {}
42 // Error is set by the agent when the installation request could not be
43 // fulfilled due to an error.
44 message Error {
45 // A human-readable message of what went wrong.
46 string error = 1;
47 }
48 oneof result {
49 Success success = 2;
50 Error error = 3;
51 }
Serge Bazanski6c9535b2023-01-03 13:17:42 +010052}
53
Tim Windelschmidt5ffa6362025-01-28 19:20:06 +010054message HeartbeatRequest {
Serge Bazanski4abeb132022-10-11 11:32:19 +020055 // MachineID that this agent represents. Technically not necessary since
56 // keypairs between agents should be unique, but this provides an extra layer
57 // of protection against programming bugs.
58 string machine_id = 1;
59 // Optional hardware report to be upserted for this machine. An agent should
60 // submit one at least once after it's started, as early as it can.
61 AgentHardwareReport hardware_report = 2;
Serge Bazanski6c9535b2023-01-03 13:17:42 +010062 // Optional installation report sent to be upserted to this machine. An agent
63 // should submit one after it successfully installed an operating system for
64 // a given OSInstallationRequest.
65 OSInstallationReport installation_report = 3;
66}
67
Lorenz Brun4bbd8b32023-03-27 15:43:28 +020068message MetropolisInstallationRequest {
Jan Schär4cc3d4d2025-04-14 11:46:47 +000069 reserved 1;
70 // Parameters for fetching the OS image to install.
71 metropolis.proto.api.OSImageRef os_image = 4;
Lorenz Brun4bbd8b32023-03-27 15:43:28 +020072 // Node parameters to be supplied to the new node. Note that network_config
73 // is automatically filled out if coming from the takeover.
74 metropolis.proto.api.NodeParameters node_parameters = 2;
75 // Name of the block device to be used as the root device for the install.
76 // A list of block devices can be taken from the node hardware report.
77 string root_device = 3;
78}
79
Serge Bazanski6c9535b2023-01-03 13:17:42 +010080// OSInstallationRequest is provided to the agent by the BMDB server, from
81// a responding BMDB tag, when an OS installation request is pending.
82message OSInstallationRequest {
83 // generation is the 'version' of the OS installation request, and will always
84 // be incremented within the BMDB when a new OS installation request is
85 // submitted. The agent must pipe this through to the OSInstallationReport to
86 // let the rest of the system know which OS installation request it actually
87 // fulfilled.
88 int64 generation = 1;
Lorenz Brun4bbd8b32023-03-27 15:43:28 +020089 // Selects which operating system installation flow is used.
90 oneof type {
91 MetropolisInstallationRequest metropolis = 2;
92 }
Serge Bazanski4abeb132022-10-11 11:32:19 +020093}
94
Tim Windelschmidt5ffa6362025-01-28 19:20:06 +010095message HeartbeatResponse {
Serge Bazanski6c9535b2023-01-03 13:17:42 +010096 // If set, the control plane is requesting the installation of an operating
97 // system.
98 OSInstallationRequest installation_request = 1;
Jan Schär4cc3d4d2025-04-14 11:46:47 +000099}