Skip to content

Commit 97e3b44

Browse files
Google APIscopybara-github
authored andcommitted
docs:clarify some defaults and required or optional values
feat:support mounting NFS and GCS volumes in Cloud Run Jobs and Services feat:support specifying a per-Service min-instance-count feat:support disabling waiting for health checks during Service deployment. feat:allow disabling the default URL (run.app) for Cloud Run Services PiperOrigin-RevId: 612580574
1 parent 9f09101 commit 97e3b44

7 files changed

Lines changed: 111 additions & 18 deletions

File tree

google/cloud/run/v2/BUILD.bazel

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
# * extra_protoc_file_parameters
1010
# The complete list of preserved parameters can be found in the source code.
1111

12+
# buildifier: disable=load-on-top
13+
1214
# This is an API workspace, having public visibility by default makes perfect sense.
1315
package(default_visibility = ["//visibility:public"])
1416

1517
##############################################################################
1618
# Common
1719
##############################################################################
18-
load("@rules_proto//proto:defs.bzl", "proto_library")
20+
# buildifier: disable=same-origin-load
1921
load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
22+
load("@rules_proto//proto:defs.bzl", "proto_library")
2023

2124
proto_library(
2225
name = "run_proto",
@@ -29,6 +32,7 @@ proto_library(
2932
"revision.proto",
3033
"revision_template.proto",
3134
"service.proto",
35+
"status.proto",
3236
"task.proto",
3337
"task_template.proto",
3438
"traffic_target.proto",
@@ -62,6 +66,7 @@ proto_library_with_info(
6266
##############################################################################
6367
# Java
6468
##############################################################################
69+
# buildifier: disable=same-origin-load
6570
load(
6671
"@com_google_googleapis_imports//:imports.bzl",
6772
"java_gapic_assembly_gradle_pkg",
@@ -136,6 +141,7 @@ java_gapic_assembly_gradle_pkg(
136141
##############################################################################
137142
# Go
138143
##############################################################################
144+
# buildifier: disable=same-origin-load
139145
load(
140146
"@com_google_googleapis_imports//:imports.bzl",
141147
"go_gapic_assembly_pkg",
@@ -151,7 +157,6 @@ go_proto_library(
151157
deps = [
152158
"//google/api:annotations_go_proto",
153159
"//google/api:api_go_proto",
154-
"//google/api:routing_go_proto",
155160
"//google/iam/v1:iam_go_proto",
156161
"//google/longrunning:longrunning_go_proto",
157162
"//google/rpc:status_go_proto",
@@ -194,6 +199,7 @@ go_gapic_assembly_pkg(
194199
##############################################################################
195200
# Python
196201
##############################################################################
202+
# buildifier: disable=same-origin-load
197203
load(
198204
"@com_google_googleapis_imports//:imports.bzl",
199205
"py_gapic_assembly_pkg",
@@ -234,6 +240,7 @@ py_gapic_assembly_pkg(
234240
##############################################################################
235241
# PHP
236242
##############################################################################
243+
# buildifier: disable=same-origin-load
237244
load(
238245
"@com_google_googleapis_imports//:imports.bzl",
239246
"php_gapic_assembly_pkg",
@@ -254,7 +261,9 @@ php_gapic_library(
254261
rest_numeric_enums = True,
255262
service_yaml = "run_v2.yaml",
256263
transport = "grpc+rest",
257-
deps = [":run_php_proto"],
264+
deps = [
265+
":run_php_proto",
266+
],
258267
)
259268

260269
# Open Source Packages
@@ -269,6 +278,7 @@ php_gapic_assembly_pkg(
269278
##############################################################################
270279
# Node.js
271280
##############################################################################
281+
# buildifier: disable=same-origin-load
272282
load(
273283
"@com_google_googleapis_imports//:imports.bzl",
274284
"nodejs_gapic_assembly_pkg",
@@ -299,6 +309,7 @@ nodejs_gapic_assembly_pkg(
299309
##############################################################################
300310
# Ruby
301311
##############################################################################
312+
# buildifier: disable=same-origin-load
302313
load(
303314
"@com_google_googleapis_imports//:imports.bzl",
304315
"ruby_cloud_gapic_library",
@@ -353,6 +364,7 @@ ruby_gapic_assembly_pkg(
353364
##############################################################################
354365
# C#
355366
##############################################################################
367+
# buildifier: disable=same-origin-load
356368
load(
357369
"@com_google_googleapis_imports//:imports.bzl",
358370
"csharp_gapic_assembly_pkg",
@@ -363,6 +375,7 @@ load(
363375

364376
csharp_proto_library(
365377
name = "run_csharp_proto",
378+
extra_opts = [],
366379
deps = [":run_proto"],
367380
)
368381

@@ -399,6 +412,7 @@ csharp_gapic_assembly_pkg(
399412
##############################################################################
400413
# C++
401414
##############################################################################
415+
# buildifier: disable=same-origin-load
402416
load(
403417
"@com_google_googleapis_imports//:imports.bzl",
404418
"cc_grpc_library",

google/cloud/run/v2/k8s.min.proto

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ message Container {
100100

101101
// ResourceRequirements describes the compute resource requirements.
102102
message ResourceRequirements {
103-
// Only ´memory´ and 'cpu' are supported.
103+
// Only `memory` and `cpu` keys in the map are supported.
104104
//
105105
// <p>Notes:
106106
// * The only supported values for CPU are '1', '2', '4', and '8'. Setting 4
@@ -110,7 +110,9 @@ message ResourceRequirements {
110110
// https://cloud.google.com/run/docs/configuring/memory-limits
111111
map<string, string> limits = 1;
112112

113-
// Determines whether CPU should be throttled or not outside of requests.
113+
// Determines whether CPU is only allocated during requests (true by default).
114+
// However, if ResourceRequirements is set, the caller must explicitly
115+
// set this field to true to preserve the default behavior.
114116
bool cpu_idle = 2;
115117

116118
// Determines whether CPU should be boosted on startup of a new container
@@ -208,6 +210,12 @@ message Volume {
208210

209211
// Ephemeral storage used as a shared volume.
210212
EmptyDirVolumeSource empty_dir = 4;
213+
214+
// For NFS Voumes, contains the path to the nfs Volume
215+
NFSVolumeSource nfs = 5;
216+
217+
// Persistent storage backed by a Google Cloud Storage bucket.
218+
GCSVolumeSource gcs = 6;
211219
}
212220
}
213221

@@ -322,6 +330,27 @@ message EmptyDirVolumeSource {
322330
string size_limit = 2;
323331
}
324332

333+
// Represents an NFS mount.
334+
message NFSVolumeSource {
335+
// Hostname or IP address of the NFS server
336+
string server = 1;
337+
338+
// Path that is exported by the NFS server.
339+
string path = 2;
340+
341+
// If true, mount the NFS volume as read only
342+
bool read_only = 3;
343+
}
344+
345+
// Represents a GCS Bucket mounted as a volume.
346+
message GCSVolumeSource {
347+
// GCS Bucket name
348+
string bucket = 1;
349+
350+
// If true, mount the GCS bucket as read-only
351+
bool read_only = 2;
352+
}
353+
325354
// Probe describes a health check to be performed against a container to
326355
// determine whether it is alive or ready to receive traffic.
327356
message Probe {

google/cloud/run/v2/revision.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import "google/api/resource.proto";
2424
import "google/api/routing.proto";
2525
import "google/cloud/run/v2/condition.proto";
2626
import "google/cloud/run/v2/k8s.min.proto";
27+
import "google/cloud/run/v2/status.proto";
2728
import "google/cloud/run/v2/vendor_settings.proto";
2829
import "google/longrunning/operations.proto";
2930
import "google/protobuf/duration.proto";
@@ -293,6 +294,10 @@ message Revision {
293294
// Enable session affinity.
294295
bool session_affinity = 38;
295296

297+
// Output only. The current effective scaling settings for the revision.
298+
RevisionScalingStatus scaling_status = 39
299+
[(google.api.field_behavior) = OUTPUT_ONLY];
300+
296301
// Output only. A system-generated fingerprint for this version of the
297302
// resource. May be used to detect modification conflict during updates.
298303
string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY];

google/cloud/run/v2/revision_template.proto

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ syntax = "proto3";
1616

1717
package google.cloud.run.v2;
1818

19+
import "google/api/field_behavior.proto";
1920
import "google/api/resource.proto";
2021
import "google/cloud/run/v2/k8s.min.proto";
2122
import "google/cloud/run/v2/vendor_settings.proto";
@@ -98,6 +99,9 @@ message RevisionTemplate {
9899
// Sets the maximum number of requests that each serving instance can receive.
99100
int32 max_instance_request_concurrency = 15;
100101

101-
// Enable session affinity.
102-
bool session_affinity = 19;
102+
// Optional. Enable session affinity.
103+
bool session_affinity = 19 [(google.api.field_behavior) = OPTIONAL];
104+
105+
// Optional. Disables health checking containers during deployment.
106+
bool health_check_disabled = 20 [(google.api.field_behavior) = OPTIONAL];
103107
}

google/cloud/run/v2/service.proto

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -301,23 +301,22 @@ message Service {
301301
// APIs, its JSON representation will be a `string` instead of an `integer`.
302302
int64 generation = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
303303

304-
// Unstructured key value map that can be used to organize and categorize
305-
// objects.
306-
// User-provided labels are shared with Google's billing system, so they can
307-
// be used to filter, or break down billing charges by team, component,
308-
// environment, state, etc. For more information, visit
304+
// Optional. Unstructured key value map that can be used to organize and
305+
// categorize objects. User-provided labels are shared with Google's billing
306+
// system, so they can be used to filter, or break down billing charges by
307+
// team, component, environment, state, etc. For more information, visit
309308
// https://cloud.google.com/resource-manager/docs/creating-managing-labels or
310309
// https://cloud.google.com/run/docs/configuring/labels.
311310
//
312311
// <p>Cloud Run API v2 does not support labels with `run.googleapis.com`,
313312
// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
314313
// namespaces, and they will be rejected. All system labels in v1 now have a
315314
// corresponding field in v2 Service.
316-
map<string, string> labels = 5;
315+
map<string, string> labels = 5 [(google.api.field_behavior) = OPTIONAL];
317316

318-
// Unstructured key value map that may be set by external tools to store and
319-
// arbitrary metadata. They are not queryable and should be preserved
320-
// when modifying objects.
317+
// Optional. Unstructured key value map that may be set by external tools to
318+
// store and arbitrary metadata. They are not queryable and should be
319+
// preserved when modifying objects.
321320
//
322321
// <p>Cloud Run API v2 does not support annotations with `run.googleapis.com`,
323322
// `cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
@@ -326,7 +325,7 @@ message Service {
326325
//
327326
// <p>This field follows Kubernetes
328327
// annotations' namespacing, limits, and rules.
329-
map<string, string> annotations = 6;
328+
map<string, string> annotations = 6 [(google.api.field_behavior) = OPTIONAL];
330329

331330
// Output only. The creation time.
332331
google.protobuf.Timestamp create_time = 7
@@ -385,6 +384,12 @@ message Service {
385384
// 100% traffic to the latest `Ready` Revision.
386385
repeated TrafficTarget traffic = 19;
387386

387+
// Optional. Specifies service-level scaling settings
388+
ServiceScaling scaling = 20 [(google.api.field_behavior) = OPTIONAL];
389+
390+
// Optional. Disables public resolution of the default URI of this service.
391+
bool default_uri_disabled = 22 [(google.api.field_behavior) = OPTIONAL];
392+
388393
// Output only. The generation of this Service currently serving traffic. See
389394
// comments in `reconciling` for additional information on reconciliation
390395
// process in Cloud Run. Please note that unlike v1, this is an int64 value.

google/cloud/run/v2/status.proto

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.cloud.run.v2;
18+
19+
option go_package = "cloud.google.com/go/run/apiv2/runpb;runpb";
20+
option java_multiple_files = true;
21+
option java_outer_classname = "StatusProto";
22+
option java_package = "com.google.cloud.run.v2";
23+
24+
// Effective settings for the current revision
25+
message RevisionScalingStatus {
26+
// The current number of min instances provisioned for this revision.
27+
int32 desired_min_instance_count = 1;
28+
}

google/cloud/run/v2/vendor_settings.proto

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ syntax = "proto3";
1616

1717
package google.cloud.run.v2;
1818

19-
import "google/api/field_behavior.proto";
2019
import "google/api/resource.proto";
2120

2221
option go_package = "cloud.google.com/go/run/apiv2/runpb;runpb";
@@ -139,3 +138,12 @@ enum EncryptionKeyRevocationAction {
139138
// Shuts down existing instances, and prevents creation of new ones.
140139
SHUTDOWN = 2;
141140
}
141+
142+
// Scaling settings applied at the service level rather than
143+
// at the revision level.
144+
message ServiceScaling {
145+
// total min instances for the service. This number of instances is
146+
// divided among all revisions with specified traffic based on the percent
147+
// of traffic they are receiving. (BETA)
148+
int32 min_instance_count = 1;
149+
}

0 commit comments

Comments
 (0)