blob: 0ed29c3dc564ea62617b5422714763cc180974ab [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
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.
9service 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
20message AgentHardwareReport {
21 // TODO(lorenz): implement
22}
23
Serge Bazanski6c9535b2023-01-03 13:17:42 +010024// OSInstallationReport is submitted from the agent to the BMDB server after
25// successful OS installation.
26message 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 Bazanski4abeb132022-10-11 11:32:19 +020032message 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 Bazanski6c9535b2023-01-03 13:17:42 +010040 // 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.
48message 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 Bazanski4abeb132022-10-11 11:32:19 +020056}
57
58message AgentHeartbeatResponse {
Serge Bazanski6c9535b2023-01-03 13:17:42 +010059 // If set, the control plane is requesting the installation of an operating
60 // system.
61 OSInstallationRequest installation_request = 1;
Serge Bazanski4abeb132022-10-11 11:32:19 +020062}