Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | package cloud.bmaas.server.api; |
| 3 | option go_package = "source.monogon.dev/cloud/bmaas/server/api"; |
| 4 | |
Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame^] | 5 | import "metropolis/proto/api/configuration.proto"; |
| 6 | import "cloud/agent/api/hwreport.proto"; |
| 7 | |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 8 | // AgentCallback runs on the BMDB Server and exposes a gRPC interface to agents |
| 9 | // running on machines. These APIs are served over TLS using component-style |
| 10 | // server certificates, but clients are authenticated using ephemeral |
| 11 | // certificates proving ownership of an agent keypair. |
| 12 | service AgentCallback { |
| 13 | // Heartbeat is called by agents repeatedly to upload a hardware report, signal |
| 14 | // liveness and retrieve actions to be prformed on a host. |
| 15 | // |
| 16 | // This isn't a streaming RPC as the current server implementation actually |
| 17 | // isn't reactive, so it would have to do its own inner polling to create |
| 18 | // a stream of updates. To keep things simple, we instead let the agent decide |
| 19 | // on the cadence of updates it wants to keep up with. |
| 20 | rpc Heartbeat(AgentHeartbeatRequest) returns (AgentHeartbeatResponse); |
| 21 | } |
| 22 | |
| 23 | message AgentHardwareReport { |
Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame^] | 24 | cloud.agent.api.Node report = 1; |
| 25 | // List of human-readable warnings which occurred during hardware report |
| 26 | // generation. |
| 27 | repeated string warning = 2; |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 28 | } |
| 29 | |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 30 | // OSInstallationReport is submitted from the agent to the BMDB server after |
| 31 | // successful OS installation. |
| 32 | message OSInstallationReport { |
| 33 | // generation must be set to the same value as 'generation' in the |
| 34 | // OSInstallation request which triggered the OS installation |
| 35 | int64 generation = 1; |
Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame^] | 36 | |
| 37 | // Success is set by the agent when the installation request has been |
| 38 | // successfully fulfilled. It is currently empty but is specified as a |
| 39 | // message to allow it to be expanded in the future. |
| 40 | message Success {} |
| 41 | // Error is set by the agent when the installation request could not be |
| 42 | // fulfilled due to an error. |
| 43 | message Error { |
| 44 | // A human-readable message of what went wrong. |
| 45 | string error = 1; |
| 46 | } |
| 47 | oneof result { |
| 48 | Success success = 2; |
| 49 | Error error = 3; |
| 50 | } |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 51 | } |
| 52 | |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 53 | message AgentHeartbeatRequest { |
| 54 | // MachineID that this agent represents. Technically not necessary since |
| 55 | // keypairs between agents should be unique, but this provides an extra layer |
| 56 | // of protection against programming bugs. |
| 57 | string machine_id = 1; |
| 58 | // Optional hardware report to be upserted for this machine. An agent should |
| 59 | // submit one at least once after it's started, as early as it can. |
| 60 | AgentHardwareReport hardware_report = 2; |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 61 | // Optional installation report sent to be upserted to this machine. An agent |
| 62 | // should submit one after it successfully installed an operating system for |
| 63 | // a given OSInstallationRequest. |
| 64 | OSInstallationReport installation_report = 3; |
| 65 | } |
| 66 | |
Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame^] | 67 | message MetropolisInstallationRequest { |
| 68 | // An HTTPS URL to a Metropolis bundle containing the OS to install. |
| 69 | string bundle_url = 1; |
| 70 | // Node parameters to be supplied to the new node. Note that network_config |
| 71 | // is automatically filled out if coming from the takeover. |
| 72 | metropolis.proto.api.NodeParameters node_parameters = 2; |
| 73 | // Name of the block device to be used as the root device for the install. |
| 74 | // A list of block devices can be taken from the node hardware report. |
| 75 | string root_device = 3; |
| 76 | } |
| 77 | |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 78 | // OSInstallationRequest is provided to the agent by the BMDB server, from |
| 79 | // a responding BMDB tag, when an OS installation request is pending. |
| 80 | message OSInstallationRequest { |
| 81 | // generation is the 'version' of the OS installation request, and will always |
| 82 | // be incremented within the BMDB when a new OS installation request is |
| 83 | // submitted. The agent must pipe this through to the OSInstallationReport to |
| 84 | // let the rest of the system know which OS installation request it actually |
| 85 | // fulfilled. |
| 86 | int64 generation = 1; |
Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame^] | 87 | // Selects which operating system installation flow is used. |
| 88 | oneof type { |
| 89 | MetropolisInstallationRequest metropolis = 2; |
| 90 | } |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | message AgentHeartbeatResponse { |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 94 | // If set, the control plane is requesting the installation of an operating |
| 95 | // system. |
| 96 | OSInstallationRequest installation_request = 1; |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 97 | } |