Skip to content

Commit 86d21e8

Browse files
authoredJan 14, 2022
feat: add Autoscaling API (#963)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 410080804 Source-Link: googleapis/googleapis@0fd6a32 Source-Link: googleapis/googleapis-gen@788247b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzg4MjQ3YjdjYmRhNWIwNWYyYWM0ZjZjMTNmMTBmZjI2NWUxODNmMCJ9
1 parent 0d4688f commit 86d21e8

12 files changed

+3816
-1176
lines changed
 

‎protos/google/bigtable/admin/v2/bigtable_instance_admin.proto

+63-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -51,6 +51,12 @@ service BigtableInstanceAdmin {
5151
"https://www.googleapis.com/auth/cloud-platform.read-only";
5252

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

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

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

171+
// Partially updates a cluster within a project. This method is the preferred
172+
// way to update a Cluster.
173+
//
174+
// To enable and update autoscaling, set
175+
// cluster_config.cluster_autoscaling_config. When autoscaling is enabled,
176+
// serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it
177+
// are ignored. Note that an update cannot simultaneously set serve_nodes to
178+
// non-zero and cluster_config.cluster_autoscaling_config to non-empty, and
179+
// also specify both in the update_mask.
180+
//
181+
// To disable autoscaling, clear cluster_config.cluster_autoscaling_config,
182+
// and explicitly set a serve_node count via the update_mask.
183+
rpc PartialUpdateCluster(PartialUpdateClusterRequest) returns (google.longrunning.Operation) {
184+
option (google.api.http) = {
185+
patch: "/v2/{cluster.name=projects/*/instances/*/clusters/*}"
186+
body: "cluster"
187+
};
188+
option (google.api.method_signature) = "cluster,update_mask";
189+
option (google.longrunning.operation_info) = {
190+
response_type: "Cluster"
191+
metadata_type: "PartialUpdateClusterMetadata"
192+
};
193+
}
194+
155195
// Deletes a cluster from an instance.
156196
rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) {
157197
option (google.api.http) = {
@@ -457,6 +497,28 @@ message UpdateClusterMetadata {
457497
google.protobuf.Timestamp finish_time = 3;
458498
}
459499

500+
// The metadata for the Operation returned by PartialUpdateCluster.
501+
message PartialUpdateClusterMetadata {
502+
// The time at which the original request was received.
503+
google.protobuf.Timestamp request_time = 1;
504+
505+
// The time at which the operation failed or was completed successfully.
506+
google.protobuf.Timestamp finish_time = 2;
507+
508+
// The original request for PartialUpdateCluster.
509+
PartialUpdateClusterRequest original_request = 3;
510+
}
511+
512+
// Request message for BigtableInstanceAdmin.PartialUpdateCluster.
513+
message PartialUpdateClusterRequest {
514+
// Required. The Cluster which contains the partial updates to be applied, subject to
515+
// the update_mask.
516+
Cluster cluster = 1 [(google.api.field_behavior) = REQUIRED];
517+
518+
// Required. The subset of Cluster fields which should be replaced.
519+
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
520+
}
521+
460522
// Request message for BigtableInstanceAdmin.CreateAppProfile.
461523
message CreateAppProfileRequest {
462524
// Required. The unique name of the instance in which to create the new app profile.

‎protos/google/bigtable/admin/v2/common.proto

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2020 Google LLC
1+
// Copyright 2021 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ syntax = "proto3";
1717
package google.bigtable.admin.v2;
1818

1919
import "google/protobuf/timestamp.proto";
20+
import "google/api/annotations.proto";
2021

2122
option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
2223
option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";

‎protos/google/bigtable/admin/v2/instance.proto

+40-3
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,23 @@ message Instance {
114114
google.protobuf.Timestamp create_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
115115
}
116116

117+
// The Autoscaling targets for a Cluster. These determine the recommended nodes.
118+
message AutoscalingTargets {
119+
// The cpu utilization that the Autoscaler should be trying to achieve.
120+
// This number is on a scale from 0 (no utilization) to
121+
// 100 (total utilization).
122+
int32 cpu_utilization_percent = 2;
123+
}
124+
125+
// Limits for the number of nodes a Cluster can autoscale up/down to.
126+
message AutoscalingLimits {
127+
// Required. Minimum number of nodes to scale down to.
128+
int32 min_serve_nodes = 1 [(google.api.field_behavior) = REQUIRED];
129+
130+
// Required. Maximum number of nodes to scale up to.
131+
int32 max_serve_nodes = 2 [(google.api.field_behavior) = REQUIRED];
132+
}
133+
117134
// A resizable group of nodes in a particular cloud location, capable
118135
// of serving all [Tables][google.bigtable.admin.v2.Table] in the parent
119136
// [Instance][google.bigtable.admin.v2.Instance].
@@ -123,6 +140,21 @@ message Cluster {
123140
pattern: "projects/{project}/instances/{instance}/clusters/{cluster}"
124141
};
125142

143+
// Autoscaling config for a cluster.
144+
message ClusterAutoscalingConfig {
145+
// Required. Autoscaling limits for this cluster.
146+
AutoscalingLimits autoscaling_limits = 1 [(google.api.field_behavior) = REQUIRED];
147+
148+
// Required. Autoscaling targets for this cluster.
149+
AutoscalingTargets autoscaling_targets = 2 [(google.api.field_behavior) = REQUIRED];
150+
}
151+
152+
// Configuration for a cluster.
153+
message ClusterConfig {
154+
// Autoscaling configuration for this cluster.
155+
ClusterAutoscalingConfig cluster_autoscaling_config = 1;
156+
}
157+
126158
// Cloud Key Management Service (Cloud KMS) settings for a CMEK-protected
127159
// cluster.
128160
message EncryptionConfig {
@@ -180,9 +212,14 @@ message Cluster {
180212
// The current state of the cluster.
181213
State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
182214

183-
// Required. The number of nodes allocated to this cluster. More nodes enable
184-
// higher throughput and more consistent performance.
185-
int32 serve_nodes = 4 [(google.api.field_behavior) = REQUIRED];
215+
// The number of nodes allocated to this cluster. More nodes enable higher
216+
// throughput and more consistent performance.
217+
int32 serve_nodes = 4;
218+
219+
oneof config {
220+
// Configuration for this cluster.
221+
ClusterConfig cluster_config = 7;
222+
}
186223

187224
// (`CreationOnly`)
188225
// The type of storage used by this cluster to serve its

0 commit comments

Comments
 (0)