Skip to content

Commit

Permalink
feat: Adds support for cancel Execution
Browse files Browse the repository at this point in the history
feat: Adds support for Execution overrides
feat: Adds support for Direct VPC egress setting
feat: New fields for multi-container
feat: New field for Task's scheduled timestamp
docs: General documentation fixes.

PiperOrigin-RevId: 567710896
  • Loading branch information
Google APIs authored and Copybara-Service committed Sep 22, 2023
1 parent 2f8920a commit c5985fe
Show file tree
Hide file tree
Showing 8 changed files with 204 additions and 46 deletions.
3 changes: 3 additions & 0 deletions google/cloud/run/v2/condition.proto
Expand Up @@ -172,6 +172,9 @@ message Condition {

// The execution is in the process of being cancelled.
CANCELLING = 4;

// The execution was deleted.
DELETED = 5;
}

// type is used to communicate the status of the reconciliation process.
Expand Down
46 changes: 40 additions & 6 deletions google/cloud/run/v2/execution.proto
Expand Up @@ -65,14 +65,28 @@ service Executions {
metadata_type: "Execution"
};
}

// Cancels an Execution.
rpc CancelExecution(CancelExecutionRequest)
returns (google.longrunning.Operation) {
option (google.api.http) = {
post: "/v2/{name=projects/*/locations/*/jobs/*/executions/*}:cancel"
body: "*"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "Execution"
metadata_type: "Execution"
};
}
}

// Request message for obtaining a Execution by its full name.
message GetExecutionRequest {
// Required. The full name of the Execution.
// Format:
// projects/{project}/locations/{location}/jobs/{job}/executions/{execution},
// where {project} can be project id or number.
// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
// where `{project}` can be project id or number.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "run.googleapis.com/Execution" }
Expand All @@ -83,8 +97,8 @@ message GetExecutionRequest {
message ListExecutionsRequest {
// Required. The Execution from which the Executions should be listed.
// To list all Executions across Jobs, use "-" instead of Job name.
// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
// can be project id or number.
// Format: `projects/{project}/locations/{location}/jobs/{job}`, where
// `{project}` can be project id or number.
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
Expand Down Expand Up @@ -117,8 +131,8 @@ message ListExecutionsResponse {
message DeleteExecutionRequest {
// Required. The name of the Execution to delete.
// Format:
// projects/{project}/locations/{location}/jobs/{job}/executions/{execution},
// where {project} can be project id or number.
// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
// where `{project}` can be project id or number.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "run.googleapis.com/Execution" }
Expand All @@ -133,6 +147,26 @@ message DeleteExecutionRequest {
string etag = 3;
}

// Request message for deleting an Execution.
message CancelExecutionRequest {
// Required. The name of the Execution to cancel.
// Format:
// `projects/{project}/locations/{location}/jobs/{job}/executions/{execution}`,
// where `{project}` can be project id or number.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "run.googleapis.com/Execution" }
];

// Indicates that the request should be validated without actually
// cancelling any resources.
bool validate_only = 2;

// A system-generated fingerprint for this version of the resource.
// This may be used to detect modification conflict during updates.
string etag = 3;
}

// Execution represents the configuration of a single execution. A execution an
// immutable resource that references a container image which is run to
// completion.
Expand Down
75 changes: 75 additions & 0 deletions google/cloud/run/v2/job.proto
Expand Up @@ -21,13 +21,16 @@ import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/launch_stage.proto";
import "google/api/resource.proto";
import "google/api/routing.proto";
import "google/cloud/run/v2/condition.proto";
import "google/cloud/run/v2/execution.proto";
import "google/cloud/run/v2/execution_template.proto";
import "google/cloud/run/v2/k8s.min.proto";
import "google/cloud/run/v2/vendor_settings.proto";
import "google/iam/v1/iam_policy.proto";
import "google/iam/v1/policy.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";

option go_package = "cloud.google.com/go/run/apiv2/runpb;runpb";
Expand All @@ -47,6 +50,12 @@ service Jobs {
post: "/v2/{parent=projects/*/locations/*}/jobs"
body: "job"
};
option (google.api.routing) = {
routing_parameters {
field: "parent"
path_template: "projects/*/locations/{location=*}"
}
};
option (google.api.method_signature) = "parent,job,job_id";
option (google.longrunning.operation_info) = {
response_type: "Job"
Expand All @@ -59,6 +68,12 @@ service Jobs {
option (google.api.http) = {
get: "/v2/{name=projects/*/locations/*/jobs/*}"
};
option (google.api.routing) = {
routing_parameters {
field: "name"
path_template: "projects/*/locations/{location=*}/**"
}
};
option (google.api.method_signature) = "name";
}

Expand All @@ -67,6 +82,12 @@ service Jobs {
option (google.api.http) = {
get: "/v2/{parent=projects/*/locations/*}/jobs"
};
option (google.api.routing) = {
routing_parameters {
field: "parent"
path_template: "projects/*/locations/{location=*}"
}
};
option (google.api.method_signature) = "parent";
}

Expand All @@ -76,6 +97,12 @@ service Jobs {
patch: "/v2/{job.name=projects/*/locations/*/jobs/*}"
body: "job"
};
option (google.api.routing) = {
routing_parameters {
field: "job.name"
path_template: "projects/*/locations/{location=*}/**"
}
};
option (google.api.method_signature) = "job";
option (google.longrunning.operation_info) = {
response_type: "Job"
Expand All @@ -88,6 +115,12 @@ service Jobs {
option (google.api.http) = {
delete: "/v2/{name=projects/*/locations/*/jobs/*}"
};
option (google.api.routing) = {
routing_parameters {
field: "name"
path_template: "projects/*/locations/{location=*}/**"
}
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "Job"
Expand All @@ -101,6 +134,12 @@ service Jobs {
post: "/v2/{name=projects/*/locations/*/jobs/*}:run"
body: "*"
};
option (google.api.routing) = {
routing_parameters {
field: "name"
path_template: "projects/*/locations/{location=*}/**"
}
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "Execution"
Expand Down Expand Up @@ -239,6 +278,38 @@ message DeleteJobRequest {

// Request message to create a new Execution of a Job.
message RunJobRequest {
// RunJob Overrides that contains Execution fields to be overridden on the go.
message Overrides {
// Per container override specification.
message ContainerOverride {
// The name of the container specified as a DNS_LABEL.
string name = 1;

// Optional. Arguments to the entrypoint. Will replace existing args for
// override.
repeated string args = 2 [(google.api.field_behavior) = OPTIONAL];

// List of environment variables to set in the container. Will be merged
// with existing env for override.
repeated EnvVar env = 3;

// Optional. True if the intention is to clear out existing args list.
bool clear_args = 4 [(google.api.field_behavior) = OPTIONAL];
}

// Per container override specification.
repeated ContainerOverride container_overrides = 1;

// Optional. The desired number of tasks the execution should run. Will
// replace existing task_count value.
int32 task_count = 2 [(google.api.field_behavior) = OPTIONAL];

// Duration in seconds the task may be active before the system will
// actively try to mark it failed and kill associated containers. Will
// replace existing timeout_seconds value.
google.protobuf.Duration timeout = 4;
}

// Required. The full name of the Job.
// Format: projects/{project}/locations/{location}/jobs/{job}, where {project}
// can be project id or number.
Expand All @@ -254,6 +325,10 @@ message RunJobRequest {
// A system-generated fingerprint for this version of the
// resource. May be used to detect modification conflict during updates.
string etag = 3;

// Overrides specification for a given execution of a job. If provided,
// overrides will be applied to update the execution or task spec.
Overrides overrides = 4;
}

// Job represents the configuration of a single job, which references a
Expand Down
43 changes: 40 additions & 3 deletions google/cloud/run/v2/k8s.min.proto
Expand Up @@ -43,7 +43,7 @@ option (google.api.resource_definition) = {
// A single application container.
// This specifies both the container to run, the command to run in the container
// and the arguments to supply to it.
// Note that additional arguments may be supplied by the system to the container
// Note that additional arguments can be supplied by the system to the container
// at runtime.
message Container {
// Name of the container specified as a DNS_LABEL (RFC 1123).
Expand Down Expand Up @@ -93,6 +93,9 @@ message Container {
// succeeds. Container will not be added to service endpoints if the probe
// fails.
Probe startup_probe = 11;

// Names of the containers that must start before this container.
repeated string depends_on = 12;
}

// ResourceRequirements describes the compute resource requirements.
Expand All @@ -119,7 +122,7 @@ message ResourceRequirements {
// EnvVar represents an environment variable present in a Container.
message EnvVar {
// Required. Name of the environment variable. Must be a C_IDENTIFIER, and
// mnay not exceed 32768 characters.
// must not exceed 32768 characters.
string name = 1 [(google.api.field_behavior) = REQUIRED];

oneof values {
Expand Down Expand Up @@ -202,6 +205,9 @@ message Volume {
// mounted. Visit https://cloud.google.com/sql/docs/mysql/connect-run for
// more information on how to connect Cloud SQL and Cloud Run.
CloudSqlInstance cloud_sql_instance = 3;

// Ephemeral storage used as a shared volume.
EmptyDirVolumeSource empty_dir = 4;
}
}

Expand Down Expand Up @@ -285,6 +291,37 @@ message CloudSqlInstance {
repeated string instances = 1;
}

// In memory (tmpfs) ephemeral storage.
// It is ephemeral in the sense that when the sandbox is taken down, the data is
// destroyed with it (it does not persist across sandbox runs).
message EmptyDirVolumeSource {
// The different types of medium supported for EmptyDir.
enum Medium {
// When not specified, falls back to the default implementation which
// is currently in memory (this may change over time).
MEDIUM_UNSPECIFIED = 0;

// Explicitly set the EmptyDir to be in memory. Uses tmpfs.
MEMORY = 1;
}

// The medium on which the data is stored. Acceptable values today is only
// MEMORY or none. When none, the default will currently be backed by memory
// but could change over time. +optional
Medium medium = 1;

// Limit on the storage usable by this EmptyDir volume.
// The size limit is also applicable for memory medium.
// The maximum usage on memory medium EmptyDir would be the minimum value
// between the SizeLimit specified here and the sum of memory limits of all
// containers. The default is nil which means that the limit is undefined.
// More info:
// https://cloud.google.com/run/docs/configuring/in-memory-volumes#configure-volume.
// Info in Kubernetes:
// https://kubernetes.io/docs/concepts/storage/volumes/#emptydir
string size_limit = 2;
}

// Probe describes a health check to be performed against a container to
// determine whether it is alive or ready to receive traffic.
message Probe {
Expand Down Expand Up @@ -363,7 +400,7 @@ message GRPCAction {
int32 port = 1;

// Service is the name of the service to place in the gRPC HealthCheckRequest
// (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md). If
// (see https://github.com/grpc/grpc/blob/master/doc/health-checking.md ). If
// this is not specified, the default behavior is defined by gRPC.
string service = 2;
}
29 changes: 0 additions & 29 deletions google/cloud/run/v2/run_v2.yaml
Expand Up @@ -23,35 +23,6 @@ documentation:
- selector: google.cloud.location.Locations.ListLocations
description: Lists information about the supported locations for this service.

backend:
rules:
- selector: google.cloud.location.Locations.ListLocations
deadline: 5.0
- selector: 'google.cloud.run.v2.Executions.*'
deadline: 5.0
- selector: 'google.cloud.run.v2.Jobs.*'
deadline: 5.0
- selector: google.cloud.run.v2.Jobs.CreateJob
deadline: 10.0
- selector: google.cloud.run.v2.Jobs.UpdateJob
deadline: 10.0
- selector: 'google.cloud.run.v2.Revisions.*'
deadline: 5.0
- selector: 'google.cloud.run.v2.Services.*'
deadline: 5.0
- selector: google.cloud.run.v2.Services.CreateService
deadline: 10.0
- selector: google.cloud.run.v2.Services.UpdateService
deadline: 10.0
- selector: google.cloud.run.v2.Tasks.GetTask
deadline: 5.0
- selector: google.cloud.run.v2.Tasks.ListTasks
deadline: 5.0
- selector: 'google.longrunning.Operations.*'
deadline: 5.0
- selector: google.longrunning.Operations.WaitOperation
deadline: 60.0

http:
rules:
- selector: google.longrunning.Operations.DeleteOperation
Expand Down
6 changes: 6 additions & 0 deletions google/cloud/run/v2/service.proto
Expand Up @@ -440,6 +440,12 @@ message Service {
// Output only. Reserved for future use.
bool satisfies_pzs = 38 [(google.api.field_behavior) = OUTPUT_ONLY];

// Optional. Override the traffic tag threshold limit. Garbage collection will
// start cleaning up non-serving tagged traffic targets based on creation
// item. The default value is 2000.
int64 traffic_tags_cleanup_threshold = 39
[(google.api.field_behavior) = OPTIONAL];

// Output only. Returns true if the Service is currently being acted upon by
// the system to bring it into the desired state.
//
Expand Down
12 changes: 9 additions & 3 deletions google/cloud/run/v2/task.proto
Expand Up @@ -133,12 +133,18 @@ message Task {
map<string, string> annotations = 5
[(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Represents time when the task was created by the job
// controller. It is not guaranteed to be set in happens-before order across
// separate operations.
// Output only. Represents time when the task was created by the system.
// It is not guaranteed to be set in happens-before order across separate
// operations.
google.protobuf.Timestamp create_time = 6
[(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Represents time when the task was scheduled to run by the
// system. It is not guaranteed to be set in happens-before order across
// separate operations.
google.protobuf.Timestamp scheduled_time = 34
[(google.api.field_behavior) = OUTPUT_ONLY];

// Output only. Represents time when the task started to run.
// It is not guaranteed to be set in happens-before order across separate
// operations.
Expand Down

0 comments on commit c5985fe

Please sign in to comment.