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

Commit 8eeee3b

Browse files
feat: Add field for enabled Beta K8s APIs in proto (#329)
* 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: https://github.com/googleapis/googleapis-gen/commit/7bf29a414b9ecac3170f0b65bdc2a95705c0ef1a 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: https://github.com/googleapis/googleapis-gen/commit/6d95a0e2be7fb65cfee8b49a29c0e21acf673195 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>
1 parent fa5eb7f commit 8eeee3b

File tree

12 files changed

+115
-7
lines changed

12 files changed

+115
-7
lines changed

google/cloud/container_v1/services/cluster_manager/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get_mtls_endpoint_and_cert_source(
137137
The API endpoint is determined in the following order:
138138
(1) if `client_options.api_endpoint` if provided, use the provided one.
139139
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
140-
default mTLS endpoint; if the environment variabel is "never", use the default API
140+
default mTLS endpoint; if the environment variable is "never", use the default API
141141
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
142142
use the default API endpoint.
143143

google/cloud/container_v1/services/cluster_manager/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def get_mtls_endpoint_and_cert_source(
288288
The API endpoint is determined in the following order:
289289
(1) if `client_options.api_endpoint` if provided, use the provided one.
290290
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
291-
default mTLS endpoint; if the environment variabel is "never", use the default API
291+
default mTLS endpoint; if the environment variable is "never", use the default API
292292
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
293293
use the default API endpoint.
294294

google/cloud/container_v1/types/cluster_service.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ class NodeConfig(proto.Message):
358358
[AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults]
359359
instead.
360360
361+
362+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
363+
361364
Attributes:
362365
machine_type (str):
363366
The name of a Google Compute Engine `machine
@@ -716,6 +719,8 @@ class NodeConfig(proto.Message):
716719
class AdvancedMachineFeatures(proto.Message):
717720
r"""Specifies options for controlling advanced machine features.
718721
722+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
723+
719724
Attributes:
720725
threads_per_core (int):
721726
The number of threads per physical core. To
@@ -737,6 +742,8 @@ class AdvancedMachineFeatures(proto.Message):
737742
class NodeNetworkConfig(proto.Message):
738743
r"""Parameters for node pool-level network config.
739744
745+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
746+
740747
Attributes:
741748
create_pod_range (bool):
742749
Input only. Whether to create a new range for pod IPs in
@@ -799,6 +806,8 @@ class NodeNetworkConfig(proto.Message):
799806
class NetworkPerformanceConfig(proto.Message):
800807
r"""Configuration of all network bandwidth tiers
801808
809+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
810+
802811
Attributes:
803812
total_egress_bandwidth_tier (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier):
804813
Specifies the total network bandwidth tier
@@ -1543,6 +1552,9 @@ class MasterAuthorizedNetworksConfig(proto.Message):
15431552
except traffic from the given CIDR blocks, Google Compute Engine
15441553
Public IPs and Google Prod IPs.
15451554
1555+
1556+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1557+
15461558
Attributes:
15471559
enabled (bool):
15481560
Whether or not master authorized networks is
@@ -1865,6 +1877,8 @@ class IPAllocationPolicy(proto.Message):
18651877
class Cluster(proto.Message):
18661878
r"""A Google Kubernetes Engine cluster.
18671879
1880+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1881+
18681882
Attributes:
18691883
name (str):
18701884
The name of this cluster. The name must be unique within
@@ -2531,6 +2545,9 @@ class ClusterUpdate(proto.Message):
25312545
update can be applied to a cluster with each request, so at most
25322546
one field can be provided.
25332547
2548+
2549+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2550+
25342551
Attributes:
25352552
desired_node_version (str):
25362553
The Kubernetes version to change the nodes to
@@ -4693,6 +4710,9 @@ class UpgradeSettings(proto.Message):
46934710
2. node_pool_soak_duration is the soak time after all blue nodes are
46944711
drained. After this period, the blue pool nodes will be deleted.
46954712
4713+
4714+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
4715+
46964716
Attributes:
46974717
max_surge (int):
46984718
The maximum number of nodes that can be
@@ -5884,6 +5904,8 @@ class CompleteIPRotationRequest(proto.Message):
58845904
class AcceleratorConfig(proto.Message):
58855905
r"""AcceleratorConfig represents a Hardware Accelerator request.
58865906
5907+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
5908+
58875909
Attributes:
58885910
accelerator_count (int):
58895911
The number of the accelerator cards exposed
@@ -5926,6 +5948,9 @@ class GPUSharingConfig(proto.Message):
59265948
r"""GPUSharingConfig represents the GPU sharing configuration for
59275949
Hardware Accelerators.
59285950
5951+
5952+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
5953+
59295954
Attributes:
59305955
max_shared_clients_per_gpu (int):
59315956
The max number of containers that can share a

google/cloud/container_v1beta1/services/cluster_manager/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get_mtls_endpoint_and_cert_source(
137137
The API endpoint is determined in the following order:
138138
(1) if `client_options.api_endpoint` if provided, use the provided one.
139139
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
140-
default mTLS endpoint; if the environment variabel is "never", use the default API
140+
default mTLS endpoint; if the environment variable is "never", use the default API
141141
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
142142
use the default API endpoint.
143143

google/cloud/container_v1beta1/services/cluster_manager/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def get_mtls_endpoint_and_cert_source(
288288
The API endpoint is determined in the following order:
289289
(1) if `client_options.api_endpoint` if provided, use the provided one.
290290
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
291-
default mTLS endpoint; if the environment variabel is "never", use the default API
291+
default mTLS endpoint; if the environment variable is "never", use the default API
292292
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
293293
use the default API endpoint.
294294

google/cloud/container_v1beta1/types/cluster_service.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ class NodeConfig(proto.Message):
366366
[AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults]
367367
instead.
368368
369+
370+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
371+
369372
Attributes:
370373
machine_type (str):
371374
The name of a Google Compute Engine `machine
@@ -733,6 +736,8 @@ class NodeConfig(proto.Message):
733736
class AdvancedMachineFeatures(proto.Message):
734737
r"""Specifies options for controlling advanced machine features.
735738
739+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
740+
736741
Attributes:
737742
threads_per_core (int):
738743
The number of threads per physical core. To
@@ -754,6 +759,8 @@ class AdvancedMachineFeatures(proto.Message):
754759
class NodeNetworkConfig(proto.Message):
755760
r"""Parameters for node pool-level network config.
756761
762+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
763+
757764
Attributes:
758765
create_pod_range (bool):
759766
Input only. Whether to create a new range for pod IPs in
@@ -816,6 +823,8 @@ class NodeNetworkConfig(proto.Message):
816823
class NetworkPerformanceConfig(proto.Message):
817824
r"""Configuration of all network bandwidth tiers
818825
826+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
827+
819828
Attributes:
820829
total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier):
821830
Specifies the total network bandwidth tier
@@ -1678,6 +1687,9 @@ class MasterAuthorizedNetworksConfig(proto.Message):
16781687
except traffic from the given CIDR blocks, Google Compute Engine
16791688
Public IPs and Google Prod IPs.
16801689
1690+
1691+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1692+
16811693
Attributes:
16821694
enabled (bool):
16831695
Whether or not master authorized networks is
@@ -2111,6 +2123,8 @@ class Type(proto.Enum):
21112123
class Cluster(proto.Message):
21122124
r"""A Google Kubernetes Engine cluster.
21132125
2126+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2127+
21142128
Attributes:
21152129
name (str):
21162130
The name of this cluster. The name must be unique within
@@ -2439,6 +2453,11 @@ class Cluster(proto.Message):
24392453
cluster.
24402454
24412455
This field is a member of `oneof`_ ``_protect_config``.
2456+
etag (str):
2457+
This checksum is computed by the server based
2458+
on the value of cluster fields, and may be sent
2459+
on update requests to ensure the client has an
2460+
up-to-date value before proceeding.
24422461
"""
24432462

24442463
class Status(proto.Enum):
@@ -2778,12 +2797,19 @@ class Status(proto.Enum):
27782797
optional=True,
27792798
message="ProtectConfig",
27802799
)
2800+
etag: str = proto.Field(
2801+
proto.STRING,
2802+
number=139,
2803+
)
27812804

27822805

27832806
class WorkloadConfig(proto.Message):
27842807
r"""WorkloadConfig defines the flags to enable or disable the
27852808
workload configurations for the cluster.
27862809
2810+
2811+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2812+
27872813
Attributes:
27882814
audit_mode (google.cloud.container_v1beta1.types.WorkloadConfig.Mode):
27892815
Sets which mode of auditing should be used
@@ -2812,6 +2838,9 @@ class ProtectConfig(proto.Message):
28122838
r"""ProtectConfig defines the flags needed to enable/disable
28132839
features for the Protect API.
28142840
2841+
2842+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2843+
28152844
Attributes:
28162845
workload_config (google.cloud.container_v1beta1.types.WorkloadConfig):
28172846
WorkloadConfig defines which actions are
@@ -2913,6 +2942,9 @@ class ClusterUpdate(proto.Message):
29132942
update can be applied to a cluster with each request, so at most
29142943
one field can be provided.
29152944
2945+
2946+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2947+
29162948
Attributes:
29172949
desired_node_version (str):
29182950
The Kubernetes version to change the nodes to
@@ -3096,6 +3128,11 @@ class ClusterUpdate(proto.Message):
30963128
desired_gateway_api_config (google.cloud.container_v1beta1.types.GatewayAPIConfig):
30973129
The desired config of Gateway API on this
30983130
cluster.
3131+
etag (str):
3132+
The current etag of the cluster.
3133+
If an etag is provided and does not match the
3134+
current etag of the cluster, update will be
3135+
blocked and an ABORTED error will be returned.
30993136
desired_node_pool_logging_config (google.cloud.container_v1beta1.types.NodePoolLoggingConfig):
31003137
The desired node pool logging configuration
31013138
defaults for the cluster.
@@ -3323,6 +3360,10 @@ class ClusterUpdate(proto.Message):
33233360
number=114,
33243361
message="GatewayAPIConfig",
33253362
)
3363+
etag: str = proto.Field(
3364+
proto.STRING,
3365+
number=115,
3366+
)
33263367
desired_node_pool_logging_config: "NodePoolLoggingConfig" = proto.Field(
33273368
proto.MESSAGE,
33283369
number=116,
@@ -3799,6 +3840,11 @@ class UpdateNodePoolRequest(proto.Message):
37993840
Confidential VM once enabled.
38003841
gvnic (google.cloud.container_v1beta1.types.VirtualNIC):
38013842
Enable or disable gvnic on the node pool.
3843+
etag (str):
3844+
The current etag of the node pool.
3845+
If an etag is provided and does not match the
3846+
current etag of the node pool, update will be
3847+
blocked and an ABORTED error will be returned.
38023848
fast_socket (google.cloud.container_v1beta1.types.FastSocket):
38033849
Enable or disable NCCL fast socket for the
38043850
node pool.
@@ -3900,6 +3946,10 @@ class UpdateNodePoolRequest(proto.Message):
39003946
number=29,
39013947
message="VirtualNIC",
39023948
)
3949+
etag: str = proto.Field(
3950+
proto.STRING,
3951+
number=30,
3952+
)
39033953
fast_socket: "FastSocket" = proto.Field(
39043954
proto.MESSAGE,
39053955
number=31,
@@ -5147,6 +5197,11 @@ class NodePool(proto.Message):
51475197
update_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo):
51485198
Output only. [Output only] Update info contains relevant
51495199
information during a node pool update.
5200+
etag (str):
5201+
This checksum is computed by the server based
5202+
on the value of node pool fields, and may be
5203+
sent on update requests to ensure the client has
5204+
an up-to-date value before proceeding.
51505205
"""
51515206

51525207
class Status(proto.Enum):
@@ -5188,6 +5243,9 @@ class UpgradeSettings(proto.Message):
51885243
2. node_pool_soak_duration is the soak time after all blue nodes are
51895244
drained. After this period, the blue pool nodes will be deleted.
51905245
5246+
5247+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
5248+
51915249
Attributes:
51925250
max_surge (int):
51935251
The maximum number of nodes that can be
@@ -5405,6 +5463,10 @@ class Type(proto.Enum):
54055463
number=109,
54065464
message=UpdateInfo,
54075465
)
5466+
etag: str = proto.Field(
5467+
proto.STRING,
5468+
number=110,
5469+
)
54085470

54095471

54105472
class NodeManagement(proto.Message):
@@ -6381,6 +6443,8 @@ class CompleteIPRotationRequest(proto.Message):
63816443
class AcceleratorConfig(proto.Message):
63826444
r"""AcceleratorConfig represents a Hardware Accelerator request.
63836445
6446+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
6447+
63846448
Attributes:
63856449
accelerator_count (int):
63866450
The number of the accelerator cards exposed
@@ -6430,6 +6494,9 @@ class GPUSharingConfig(proto.Message):
64306494
r"""GPUSharingConfig represents the GPU sharing configuration for
64316495
Hardware Accelerators.
64326496
6497+
6498+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
6499+
64336500
Attributes:
64346501
max_shared_clients_per_gpu (int):
64356502
The max number of containers that can share a

samples/generated_samples/snippet_metadata_google.container.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-container",
11-
"version": "2.15.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

samples/generated_samples/snippet_metadata_google.container.v1beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-container",
11-
"version": "2.15.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

scripts/fixup_container_v1beta1_keywords.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class containerCallTransformer(cst.CSTTransformer):
7272
'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ),
7373
'update_cluster': ('project_id', 'zone', 'cluster_id', 'update', 'name', ),
7474
'update_master': ('project_id', 'zone', 'cluster_id', 'master_version', 'name', ),
75-
'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', ),
75+
'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', ),
7676
}
7777

7878
def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode:

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
dependencies = [
3939
"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.*",
4040
"proto-plus >= 1.22.0, <2.0.0dev",
41+
"proto-plus >= 1.22.2, <2.0.0dev; python_version>='3.11'",
4142
"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",
4243
]
4344
url = "https://github.com/googleapis/python-container"
@@ -77,6 +78,7 @@
7778
"Programming Language :: Python :: 3.8",
7879
"Programming Language :: Python :: 3.9",
7980
"Programming Language :: Python :: 3.10",
81+
"Programming Language :: Python :: 3.11",
8082
"Operating System :: OS Independent",
8183
"Topic :: Internet",
8284
],

0 commit comments

Comments
 (0)