| Lorenz Brun | 189495a | 2022-11-08 12:59:36 +0000 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | package cloud.agent.api; |
| Tim Windelschmidt | 10ef8f9 | 2024-08-13 15:35:10 +0200 | [diff] [blame] | 3 | import "osbase/net/proto/net.proto"; |
| Lorenz Brun | 595dfe9 | 2023-02-21 19:13:02 +0100 | [diff] [blame] | 4 | import "cloud/agent/api/takeover.proto"; |
| Tim Windelschmidt | b21bdf9 | 2025-05-28 18:37:35 +0200 | [diff] [blame] | 5 | import "cloud/agent/api/hwreport.proto"; |
| 6 | import "metropolis/proto/api/configuration.proto"; |
| 7 | import "metropolis/proto/api/management.proto"; |
| Lorenz Brun | 189495a | 2022-11-08 12:59:36 +0000 | [diff] [blame] | 8 | option go_package = "source.monogon.dev/cloud/agent/api"; |
| 9 | |
| Lorenz Brun | 595dfe9 | 2023-02-21 19:13:02 +0100 | [diff] [blame] | 10 | // AgentInit contains initialization information passed to the agent from the |
| 11 | // initial takeover process. |
| 12 | message AgentInit { |
| Tim Windelschmidt | b21bdf9 | 2025-05-28 18:37:35 +0200 | [diff] [blame] | 13 | // Original takeover init message which contains data to contact the API |
| 14 | // server with. |
| Lorenz Brun | 595dfe9 | 2023-02-21 19:13:02 +0100 | [diff] [blame] | 15 | TakeoverInit takeover_init = 1; |
| Tim Windelschmidt | b21bdf9 | 2025-05-28 18:37:35 +0200 | [diff] [blame] | 16 | // The Ed25519 private key to connect to the API server. |
| Lorenz Brun | 595dfe9 | 2023-02-21 19:13:02 +0100 | [diff] [blame] | 17 | 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 Windelschmidt | 10ef8f9 | 2024-08-13 15:35:10 +0200 | [diff] [blame] | 20 | osbase.net.proto.Net network_config = 3; |
| Tim Windelschmidt | b21bdf9 | 2025-05-28 18:37:35 +0200 | [diff] [blame] | 21 | } |
| 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. |
| 27 | service 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 | |
| 38 | message 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. |
| 47 | message 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 | |
| 68 | message 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 | |
| 82 | message 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. |
| 95 | message 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 | |
| 108 | message HeartbeatResponse { |
| 109 | // If set, the control plane is requesting the installation of an operating |
| 110 | // system. |
| 111 | OSInstallationRequest installation_request = 1; |
| 112 | } |