membership.proto 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.gkehub.v1;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/protobuf/timestamp.proto";
  19. option csharp_namespace = "Google.Cloud.GkeHub.V1";
  20. option go_package = "google.golang.org/genproto/googleapis/cloud/gkehub/v1;gkehub";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "MembershipProto";
  23. option java_package = "com.google.cloud.gkehub.v1";
  24. option php_namespace = "Google\\Cloud\\GkeHub\\V1";
  25. option ruby_package = "Google::Cloud::GkeHub::V1";
  26. // Membership contains information about a member cluster.
  27. message Membership {
  28. option (google.api.resource) = {
  29. type: "gkehub.googleapis.com/Membership"
  30. pattern: "projects/{project}/locations/{location}/memberships/{membership}"
  31. };
  32. // Type of resource represented by this Membership
  33. oneof type {
  34. // Optional. Endpoint information to reach this member.
  35. MembershipEndpoint endpoint = 4 [(google.api.field_behavior) = OPTIONAL];
  36. }
  37. // Output only. The full, unique name of this Membership resource in the format
  38. // `projects/*/locations/*/memberships/{membership_id}`, set during creation.
  39. //
  40. // `membership_id` must be a valid RFC 1123 compliant DNS label:
  41. //
  42. // 1. At most 63 characters in length
  43. // 2. It must consist of lower case alphanumeric characters or `-`
  44. // 3. It must start and end with an alphanumeric character
  45. //
  46. // Which can be expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`,
  47. // with a maximum length of 63 characters.
  48. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  49. // Optional. GCP labels for this membership.
  50. map<string, string> labels = 2 [(google.api.field_behavior) = OPTIONAL];
  51. // Output only. Description of this membership, limited to 63 characters.
  52. // Must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.\ ]*`
  53. //
  54. // This field is present for legacy purposes.
  55. string description = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  56. // Output only. State of the Membership resource.
  57. MembershipState state = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  58. // Output only. When the Membership was created.
  59. google.protobuf.Timestamp create_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  60. // Output only. When the Membership was last updated.
  61. google.protobuf.Timestamp update_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  62. // Output only. When the Membership was deleted.
  63. google.protobuf.Timestamp delete_time = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  64. // Optional. An externally-generated and managed ID for this Membership. This ID may
  65. // be modified after creation, but this is not recommended.
  66. //
  67. // The ID must match the regex: `[a-zA-Z0-9][a-zA-Z0-9_\-\.]*`
  68. //
  69. // If this Membership represents a Kubernetes cluster, this value should be
  70. // set to the UID of the `kube-system` namespace object.
  71. string external_id = 9 [(google.api.field_behavior) = OPTIONAL];
  72. // Output only. For clusters using Connect, the timestamp of the most recent connection
  73. // established with Google Cloud. This time is updated every several minutes,
  74. // not continuously. For clusters that do not use GKE Connect, or that have
  75. // never connected successfully, this field will be unset.
  76. google.protobuf.Timestamp last_connection_time = 10 [(google.api.field_behavior) = OUTPUT_ONLY];
  77. // Output only. Google-generated UUID for this resource. This is unique across all
  78. // Membership resources. If a Membership resource is deleted and another
  79. // resource with the same name is created, it gets a different unique_id.
  80. string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY];
  81. // Optional. How to identify workloads from this Membership.
  82. // See the documentation on Workload Identity for more details:
  83. // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity
  84. Authority authority = 12 [(google.api.field_behavior) = OPTIONAL];
  85. }
  86. // MembershipEndpoint contains information needed to contact a Kubernetes API,
  87. // endpoint and any additional Kubernetes metadata.
  88. message MembershipEndpoint {
  89. // Optional. GKE-specific information. Only present if this Membership is a GKE cluster.
  90. GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL];
  91. // Output only. Useful Kubernetes-specific metadata.
  92. KubernetesMetadata kubernetes_metadata = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  93. // Optional. The in-cluster Kubernetes Resources that should be applied for a correctly
  94. // registered cluster, in the steady state. These resources:
  95. //
  96. // * Ensure that the cluster is exclusively registered to one and only one
  97. // Hub Membership.
  98. // * Propagate Workload Pool Information available in the Membership
  99. // Authority field.
  100. // * Ensure proper initial configuration of default Hub Features.
  101. KubernetesResource kubernetes_resource = 3 [(google.api.field_behavior) = OPTIONAL];
  102. }
  103. // KubernetesResource contains the YAML manifests and configuration for
  104. // Membership Kubernetes resources in the cluster. After CreateMembership or
  105. // UpdateMembership, these resources should be re-applied in the cluster.
  106. message KubernetesResource {
  107. // Input only. The YAML representation of the Membership CR. This field is ignored for GKE
  108. // clusters where Hub can read the CR directly.
  109. //
  110. // Callers should provide the CR that is currently present in the cluster
  111. // during CreateMembership or UpdateMembership, or leave this field empty if
  112. // none exists. The CR manifest is used to validate the cluster has not been
  113. // registered with another Membership.
  114. string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY];
  115. // Output only. Additional Kubernetes resources that need to be applied to the cluster
  116. // after Membership creation, and after every update.
  117. //
  118. // This field is only populated in the Membership returned from a successful
  119. // long-running operation from CreateMembership or UpdateMembership. It is not
  120. // populated during normal GetMembership or ListMemberships requests. To get
  121. // the resource manifest after the initial registration, the caller should
  122. // make a UpdateMembership call with an empty field mask.
  123. repeated ResourceManifest membership_resources = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  124. // Output only. The Kubernetes resources for installing the GKE Connect agent
  125. //
  126. // This field is only populated in the Membership returned from a successful
  127. // long-running operation from CreateMembership or UpdateMembership. It is not
  128. // populated during normal GetMembership or ListMemberships requests. To get
  129. // the resource manifest after the initial registration, the caller should
  130. // make a UpdateMembership call with an empty field mask.
  131. repeated ResourceManifest connect_resources = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  132. // Optional. Options for Kubernetes resource generation.
  133. ResourceOptions resource_options = 4 [(google.api.field_behavior) = OPTIONAL];
  134. }
  135. // ResourceOptions represent options for Kubernetes resource generation.
  136. message ResourceOptions {
  137. // Optional. The Connect agent version to use for connect_resources. Defaults to the
  138. // latest GKE Connect version. The version must be a currently supported
  139. // version, obsolete versions will be rejected.
  140. string connect_version = 1 [(google.api.field_behavior) = OPTIONAL];
  141. // Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for
  142. // CustomResourceDefinition resources.
  143. // This option should be set for clusters with Kubernetes apiserver versions
  144. // <1.16.
  145. bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL];
  146. // Optional. Major version of the Kubernetes cluster. This is only used to determine
  147. // which version to use for the CustomResourceDefinition resources,
  148. // `apiextensions/v1beta1` or`apiextensions/v1`.
  149. string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL];
  150. }
  151. // ResourceManifest represents a single Kubernetes resource to be applied to
  152. // the cluster.
  153. message ResourceManifest {
  154. // YAML manifest of the resource.
  155. string manifest = 1;
  156. // Whether the resource provided in the manifest is `cluster_scoped`.
  157. // If unset, the manifest is assumed to be namespace scoped.
  158. //
  159. // This field is used for REST mapping when applying the resource in a
  160. // cluster.
  161. bool cluster_scoped = 2;
  162. }
  163. // GkeCluster contains information specific to GKE clusters.
  164. message GkeCluster {
  165. // Immutable. Self-link of the GCP resource for the GKE cluster. For example:
  166. //
  167. // //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster
  168. //
  169. // Zonal clusters are also supported.
  170. string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];
  171. }
  172. // KubernetesMetadata provides informational metadata for Memberships
  173. // representing Kubernetes clusters.
  174. message KubernetesMetadata {
  175. // Output only. Kubernetes API server version string as reported by `/version`.
  176. string kubernetes_api_server_version = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  177. // Output only. Node providerID as reported by the first node in the list of nodes on
  178. // the Kubernetes endpoint. On Kubernetes platforms that support zero-node
  179. // clusters (like GKE-on-GCP), the node_count will be zero and the
  180. // node_provider_id will be empty.
  181. string node_provider_id = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  182. // Output only. Node count as reported by Kubernetes nodes resources.
  183. int32 node_count = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  184. // Output only. vCPU count as reported by Kubernetes nodes resources.
  185. int32 vcpu_count = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  186. // Output only. The total memory capacity as reported by the sum of all Kubernetes nodes
  187. // resources, defined in MB.
  188. int32 memory_mb = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  189. // Output only. The time at which these details were last updated. This update_time is
  190. // different from the Membership-level update_time since EndpointDetails are
  191. // updated internally for API consumers.
  192. google.protobuf.Timestamp update_time = 100 [(google.api.field_behavior) = OUTPUT_ONLY];
  193. }
  194. // MembershipState describes the state of a Membership resource.
  195. message MembershipState {
  196. // Code describes the state of a Membership resource.
  197. enum Code {
  198. // The code is not set.
  199. CODE_UNSPECIFIED = 0;
  200. // The cluster is being registered.
  201. CREATING = 1;
  202. // The cluster is registered.
  203. READY = 2;
  204. // The cluster is being unregistered.
  205. DELETING = 3;
  206. // The Membership is being updated.
  207. UPDATING = 4;
  208. // The Membership is being updated by the Hub Service.
  209. SERVICE_UPDATING = 5;
  210. }
  211. // Output only. The current state of the Membership resource.
  212. Code code = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  213. }
  214. // Authority encodes how Google will recognize identities from this Membership.
  215. // See the workload identity documentation for more details:
  216. // https://cloud.google.com/kubernetes-engine/docs/how-to/workload-identity
  217. message Authority {
  218. // Optional. A JSON Web Token (JWT) issuer URI. `issuer` must start with `https://` and
  219. // be a valid URL with length <2000 characters.
  220. //
  221. // If set, then Google will allow valid OIDC tokens from this issuer to
  222. // authenticate within the workload_identity_pool. OIDC discovery will be
  223. // performed on this URI to validate tokens from the issuer.
  224. //
  225. // Clearing `issuer` disables Workload Identity. `issuer` cannot be directly
  226. // modified; it must be cleared (and Workload Identity disabled) before using
  227. // a new issuer (and re-enabling Workload Identity).
  228. string issuer = 1 [(google.api.field_behavior) = OPTIONAL];
  229. // Output only. The name of the workload identity pool in which `issuer` will be
  230. // recognized.
  231. //
  232. // There is a single Workload Identity Pool per Hub that is shared
  233. // between all Memberships that belong to that Hub. For a Hub hosted in
  234. // {PROJECT_ID}, the workload pool format is `{PROJECT_ID}.hub.id.goog`,
  235. // although this is subject to change in newer versions of this API.
  236. string workload_identity_pool = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
  237. // Output only. An identity provider that reflects the `issuer` in the workload identity
  238. // pool.
  239. string identity_provider = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
  240. // Optional. OIDC verification keys for this Membership in JWKS format (RFC 7517).
  241. //
  242. // When this field is set, OIDC discovery will NOT be performed on `issuer`,
  243. // and instead OIDC tokens will be validated using this field.
  244. bytes oidc_jwks = 4 [(google.api.field_behavior) = OPTIONAL];
  245. }