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 | |
| 5 | // AgentCallback runs on the BMDB Server and exposes a gRPC interface to agents |
| 6 | // running on machines. These APIs are served over TLS using component-style |
| 7 | // server certificates, but clients are authenticated using ephemeral |
| 8 | // certificates proving ownership of an agent keypair. |
| 9 | service AgentCallback { |
| 10 | // Heartbeat is called by agents repeatedly to upload a hardware report, signal |
| 11 | // liveness and retrieve actions to be prformed on a host. |
| 12 | // |
| 13 | // This isn't a streaming RPC as the current server implementation actually |
| 14 | // isn't reactive, so it would have to do its own inner polling to create |
| 15 | // a stream of updates. To keep things simple, we instead let the agent decide |
| 16 | // on the cadence of updates it wants to keep up with. |
| 17 | rpc Heartbeat(AgentHeartbeatRequest) returns (AgentHeartbeatResponse); |
| 18 | } |
| 19 | |
| 20 | message AgentHardwareReport { |
| 21 | // TODO(lorenz): implement |
| 22 | } |
| 23 | |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame^] | 24 | // OSInstallationReport is submitted from the agent to the BMDB server after |
| 25 | // successful OS installation. |
| 26 | message OSInstallationReport { |
| 27 | // generation must be set to the same value as 'generation' in the |
| 28 | // OSInstallation request which triggered the OS installation |
| 29 | int64 generation = 1; |
| 30 | } |
| 31 | |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 32 | message AgentHeartbeatRequest { |
| 33 | // MachineID that this agent represents. Technically not necessary since |
| 34 | // keypairs between agents should be unique, but this provides an extra layer |
| 35 | // of protection against programming bugs. |
| 36 | string machine_id = 1; |
| 37 | // Optional hardware report to be upserted for this machine. An agent should |
| 38 | // submit one at least once after it's started, as early as it can. |
| 39 | AgentHardwareReport hardware_report = 2; |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame^] | 40 | // Optional installation report sent to be upserted to this machine. An agent |
| 41 | // should submit one after it successfully installed an operating system for |
| 42 | // a given OSInstallationRequest. |
| 43 | OSInstallationReport installation_report = 3; |
| 44 | } |
| 45 | |
| 46 | // OSInstallationRequest is provided to the agent by the BMDB server, from |
| 47 | // a responding BMDB tag, when an OS installation request is pending. |
| 48 | message OSInstallationRequest { |
| 49 | // generation is the 'version' of the OS installation request, and will always |
| 50 | // be incremented within the BMDB when a new OS installation request is |
| 51 | // submitted. The agent must pipe this through to the OSInstallationReport to |
| 52 | // let the rest of the system know which OS installation request it actually |
| 53 | // fulfilled. |
| 54 | int64 generation = 1; |
| 55 | // TODO(lorenz): implement |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | message AgentHeartbeatResponse { |
Serge Bazanski | 6c9535b | 2023-01-03 13:17:42 +0100 | [diff] [blame^] | 59 | // If set, the control plane is requesting the installation of an operating |
| 60 | // system. |
| 61 | OSInstallationRequest installation_request = 1; |
Serge Bazanski | 4abeb13 | 2022-10-11 11:32:19 +0200 | [diff] [blame] | 62 | } |