Skip to content

Commit

Permalink
feat: add Autoscaling API (#963)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 410080804

Source-Link: googleapis/googleapis@0fd6a32

Source-Link: googleapis/googleapis-gen@788247b
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzg4MjQ3YjdjYmRhNWIwNWYyYWM0ZjZjMTNmMTBmZjI2NWUxODNmMCJ9
  • Loading branch information
gcf-owl-bot[bot] authored Jan 14, 2022
1 parent 0d4688f commit 86d21e8
Show file tree
Hide file tree
Showing 12 changed files with 3,816 additions and 1,176 deletions.
64 changes: 63 additions & 1 deletion protos/google/bigtable/admin/v2/bigtable_instance_admin.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,6 +51,12 @@ service BigtableInstanceAdmin {
"https://www.googleapis.com/auth/cloud-platform.read-only";

// Create an instance within a project.
//
// Note that exactly one of Cluster.serve_nodes and
// Cluster.cluster_config.cluster_autoscaling_config can be set. If
// serve_nodes is set to non-zero, then the cluster is manually scaled. If
// cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is
// enabled.
rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v2/{parent=projects/*}/instances"
Expand Down Expand Up @@ -112,6 +118,12 @@ service BigtableInstanceAdmin {
}

// Creates a cluster within an instance.
//
// Note that exactly one of Cluster.serve_nodes and
// Cluster.cluster_config.cluster_autoscaling_config can be set. If
// serve_nodes is set to non-zero, then the cluster is manually scaled. If
// cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is
// enabled.
rpc CreateCluster(CreateClusterRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v2/{parent=projects/*/instances/*}/clusters"
Expand Down Expand Up @@ -141,6 +153,10 @@ service BigtableInstanceAdmin {
}

// Updates a cluster within an instance.
//
// Note that UpdateCluster does not support updating
// cluster_config.cluster_autoscaling_config. In order to update it, you
// must use PartialUpdateCluster.
rpc UpdateCluster(Cluster) returns (google.longrunning.Operation) {
option (google.api.http) = {
put: "/v2/{name=projects/*/instances/*/clusters/*}"
Expand All @@ -152,6 +168,30 @@ service BigtableInstanceAdmin {
};
}

// Partially updates a cluster within a project. This method is the preferred
// way to update a Cluster.
//
// To enable and update autoscaling, set
// cluster_config.cluster_autoscaling_config. When autoscaling is enabled,
// serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it
// are ignored. Note that an update cannot simultaneously set serve_nodes to
// non-zero and cluster_config.cluster_autoscaling_config to non-empty, and
// also specify both in the update_mask.
//
// To disable autoscaling, clear cluster_config.cluster_autoscaling_config,
// and explicitly set a serve_node count via the update_mask.
rpc PartialUpdateCluster(PartialUpdateClusterRequest) returns (google.longrunning.Operation) {
option (google.api.http) = {
patch: "/v2/{cluster.name=projects/*/instances/*/clusters/*}"
body: "cluster"
};
option (google.api.method_signature) = "cluster,update_mask";
option (google.longrunning.operation_info) = {
response_type: "Cluster"
metadata_type: "PartialUpdateClusterMetadata"
};
}

// Deletes a cluster from an instance.
rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
Expand Down Expand Up @@ -457,6 +497,28 @@ message UpdateClusterMetadata {
google.protobuf.Timestamp finish_time = 3;
}

// The metadata for the Operation returned by PartialUpdateCluster.
message PartialUpdateClusterMetadata {
// The time at which the original request was received.
google.protobuf.Timestamp request_time = 1;

// The time at which the operation failed or was completed successfully.
google.protobuf.Timestamp finish_time = 2;

// The original request for PartialUpdateCluster.
PartialUpdateClusterRequest original_request = 3;
}

// Request message for BigtableInstanceAdmin.PartialUpdateCluster.
message PartialUpdateClusterRequest {
// Required. The Cluster which contains the partial updates to be applied, subject to
// the update_mask.
Cluster cluster = 1 [(google.api.field_behavior) = REQUIRED];

// Required. The subset of Cluster fields which should be replaced.
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
}

// Request message for BigtableInstanceAdmin.CreateAppProfile.
message CreateAppProfileRequest {
// Required. The unique name of the instance in which to create the new app profile.
Expand Down
3 changes: 2 additions & 1 deletion protos/google/bigtable/admin/v2/common.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 Google LLC
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@ syntax = "proto3";
package google.bigtable.admin.v2;

import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";
Expand Down
43 changes: 40 additions & 3 deletions protos/google/bigtable/admin/v2/instance.proto
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ message Instance {
google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// The Autoscaling targets for a Cluster. These determine the recommended nodes.
message AutoscalingTargets {
// The cpu utilization that the Autoscaler should be trying to achieve.
// This number is on a scale from 0 (no utilization) to
// 100 (total utilization).
int32 cpu_utilization_percent = 2;
}

// Limits for the number of nodes a Cluster can autoscale up/down to.
message AutoscalingLimits {
// Required. Minimum number of nodes to scale down to.
int32 min_serve_nodes = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Maximum number of nodes to scale up to.
int32 max_serve_nodes = 2 [(google.api.field_behavior) = REQUIRED];
}

// A resizable group of nodes in a particular cloud location, capable
// of serving all [Tables][google.bigtable.admin.v2.Table] in the parent
// [Instance][google.bigtable.admin.v2.Instance].
Expand All @@ -123,6 +140,21 @@ message Cluster {
pattern: "projects/{project}/instances/{instance}/clusters/{cluster}"
};

// Autoscaling config for a cluster.
message ClusterAutoscalingConfig {
// Required. Autoscaling limits for this cluster.
AutoscalingLimits autoscaling_limits = 1 [(google.api.field_behavior) = REQUIRED];

// Required. Autoscaling targets for this cluster.
AutoscalingTargets autoscaling_targets = 2 [(google.api.field_behavior) = REQUIRED];
}

// Configuration for a cluster.
message ClusterConfig {
// Autoscaling configuration for this cluster.
ClusterAutoscalingConfig cluster_autoscaling_config = 1;
}

// Cloud Key Management Service (Cloud KMS) settings for a CMEK-protected
// cluster.
message EncryptionConfig {
Expand Down Expand Up @@ -180,9 +212,14 @@ message Cluster {
// The current state of the cluster.
State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

// Required. The number of nodes allocated to this cluster. More nodes enable
// higher throughput and more consistent performance.
int32 serve_nodes = 4 [(google.api.field_behavior) = REQUIRED];
// The number of nodes allocated to this cluster. More nodes enable higher
// throughput and more consistent performance.
int32 serve_nodes = 4;

oneof config {
// Configuration for this cluster.
ClusterConfig cluster_config = 7;
}

// (`CreationOnly`)
// The type of storage used by this cluster to serve its
Expand Down
Loading

0 comments on commit 86d21e8

Please sign in to comment.