blob: f62b2b051d2a1c165b42316a3606f78475bbb61b [file] [log] [blame]
Lorenz Brun189495a2022-11-08 12:59:36 +00001syntax = "proto3";
2package cloud.agent.api;
Tim Windelschmidt10ef8f92024-08-13 15:35:10 +02003import "osbase/net/proto/net.proto";
Lorenz Brun595dfe92023-02-21 19:13:02 +01004import "cloud/agent/api/takeover.proto";
Tim Windelschmidtb21bdf92025-05-28 18:37:35 +02005import "cloud/agent/api/hwreport.proto";
6import "metropolis/proto/api/configuration.proto";
7import "metropolis/proto/api/management.proto";
Lorenz Brun189495a2022-11-08 12:59:36 +00008option go_package = "source.monogon.dev/cloud/agent/api";
9
Lorenz Brun595dfe92023-02-21 19:13:02 +010010// AgentInit contains initialization information passed to the agent from the
11// initial takeover process.
12message AgentInit {
Tim Windelschmidtb21bdf92025-05-28 18:37:35 +020013 // Original takeover init message which contains data to contact the API
14 // server with.
Lorenz Brun595dfe92023-02-21 19:13:02 +010015 TakeoverInit takeover_init = 1;
Tim Windelschmidtb21bdf92025-05-28 18:37:35 +020016 // The Ed25519 private key to connect to the API server.
Lorenz Brun595dfe92023-02-21 19:13:02 +010017 bytes private_key = 2;
18 // A network configuration in case automatic configuration does not work or is
19 // not desired. If left unset, automatic configuration is used.
Tim Windelschmidt10ef8f92024-08-13 15:35:10 +020020 osbase.net.proto.Net network_config = 3;
Tim Windelschmidtb21bdf92025-05-28 18:37:35 +020021}
22
23// AgentCallback runs on the API Server and exposes a gRPC interface to agents
24// running on machines. These APIs are served over TLS using component-style
25// server certificates, but clients are authenticated using ephemeral
26// certificates proving ownership of an agent keypair.
27service AgentCallback {
28 // Heartbeat is called by agents repeatedly to upload a hardware report, signal
29 // liveness and retrieve actions to be performed on a host.
30 //
31 // This isn't a streaming RPC as the current server implementation actually
32 // isn't reactive, so it would have to do its own inner polling to create
33 // a stream of updates. To keep things simple, we instead let the agent decide
34 // on the cadence of updates it wants to keep up with.
35 rpc Heartbeat(HeartbeatRequest) returns (HeartbeatResponse);
36}
37
38message AgentHardwareReport {
39 cloud.agent.api.Node report = 1;
40 // List of human-readable warnings which occurred during hardware report
41 // generation.
42 repeated string warning = 2;
43}
44
45// OSInstallationReport is submitted from the agent to the API server after
46// successful OS installation.
47message OSInstallationReport {
48 // generation must be set to the same value as 'generation' in the
49 // OSInstallation request which triggered the OS installation
50 int64 generation = 1;
51
52 // Success is set by the agent when the installation request has been
53 // successfully fulfilled. It is currently empty but is specified as a
54 // message to allow it to be expanded in the future.
55 message Success {}
56 // Error is set by the agent when the installation request could not be
57 // fulfilled due to an error.
58 message Error {
59 // A human-readable message of what went wrong.
60 string error = 1;
61 }
62 oneof result {
63 Success success = 2;
64 Error error = 3;
65 }
66}
67
68message HeartbeatRequest {
69 // MachineID that this agent represents. Technically not necessary since
70 // keypairs between agents should be unique, but this provides an extra layer
71 // of protection against programming bugs.
72 string machine_id = 1;
73 // Optional hardware report to be upserted for this machine. An agent should
74 // submit one at least once after it's started, as early as it can.
75 AgentHardwareReport hardware_report = 2;
76 // Optional installation report sent to be upserted to this machine. An agent
77 // should submit one after it successfully installed an operating system for
78 // a given OSInstallationRequest.
79 OSInstallationReport installation_report = 3;
80}
81
82message MetropolisInstallationRequest {
83 reserved 1;
84 // Parameters for fetching the OS image to install.
85 metropolis.proto.api.OSImageRef os_image = 4;
86 // Node parameters to be supplied to the new node. Note that network_config
87 // is automatically filled out if coming from the takeover.
88 metropolis.proto.api.NodeParameters node_parameters = 2;
89 // Name of the block device to be used as the root device for the install.
90 // A list of block devices can be taken from the node hardware report.
91 string root_device = 3;
92}
93
94// OSInstallationRequest is provided to the agent API server.
95message OSInstallationRequest {
96 // generation is the 'version' of the OS installation request, and will always
97 // be incremented within the API when a new OS installation request is
98 // submitted. The agent must pipe this through to the OSInstallationReport to
99 // let the rest of the system know which OS installation request it actually
100 // fulfilled.
101 int64 generation = 1;
102 // Selects which operating system installation flow is used.
103 oneof type {
104 MetropolisInstallationRequest metropolis = 2;
105 }
106}
107
108message HeartbeatResponse {
109 // If set, the control plane is requesting the installation of an operating
110 // system.
111 OSInstallationRequest installation_request = 1;
112}