Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Autoscaling API #963

Merged
merged 3 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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