Serge Bazanski | 6bd4159 | 2021-08-23 13:18:37 +0200 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | package metropolis.proto.api; |
| 3 | option go_package = "source.monogon.dev/metropolis/proto/api"; |
| 4 | |
Serge Bazanski | bc671d0 | 2021-10-05 17:53:32 +0200 | [diff] [blame] | 5 | import "metropolis/proto/common/common.proto"; |
Serge Bazanski | 9ffa1f9 | 2021-09-01 15:42:23 +0200 | [diff] [blame] | 6 | import "metropolis/proto/ext/authorization.proto"; |
| 7 | |
Serge Bazanski | 5611447 | 2021-10-11 14:47:54 +0200 | [diff] [blame^] | 8 | // Management service available to Cluster Managers, allowing operational work |
| 9 | // to be performed on the cluster (eg. adding nodes, retrieving information |
| 10 | // about a running cluster, etc.). |
Serge Bazanski | 6bd4159 | 2021-08-23 13:18:37 +0200 | [diff] [blame] | 11 | service Management { |
| 12 | // GetRegisterTicket retrieves the current RegisterTicket which is required |
| 13 | // for new nodes to register into the cluster. Presenting this ticket on |
| 14 | // registration does not automatically grant access to arbitrary node |
| 15 | // registration. Instead, it is used to guard the API surface of the |
| 16 | // Register RPC from potential denial of service attacks, and can be |
| 17 | // regenerated at any time in case it leaks. |
Serge Bazanski | 9ffa1f9 | 2021-09-01 15:42:23 +0200 | [diff] [blame] | 18 | rpc GetRegisterTicket(GetRegisterTicketRequest) returns (GetRegisterTicketResponse) { |
| 19 | option (metropolis.proto.ext.authorization) = { |
| 20 | need: PERMISSION_GET_REGISTER_TICKET |
| 21 | }; |
| 22 | } |
Serge Bazanski | 5611447 | 2021-10-11 14:47:54 +0200 | [diff] [blame^] | 23 | |
Serge Bazanski | bc671d0 | 2021-10-05 17:53:32 +0200 | [diff] [blame] | 24 | // GetClusterInfo retrieves publicly available summary information about |
| 25 | // this cluster, notably data required for nodes to register into a cluster |
| 26 | // or join it (other than the Register Ticket, which is gated by an |
| 27 | // additional permission). |
| 28 | rpc GetClusterInfo(GetClusterInfoRequest) returns (GetClusterInfoResponse) { |
| 29 | option (metropolis.proto.ext.authorization) = { |
| 30 | need: PERMISSION_READ_CLUSTER_STATUS |
| 31 | }; |
| 32 | } |
Serge Bazanski | 5611447 | 2021-10-11 14:47:54 +0200 | [diff] [blame^] | 33 | |
| 34 | // GetNodes retrieves information about nodes in the cluster. Currently, |
| 35 | // it returns all available data about all nodes. |
| 36 | rpc GetNodes(GetNodesRequest) returns (stream Node) { |
| 37 | option (metropolis.proto.ext.authorization) = { |
| 38 | need: PERMISSION_READ_CLUSTER_STATUS |
| 39 | }; |
| 40 | } |
Serge Bazanski | 6bd4159 | 2021-08-23 13:18:37 +0200 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | message GetRegisterTicketRequest { |
| 44 | } |
| 45 | |
| 46 | message GetRegisterTicketResponse { |
| 47 | // Opaque bytes that comprise the RegisterTicket. |
| 48 | bytes ticket = 1; |
Serge Bazanski | 2893e98 | 2021-09-09 13:06:16 +0200 | [diff] [blame] | 49 | } |
Serge Bazanski | bc671d0 | 2021-10-05 17:53:32 +0200 | [diff] [blame] | 50 | |
| 51 | message GetClusterInfoRequest { |
| 52 | } |
| 53 | |
| 54 | message GetClusterInfoResponse { |
| 55 | // cluster_directory contains information about individual nodes in the |
| 56 | // cluster that can be used to dial the cluster's services. |
| 57 | metropolis.proto.common.ClusterDirectory cluster_directory = 1; |
Serge Bazanski | 2f58ac0 | 2021-10-05 11:47:20 +0200 | [diff] [blame] | 58 | |
Serge Bazanski | fbd38e2 | 2021-10-08 14:41:16 +0200 | [diff] [blame] | 59 | // ca_certificate is the x509 DER encoded CA certificate of the cluster. |
| 60 | bytes ca_certificate = 2; |
Serge Bazanski | bc671d0 | 2021-10-05 17:53:32 +0200 | [diff] [blame] | 61 | } |
Serge Bazanski | 5611447 | 2021-10-11 14:47:54 +0200 | [diff] [blame^] | 62 | |
| 63 | message GetNodesRequest { |
| 64 | } |
| 65 | |
| 66 | // Node in a Metropolis cluster, streamed by Management.GetNodes. For each node |
| 67 | // in the cluster, this message will be emitted and will contain information |
| 68 | // about that node. |
| 69 | // |
| 70 | // The fields contained are node fields that PERMISSION_READ_CLUSTER_STATUS |
| 71 | // allows access to, ie. 'non-private' fields, ones that might be internal to |
| 72 | // the cluster and possibly considered sensitive information about the |
| 73 | // infrastructure, but whose knowledge does not allow to escalate privileges |
| 74 | // within the cluster. |
| 75 | message Node { |
| 76 | // Raw Ed25519 public key of this node, which can be used to generate |
| 77 | // the node's ID. This is always set. |
| 78 | bytes pubkey = 1; |
| 79 | // State of the node from the point of view of the cluster. This is |
| 80 | // always set. |
| 81 | metropolis.proto.common.NodeState state = 2; |
| 82 | // Last reported status by the Node, absent if a node hasn't yet reported |
| 83 | // its status. |
| 84 | metropolis.proto.common.NodeStatus status = 3; |
| 85 | // Roles assigned by the cluster. This is always set. |
| 86 | metropolis.proto.common.NodeRoles roles = 4; |
| 87 | } |