blob: 5bebef5eaa9b3f1b6322051e20cba2fab5b65b9b [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
Lorenz Brun4bbd8b32023-03-27 15:43:28 +02005import "metropolis/proto/api/configuration.proto";
6import "cloud/agent/api/hwreport.proto";
7
Serge Bazanski4abeb132022-10-11 11:32:19 +02008// 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.
12service AgentCallback {
13 // Heartbeat is called by agents repeatedly to upload a hardware report, signal
Tim Windelschmidt9fbe8382023-04-24 19:05:10 +020014 // liveness and retrieve actions to be performed on a host.
Serge Bazanski4abeb132022-10-11 11:32:19 +020015 //
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
23message AgentHardwareReport {
Lorenz Brun4bbd8b32023-03-27 15:43:28 +020024 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 Bazanski4abeb132022-10-11 11:32:19 +020028}
29
Serge Bazanski6c9535b2023-01-03 13:17:42 +010030// OSInstallationReport is submitted from the agent to the BMDB server after
31// successful OS installation.
32message 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 Brun4bbd8b32023-03-27 15:43:28 +020036
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 Bazanski6c9535b2023-01-03 13:17:42 +010051}
52
Serge Bazanski4abeb132022-10-11 11:32:19 +020053message 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 Bazanski6c9535b2023-01-03 13:17:42 +010061 // 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 Brun4bbd8b32023-03-27 15:43:28 +020067message 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 Bazanski6c9535b2023-01-03 13:17:42 +010078// OSInstallationRequest is provided to the agent by the BMDB server, from
79// a responding BMDB tag, when an OS installation request is pending.
80message 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 Brun4bbd8b32023-03-27 15:43:28 +020087 // Selects which operating system installation flow is used.
88 oneof type {
89 MetropolisInstallationRequest metropolis = 2;
90 }
Serge Bazanski4abeb132022-10-11 11:32:19 +020091}
92
93message AgentHeartbeatResponse {
Serge Bazanski6c9535b2023-01-03 13:17:42 +010094 // If set, the control plane is requesting the installation of an operating
95 // system.
96 OSInstallationRequest installation_request = 1;
Serge Bazanski4abeb132022-10-11 11:32:19 +020097}