Skip to content

Commit 33373fd

Browse files
feat: [orchestration] added RPCs StopAirflowCommand, ExecuteAirflowCommand, PollAirflowCommand, DatabaseFailover, FetchDatabaseProperties (#4341)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 540052133 Source-Link: https://togithub.com/googleapis/googleapis/commit/386f722b6251585d42b1698ce433b1b55010eb11 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/b8b5220bb0ca29e108194248def0dbb38b068769 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9yY2hlc3RyYXRpb24tYWlyZmxvdy1zZXJ2aWNlLy5Pd2xCb3QueWFtbCIsImgiOiJiOGI1MjIwYmIwY2EyOWUxMDgxOTQyNDhkZWYwZGJiMzhiMDY4NzY5In0= BEGIN_NESTED_COMMIT feat: [orchestration] added RPCs StopAirflowCommand, ExecuteAirflowCommand, PollAirflowCommand, DatabaseFailover, FetchDatabaseProperties PiperOrigin-RevId: 540051332 Source-Link: https://togithub.com/googleapis/googleapis/commit/b84c697241488e5dd521b09b7eaf75b081648585 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/02564778c80b7b5dc2ddff413be253ef24b69165 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9yY2hlc3RyYXRpb24tYWlyZmxvdy1zZXJ2aWNlLy5Pd2xCb3QueWFtbCIsImgiOiIwMjU2NDc3OGM4MGI3YjVkYzJkZGZmNDEzYmUyNTNlZjI0YjY5MTY1In0= END_NESTED_COMMIT
1 parent d4d75c6 commit 33373fd

29 files changed

Lines changed: 23454 additions & 10687 deletions

packages/google-cloud-orchestration-airflow-service/README.md

Lines changed: 31 additions & 22 deletions
Large diffs are not rendered by default.

packages/google-cloud-orchestration-airflow-service/protos/google/cloud/orchestration/airflow/service/v1/environments.proto

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,33 @@ service Environments {
9494
};
9595
}
9696

97+
// Executes Airflow CLI command.
98+
rpc ExecuteAirflowCommand(ExecuteAirflowCommandRequest)
99+
returns (ExecuteAirflowCommandResponse) {
100+
option (google.api.http) = {
101+
post: "/v1/{environment=projects/*/locations/*/environments/*}:executeAirflowCommand"
102+
body: "*"
103+
};
104+
}
105+
106+
// Stops Airflow CLI command execution.
107+
rpc StopAirflowCommand(StopAirflowCommandRequest)
108+
returns (StopAirflowCommandResponse) {
109+
option (google.api.http) = {
110+
post: "/v1/{environment=projects/*/locations/*/environments/*}:stopAirflowCommand"
111+
body: "*"
112+
};
113+
}
114+
115+
// Polls Airflow CLI command execution and fetches logs.
116+
rpc PollAirflowCommand(PollAirflowCommandRequest)
117+
returns (PollAirflowCommandResponse) {
118+
option (google.api.http) = {
119+
post: "/v1/{environment=projects/*/locations/*/environments/*}:pollAirflowCommand"
120+
body: "*"
121+
};
122+
}
123+
97124
// Creates a snapshots of a Cloud Composer environment.
98125
//
99126
// As a result of this operation, snapshot of environment's state is stored
@@ -123,6 +150,27 @@ service Environments {
123150
metadata_type: "google.cloud.orchestration.airflow.service.v1.OperationMetadata"
124151
};
125152
}
153+
154+
// Triggers database failover (only for highly resilient environments).
155+
rpc DatabaseFailover(DatabaseFailoverRequest)
156+
returns (google.longrunning.Operation) {
157+
option (google.api.http) = {
158+
post: "/v1/{environment=projects/*/locations/*/environments/*}:databaseFailover"
159+
body: "*"
160+
};
161+
option (google.longrunning.operation_info) = {
162+
response_type: "google.cloud.orchestration.airflow.service.v1.DatabaseFailoverResponse"
163+
metadata_type: "google.cloud.orchestration.airflow.service.v1.OperationMetadata"
164+
};
165+
}
166+
167+
// Fetches database properties.
168+
rpc FetchDatabaseProperties(FetchDatabasePropertiesRequest)
169+
returns (FetchDatabasePropertiesResponse) {
170+
option (google.api.http) = {
171+
get: "/v1/{environment=projects/*/locations/*/environments/*}:fetchDatabaseProperties"
172+
};
173+
}
126174
}
127175

128176
// Create a new environment.
@@ -307,6 +355,119 @@ message UpdateEnvironmentRequest {
307355
google.protobuf.FieldMask update_mask = 3;
308356
}
309357

358+
// Execute Airflow Command request.
359+
message ExecuteAirflowCommandRequest {
360+
// The resource name of the environment in the form:
361+
// "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
362+
string environment = 1;
363+
364+
// Airflow command.
365+
string command = 2;
366+
367+
// Airflow subcommand.
368+
string subcommand = 3;
369+
370+
// Parameters for the Airflow command/subcommand as an array of arguments.
371+
// It may contain positional arguments like `["my-dag-id"]`, key-value
372+
// parameters like `["--foo=bar"]` or `["--foo","bar"]`,
373+
// or other flags like `["-f"]`.
374+
repeated string parameters = 4;
375+
}
376+
377+
// Response to ExecuteAirflowCommandRequest.
378+
message ExecuteAirflowCommandResponse {
379+
// The unique ID of the command execution for polling.
380+
string execution_id = 1;
381+
382+
// The name of the pod where the command is executed.
383+
string pod = 2;
384+
385+
// The namespace of the pod where the command is executed.
386+
string pod_namespace = 3;
387+
388+
// Error message. Empty if there was no error.
389+
string error = 4;
390+
}
391+
392+
// Stop Airflow Command request.
393+
message StopAirflowCommandRequest {
394+
// The resource name of the environment in the form:
395+
// "projects/{projectId}/locations/{locationId}/environments/{environmentId}".
396+
string environment = 1;
397+
398+
// The unique ID of the command execution.
399+
string execution_id = 2;
400+
401+
// The name of the pod where the command is executed.
402+
string pod = 3;
403+
404+
// The namespace of the pod where the command is executed.
405+
string pod_namespace = 4;
406+
407+
// If true, the execution is terminated forcefully (SIGKILL). If false, the
408+
// execution is stopped gracefully, giving it time for cleanup.
409+
bool force = 5;
410+
}
411+
412+
// Response to StopAirflowCommandRequest.
413+
message StopAirflowCommandResponse {
414+
// Whether the execution is still running.
415+
bool is_done = 1;
416+
417+
// Output message from stopping execution request.
418+
repeated string output = 2;
419+
}
420+
421+
// Poll Airflow Command request.
422+
message PollAirflowCommandRequest {
423+
// The resource name of the environment in the form:
424+
// "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
425+
string environment = 1;
426+
427+
// The unique ID of the command execution.
428+
string execution_id = 2;
429+
430+
// The name of the pod where the command is executed.
431+
string pod = 3;
432+
433+
// The namespace of the pod where the command is executed.
434+
string pod_namespace = 4;
435+
436+
// Line number from which new logs should be fetched.
437+
int32 next_line_number = 5;
438+
}
439+
440+
// Response to PollAirflowCommandRequest.
441+
message PollAirflowCommandResponse {
442+
// Contains information about a single line from logs.
443+
message Line {
444+
// Number of the line.
445+
int32 line_number = 1;
446+
447+
// Text content of the log line.
448+
string content = 2;
449+
}
450+
451+
// Information about how a command ended.
452+
message ExitInfo {
453+
// The exit code from the command execution.
454+
int32 exit_code = 1;
455+
456+
// Error message. Empty if there was no error.
457+
string error = 2;
458+
}
459+
460+
// Output from the command execution. It may not contain the full output
461+
// and the caller may need to poll for more lines.
462+
repeated Line output = 1;
463+
464+
// Whether the command execution has finished and there is no more output.
465+
bool output_end = 2;
466+
467+
// The result exit status of the command.
468+
ExitInfo exit_info = 3;
469+
}
470+
310471
// Request to create a snapshot of a Cloud Composer environment.
311472
message SaveSnapshotRequest {
312473
// The resource name of the source environment in the form:
@@ -357,6 +518,44 @@ message LoadSnapshotRequest {
357518
// Response to LoadSnapshotRequest.
358519
message LoadSnapshotResponse {}
359520

521+
// Request to trigger database failover (only for highly resilient
522+
// environments).
523+
message DatabaseFailoverRequest {
524+
// Target environment:
525+
// "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
526+
string environment = 1;
527+
}
528+
529+
// Response for DatabaseFailoverRequest.
530+
message DatabaseFailoverResponse {}
531+
532+
// Request to fetch properties of environment's database.
533+
message FetchDatabasePropertiesRequest {
534+
// Required. The resource name of the environment, in the form:
535+
// "projects/{projectId}/locations/{locationId}/environments/{environmentId}"
536+
string environment = 1 [
537+
(google.api.field_behavior) = REQUIRED,
538+
(google.api.resource_reference) = {
539+
type: "composer.googleapis.com/Environment"
540+
}
541+
];
542+
}
543+
544+
// Response for FetchDatabasePropertiesRequest.
545+
message FetchDatabasePropertiesResponse {
546+
// The Compute Engine zone that the instance is currently serving from.
547+
string primary_gce_zone = 1;
548+
549+
// The Compute Engine zone that the failover instance is currently serving
550+
// from for a regional Cloud SQL instance.
551+
string secondary_gce_zone = 2;
552+
553+
// The availability status of the failover replica. A false status indicates
554+
// that the failover replica is out of sync. The primary instance can only
555+
// fail over to the failover replica when the status is true.
556+
bool is_failover_replica_available = 3;
557+
}
558+
360559
// Configuration information for an environment.
361560
message EnvironmentConfig {
362561
// The size of the Cloud Composer environment.
@@ -374,6 +573,15 @@ message EnvironmentConfig {
374573
ENVIRONMENT_SIZE_LARGE = 3;
375574
}
376575

576+
// Resilience mode of the Cloud Composer Environment.
577+
enum ResilienceMode {
578+
// Default mode doesn't change environment parameters.
579+
RESILIENCE_MODE_UNSPECIFIED = 0;
580+
581+
// Enabled High Resilience mode, including Cloud SQL HA.
582+
HIGH_RESILIENCE = 1;
583+
}
584+
377585
// Output only. The Kubernetes Engine cluster used to run this environment.
378586
string gke_cluster = 1;
379587

@@ -478,6 +686,12 @@ message EnvironmentConfig {
478686
// This field is supported for Cloud Composer environments in versions
479687
// composer-2.*.*-airflow-*.*.* and newer.
480688
RecoveryConfig recovery_config = 18 [(google.api.field_behavior) = OPTIONAL];
689+
690+
// Optional. Resilience mode of the Cloud Composer Environment.
691+
//
692+
// This field is supported for Cloud Composer environments in versions
693+
// composer-2.2.0-airflow-*.*.* and newer.
694+
ResilienceMode resilience_mode = 19 [(google.api.field_behavior) = OPTIONAL];
481695
}
482696

483697
// Network-level access control policy for the Airflow web server.

packages/google-cloud-orchestration-airflow-service/protos/google/cloud/orchestration/airflow/service/v1/operations.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ message OperationMetadata {
6969

7070
// Loads snapshot of the resource operation.
7171
LOAD_SNAPSHOT = 6;
72+
73+
// Triggers failover of environment's Cloud SQL instance (only for highly
74+
// resilient environments).
75+
DATABASE_FAILOVER = 7;
7276
}
7377

7478
// Output only. The current operation state.

0 commit comments

Comments
 (0)