Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
feat: Add field for enabled Beta K8s APIs in proto (#329)
Browse files Browse the repository at this point in the history
* feat: Add support for python 3.11

chore: Update gapic-generator-python to v1.8.0
PiperOrigin-RevId: 500768693

Source-Link: googleapis/googleapis@190b612

Source-Link: googleapis/googleapis-gen@7bf29a4
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2JmMjlhNDE0YjllY2FjMzE3MGYwYjY1YmRjMmE5NTcwNWMwZWYxYSJ9

* 🦉 Updates from OwlBot post-processor

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

* feat: Add field for enabled Beta K8s APIs in proto

---
feat: add etags for cluster and node pool update operations

Clients may now optionally specify the previously read etag for a cluster or node pool during update requests. The etag is regenerated every time the object is updated. If an etag is provided, it will be checked against the current etag, and the request will be rejected on mismatch. This is particularly useful for allowing two clients to concurrently update a repeated field without overwriting each other.

PiperOrigin-RevId: 500787735

Source-Link: googleapis/googleapis@961d1ee

Source-Link: googleapis/googleapis-gen@6d95a0e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmQ5NWEwZTJiZTdmYjY1Y2ZlZThiNDlhMjljMGUyMWFjZjY3MzE5NSJ9

* 🦉 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] committed Jan 10, 2023
1 parent fa5eb7f commit 8eeee3b
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 7 deletions.
Expand Up @@ -137,7 +137,7 @@ def get_mtls_endpoint_and_cert_source(
The API endpoint is determined in the following order:
(1) if `client_options.api_endpoint` if provided, use the provided one.
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
default mTLS endpoint; if the environment variabel is "never", use the default API
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
Expand Down
Expand Up @@ -288,7 +288,7 @@ def get_mtls_endpoint_and_cert_source(
The API endpoint is determined in the following order:
(1) if `client_options.api_endpoint` if provided, use the provided one.
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
default mTLS endpoint; if the environment variabel is "never", use the default API
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
Expand Down
25 changes: 25 additions & 0 deletions google/cloud/container_v1/types/cluster_service.py
Expand Up @@ -358,6 +358,9 @@ class NodeConfig(proto.Message):
[AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults]
instead.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
machine_type (str):
The name of a Google Compute Engine `machine
Expand Down Expand Up @@ -716,6 +719,8 @@ class NodeConfig(proto.Message):
class AdvancedMachineFeatures(proto.Message):
r"""Specifies options for controlling advanced machine features.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
threads_per_core (int):
The number of threads per physical core. To
Expand All @@ -737,6 +742,8 @@ class AdvancedMachineFeatures(proto.Message):
class NodeNetworkConfig(proto.Message):
r"""Parameters for node pool-level network config.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
create_pod_range (bool):
Input only. Whether to create a new range for pod IPs in
Expand Down Expand Up @@ -799,6 +806,8 @@ class NodeNetworkConfig(proto.Message):
class NetworkPerformanceConfig(proto.Message):
r"""Configuration of all network bandwidth tiers
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
total_egress_bandwidth_tier (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier):
Specifies the total network bandwidth tier
Expand Down Expand Up @@ -1543,6 +1552,9 @@ class MasterAuthorizedNetworksConfig(proto.Message):
except traffic from the given CIDR blocks, Google Compute Engine
Public IPs and Google Prod IPs.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
enabled (bool):
Whether or not master authorized networks is
Expand Down Expand Up @@ -1865,6 +1877,8 @@ class IPAllocationPolicy(proto.Message):
class Cluster(proto.Message):
r"""A Google Kubernetes Engine cluster.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
name (str):
The name of this cluster. The name must be unique within
Expand Down Expand Up @@ -2531,6 +2545,9 @@ class ClusterUpdate(proto.Message):
update can be applied to a cluster with each request, so at most
one field can be provided.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
desired_node_version (str):
The Kubernetes version to change the nodes to
Expand Down Expand Up @@ -4693,6 +4710,9 @@ class UpgradeSettings(proto.Message):
2. node_pool_soak_duration is the soak time after all blue nodes are
drained. After this period, the blue pool nodes will be deleted.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
max_surge (int):
The maximum number of nodes that can be
Expand Down Expand Up @@ -5884,6 +5904,8 @@ class CompleteIPRotationRequest(proto.Message):
class AcceleratorConfig(proto.Message):
r"""AcceleratorConfig represents a Hardware Accelerator request.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
accelerator_count (int):
The number of the accelerator cards exposed
Expand Down Expand Up @@ -5926,6 +5948,9 @@ class GPUSharingConfig(proto.Message):
r"""GPUSharingConfig represents the GPU sharing configuration for
Hardware Accelerators.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
max_shared_clients_per_gpu (int):
The max number of containers that can share a
Expand Down
Expand Up @@ -137,7 +137,7 @@ def get_mtls_endpoint_and_cert_source(
The API endpoint is determined in the following order:
(1) if `client_options.api_endpoint` if provided, use the provided one.
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
default mTLS endpoint; if the environment variabel is "never", use the default API
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
Expand Down
Expand Up @@ -288,7 +288,7 @@ def get_mtls_endpoint_and_cert_source(
The API endpoint is determined in the following order:
(1) if `client_options.api_endpoint` if provided, use the provided one.
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
default mTLS endpoint; if the environment variabel is "never", use the default API
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
Expand Down
67 changes: 67 additions & 0 deletions google/cloud/container_v1beta1/types/cluster_service.py
Expand Up @@ -366,6 +366,9 @@ class NodeConfig(proto.Message):
[AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults]
instead.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
machine_type (str):
The name of a Google Compute Engine `machine
Expand Down Expand Up @@ -733,6 +736,8 @@ class NodeConfig(proto.Message):
class AdvancedMachineFeatures(proto.Message):
r"""Specifies options for controlling advanced machine features.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
threads_per_core (int):
The number of threads per physical core. To
Expand All @@ -754,6 +759,8 @@ class AdvancedMachineFeatures(proto.Message):
class NodeNetworkConfig(proto.Message):
r"""Parameters for node pool-level network config.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
create_pod_range (bool):
Input only. Whether to create a new range for pod IPs in
Expand Down Expand Up @@ -816,6 +823,8 @@ class NodeNetworkConfig(proto.Message):
class NetworkPerformanceConfig(proto.Message):
r"""Configuration of all network bandwidth tiers
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier):
Specifies the total network bandwidth tier
Expand Down Expand Up @@ -1678,6 +1687,9 @@ class MasterAuthorizedNetworksConfig(proto.Message):
except traffic from the given CIDR blocks, Google Compute Engine
Public IPs and Google Prod IPs.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
enabled (bool):
Whether or not master authorized networks is
Expand Down Expand Up @@ -2111,6 +2123,8 @@ class Type(proto.Enum):
class Cluster(proto.Message):
r"""A Google Kubernetes Engine cluster.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
name (str):
The name of this cluster. The name must be unique within
Expand Down Expand Up @@ -2439,6 +2453,11 @@ class Cluster(proto.Message):
cluster.
This field is a member of `oneof`_ ``_protect_config``.
etag (str):
This checksum is computed by the server based
on the value of cluster fields, and may be sent
on update requests to ensure the client has an
up-to-date value before proceeding.
"""

class Status(proto.Enum):
Expand Down Expand Up @@ -2778,12 +2797,19 @@ class Status(proto.Enum):
optional=True,
message="ProtectConfig",
)
etag: str = proto.Field(
proto.STRING,
number=139,
)


class WorkloadConfig(proto.Message):
r"""WorkloadConfig defines the flags to enable or disable the
workload configurations for the cluster.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
audit_mode (google.cloud.container_v1beta1.types.WorkloadConfig.Mode):
Sets which mode of auditing should be used
Expand Down Expand Up @@ -2812,6 +2838,9 @@ class ProtectConfig(proto.Message):
r"""ProtectConfig defines the flags needed to enable/disable
features for the Protect API.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
workload_config (google.cloud.container_v1beta1.types.WorkloadConfig):
WorkloadConfig defines which actions are
Expand Down Expand Up @@ -2913,6 +2942,9 @@ class ClusterUpdate(proto.Message):
update can be applied to a cluster with each request, so at most
one field can be provided.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
desired_node_version (str):
The Kubernetes version to change the nodes to
Expand Down Expand Up @@ -3096,6 +3128,11 @@ class ClusterUpdate(proto.Message):
desired_gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig):
The desired config of Gateway API on this
cluster.
etag (str):
The current etag of the cluster.
If an etag is provided and does not match the
current etag of the cluster, update will be
blocked and an ABORTED error will be returned.
desired_node_pool_logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig):
The desired node pool logging configuration
defaults for the cluster.
Expand Down Expand Up @@ -3323,6 +3360,10 @@ class ClusterUpdate(proto.Message):
number=114,
message="GatewayAPIConfig",
)
etag: str = proto.Field(
proto.STRING,
number=115,
)
desired_node_pool_logging_config: "NodePoolLoggingConfig" = proto.Field(
proto.MESSAGE,
number=116,
Expand Down Expand Up @@ -3799,6 +3840,11 @@ class UpdateNodePoolRequest(proto.Message):
Confidential VM once enabled.
gvnic (google.cloud.container_v1beta1.types.VirtualNIC):
Enable or disable gvnic on the node pool.
etag (str):
The current etag of the node pool.
If an etag is provided and does not match the
current etag of the node pool, update will be
blocked and an ABORTED error will be returned.
fast_socket (google.cloud.container_v1beta1.types.FastSocket):
Enable or disable NCCL fast socket for the
node pool.
Expand Down Expand Up @@ -3900,6 +3946,10 @@ class UpdateNodePoolRequest(proto.Message):
number=29,
message="VirtualNIC",
)
etag: str = proto.Field(
proto.STRING,
number=30,
)
fast_socket: "FastSocket" = proto.Field(
proto.MESSAGE,
number=31,
Expand Down Expand Up @@ -5147,6 +5197,11 @@ class NodePool(proto.Message):
update_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo):
Output only. [Output only] Update info contains relevant
information during a node pool update.
etag (str):
This checksum is computed by the server based
on the value of node pool fields, and may be
sent on update requests to ensure the client has
an up-to-date value before proceeding.
"""

class Status(proto.Enum):
Expand Down Expand Up @@ -5188,6 +5243,9 @@ class UpgradeSettings(proto.Message):
2. node_pool_soak_duration is the soak time after all blue nodes are
drained. After this period, the blue pool nodes will be deleted.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
max_surge (int):
The maximum number of nodes that can be
Expand Down Expand Up @@ -5405,6 +5463,10 @@ class Type(proto.Enum):
number=109,
message=UpdateInfo,
)
etag: str = proto.Field(
proto.STRING,
number=110,
)


class NodeManagement(proto.Message):
Expand Down Expand Up @@ -6381,6 +6443,8 @@ class CompleteIPRotationRequest(proto.Message):
class AcceleratorConfig(proto.Message):
r"""AcceleratorConfig represents a Hardware Accelerator request.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
accelerator_count (int):
The number of the accelerator cards exposed
Expand Down Expand Up @@ -6430,6 +6494,9 @@ class GPUSharingConfig(proto.Message):
r"""GPUSharingConfig represents the GPU sharing configuration for
Hardware Accelerators.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
max_shared_clients_per_gpu (int):
The max number of containers that can share a
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-container",
"version": "2.15.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-container",
"version": "2.15.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
2 changes: 1 addition & 1 deletion scripts/fixup_container_v1beta1_keywords.py
Expand Up @@ -72,7 +72,7 @@ class containerCallTransformer(cst.CSTTransformer):
'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ),
'update_cluster': ('project_id', 'zone', 'cluster_id', 'update', 'name', ),
'update_master': ('project_id', 'zone', 'cluster_id', 'master_version', 'name', ),
'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', ),
'update_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'node_version', 'image_type', 'locations', 'workload_metadata_config', 'name', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', 'etag', 'fast_socket', 'logging_config', 'resource_labels', 'windows_node_config', ),
}

def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode:
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Expand Up @@ -38,6 +38,7 @@
dependencies = [
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
"proto-plus >= 1.22.0, <2.0.0dev",
"proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'",
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
]
url = "https://github.com/googleapis/python-container"
Expand Down Expand Up @@ -77,6 +78,7 @@
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: OS Independent",
"Topic :: Internet",
],
Expand Down
6 changes: 6 additions & 0 deletions testing/constraints-3.12.txt
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# This constraints file is required for unit tests.
# List all library dependencies and extras in this file.
google-api-core
proto-plus
protobuf

0 comments on commit 8eeee3b

Please sign in to comment.