| 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"; |
| Jan Schär | 4cc3d4d | 2025-04-14 11:46:47 +0000 | [diff] [blame^] | 6 | import "metropolis/proto/api/management.proto"; |
| Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame] | 7 | import "cloud/agent/api/hwreport.proto"; |
| 8 | |
| Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 9 | // 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. |
| 13 | service AgentCallback { |
| 14 | // Heartbeat is called by agents repeatedly to upload a hardware report, signal |
| Tim Windelschmidt | 9fbe838 | 2023-04-24 19:05:10 +0200 | [diff] [blame] | 15 | // liveness and retrieve actions to be performed on a host. |
| Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 16 | // |
| 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 Windelschmidt | 5ffa636 | 2025-01-28 19:20:06 +0100 | [diff] [blame] | 21 | rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse); |
| Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | message AgentHardwareReport { |
| Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame] | 25 | 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 Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 29 | } |
| 30 | |
| Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 31 | // OSInstallationReport is submitted from the agent to the BMDB server after |
| 32 | // successful OS installation. |
| 33 | message 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 Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame] | 37 | |
| 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 Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 52 | } |
| 53 | |
| Tim Windelschmidt | 5ffa636 | 2025-01-28 19:20:06 +0100 | [diff] [blame] | 54 | message HeartbeatRequest { |
| Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 55 | // 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 Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 62 | // 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 Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame] | 68 | message MetropolisInstallationRequest { |
| Jan Schär | 4cc3d4d | 2025-04-14 11:46:47 +0000 | [diff] [blame^] | 69 | reserved 1; |
| 70 | // Parameters for fetching the OS image to install. |
| 71 | metropolis.proto.api.OSImageRef os_image = 4; |
| Lorenz Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame] | 72 | // 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 Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 80 | // OSInstallationRequest is provided to the agent by the BMDB server, from |
| 81 | // a responding BMDB tag, when an OS installation request is pending. |
| 82 | message 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 Brun | 4bbd8b3 | 2023-03-27 15:43:28 +0200 | [diff] [blame] | 89 | // Selects which operating system installation flow is used. |
| 90 | oneof type { |
| 91 | MetropolisInstallationRequest metropolis = 2; |
| 92 | } |
| Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 93 | } |
| 94 | |
| Tim Windelschmidt | 5ffa636 | 2025-01-28 19:20:06 +0100 | [diff] [blame] | 95 | message HeartbeatResponse { |
| Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame] | 96 | // If set, the control plane is requesting the installation of an operating |
| 97 | // system. |
| 98 | OSInstallationRequest installation_request = 1; |
| Jan Schär | 4cc3d4d | 2025-04-14 11:46:47 +0000 | [diff] [blame^] | 99 | } |