Skip to content

Commit

Permalink
feat: Adds support for Startup CPU Boost (GA) (#96)
Browse files Browse the repository at this point in the history
* feat: Adds support for Startup CPU Boost (GA)
feat: Adds support for Session affinity in Service (GA)
feat: New 'port' field for HttpGetAction probe type
feat: New fields/enum values
docs: General documentation fixes.

Startup CPU Boost
 * The new field is found in https://cloud.google.com/run/docs/reference/rest/v2/Container#resourcerequirements.
 * For more information, see https://cloud.google.com/run/docs/configuring/cpu#startup-boost

Session Affinity
 * The new field is found in https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.services#revisiontemplate.
 * For more informaton, see https://cloud.google.com/run/docs/configuring/session-affinity

HttpGetAction probe port
 * The new field is found in https://cloud.google.com/run/docs/reference/rest/v2/Container#httpgetaction

Fields/enum values
* New output-only field satisfiesPzs in Service, Revision, Execution, and Job, currently unused. The field is reserved for future use. It is surfaced to maintain v1<->v2 portability.
* New ExecutionReason.CANCELLING enum value. This is used in output-only field.

Documentation fixes
* Clarified permissions required for Upsert behavior (UpdateServiceRequest.allowMissing)
* Clarified behavior for LaunchStage in all resource types.
* Misc documentation improvements; removed most external references.

PiperOrigin-RevId: 528248744

Source-Link: googleapis/googleapis@a9fb0d2

Source-Link: googleapis/googleapis-gen@8ffce4c
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGZmY2U0YzExYjk3OTI4YWU4YjE3Mjc2NTdhYjIwM2RhZDY1OTdlNCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored May 4, 2023
1 parent eac87f8 commit 691ec83
Show file tree
Hide file tree
Showing 16 changed files with 306 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,15 @@ class ExecutionReason(proto.Enum):
with a non-zero exit code.
CANCELLED (3):
The execution was cancelled by users.
CANCELLING (4):
The execution is in the process of being
cancelled.
"""
EXECUTION_REASON_UNDEFINED = 0
JOB_STATUS_SERVICE_POLLING_ERROR = 1
NON_ZERO_EXIT_CODE = 2
CANCELLED = 3
CANCELLING = 4

type_: str = proto.Field(
proto.STRING,
Expand Down
34 changes: 24 additions & 10 deletions packages/google-cloud-run/google/cloud/run_v2/types/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ class Execution(proto.Message):
increases every time the user modifies the
desired state.
labels (MutableMapping[str, str]):
KRM-style labels for the resource.
Output only. Unstructured key value map that
can be used to organize and categorize objects.
User-provided labels are shared with Google's
billing system, so they can be used to filter,
or break down billing charges by team,
Expand All @@ -180,7 +181,10 @@ class Execution(proto.Message):
or
https://cloud.google.com/run/docs/configuring/labels
annotations (MutableMapping[str, str]):
KRM-style annotations for the resource.
Output only. Unstructured key value map that
may be set by external tools to store and
arbitrary metadata. They are not queryable and
should be preserved when modifying objects.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. Represents time when the
execution was acknowledged by the execution
Expand Down Expand Up @@ -208,11 +212,17 @@ class Execution(proto.Message):
is only populated as a response to a Delete
request.
launch_stage (google.api.launch_stage_pb2.LaunchStage):
Set the launch stage to a preview stage on write to allow
use of preview features in that stage. On read, describes
whether the resource uses preview features. Launch Stages
are defined at `Google Cloud Platform Launch
The least stable launch stage needed to create this
resource, as defined by `Google Cloud Platform Launch
Stages <https://cloud.google.com/terms/launch-stages>`__.
Cloud Run supports ``ALPHA``, ``BETA``, and ``GA``.
.. raw:: html
<p>Note that this value might not be what was used
as input. For example, if ALPHA was provided as input in the parent
resource, but only BETA and GA-level features are were, this field will be
BETA.
job (str):
Output only. The name of the parent Job.
parallelism (int):
Expand All @@ -221,15 +231,13 @@ class Execution(proto.Message):
task_count. The actual number of tasks running in steady
state will be less than this number when ((.spec.task_count
- .status.successful) < .spec.parallelism), i.e. when the
work left to do is less than max parallelism. More info:
https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
work left to do is less than max parallelism.
task_count (int):
Output only. Specifies the desired number of
tasks the execution should run. Setting to 1
means that parallelism is limited to 1 and the
success of that task signals the success of the
execution. More info:
https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
execution.
template (google.cloud.run_v2.types.TaskTemplate):
Output only. The template used to create
tasks for this execution.
Expand Down Expand Up @@ -265,6 +273,8 @@ class Execution(proto.Message):
log_uri (str):
Output only. URI where logs for this
execution can be found in Cloud Console.
satisfies_pzs (bool):
Output only. Reserved for future use.
etag (str):
Output only. A system-generated fingerprint
for this version of the resource. May be used to
Expand Down Expand Up @@ -382,6 +392,10 @@ class Execution(proto.Message):
proto.STRING,
number=26,
)
satisfies_pzs: bool = proto.Field(
proto.BOOL,
number=27,
)
etag: str = proto.Field(
proto.STRING,
number=99,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ class ExecutionTemplate(proto.Message):
Attributes:
labels (MutableMapping[str, str]):
KRM-style labels for the resource.
Unstructured key value map that can be used to organize and
categorize objects. User-provided labels are shared with
Google's billing system, so they can be used to filter, or
break down billing charges by team, component, environment,
state, etc. For more information, visit
https://cloud.google.com/resource-manager/docs/creating-managing-labels
or https://cloud.google.com/run/docs/configuring/labels.
.. raw:: html
Expand All @@ -44,14 +50,21 @@ class ExecutionTemplate(proto.Message):
namespaces, and they will be rejected. All system labels in v1 now have a
corresponding field in v2 ExecutionTemplate.
annotations (MutableMapping[str, str]):
KRM-style annotations for the resource.
Unstructured key value map that may be set by external tools
to store and arbitrary metadata. They are not queryable and
should be preserved when modifying objects.
.. raw:: html
<p>Cloud Run API v2 does not support annotations with `run.googleapis.com`,
`cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
namespaces, and they will be rejected. All system annotations in v1 now
have a corresponding field in v2 ExecutionTemplate.
.. raw:: html
<p>This field follows Kubernetes annotations' namespacing, limits, and
rules.
parallelism (int):
Specifies the maximum desired number of tasks the execution
should run at given time. Must be <= task_count. When the
Expand All @@ -66,8 +79,7 @@ class ExecutionTemplate(proto.Message):
execution should run. Setting to 1 means that
parallelism is limited to 1 and the success of
that task signals the success of the execution.
More info:
https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/
Defaults to 1.
template (google.cloud.run_v2.types.TaskTemplate):
Required. Describes the task(s) that will be
created when executing an execution.
Expand Down
41 changes: 28 additions & 13 deletions packages/google-cloud-run/google/cloud/run_v2/types/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,13 @@ class Job(proto.Message):
increases every time the user modifies the
desired state.
labels (MutableMapping[str, str]):
KRM-style labels for the resource. User-provided labels are
shared with Google's billing system, so they can be used to
filter, or break down billing charges by team, component,
environment, state, etc. For more information, visit
Unstructured key value map that can be used to organize and
categorize objects. User-provided labels are shared with
Google's billing system, so they can be used to filter, or
break down billing charges by team, component, environment,
state, etc. For more information, visit
https://cloud.google.com/resource-manager/docs/creating-managing-labels
or https://cloud.google.com/run/docs/configuring/labels
or https://cloud.google.com/run/docs/configuring/labels.
.. raw:: html
Expand All @@ -292,22 +293,21 @@ class Job(proto.Message):
namespaces, and they will be rejected. All system labels in v1 now have a
corresponding field in v2 Job.
annotations (MutableMapping[str, str]):
KRM-style annotations for the resource. Unstructured key
value map that may be set by external tools to store and
arbitrary metadata. They are not queryable and should be
preserved when modifying objects.
Unstructured key value map that may be set by external tools
to store and arbitrary metadata. They are not queryable and
should be preserved when modifying objects.
.. raw:: html
<p>Cloud Run API v2 does not support annotations with `run.googleapis.com`,
`cloud.googleapis.com`, `serving.knative.dev`, or `autoscaling.knative.dev`
namespaces, and they will be rejected. All system annotations in v1 now
have a corresponding field in v2 Job.
namespaces, and they will be rejected on new resources. All system
annotations in v1 now have a corresponding field in v2 Job.
.. raw:: html
<p>This field follows Kubernetes annotations' namespacing, limits, and
rules. More info: https://kubernetes.io/docs/user-guide/annotations
rules.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The creation time.
update_time (google.protobuf.timestamp_pb2.Timestamp):
Expand All @@ -332,7 +332,16 @@ class Job(proto.Message):
The launch stage as defined by `Google Cloud Platform Launch
Stages <https://cloud.google.com/terms/launch-stages>`__.
Cloud Run supports ``ALPHA``, ``BETA``, and ``GA``. If no
value is specified, GA is assumed.
value is specified, GA is assumed. Set the launch stage to a
preview stage on input to allow use of preview features in
that stage. On read (or output), describes whether the
resource uses preview features.
.. raw:: html
<p>
For example, if ALPHA is provided as input, but only BETA and GA-level
features are used, this field will be BETA on output.
binary_authorization (google.cloud.run_v2.types.BinaryAuthorization):
Settings for the Binary Authorization
feature.
Expand Down Expand Up @@ -386,6 +395,8 @@ class Job(proto.Message):
last succeeded execution or empty for newly created Job.
Additional information on the failure can be found in
``terminal_condition`` and ``conditions``.
satisfies_pzs (bool):
Output only. Reserved for future use.
etag (str):
Output only. A system-generated fingerprint
for this version of the resource. May be used to
Expand Down Expand Up @@ -492,6 +503,10 @@ class Job(proto.Message):
proto.BOOL,
number=23,
)
satisfies_pzs: bool = proto.Field(
proto.BOOL,
number=25,
)
etag: str = proto.Field(
proto.STRING,
number=99,
Expand Down
Loading

0 comments on commit 691ec83

Please sign in to comment.