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 | |
| 24 | message AgentHeartbeatRequest { |
| 25 | // MachineID that this agent represents. Technically not necessary since |
| 26 | // keypairs between agents should be unique, but this provides an extra layer |
| 27 | // of protection against programming bugs. |
| 28 | string machine_id = 1; |
| 29 | // Optional hardware report to be upserted for this machine. An agent should |
| 30 | // submit one at least once after it's started, as early as it can. |
| 31 | AgentHardwareReport hardware_report = 2; |
| 32 | } |
| 33 | |
| 34 | message AgentHeartbeatResponse { |
| 35 | // Agent actions (like install, reboot, etc) go here. |
| 36 | } |