Skip to content

Commit fbae10c

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add OnPremCluster and MultiCloudCluster as GkeCluster equivalent field
feat!: Move `GkeCluster` under oneof PiperOrigin-RevId: 393865355
1 parent 2e9e9ef commit fbae10c

3 files changed

Lines changed: 81 additions & 6 deletions

File tree

google/cloud/gkehub/v1alpha2/BUILD.bazel

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,18 @@ java_grpc_library(
6868
java_gapic_library(
6969
name = "gkehub_java_gapic",
7070
srcs = [":gkehub_proto_with_info"],
71+
gapic_yaml = None,
7172
grpc_service_config = "membership_grpc_service_config.json",
73+
service_yaml = "gkehub_v1alpha2.yaml",
7274
test_deps = [
7375
":gkehub_java_grpc",
76+
"//google/cloud/location:location_java_grpc",
7477
],
7578
deps = [
7679
":gkehub_java_proto",
80+
"//google/api:api_java_proto",
81+
"//google/cloud/location:location_java_grpc",
82+
"//google/cloud/location:location_java_proto",
7783
],
7884
)
7985

@@ -93,6 +99,9 @@ java_gapic_assembly_gradle_pkg(
9399
":gkehub_java_grpc",
94100
":gkehub_java_proto",
95101
":gkehub_proto",
102+
"//google/cloud/location:location_java_grpc",
103+
"//google/cloud/location:location_java_proto",
104+
"//google/cloud/location:location_proto",
96105
],
97106
)
98107

google/cloud/gkehub/v1alpha2/gkehub_v1alpha2.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
type: google.api.Service
22
config_version: 3
33
name: gkehub.googleapis.com
4-
title: GKE Hub
4+
title: GKE Hub API
55

66
apis:
77
- name: google.cloud.gkehub.v1alpha2.GkeHub
@@ -44,6 +44,8 @@ backend:
4444
rules:
4545
- selector: 'google.cloud.gkehub.v1alpha2.GkeHub.*'
4646
deadline: 60.0
47+
- selector: google.cloud.gkehub.v1alpha2.GkeHub.CreateMembership
48+
deadline: 120.0
4749
- selector: google.cloud.location.Locations.GetLocation
4850
deadline: 60.0
4951
- selector: google.cloud.location.Locations.ListLocations

google/cloud/gkehub/v1alpha2/membership.proto

Lines changed: 69 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,14 @@ option java_package = "com.google.cloud.gkehub.v1alpha2";
3232
option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha2";
3333
option ruby_package = "Google::Cloud::GkeHub::V1alpha2";
3434

35-
// GKE Hub CRUD API for the Membership resource.
36-
// The Membership service is currently only available in the global location.
35+
// The GKE Hub service handles the registration of many Kubernetes
36+
// clusters to Google Cloud, represented with the [Membership][google.cloud.gkehub.v1alpha2.Membership] resource.
37+
//
38+
// GKE Hub is currently only available in the global region.
39+
//
40+
// **Membership management may be non-trivial:** it is recommended to use one
41+
// of the Google-provided client libraries or tools where possible when working
42+
// with Membership resources.
3743
service GkeHub {
3844
option (google.api.default_host) = "gkehub.googleapis.com";
3945
option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
@@ -54,7 +60,11 @@ service GkeHub {
5460
option (google.api.method_signature) = "name";
5561
}
5662

57-
// Adds a new Membership.
63+
// Creates a new Membership.
64+
//
65+
// **This is currently only supported for GKE clusters on Google Cloud**.
66+
// To register other clusters, follow the instructions at
67+
// https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster.
5868
rpc CreateMembership(CreateMembershipRequest) returns (google.longrunning.Operation) {
5969
option (google.api.http) = {
6070
post: "/v1alpha2/{parent=projects/*/locations/*}/memberships"
@@ -68,6 +78,10 @@ service GkeHub {
6878
}
6979

7080
// Removes a Membership.
81+
//
82+
// **This is currently only supported for GKE clusters on Google Cloud**.
83+
// To unregister other clusters, follow the instructions at
84+
// https://cloud.google.com/anthos/multicluster-management/connect/unregistering-a-cluster.
7185
rpc DeleteMembership(DeleteMembershipRequest) returns (google.longrunning.Operation) {
7286
option (google.api.http) = {
7387
delete: "/v1alpha2/{name=projects/*/locations/*/memberships/*}"
@@ -93,6 +107,9 @@ service GkeHub {
93107
}
94108

95109
// Generates the manifest for deployment of the GKE connect agent.
110+
//
111+
// **This method is used internally by Google-provided libraries.**
112+
// Most clients should not need to call this method directly.
96113
rpc GenerateConnectManifest(GenerateConnectManifestRequest) returns (GenerateConnectManifestResponse) {
97114
option (google.api.http) = {
98115
get: "/v1alpha2/{name=projects/*/locations/*/memberships/*}:generateConnectManifest"
@@ -214,8 +231,17 @@ message Membership {
214231
// MembershipEndpoint contains information needed to contact a Kubernetes API,
215232
// endpoint and any additional Kubernetes metadata.
216233
message MembershipEndpoint {
217-
// Optional. GKE-specific information. Only present if this Membership is a GKE cluster.
218-
GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL];
234+
// Cluster information of the registered cluster.
235+
oneof type {
236+
// Optional. Specific information for a GKE-on-GCP cluster.
237+
GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL];
238+
239+
// Optional. Specific information for a GKE On-Prem cluster.
240+
OnPremCluster on_prem_cluster = 4 [(google.api.field_behavior) = OPTIONAL];
241+
242+
// Optional. Specific information for a GKE Multi-Cloud cluster.
243+
MultiCloudCluster multi_cloud_cluster = 5 [(google.api.field_behavior) = OPTIONAL];
244+
}
219245

220246
// Output only. Useful Kubernetes-specific metadata.
221247
KubernetesMetadata kubernetes_metadata = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
@@ -289,6 +315,42 @@ message GkeCluster {
289315
//
290316
// Zonal clusters are also supported.
291317
string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];
318+
319+
// Output only. If cluster_missing is set then it denotes that the GKE cluster no longer
320+
// exists in the GKE Control Plane.
321+
bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
322+
}
323+
324+
// OnPremCluster contains information specific to GKE On-Prem clusters.
325+
message OnPremCluster {
326+
// Immutable. Self-link of the GCP resource for the GKE On-Prem cluster. For example:
327+
//
328+
// //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster
329+
// //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster
330+
string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];
331+
332+
// Output only. If cluster_missing is set then it denotes that
333+
// API(gkeonprem.googleapis.com) resource for this GKE On-Prem cluster no
334+
// longer exists.
335+
bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
336+
337+
// Immutable. Whether the cluster is an admin cluster.
338+
bool admin_cluster = 3 [(google.api.field_behavior) = IMMUTABLE];
339+
}
340+
341+
// MultiCloudCluster contains information specific to GKE Multi-Cloud clusters.
342+
message MultiCloudCluster {
343+
// Immutable. Self-link of the GCP resource for the GKE Multi-Cloud cluster. For
344+
// example:
345+
//
346+
// //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster
347+
// //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster
348+
string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];
349+
350+
// Output only. If cluster_missing is set then it denotes that
351+
// API(gkemulticloud.googleapis.com) resource for this GKE Multi-Cloud cluster
352+
// no longer exists.
353+
bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
292354
}
293355

294356
// KubernetesMetadata provides informational metadata for Memberships
@@ -511,6 +573,8 @@ message UpdateMembershipRequest {
511573
// If you are updating a map field, set the value of a key to null or empty
512574
// string to delete the key from the map. It's not possible to update a key's
513575
// value to the empty string.
576+
// If you specify the update_mask to be a special path "*", fully replaces all
577+
// user-modifiable fields to match `resource`.
514578
Membership resource = 3 [(google.api.field_behavior) = REQUIRED];
515579
}
516580

0 commit comments

Comments
 (0)