Skip to content

Commit 61cbd8b

Browse files
authored
feat: add lifecycle config and reservation affinity support to v1 (via synth) (#10)
1 parent b5cf4fa commit 61cbd8b

35 files changed

+1951
-843
lines changed

packages/google-cloud-dataproc/google/cloud/dataproc_v1/gapic/cluster_controller_client.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -416,10 +416,12 @@ def update_cluster(
416416
message :class:`~google.cloud.dataproc_v1.types.FieldMask`
417417
graceful_decommission_timeout (Union[dict, ~google.cloud.dataproc_v1.types.Duration]): Optional. Timeout for graceful YARN decomissioning. Graceful
418418
decommissioning allows removing nodes from the cluster without
419-
interrupting jobs in progress. Timeout specifies how long to wait for jobs
420-
in progress to finish before forcefully removing nodes (and potentially
421-
interrupting jobs). Default timeout is 0 (for forceful decommission), and
422-
the maximum allowed timeout is 1 day.
419+
interrupting jobs in progress. Timeout specifies how long to wait for
420+
jobs in progress to finish before forcefully removing nodes (and
421+
potentially interrupting jobs). Default timeout is 0 (for forceful
422+
decommission), and the maximum allowed timeout is 1 day. (see JSON
423+
representation of
424+
`Duration <https://developers.google.com/protocol-buffers/docs/proto3#json>`__).
423425
424426
Only supported on Dataproc image versions 1.2 and higher.
425427

packages/google-cloud-dataproc/google/cloud/dataproc_v1/gapic/enums.py

+19
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,25 @@ class Level(enum.IntEnum):
207207
OFF = 8
208208

209209

210+
class ReservationAffinity(object):
211+
class Type(enum.IntEnum):
212+
"""
213+
Indicates whether to consume capacity from an reservation or not.
214+
215+
Attributes:
216+
TYPE_UNSPECIFIED (int)
217+
NO_RESERVATION (int): Do not consume from any allocated capacity.
218+
ANY_RESERVATION (int): Consume any reservation available.
219+
SPECIFIC_RESERVATION (int): Must consume from a specific reservation. Must specify key value fields
220+
for specifying the reservations.
221+
"""
222+
223+
TYPE_UNSPECIFIED = 0
224+
NO_RESERVATION = 1
225+
ANY_RESERVATION = 2
226+
SPECIFIC_RESERVATION = 3
227+
228+
210229
class WorkflowMetadata(object):
211230
class State(enum.IntEnum):
212231
"""

packages/google-cloud-dataproc/google/cloud/dataproc_v1/proto/autoscaling_policies.proto

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2020 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.
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
syntax = "proto3";
1716

@@ -28,7 +27,6 @@ option go_package = "google.golang.org/genproto/googleapis/cloud/dataproc/v1;dat
2827
option java_multiple_files = true;
2928
option java_outer_classname = "AutoscalingPoliciesProto";
3029
option java_package = "com.google.cloud.dataproc.v1";
31-
3230
option (google.api.resource_definition) = {
3331
type: "dataproc.googleapis.com/Region"
3432
pattern: "projects/{project}/regions/{region}"

packages/google-cloud-dataproc/google/cloud/dataproc_v1/proto/clusters.proto

+79-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2020 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.
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
syntax = "proto3";
1716

@@ -20,7 +19,6 @@ package google.cloud.dataproc.v1;
2019
import "google/api/annotations.proto";
2120
import "google/api/client.proto";
2221
import "google/api/field_behavior.proto";
23-
import "google/cloud/dataproc/v1/operations.proto";
2422
import "google/cloud/dataproc/v1/shared.proto";
2523
import "google/longrunning/operations.proto";
2624
import "google/protobuf/duration.proto";
@@ -40,7 +38,7 @@ service ClusterController {
4038

4139
// Creates a cluster in a project. The returned
4240
// [Operation.metadata][google.longrunning.Operation.metadata] will be
43-
// [ClusterOperationMetadata](/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
41+
// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
4442
rpc CreateCluster(CreateClusterRequest) returns (google.longrunning.Operation) {
4543
option (google.api.http) = {
4644
post: "/v1/projects/{project_id}/regions/{region}/clusters"
@@ -55,22 +53,22 @@ service ClusterController {
5553

5654
// Updates a cluster in a project. The returned
5755
// [Operation.metadata][google.longrunning.Operation.metadata] will be
58-
// [ClusterOperationMetadata](/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
56+
// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
5957
rpc UpdateCluster(UpdateClusterRequest) returns (google.longrunning.Operation) {
6058
option (google.api.http) = {
6159
patch: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}"
6260
body: "cluster"
6361
};
62+
option (google.api.method_signature) = "project_id,region,cluster_name,cluster,update_mask";
6463
option (google.longrunning.operation_info) = {
6564
response_type: "Cluster"
6665
metadata_type: "google.cloud.dataproc.v1.ClusterOperationMetadata"
6766
};
68-
option (google.api.method_signature) = "project_id,region,cluster_name,cluster,update_mask";
6967
}
7068

7169
// Deletes a cluster in a project. The returned
7270
// [Operation.metadata][google.longrunning.Operation.metadata] will be
73-
// [ClusterOperationMetadata](/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
71+
// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
7472
rpc DeleteCluster(DeleteClusterRequest) returns (google.longrunning.Operation) {
7573
option (google.api.http) = {
7674
delete: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}"
@@ -101,11 +99,11 @@ service ClusterController {
10199

102100
// Gets cluster diagnostic information. The returned
103101
// [Operation.metadata][google.longrunning.Operation.metadata] will be
104-
// [ClusterOperationMetadata](/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
102+
// [ClusterOperationMetadata](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#clusteroperationmetadata).
105103
// After the operation completes,
106104
// [Operation.response][google.longrunning.Operation.response]
107105
// contains
108-
// [DiagnoseClusterResults](/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
106+
// [DiagnoseClusterResults](https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#diagnoseclusterresults).
109107
rpc DiagnoseCluster(DiagnoseClusterRequest) returns (google.longrunning.Operation) {
110108
option (google.api.http) = {
111109
post: "/v1/projects/{project_id}/regions/{region}/clusters/{cluster_name}:diagnose"
@@ -215,6 +213,9 @@ message ClusterConfig {
215213

216214
// Optional. Security settings for the cluster.
217215
SecurityConfig security_config = 16 [(google.api.field_behavior) = OPTIONAL];
216+
217+
// Optional. Lifecycle setting for the cluster.
218+
LifecycleConfig lifecycle_config = 17 [(google.api.field_behavior) = OPTIONAL];
218219
}
219220

220221
// Autoscaling Policy config associated with the cluster.
@@ -322,9 +323,12 @@ message GceClusterConfig {
322323
// [Project and instance
323324
// metadata](https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)).
324325
map<string, string> metadata = 5;
326+
327+
// Optional. Reservation Affinity for consuming Zonal reservation.
328+
ReservationAffinity reservation_affinity = 11 [(google.api.field_behavior) = OPTIONAL];
325329
}
326330

327-
// Optional. The config settings for Compute Engine resources in
331+
// The config settings for Compute Engine resources in
328332
// an instance group, such as a master or worker group.
329333
message InstanceGroupConfig {
330334
// Optional. The number of VM instances in the instance group.
@@ -438,7 +442,10 @@ message NodeInitializationAction {
438442
string executable_file = 1 [(google.api.field_behavior) = REQUIRED];
439443

440444
// Optional. Amount of time executable has to complete. Default is
441-
// 10 minutes. Cluster creation fails with an explanatory error message (the
445+
// 10 minutes (see JSON representation of
446+
// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
447+
//
448+
// Cluster creation fails with an explanatory error message (the
442449
// name of the executable that caused the error and the exceeded timeout
443450
// period) if the executable is not completed at end of the timeout period.
444451
google.protobuf.Duration execution_timeout = 2 [(google.api.field_behavior) = OPTIONAL];
@@ -495,7 +502,8 @@ message ClusterStatus {
495502
(google.api.field_behavior) = OPTIONAL
496503
];
497504

498-
// Output only. Time when this state was entered.
505+
// Output only. Time when this state was entered (see JSON representation of
506+
// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
499507
google.protobuf.Timestamp state_start_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
500508

501509
// Output only. Additional state information that includes
@@ -613,6 +621,36 @@ message SoftwareConfig {
613621
repeated Component optional_components = 3 [(google.api.field_behavior) = OPTIONAL];
614622
}
615623

624+
// Specifies the cluster auto-delete schedule configuration.
625+
message LifecycleConfig {
626+
// Optional. The duration to keep the cluster alive while idling (when no jobs
627+
// are running). Passing this threshold will cause the cluster to be
628+
// deleted. Minimum value is 10 minutes; maximum value is 14 days (see JSON
629+
// representation of
630+
// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json).
631+
google.protobuf.Duration idle_delete_ttl = 1 [(google.api.field_behavior) = OPTIONAL];
632+
633+
// Either the exact time the cluster should be deleted at or
634+
// the cluster maximum age.
635+
oneof ttl {
636+
// Optional. The time when cluster will be auto-deleted (see JSON representation of
637+
// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
638+
google.protobuf.Timestamp auto_delete_time = 2 [(google.api.field_behavior) = OPTIONAL];
639+
640+
// Optional. The lifetime duration of cluster. The cluster will be
641+
// auto-deleted at the end of this period. Minimum value is 10 minutes;
642+
// maximum value is 14 days (see JSON representation of
643+
// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
644+
google.protobuf.Duration auto_delete_ttl = 3 [(google.api.field_behavior) = OPTIONAL];
645+
}
646+
647+
// Output only. The time when cluster became idle (most recent job finished)
648+
// and became eligible for deletion due to idleness (see JSON representation
649+
// of
650+
// [Timestamp](https://developers.google.com/protocol-buffers/docs/proto3#json)).
651+
google.protobuf.Timestamp idle_start_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
652+
}
653+
616654
// Contains cluster daemon metrics, such as HDFS and YARN stats.
617655
//
618656
// **Beta Feature**: This report is available for testing purposes only. It may
@@ -671,7 +709,8 @@ message UpdateClusterRequest {
671709
// interrupting jobs in progress. Timeout specifies how long to wait for jobs
672710
// in progress to finish before forcefully removing nodes (and potentially
673711
// interrupting jobs). Default timeout is 0 (for forceful decommission), and
674-
// the maximum allowed timeout is 1 day.
712+
// the maximum allowed timeout is 1 day. (see JSON representation of
713+
// [Duration](https://developers.google.com/protocol-buffers/docs/proto3#json)).
675714
//
676715
// Only supported on Dataproc image versions 1.2 and higher.
677716
google.protobuf.Duration graceful_decommission_timeout = 6 [(google.api.field_behavior) = OPTIONAL];
@@ -854,3 +893,30 @@ message DiagnoseClusterResults {
854893
// diagnostics.
855894
string output_uri = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
856895
}
896+
897+
// Reservation Affinity for consuming Zonal reservation.
898+
message ReservationAffinity {
899+
// Indicates whether to consume capacity from an reservation or not.
900+
enum Type {
901+
TYPE_UNSPECIFIED = 0;
902+
903+
// Do not consume from any allocated capacity.
904+
NO_RESERVATION = 1;
905+
906+
// Consume any reservation available.
907+
ANY_RESERVATION = 2;
908+
909+
// Must consume from a specific reservation. Must specify key value fields
910+
// for specifying the reservations.
911+
SPECIFIC_RESERVATION = 3;
912+
}
913+
914+
// Optional. Type of reservation to consume
915+
Type consume_reservation_type = 1 [(google.api.field_behavior) = OPTIONAL];
916+
917+
// Optional. Corresponds to the label key of reservation resource.
918+
string key = 2 [(google.api.field_behavior) = OPTIONAL];
919+
920+
// Optional. Corresponds to the label values of reservation resource.
921+
repeated string values = 3 [(google.api.field_behavior) = OPTIONAL];
922+
}

0 commit comments

Comments
 (0)