Skip to content

Commit

Permalink
feat: Add OnPremCluster and MultiCloudCluster as GkeCluster equ…
Browse files Browse the repository at this point in the history
…ivalent field

feat!: Move `GkeCluster` under oneof

PiperOrigin-RevId: 393865355
  • Loading branch information
Google APIs authored and copybara-github committed Aug 30, 2021
1 parent 2e9e9ef commit fbae10c
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 6 deletions.
9 changes: 9 additions & 0 deletions google/cloud/gkehub/v1alpha2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,18 @@ java_grpc_library(
java_gapic_library(
name = "gkehub_java_gapic",
srcs = [":gkehub_proto_with_info"],
gapic_yaml = None,
grpc_service_config = "membership_grpc_service_config.json",
service_yaml = "gkehub_v1alpha2.yaml",
test_deps = [
":gkehub_java_grpc",
"//google/cloud/location:location_java_grpc",
],
deps = [
":gkehub_java_proto",
"//google/api:api_java_proto",
"//google/cloud/location:location_java_grpc",
"//google/cloud/location:location_java_proto",
],
)

Expand All @@ -93,6 +99,9 @@ java_gapic_assembly_gradle_pkg(
":gkehub_java_grpc",
":gkehub_java_proto",
":gkehub_proto",
"//google/cloud/location:location_java_grpc",
"//google/cloud/location:location_java_proto",
"//google/cloud/location:location_proto",
],
)

Expand Down
4 changes: 3 additions & 1 deletion google/cloud/gkehub/v1alpha2/gkehub_v1alpha2.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
type: google.api.Service
config_version: 3
name: gkehub.googleapis.com
title: GKE Hub
title: GKE Hub API

apis:
- name: google.cloud.gkehub.v1alpha2.GkeHub
Expand Down Expand Up @@ -44,6 +44,8 @@ backend:
rules:
- selector: 'google.cloud.gkehub.v1alpha2.GkeHub.*'
deadline: 60.0
- selector: google.cloud.gkehub.v1alpha2.GkeHub.CreateMembership
deadline: 120.0
- selector: google.cloud.location.Locations.GetLocation
deadline: 60.0
- selector: google.cloud.location.Locations.ListLocations
Expand Down
74 changes: 69 additions & 5 deletions google/cloud/gkehub/v1alpha2/membership.proto
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ option java_package = "com.google.cloud.gkehub.v1alpha2";
option php_namespace = "Google\\Cloud\\GkeHub\\V1alpha2";
option ruby_package = "Google::Cloud::GkeHub::V1alpha2";

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

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

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

// Generates the manifest for deployment of the GKE connect agent.
//
// **This method is used internally by Google-provided libraries.**
// Most clients should not need to call this method directly.
rpc GenerateConnectManifest(GenerateConnectManifestRequest) returns (GenerateConnectManifestResponse) {
option (google.api.http) = {
get: "/v1alpha2/{name=projects/*/locations/*/memberships/*}:generateConnectManifest"
Expand Down Expand Up @@ -214,8 +231,17 @@ message Membership {
// MembershipEndpoint contains information needed to contact a Kubernetes API,
// endpoint and any additional Kubernetes metadata.
message MembershipEndpoint {
// Optional. GKE-specific information. Only present if this Membership is a GKE cluster.
GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL];
// Cluster information of the registered cluster.
oneof type {
// Optional. Specific information for a GKE-on-GCP cluster.
GkeCluster gke_cluster = 1 [(google.api.field_behavior) = OPTIONAL];

// Optional. Specific information for a GKE On-Prem cluster.
OnPremCluster on_prem_cluster = 4 [(google.api.field_behavior) = OPTIONAL];

// Optional. Specific information for a GKE Multi-Cloud cluster.
MultiCloudCluster multi_cloud_cluster = 5 [(google.api.field_behavior) = OPTIONAL];
}

// Output only. Useful Kubernetes-specific metadata.
KubernetesMetadata kubernetes_metadata = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
Expand Down Expand Up @@ -289,6 +315,42 @@ message GkeCluster {
//
// Zonal clusters are also supported.
string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];

// Output only. If cluster_missing is set then it denotes that the GKE cluster no longer
// exists in the GKE Control Plane.
bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// OnPremCluster contains information specific to GKE On-Prem clusters.
message OnPremCluster {
// Immutable. Self-link of the GCP resource for the GKE On-Prem cluster. For example:
//
// //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/vmwareClusters/my-cluster
// //gkeonprem.googleapis.com/projects/my-project/locations/us-west1-a/bareMetalClusters/my-cluster
string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];

// Output only. If cluster_missing is set then it denotes that
// API(gkeonprem.googleapis.com) resource for this GKE On-Prem cluster no
// longer exists.
bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

// Immutable. Whether the cluster is an admin cluster.
bool admin_cluster = 3 [(google.api.field_behavior) = IMMUTABLE];
}

// MultiCloudCluster contains information specific to GKE Multi-Cloud clusters.
message MultiCloudCluster {
// Immutable. Self-link of the GCP resource for the GKE Multi-Cloud cluster. For
// example:
//
// //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/awsClusters/my-cluster
// //gkemulticloud.googleapis.com/projects/my-project/locations/us-west1-a/azureClusters/my-cluster
string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];

// Output only. If cluster_missing is set then it denotes that
// API(gkemulticloud.googleapis.com) resource for this GKE Multi-Cloud cluster
// no longer exists.
bool cluster_missing = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

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

Expand Down

0 comments on commit fbae10c

Please sign in to comment.