diff --git a/packages/google-cloud-container/.github/sync-repo-settings.yaml b/packages/google-cloud-container/.github/sync-repo-settings.yaml new file mode 100644 index 000000000000..da344f850c48 --- /dev/null +++ b/packages/google-cloud-container/.github/sync-repo-settings.yaml @@ -0,0 +1,27 @@ + + +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/sync-repo-settings +# Rules for main branch protection +branchProtectionRules: +# Identifies the protection rule pattern. Name of the branch to be protected. +# Defaults to `main` +- pattern: main + requiresCodeOwnerReviews: true + requiresStrictStatusChecks: true + requiredStatusCheckContexts: + - 'Kokoro' + - 'cla/google' + - 'Samples - Lint' + - 'Samples - Python 3.7' + - 'Samples - Python 3.8' + - 'Samples - Python 3.9' + - 'Samples - Python 3.10' + - 'OwlBot Post Processor' + - 'docs' + - 'docfx' + - 'lint' + - 'unit (3.7)' + - 'unit (3.8)' + - 'unit (3.9)' + - 'unit (3.10)' + - 'cover' \ No newline at end of file diff --git a/packages/google-cloud-container/container-v1-py.tar.gz b/packages/google-cloud-container/container-v1-py.tar.gz new file mode 100644 index 000000000000..e952e390fa0c Binary files /dev/null and b/packages/google-cloud-container/container-v1-py.tar.gz differ diff --git a/packages/google-cloud-container/google/cloud/container/__init__.py b/packages/google-cloud-container/google/cloud/container/__init__.py index 59467da88f38..70e7339136a8 100644 --- a/packages/google-cloud-container/google/cloud/container/__init__.py +++ b/packages/google-cloud-container/google/cloud/container/__init__.py @@ -29,6 +29,7 @@ AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, BinaryAuthorization, + BlueGreenSettings, CancelOperationRequest, ClientCertificateConfig, CloudRunConfig, @@ -36,6 +37,7 @@ ClusterAutoscaling, ClusterUpdate, CompleteIPRotationRequest, + CompleteNodePoolUpgradeRequest, ConfidentialNodes, ConfigConnectorConfig, CreateClusterRequest, @@ -59,8 +61,10 @@ GetOpenIDConfigResponse, GetOperationRequest, GetServerConfigRequest, + GPUSharingConfig, HorizontalPodAutoscaling, HttpLoadBalancing, + IdentityServiceConfig, ILBSubsettingConfig, IntraNodeVisibilityConfig, IPAllocationPolicy, @@ -81,6 +85,7 @@ MaintenanceExclusionOptions, MaintenancePolicy, MaintenanceWindow, + ManagedPrometheusConfig, MasterAuth, MasterAuthorizedNetworksConfig, MaxPodsConstraint, @@ -90,15 +95,20 @@ NetworkConfig, NetworkPolicy, NetworkPolicyConfig, + NetworkTags, NodeConfig, NodeConfigDefaults, NodeKubeletConfig, + NodeLabels, NodeManagement, NodeNetworkConfig, NodePool, + NodePoolAutoConfig, NodePoolAutoscaling, NodePoolDefaults, + NodePoolUpdateStrategy, NodeTaint, + NodeTaints, NotificationConfig, Operation, OperationProgress, @@ -157,6 +167,7 @@ "AutoprovisioningNodePoolDefaults", "AutoUpgradeOptions", "BinaryAuthorization", + "BlueGreenSettings", "CancelOperationRequest", "ClientCertificateConfig", "CloudRunConfig", @@ -164,6 +175,7 @@ "ClusterAutoscaling", "ClusterUpdate", "CompleteIPRotationRequest", + "CompleteNodePoolUpgradeRequest", "ConfidentialNodes", "ConfigConnectorConfig", "CreateClusterRequest", @@ -186,8 +198,10 @@ "GetOpenIDConfigResponse", "GetOperationRequest", "GetServerConfigRequest", + "GPUSharingConfig", "HorizontalPodAutoscaling", "HttpLoadBalancing", + "IdentityServiceConfig", "ILBSubsettingConfig", "IntraNodeVisibilityConfig", "IPAllocationPolicy", @@ -208,6 +222,7 @@ "MaintenanceExclusionOptions", "MaintenancePolicy", "MaintenanceWindow", + "ManagedPrometheusConfig", "MasterAuth", "MasterAuthorizedNetworksConfig", "MaxPodsConstraint", @@ -217,15 +232,19 @@ "NetworkConfig", "NetworkPolicy", "NetworkPolicyConfig", + "NetworkTags", "NodeConfig", "NodeConfigDefaults", "NodeKubeletConfig", + "NodeLabels", "NodeManagement", "NodeNetworkConfig", "NodePool", + "NodePoolAutoConfig", "NodePoolAutoscaling", "NodePoolDefaults", "NodeTaint", + "NodeTaints", "NotificationConfig", "Operation", "OperationProgress", @@ -270,6 +289,7 @@ "WorkloadIdentityConfig", "WorkloadMetadataConfig", "DatapathProvider", + "NodePoolUpdateStrategy", "PrivateIPv6GoogleAccess", "UpgradeResourceType", ) diff --git a/packages/google-cloud-container/google/cloud/container_v1/__init__.py b/packages/google-cloud-container/google/cloud/container_v1/__init__.py index 3d33a5e46072..002d8cce1500 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/__init__.py +++ b/packages/google-cloud-container/google/cloud/container_v1/__init__.py @@ -24,6 +24,7 @@ AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, BinaryAuthorization, + BlueGreenSettings, CancelOperationRequest, ClientCertificateConfig, CloudRunConfig, @@ -31,6 +32,7 @@ ClusterAutoscaling, ClusterUpdate, CompleteIPRotationRequest, + CompleteNodePoolUpgradeRequest, ConfidentialNodes, ConfigConnectorConfig, CreateClusterRequest, @@ -54,8 +56,10 @@ GetOpenIDConfigResponse, GetOperationRequest, GetServerConfigRequest, + GPUSharingConfig, HorizontalPodAutoscaling, HttpLoadBalancing, + IdentityServiceConfig, ILBSubsettingConfig, IntraNodeVisibilityConfig, IPAllocationPolicy, @@ -76,6 +80,7 @@ MaintenanceExclusionOptions, MaintenancePolicy, MaintenanceWindow, + ManagedPrometheusConfig, MasterAuth, MasterAuthorizedNetworksConfig, MaxPodsConstraint, @@ -85,15 +90,20 @@ NetworkConfig, NetworkPolicy, NetworkPolicyConfig, + NetworkTags, NodeConfig, NodeConfigDefaults, NodeKubeletConfig, + NodeLabels, NodeManagement, NodeNetworkConfig, NodePool, + NodePoolAutoConfig, NodePoolAutoscaling, NodePoolDefaults, + NodePoolUpdateStrategy, NodeTaint, + NodeTaints, NotificationConfig, Operation, OperationProgress, @@ -151,6 +161,7 @@ "Autopilot", "AutoprovisioningNodePoolDefaults", "BinaryAuthorization", + "BlueGreenSettings", "CancelOperationRequest", "ClientCertificateConfig", "CloudRunConfig", @@ -159,6 +170,7 @@ "ClusterManagerClient", "ClusterUpdate", "CompleteIPRotationRequest", + "CompleteNodePoolUpgradeRequest", "ConfidentialNodes", "ConfigConnectorConfig", "CreateClusterRequest", @@ -171,6 +183,7 @@ "DeleteClusterRequest", "DeleteNodePoolRequest", "DnsCacheConfig", + "GPUSharingConfig", "GcePersistentDiskCsiDriverConfig", "GcfsConfig", "GcpFilestoreCsiDriverConfig", @@ -186,6 +199,7 @@ "HttpLoadBalancing", "ILBSubsettingConfig", "IPAllocationPolicy", + "IdentityServiceConfig", "IntraNodeVisibilityConfig", "Jwk", "KubernetesDashboard", @@ -204,6 +218,7 @@ "MaintenanceExclusionOptions", "MaintenancePolicy", "MaintenanceWindow", + "ManagedPrometheusConfig", "MasterAuth", "MasterAuthorizedNetworksConfig", "MaxPodsConstraint", @@ -213,15 +228,20 @@ "NetworkConfig", "NetworkPolicy", "NetworkPolicyConfig", + "NetworkTags", "NodeConfig", "NodeConfigDefaults", "NodeKubeletConfig", + "NodeLabels", "NodeManagement", "NodeNetworkConfig", "NodePool", + "NodePoolAutoConfig", "NodePoolAutoscaling", "NodePoolDefaults", + "NodePoolUpdateStrategy", "NodeTaint", + "NodeTaints", "NotificationConfig", "Operation", "OperationProgress", diff --git a/packages/google-cloud-container/google/cloud/container_v1/gapic_metadata.json b/packages/google-cloud-container/google/cloud/container_v1/gapic_metadata.json index 4d2e42e0311a..5ef3b3ddb5c8 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/gapic_metadata.json +++ b/packages/google-cloud-container/google/cloud/container_v1/gapic_metadata.json @@ -20,6 +20,11 @@ "complete_ip_rotation" ] }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, "CreateCluster": { "methods": [ "create_cluster" @@ -185,6 +190,11 @@ "complete_ip_rotation" ] }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, "CreateCluster": { "methods": [ "create_cluster" diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py index ac397bcd1f6c..920f46d2fd58 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/async_client.py @@ -244,7 +244,7 @@ async def sample_list_clusters(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -377,7 +377,7 @@ async def sample_get_cluster(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -529,7 +529,7 @@ async def sample_create_cluster(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -662,7 +662,7 @@ async def sample_update_cluster(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -959,7 +959,7 @@ async def sample_set_logging_service(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1118,7 +1118,7 @@ async def sample_set_monitoring_service(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1278,7 +1278,7 @@ async def sample_set_addons_config(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1426,7 +1426,7 @@ async def sample_set_locations(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1582,7 +1582,7 @@ async def sample_update_master(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1824,7 +1824,7 @@ async def sample_delete_cluster(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1967,7 +1967,7 @@ async def sample_list_operations(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2089,7 +2089,7 @@ async def sample_get_operation(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2229,7 +2229,7 @@ async def sample_cancel_operation(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2351,7 +2351,7 @@ async def sample_get_server_config(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2560,7 +2560,7 @@ async def sample_list_node_pools(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2585,7 +2585,7 @@ async def sample_list_node_pools(): on the ``request`` instance; if ``request`` is provided, this should not be set. parent (:class:`str`): - The parent (project, location, cluster id) where the + The parent (project, location, cluster name) where the node pools will be listed. Specified in the format ``projects/*/locations/*/clusters/*``. @@ -2702,7 +2702,7 @@ async def sample_get_node_pool(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2862,7 +2862,7 @@ async def sample_create_node_pool(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2892,7 +2892,7 @@ async def sample_create_node_pool(): on the ``request`` instance; if ``request`` is provided, this should not be set. parent (:class:`str`): - The parent (project, location, cluster id) where the + The parent (project, location, cluster name) where the node pool will be created. Specified in the format ``projects/*/locations/*/clusters/*``. @@ -3003,7 +3003,7 @@ async def sample_delete_node_pool(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3118,6 +3118,67 @@ async def sample_delete_node_pool(): # Done; return the response. return response + async def complete_node_pool_upgrade( + self, + request: Union[cluster_service.CompleteNodePoolUpgradeRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. code-block:: python + + from google.cloud import container_v1 + + async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + Args: + request (Union[google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest, dict]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete upgrade. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.complete_node_pool_upgrade, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + async def rollback_node_pool_upgrade( self, request: Union[cluster_service.RollbackNodePoolUpgradeRequest, dict] = None, @@ -3162,7 +3223,7 @@ async def sample_rollback_node_pool_upgrade(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3462,7 +3523,7 @@ async def sample_set_legacy_abac(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3495,8 +3556,8 @@ async def sample_set_legacy_abac(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (:class:`str`): - The name (project, location, cluster id) of the cluster - to set legacy abac. Specified in the format + The name (project, location, cluster name) of the + cluster to set legacy abac. Specified in the format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field @@ -3606,7 +3667,7 @@ async def sample_start_ip_rotation(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3631,8 +3692,8 @@ async def sample_start_ip_rotation(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (:class:`str`): - The name (project, location, cluster id) of the cluster - to start IP rotation. Specified in the format + The name (project, location, cluster name) of the + cluster to start IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field @@ -3739,7 +3800,7 @@ async def sample_complete_ip_rotation(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3764,8 +3825,8 @@ async def sample_complete_ip_rotation(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (:class:`str`): - The name (project, location, cluster id) of the cluster - to complete IP rotation. Specified in the format + The name (project, location, cluster name) of the + cluster to complete IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field @@ -3951,7 +4012,7 @@ async def sample_set_network_policy(): project_id (:class:`str`): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3983,9 +4044,9 @@ async def sample_set_network_policy(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (:class:`str`): - The name (project, location, cluster id) of the cluster - to set networking policy. Specified in the format - ``projects/*/locations/*/clusters/*``. + The name (project, location, cluster name) of the + cluster to set networking policy. Specified in the + format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -4097,7 +4158,7 @@ async def sample_set_maintenance_policy(): project_id (:class:`str`): Required. The Google Developers Console `project ID or project - number `__. + number `__. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -4126,9 +4187,9 @@ async def sample_set_maintenance_policy(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (:class:`str`): - The name (project, location, cluster id) of the cluster - to set maintenance policy. Specified in the format - ``projects/*/locations/*/clusters/*``. + The name (project, location, cluster name) of the + cluster to set maintenance policy. Specified in the + format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py index 4f7bf8940160..19d86d1f72e3 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/client.py @@ -423,6 +423,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_clusters( @@ -463,7 +464,7 @@ def sample_list_clusters(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -586,7 +587,7 @@ def sample_get_cluster(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -728,7 +729,7 @@ def sample_create_cluster(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -861,7 +862,7 @@ def sample_update_cluster(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1162,7 +1163,7 @@ def sample_set_logging_service(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1321,7 +1322,7 @@ def sample_set_monitoring_service(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1481,7 +1482,7 @@ def sample_set_addons_config(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1629,7 +1630,7 @@ def sample_set_locations(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1785,7 +1786,7 @@ def sample_update_master(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2028,7 +2029,7 @@ def sample_delete_cluster(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2161,7 +2162,7 @@ def sample_list_operations(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2273,7 +2274,7 @@ def sample_get_operation(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2403,7 +2404,7 @@ def sample_cancel_operation(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2525,7 +2526,7 @@ def sample_get_server_config(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2725,7 +2726,7 @@ def sample_list_node_pools(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2750,7 +2751,7 @@ def sample_list_node_pools(): on the ``request`` instance; if ``request`` is provided, this should not be set. parent (str): - The parent (project, location, cluster id) where the + The parent (project, location, cluster name) where the node pools will be listed. Specified in the format ``projects/*/locations/*/clusters/*``. @@ -2857,7 +2858,7 @@ def sample_get_node_pool(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3007,7 +3008,7 @@ def sample_create_node_pool(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -3037,7 +3038,7 @@ def sample_create_node_pool(): on the ``request`` instance; if ``request`` is provided, this should not be set. parent (str): - The parent (project, location, cluster id) where the + The parent (project, location, cluster name) where the node pool will be created. Specified in the format ``projects/*/locations/*/clusters/*``. @@ -3148,7 +3149,7 @@ def sample_delete_node_pool(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3253,6 +3254,70 @@ def sample_delete_node_pool(): # Done; return the response. return response + def complete_node_pool_upgrade( + self, + request: Union[cluster_service.CompleteNodePoolUpgradeRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. code-block:: python + + from google.cloud import container_v1 + + def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + Args: + request (Union[google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest, dict]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete upgrade. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a cluster_service.CompleteNodePoolUpgradeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.complete_node_pool_upgrade + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + def rollback_node_pool_upgrade( self, request: Union[cluster_service.RollbackNodePoolUpgradeRequest, dict] = None, @@ -3297,7 +3362,7 @@ def sample_rollback_node_pool_upgrade(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3601,7 +3666,7 @@ def sample_set_legacy_abac(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3634,8 +3699,8 @@ def sample_set_legacy_abac(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (str): - The name (project, location, cluster id) of the cluster - to set legacy abac. Specified in the format + The name (project, location, cluster name) of the + cluster to set legacy abac. Specified in the format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field @@ -3745,7 +3810,7 @@ def sample_start_ip_rotation(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3770,8 +3835,8 @@ def sample_start_ip_rotation(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (str): - The name (project, location, cluster id) of the cluster - to start IP rotation. Specified in the format + The name (project, location, cluster name) of the + cluster to start IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field @@ -3878,7 +3943,7 @@ def sample_complete_ip_rotation(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3903,8 +3968,8 @@ def sample_complete_ip_rotation(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (str): - The name (project, location, cluster id) of the cluster - to complete IP rotation. Specified in the format + The name (project, location, cluster name) of the + cluster to complete IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field @@ -4091,7 +4156,7 @@ def sample_set_network_policy(): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -4123,9 +4188,9 @@ def sample_set_network_policy(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (str): - The name (project, location, cluster id) of the cluster - to set networking policy. Specified in the format - ``projects/*/locations/*/clusters/*``. + The name (project, location, cluster name) of the + cluster to set networking policy. Specified in the + format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -4237,7 +4302,7 @@ def sample_set_maintenance_policy(): project_id (str): Required. The Google Developers Console `project ID or project - number `__. + number `__. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -4266,9 +4331,9 @@ def sample_set_maintenance_policy(): on the ``request`` instance; if ``request`` is provided, this should not be set. name (str): - The name (project, location, cluster id) of the cluster - to set maintenance policy. Specified in the format - ``projects/*/locations/*/clusters/*``. + The name (project, location, cluster name) of the + cluster to set maintenance policy. Specified in the + format ``projects/*/locations/*/clusters/*``. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py index fbcaad68c73a..cc413a688a55 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/base.py @@ -55,6 +55,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -82,11 +83,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -107,6 +103,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -119,6 +120,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -322,6 +328,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=20.0, client_info=client_info, ), + self.complete_node_pool_upgrade: gapic_v1.method.wrap_method( + self.complete_node_pool_upgrade, + default_timeout=None, + client_info=client_info, + ), self.rollback_node_pool_upgrade: gapic_v1.method.wrap_method( self.rollback_node_pool_upgrade, default_timeout=45.0, @@ -593,6 +604,15 @@ def delete_node_pool( ]: raise NotImplementedError() + @property + def complete_node_pool_upgrade( + self, + ) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], + ]: + raise NotImplementedError() + @property def rollback_node_pool_upgrade( self, diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc.py index 79643edcc650..6403577c43b4 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc.py @@ -58,6 +58,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -153,6 +154,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: @@ -849,6 +851,33 @@ def delete_node_pool( ) return self._stubs["delete_node_pool"] + @property + def complete_node_pool_upgrade( + self, + ) -> Callable[[cluster_service.CompleteNodePoolUpgradeRequest], empty_pb2.Empty]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "complete_node_pool_upgrade" not in self._stubs: + self._stubs["complete_node_pool_upgrade"] = self.grpc_channel.unary_unary( + "/google.container.v1.ClusterManager/CompleteNodePoolUpgrade", + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["complete_node_pool_upgrade"] + @property def rollback_node_pool_upgrade( self, diff --git a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py index a895fd76abf8..4465c959a70a 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py +++ b/packages/google-cloud-container/google/cloud/container_v1/services/cluster_manager/transports/grpc_asyncio.py @@ -103,6 +103,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -198,6 +199,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: @@ -885,6 +887,35 @@ def delete_node_pool( ) return self._stubs["delete_node_pool"] + @property + def complete_node_pool_upgrade( + self, + ) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], Awaitable[empty_pb2.Empty] + ]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "complete_node_pool_upgrade" not in self._stubs: + self._stubs["complete_node_pool_upgrade"] = self.grpc_channel.unary_unary( + "/google.container.v1.ClusterManager/CompleteNodePoolUpgrade", + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["complete_node_pool_upgrade"] + @property def rollback_node_pool_upgrade( self, diff --git a/packages/google-cloud-container/google/cloud/container_v1/types/__init__.py b/packages/google-cloud-container/google/cloud/container_v1/types/__init__.py index a6e864856829..993dc324de94 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/types/__init__.py +++ b/packages/google-cloud-container/google/cloud/container_v1/types/__init__.py @@ -22,6 +22,7 @@ AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, BinaryAuthorization, + BlueGreenSettings, CancelOperationRequest, ClientCertificateConfig, CloudRunConfig, @@ -29,6 +30,7 @@ ClusterAutoscaling, ClusterUpdate, CompleteIPRotationRequest, + CompleteNodePoolUpgradeRequest, ConfidentialNodes, ConfigConnectorConfig, CreateClusterRequest, @@ -52,8 +54,10 @@ GetOpenIDConfigResponse, GetOperationRequest, GetServerConfigRequest, + GPUSharingConfig, HorizontalPodAutoscaling, HttpLoadBalancing, + IdentityServiceConfig, ILBSubsettingConfig, IntraNodeVisibilityConfig, IPAllocationPolicy, @@ -74,6 +78,7 @@ MaintenanceExclusionOptions, MaintenancePolicy, MaintenanceWindow, + ManagedPrometheusConfig, MasterAuth, MasterAuthorizedNetworksConfig, MaxPodsConstraint, @@ -83,15 +88,20 @@ NetworkConfig, NetworkPolicy, NetworkPolicyConfig, + NetworkTags, NodeConfig, NodeConfigDefaults, NodeKubeletConfig, + NodeLabels, NodeManagement, NodeNetworkConfig, NodePool, + NodePoolAutoConfig, NodePoolAutoscaling, NodePoolDefaults, + NodePoolUpdateStrategy, NodeTaint, + NodeTaints, NotificationConfig, Operation, OperationProgress, @@ -148,6 +158,7 @@ "AutoprovisioningNodePoolDefaults", "AutoUpgradeOptions", "BinaryAuthorization", + "BlueGreenSettings", "CancelOperationRequest", "ClientCertificateConfig", "CloudRunConfig", @@ -155,6 +166,7 @@ "ClusterAutoscaling", "ClusterUpdate", "CompleteIPRotationRequest", + "CompleteNodePoolUpgradeRequest", "ConfidentialNodes", "ConfigConnectorConfig", "CreateClusterRequest", @@ -177,8 +189,10 @@ "GetOpenIDConfigResponse", "GetOperationRequest", "GetServerConfigRequest", + "GPUSharingConfig", "HorizontalPodAutoscaling", "HttpLoadBalancing", + "IdentityServiceConfig", "ILBSubsettingConfig", "IntraNodeVisibilityConfig", "IPAllocationPolicy", @@ -199,6 +213,7 @@ "MaintenanceExclusionOptions", "MaintenancePolicy", "MaintenanceWindow", + "ManagedPrometheusConfig", "MasterAuth", "MasterAuthorizedNetworksConfig", "MaxPodsConstraint", @@ -208,15 +223,19 @@ "NetworkConfig", "NetworkPolicy", "NetworkPolicyConfig", + "NetworkTags", "NodeConfig", "NodeConfigDefaults", "NodeKubeletConfig", + "NodeLabels", "NodeManagement", "NodeNetworkConfig", "NodePool", + "NodePoolAutoConfig", "NodePoolAutoscaling", "NodePoolDefaults", "NodeTaint", + "NodeTaints", "NotificationConfig", "Operation", "OperationProgress", @@ -261,6 +280,7 @@ "WorkloadIdentityConfig", "WorkloadMetadataConfig", "DatapathProvider", + "NodePoolUpdateStrategy", "PrivateIPv6GoogleAccess", "UpgradeResourceType", ) diff --git a/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py b/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py index 33f1b470238a..77bf2d11701e 100644 --- a/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py +++ b/packages/google-cloud-container/google/cloud/container_v1/types/cluster_service.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import code_pb2 # type: ignore @@ -23,8 +24,9 @@ package="google.container.v1", manifest={ "PrivateIPv6GoogleAccess", - "DatapathProvider", "UpgradeResourceType", + "DatapathProvider", + "NodePoolUpdateStrategy", "LinuxNodeConfig", "NodeKubeletConfig", "NodeConfig", @@ -35,6 +37,9 @@ "GcfsConfig", "ReservationAffinity", "NodeTaint", + "NodeTaints", + "NodeLabels", + "NetworkTags", "MasterAuth", "ClientCertificateConfig", "AddonsConfig", @@ -56,6 +61,7 @@ "BinaryAuthorization", "IPAllocationPolicy", "Cluster", + "NodePoolAutoConfig", "NodePoolDefaults", "NodeConfigDefaults", "ClusterUpdate", @@ -85,6 +91,7 @@ "DeleteNodePoolRequest", "ListNodePoolsRequest", "GetNodePoolRequest", + "BlueGreenSettings", "NodePool", "NodeManagement", "AutoUpgradeOptions", @@ -96,6 +103,7 @@ "DailyMaintenanceWindow", "SetNodePoolManagementRequest", "SetNodePoolSizeRequest", + "CompleteNodePoolUpgradeRequest", "RollbackNodePoolUpgradeRequest", "ListNodePoolsResponse", "ClusterAutoscaling", @@ -107,6 +115,7 @@ "StartIPRotationRequest", "CompleteIPRotationRequest", "AcceleratorConfig", + "GPUSharingConfig", "WorkloadMetadataConfig", "SetNetworkPolicyRequest", "SetMaintenancePolicyRequest", @@ -124,6 +133,7 @@ "DNSConfig", "MaxPodsConstraint", "WorkloadIdentityConfig", + "IdentityServiceConfig", "MeshCertificates", "DatabaseEncryption", "ListUsableSubnetworksRequest", @@ -145,6 +155,7 @@ "LoggingComponentConfig", "MonitoringConfig", "MonitoringComponentConfig", + "ManagedPrometheusConfig", }, ) @@ -159,6 +170,15 @@ class PrivateIPv6GoogleAccess(proto.Enum): PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3 +class UpgradeResourceType(proto.Enum): + r"""UpgradeResourceType is the resource type that is upgrading. + It is used in upgrade notifications. + """ + UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0 + MASTER = 1 + NODE_POOL = 2 + + class DatapathProvider(proto.Enum): r"""The datapath provider selects the implementation of the Kubernetes networking model for service resolution and network @@ -169,13 +189,11 @@ class DatapathProvider(proto.Enum): ADVANCED_DATAPATH = 2 -class UpgradeResourceType(proto.Enum): - r"""UpgradeResourceType is the resource type that is upgrading. - It is used in upgrade notifications. - """ - UPGRADE_RESOURCE_TYPE_UNSPECIFIED = 0 - MASTER = 1 - NODE_POOL = 2 +class NodePoolUpdateStrategy(proto.Enum): + r"""Strategy used for node pool update.""" + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0 + BLUE_GREEN = 2 + SURGE = 3 class LinuxNodeConfig(proto.Message): @@ -188,6 +206,7 @@ class LinuxNodeConfig(proto.Message): The following parameters are supported. + net.core.busy_poll net.core.busy_read net.core.netdev_max_backlog net.core.rmem_max net.core.wmem_default net.core.wmem_max net.core.optmem_max net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem @@ -238,6 +257,12 @@ class NodeKubeletConfig(proto.Message): optional fraction and a unit suffix, such as "300ms". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The value must be a positive duration. + pod_pids_limit (int): + Set the Pod PID limits. See + https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits + Controls the maximum number of processes allowed + to run in a pod. The value must be greater than + or equal to 1024 and less than 4194304. """ cpu_manager_policy = proto.Field( @@ -253,11 +278,20 @@ class NodeKubeletConfig(proto.Message): proto.STRING, number=3, ) + pod_pids_limit = proto.Field( + proto.INT64, + number=4, + ) class NodeConfig(proto.Message): r"""Parameters that describe the nodes in a cluster. + GKE Autopilot clusters do not recognize parameters in + ``NodeConfig``. Use + [AutoprovisioningNodePoolDefaults][google.container.v1.AutoprovisioningNodePoolDefaults] + instead. + Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -428,6 +462,13 @@ class NodeConfig(proto.Message): Advanced features for the Compute Engine VM. gvnic (google.cloud.container_v1.types.VirtualNIC): Enable or disable gvnic in the node pool. + spot (bool): + Spot flag for enabling Spot VM, which is a + rebrand of the existing preemptible flag. + confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. """ machine_type = proto.Field( @@ -543,6 +584,15 @@ class NodeConfig(proto.Message): number=29, message="VirtualNIC", ) + spot = proto.Field( + proto.BOOL, + number=32, + ) + confidential_nodes = proto.Field( + proto.MESSAGE, + number=35, + message="ConfidentialNodes", + ) class AdvancedMachineFeatures(proto.Message): @@ -615,8 +665,35 @@ class NodeNetworkConfig(proto.Message): This field cannot be changed after the node pool has been created. + network_performance_config (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig): + Network bandwidth tier configuration. + + This field is a member of `oneof`_ ``_network_performance_config``. """ + class NetworkPerformanceConfig(proto.Message): + r"""Configuration of all network bandwidth tiers + + Attributes: + total_egress_bandwidth_tier (google.cloud.container_v1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): + Specifies the total network bandwidth tier + for the NodePool. + + This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. + """ + + class Tier(proto.Enum): + r"""Node network tier""" + TIER_UNSPECIFIED = 0 + TIER_1 = 1 + + total_egress_bandwidth_tier = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum="NodeNetworkConfig.NetworkPerformanceConfig.Tier", + ) + create_pod_range = proto.Field( proto.BOOL, number=4, @@ -629,6 +706,12 @@ class NodeNetworkConfig(proto.Message): proto.STRING, number=6, ) + network_performance_config = proto.Field( + proto.MESSAGE, + number=11, + optional=True, + message=NetworkPerformanceConfig, + ) class ShieldedInstanceConfig(proto.Message): @@ -783,6 +866,53 @@ class Effect(proto.Enum): ) +class NodeTaints(proto.Message): + r"""Collection of Kubernetes `node + taints `__. + + Attributes: + taints (Sequence[google.cloud.container_v1.types.NodeTaint]): + List of node taints. + """ + + taints = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="NodeTaint", + ) + + +class NodeLabels(proto.Message): + r"""Collection of node-level `Kubernetes + labels `__. + + Attributes: + labels (Mapping[str, str]): + Map of node label keys and node label values. + """ + + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=1, + ) + + +class NetworkTags(proto.Message): + r"""Collection of Compute Engine network tags that can be applied + to a node's underlying VM instance. + + Attributes: + tags (Sequence[str]): + List of network tags. + """ + + tags = proto.RepeatedField( + proto.STRING, + number=1, + ) + + class MasterAuth(proto.Message): r"""The authentication information for accessing the master endpoint. Authentication can be done using HTTP basic auth or @@ -1330,12 +1460,28 @@ class BinaryAuthorization(proto.Message): Enable Binary Authorization for this cluster. If enabled, all container images will be validated by Binary Authorization. + evaluation_mode (google.cloud.container_v1.types.BinaryAuthorization.EvaluationMode): + Mode of operation for binauthz policy + evaluation. Currently the only options are + equivalent to enable/disable. If unspecified, + defaults to DISABLED. """ + class EvaluationMode(proto.Enum): + r"""Binary Authorization mode of operation.""" + EVALUATION_MODE_UNSPECIFIED = 0 + DISABLED = 1 + PROJECT_SINGLETON_POLICY_ENFORCE = 2 + enabled = proto.Field( proto.BOOL, number=1, ) + evaluation_mode = proto.Field( + proto.ENUM, + number=2, + enum=EvaluationMode, + ) class IPAllocationPolicy(proto.Message): @@ -1691,7 +1837,11 @@ class Cluster(proto.Message): notification_config (google.cloud.container_v1.types.NotificationConfig): Notification configuration of the cluster. confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): - Configuration of Confidential Nodes + Configuration of Confidential Nodes. + All the nodes in the cluster will be + Confidential VM once enabled. + identity_service_config (google.cloud.container_v1.types.IdentityServiceConfig): + Configuration for Identity Service component. self_link (str): [Output only] Server-defined URL for the resource. zone (str): @@ -1797,6 +1947,11 @@ class Cluster(proto.Message): Logging configuration for the cluster. monitoring_config (google.cloud.container_v1.types.MonitoringConfig): Monitoring configuration for the cluster. + node_pool_auto_config (google.cloud.container_v1.types.NodePoolAutoConfig): + Node pool configs that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. """ class Status(proto.Enum): @@ -1978,6 +2133,11 @@ class Status(proto.Enum): number=50, message="ConfidentialNodes", ) + identity_service_config = proto.Field( + proto.MESSAGE, + number=54, + message="IdentityServiceConfig", + ) self_link = proto.Field( proto.STRING, number=100, @@ -2077,6 +2237,33 @@ class Status(proto.Enum): number=133, message="MonitoringConfig", ) + node_pool_auto_config = proto.Field( + proto.MESSAGE, + number=136, + message="NodePoolAutoConfig", + ) + + +class NodePoolAutoConfig(proto.Message): + r"""Node pool configs that apply to all auto-provisioned node + pools in autopilot clusters and node auto-provisioning enabled + clusters. + + Attributes: + network_tags (google.cloud.container_v1.types.NetworkTags): + The list of instance tags applied to all + nodes. Tags are used to identify valid sources + or targets for network firewalls and are + specified by the client during cluster creation. + Each tag within the list must comply with + RFC1035. + """ + + network_tags = proto.Field( + proto.MESSAGE, + number=1, + message="NetworkTags", + ) class NodePoolDefaults(proto.Message): @@ -2100,7 +2287,7 @@ class NodeConfigDefaults(proto.Message): Attributes: gcfs_config (google.cloud.container_v1.types.GcfsConfig): - GCFS (Google Container File System, a.k.a + GCFS (Google Container File System, a.k.a. Riptide) options. """ @@ -2239,6 +2426,9 @@ class ClusterUpdate(proto.Message): The desired logging configuration. desired_monitoring_config (google.cloud.container_v1.types.MonitoringConfig): The desired monitoring configuration. + desired_identity_service_config (google.cloud.container_v1.types.IdentityServiceConfig): + The desired Identity Service component + configuration. desired_service_external_ips_config (google.cloud.container_v1.types.ServiceExternalIPsConfig): ServiceExternalIPsConfig specifies the config for the use of Services with ExternalIPs field. @@ -2257,6 +2447,11 @@ class ClusterUpdate(proto.Message): Kubernetes version desired_gcfs_config (google.cloud.container_v1.types.GcfsConfig): The desired GCFS config for the cluster + desired_node_pool_auto_config_network_tags (google.cloud.container_v1.types.NetworkTags): + The desired network tags that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. """ desired_node_version = proto.Field( @@ -2398,6 +2593,11 @@ class ClusterUpdate(proto.Message): number=65, message="MonitoringConfig", ) + desired_identity_service_config = proto.Field( + proto.MESSAGE, + number=66, + message="IdentityServiceConfig", + ) desired_service_external_ips_config = proto.Field( proto.MESSAGE, number=60, @@ -2412,6 +2612,11 @@ class ClusterUpdate(proto.Message): number=109, message="GcfsConfig", ) + desired_node_pool_auto_config_network_tags = proto.Field( + proto.MESSAGE, + number=110, + message="NetworkTags", + ) class Operation(proto.Message): @@ -2663,7 +2868,7 @@ class CreateClusterRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -2705,7 +2910,7 @@ class GetClusterRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -2748,7 +2953,7 @@ class UpdateClusterRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -2799,7 +3004,7 @@ class UpdateNodePoolRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -2849,13 +3054,34 @@ class UpdateNodePoolRequest(proto.Message): upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): Upgrade settings control disruption and speed of the upgrade. + tags (google.cloud.container_v1.types.NetworkTags): + The desired network tags to be applied to all nodes in the + node pool. If this field is not present, the tags will not + be changed. Otherwise, the existing network tags will be + *replaced* with the provided tags. + taints (google.cloud.container_v1.types.NodeTaints): + The desired node taints to be applied to all nodes in the + node pool. If this field is not present, the taints will not + be changed. Otherwise, the existing node taints will be + *replaced* with the provided taints. + labels (google.cloud.container_v1.types.NodeLabels): + The desired node labels to be applied to all nodes in the + node pool. If this field is not present, the labels will not + be changed. Otherwise, the existing node labels will be + *replaced* with the provided labels. linux_node_config (google.cloud.container_v1.types.LinuxNodeConfig): Parameters that can be configured on Linux nodes. kubelet_config (google.cloud.container_v1.types.NodeKubeletConfig): Node kubelet configs. + node_network_config (google.cloud.container_v1.types.NodeNetworkConfig): + Node network config. gcfs_config (google.cloud.container_v1.types.GcfsConfig): GCFS config. + confidential_nodes (google.cloud.container_v1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. gvnic (google.cloud.container_v1.types.VirtualNIC): Enable or disable gvnic on the node pool. """ @@ -2902,6 +3128,21 @@ class UpdateNodePoolRequest(proto.Message): number=15, message="NodePool.UpgradeSettings", ) + tags = proto.Field( + proto.MESSAGE, + number=16, + message="NetworkTags", + ) + taints = proto.Field( + proto.MESSAGE, + number=17, + message="NodeTaints", + ) + labels = proto.Field( + proto.MESSAGE, + number=18, + message="NodeLabels", + ) linux_node_config = proto.Field( proto.MESSAGE, number=19, @@ -2912,11 +3153,21 @@ class UpdateNodePoolRequest(proto.Message): number=20, message="NodeKubeletConfig", ) + node_network_config = proto.Field( + proto.MESSAGE, + number=21, + message="NodeNetworkConfig", + ) gcfs_config = proto.Field( proto.MESSAGE, number=22, message="GcfsConfig", ) + confidential_nodes = proto.Field( + proto.MESSAGE, + number=23, + message="ConfidentialNodes", + ) gvnic = proto.Field( proto.MESSAGE, number=29, @@ -2932,7 +3183,7 @@ class SetNodePoolAutoscalingRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -2992,7 +3243,7 @@ class SetLoggingServiceRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3054,7 +3305,7 @@ class SetMonitoringServiceRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3117,7 +3368,7 @@ class SetAddonsConfigRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3168,7 +3419,7 @@ class SetLocationsRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3224,7 +3475,7 @@ class UpdateMasterRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3284,7 +3535,7 @@ class SetMasterAuthRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3349,7 +3600,7 @@ class DeleteClusterRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3392,7 +3643,7 @@ class ListClustersRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -3450,7 +3701,7 @@ class GetOperationRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3493,7 +3744,7 @@ class ListOperationsRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -3529,7 +3780,7 @@ class CancelOperationRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3597,7 +3848,7 @@ class GetServerConfigRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3708,7 +3959,7 @@ class CreateNodePoolRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -3723,7 +3974,7 @@ class CreateNodePoolRequest(proto.Message): node_pool (google.cloud.container_v1.types.NodePool): Required. The node pool to create. parent (str): - The parent (project, location, cluster id) where the node + The parent (project, location, cluster name) where the node pool will be created. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -3758,7 +4009,7 @@ class DeleteNodePoolRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3809,7 +4060,7 @@ class ListNodePoolsRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -3822,7 +4073,7 @@ class ListNodePoolsRequest(proto.Message): This field has been deprecated and replaced by the parent field. parent (str): - The parent (project, location, cluster id) where the node + The parent (project, location, cluster name) where the node pools will be listed. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -3852,7 +4103,7 @@ class GetNodePoolRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3896,6 +4147,81 @@ class GetNodePoolRequest(proto.Message): ) +class BlueGreenSettings(proto.Message): + r"""Settings for blue-green upgrade. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + standard_rollout_policy (google.cloud.container_v1.types.BlueGreenSettings.StandardRolloutPolicy): + Standard policy for the blue-green upgrade. + + This field is a member of `oneof`_ ``rollout_policy``. + node_pool_soak_duration (google.protobuf.duration_pb2.Duration): + Time needed after draining entire blue pool. + After this period, blue pool will be cleaned up. + + This field is a member of `oneof`_ ``_node_pool_soak_duration``. + """ + + class StandardRolloutPolicy(proto.Message): + r"""Standard rollout policy is the default policy for blue-green. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + batch_percentage (float): + Percentage of the bool pool nodes to drain in a batch. The + range of this field should be (0.0, 1.0]. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_node_count (int): + Number of blue nodes to drain in a batch. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_soak_duration (google.protobuf.duration_pb2.Duration): + Soak time after each batch gets drained. + Default to zero. + + This field is a member of `oneof`_ ``_batch_soak_duration``. + """ + + batch_percentage = proto.Field( + proto.FLOAT, + number=1, + oneof="update_batch_size", + ) + batch_node_count = proto.Field( + proto.INT32, + number=2, + oneof="update_batch_size", + ) + batch_soak_duration = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message=duration_pb2.Duration, + ) + + standard_rollout_policy = proto.Field( + proto.MESSAGE, + number=1, + oneof="rollout_policy", + message=StandardRolloutPolicy, + ) + node_pool_soak_duration = proto.Field( + proto.MESSAGE, + number=2, + optional=True, + message=duration_pb2.Duration, + ) + + class NodePool(proto.Message): r"""NodePool contains the name and configuration for a cluster's node pool. Node pools are a set of nodes (i.e. VM's), with a @@ -3938,7 +4264,9 @@ class NodePool(proto.Message): instance_group_urls (Sequence[str]): [Output only] The resource URLs of the `managed instance groups `__ - associated with this node pool. + associated with this node pool. During the node pool + blue-green upgrade operation, the URLs contain both blue and + green resources. status (google.cloud.container_v1.types.NodePool.Status): [Output only] The status of the nodes in this pool instance. status_message (str): @@ -3965,6 +4293,9 @@ class NodePool(proto.Message): upgrade_settings (google.cloud.container_v1.types.NodePool.UpgradeSettings): Upgrade settings control disruption and speed of the upgrade. + update_info (google.cloud.container_v1.types.NodePool.UpdateInfo): + Output only. [Output only] Update info contains relevant + information during a node pool update. """ class Status(proto.Enum): @@ -3978,30 +4309,57 @@ class Status(proto.Enum): ERROR = 6 class UpgradeSettings(proto.Message): - r"""These upgrade settings control the level of parallelism and - the level of disruption caused by an upgrade. + r"""These upgrade settings control the level of parallelism and the + level of disruption caused by an upgrade. maxUnavailable controls the number of nodes that can be simultaneously unavailable. - maxSurge controls the number of additional nodes that can be - added to the node pool temporarily for the time of the upgrade - to increase the number of available nodes. - - (maxUnavailable + maxSurge) determines the level of parallelism - (how many nodes are being upgraded at the same time). - - Note: upgrades inevitably introduce some disruption since - workloads need to be moved from old nodes to new, upgraded ones. - Even if maxUnavailable=0, this holds true. (Disruption stays - within the limits of PodDisruptionBudget, if it is configured.) - - Consider a hypothetical node pool with 5 nodes having - maxSurge=2, maxUnavailable=1. This means the upgrade process - upgrades 3 nodes simultaneously. It creates 2 additional - (upgraded) nodes, then it brings down 3 old (not yet upgraded) - nodes at the same time. This ensures that there are always at - least 4 nodes available. + maxSurge controls the number of additional nodes that can be added + to the node pool temporarily for the time of the upgrade to increase + the number of available nodes. + + (maxUnavailable + maxSurge) determines the level of parallelism (how + many nodes are being upgraded at the same time). + + Note: upgrades inevitably introduce some disruption since workloads + need to be moved from old nodes to new, upgraded ones. Even if + maxUnavailable=0, this holds true. (Disruption stays within the + limits of PodDisruptionBudget, if it is configured.) + + Consider a hypothetical node pool with 5 nodes having maxSurge=2, + maxUnavailable=1. This means the upgrade process upgrades 3 nodes + simultaneously. It creates 2 additional (upgraded) nodes, then it + brings down 3 old (not yet upgraded) nodes at the same time. This + ensures that there are always at least 4 nodes available. + + These upgrade settings configure the upgrade strategy for the node + pool. Use strategy to switch between the strategies applied to the + node pool. + + If the strategy is ROLLING, use max_surge and max_unavailable to + control the level of parallelism and the level of disruption caused + by upgrade. + + 1. maxSurge controls the number of additional nodes that can be + added to the node pool temporarily for the time of the upgrade to + increase the number of available nodes. + 2. maxUnavailable controls the number of nodes that can be + simultaneously unavailable. + 3. (maxUnavailable + maxSurge) determines the level of parallelism + (how many nodes are being upgraded at the same time). + + If the strategy is BLUE_GREEN, use blue_green_settings to configure + the blue-green upgrade related settings. + + 1. standard_rollout_policy is the default policy. The policy is used + to control the way blue pool gets drained. The draining is + executed in the batch mode. The batch size could be specified as + either percentage of the node pool size or the number of nodes. + batch_soak_duration is the soak time after each batch gets + drained. + 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. Attributes: max_surge (int): @@ -4013,6 +4371,14 @@ class UpgradeSettings(proto.Message): simultaneously unavailable during the upgrade process. A node is considered available if its status is Ready. + strategy (google.cloud.container_v1.types.NodePoolUpdateStrategy): + Update strategy of the node pool. + + This field is a member of `oneof`_ ``_strategy``. + blue_green_settings (google.cloud.container_v1.types.BlueGreenSettings): + Settings for blue-green upgrade strategy. + + This field is a member of `oneof`_ ``_blue_green_settings``. """ max_surge = proto.Field( @@ -4023,6 +4389,92 @@ class UpgradeSettings(proto.Message): proto.INT32, number=2, ) + strategy = proto.Field( + proto.ENUM, + number=3, + optional=True, + enum="NodePoolUpdateStrategy", + ) + blue_green_settings = proto.Field( + proto.MESSAGE, + number=4, + optional=True, + message="BlueGreenSettings", + ) + + class UpdateInfo(proto.Message): + r"""UpdateInfo contains resource (instance groups, etc), status + and other intermediate information relevant to a node pool + upgrade. + + Attributes: + blue_green_info (google.cloud.container_v1.types.NodePool.UpdateInfo.BlueGreenInfo): + Information of a blue-green upgrade. + """ + + class BlueGreenInfo(proto.Message): + r"""Information relevant to blue-green upgrade. + + Attributes: + phase (google.cloud.container_v1.types.NodePool.UpdateInfo.BlueGreenInfo.Phase): + Current blue-green upgrade phase. + blue_instance_group_urls (Sequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with blue pool. + green_instance_group_urls (Sequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with green pool. + blue_pool_deletion_start_time (str): + Time to start deleting blue pool to complete blue-green + upgrade, in + `RFC3339 `__ text + format. + green_pool_version (str): + Version of green pool. + """ + + class Phase(proto.Enum): + r"""Phase represents the different stages blue-green upgrade is + running in. + """ + PHASE_UNSPECIFIED = 0 + UPDATE_STARTED = 1 + CREATING_GREEN_POOL = 2 + CORDONING_BLUE_POOL = 3 + DRAINING_BLUE_POOL = 4 + NODE_POOL_SOAKING = 5 + DELETING_BLUE_POOL = 6 + ROLLBACK_STARTED = 7 + + phase = proto.Field( + proto.ENUM, + number=1, + enum="NodePool.UpdateInfo.BlueGreenInfo.Phase", + ) + blue_instance_group_urls = proto.RepeatedField( + proto.STRING, + number=2, + ) + green_instance_group_urls = proto.RepeatedField( + proto.STRING, + number=3, + ) + blue_pool_deletion_start_time = proto.Field( + proto.STRING, + number=4, + ) + green_pool_version = proto.Field( + proto.STRING, + number=5, + ) + + blue_green_info = proto.Field( + proto.MESSAGE, + number=1, + message="NodePool.UpdateInfo.BlueGreenInfo", + ) name = proto.Field( proto.STRING, @@ -4096,6 +4548,11 @@ class UpgradeSettings(proto.Message): number=107, message=UpgradeSettings, ) + update_info = proto.Field( + proto.MESSAGE, + number=109, + message=UpdateInfo, + ) class NodeManagement(proto.Message): @@ -4392,7 +4849,7 @@ class SetNodePoolManagementRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4451,7 +4908,7 @@ class SetNodePoolSizeRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4502,6 +4959,23 @@ class SetNodePoolSizeRequest(proto.Message): ) +class CompleteNodePoolUpgradeRequest(proto.Message): + r"""CompleteNodePoolUpgradeRequest sets the name of target node + pool to complete upgrade. + + Attributes: + name (str): + The name (project, location, cluster, node pool id) of the + node pool to complete upgrade. Specified in the format + 'projects/*/locations/*/clusters/*/nodePools/*'. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + class RollbackNodePoolUpgradeRequest(proto.Message): r"""RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed NodePool upgrade. This will be an no-op if the @@ -4511,7 +4985,7 @@ class RollbackNodePoolUpgradeRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4531,6 +5005,9 @@ class RollbackNodePoolUpgradeRequest(proto.Message): The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format ``projects/*/locations/*/clusters/*/nodePools/*``. + respect_pdb (bool): + Option for rollback to ignore the + PodDisruptionBudget. Default value is false. """ project_id = proto.Field( @@ -4553,6 +5030,10 @@ class RollbackNodePoolUpgradeRequest(proto.Message): proto.STRING, number=6, ) + respect_pdb = proto.Field( + proto.BOOL, + number=7, + ) class ListNodePoolsResponse(proto.Message): @@ -4643,15 +5124,17 @@ class AutoprovisioningNodePoolDefaults(proto.Message): Specifies the node management options for NAP created node-pools. min_cpu_platform (str): - Minimum CPU platform to be used for NAP created node pools. - The instance may be scheduled on the specified or newer CPU - platform. Applicable values are the friendly names of CPU - platforms, such as minCpuPlatform: Intel Haswell or - minCpuPlatform: Intel Sandy Bridge. For more information, - read `how to specify min CPU + Deprecated. Minimum CPU platform to be used for NAP created + node pools. The instance may be scheduled on the specified + or newer CPU platform. Applicable values are the friendly + names of CPU platforms, such as minCpuPlatform: Intel + Haswell or minCpuPlatform: Intel Sandy Bridge. For more + information, read `how to specify min CPU platform `__ - To unset the min cpu platform field pass "automatic" as - field value. + This field is deprecated, min_cpu_platform should be + specified using cloud.google.com/requested-min-cpu-platform + label selector on the pod. To unset the min cpu platform + field pass "automatic" as field value. disk_size_gb (int): Size of the disk attached to each node, specified in GB. The smallest allowed disk size @@ -4769,8 +5252,29 @@ class NodePoolAutoscaling(proto.Message): scale up the cluster. autoprovisioned (bool): Can this node pool be deleted automatically. + location_policy (google.cloud.container_v1.types.NodePoolAutoscaling.LocationPolicy): + Location policy used when scaling up a + nodepool. + total_min_node_count (int): + Minimum number of nodes in the node pool. Must be greater + than 1 less than total_max_node_count. The + total_*_node_count fields are mutually exclusive with the + \*_node_count fields. + total_max_node_count (int): + Maximum number of nodes in the node pool. Must be greater + than total_min_node_count. There has to be enough quota to + scale up the cluster. The total_*_node_count fields are + mutually exclusive with the \*_node_count fields. """ + class LocationPolicy(proto.Enum): + r"""Location policy specifies how zones are picked when scaling + up the nodepool. + """ + LOCATION_POLICY_UNSPECIFIED = 0 + BALANCED = 1 + ANY = 2 + enabled = proto.Field( proto.BOOL, number=1, @@ -4787,6 +5291,19 @@ class NodePoolAutoscaling(proto.Message): proto.BOOL, number=4, ) + location_policy = proto.Field( + proto.ENUM, + number=5, + enum=LocationPolicy, + ) + total_min_node_count = proto.Field( + proto.INT32, + number=6, + ) + total_max_node_count = proto.Field( + proto.INT32, + number=7, + ) class SetLabelsRequest(proto.Message): @@ -4798,7 +5315,7 @@ class SetLabelsRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4821,7 +5338,7 @@ class SetLabelsRequest(proto.Message): changing labels. Make a ``get()`` request to the resource to get the latest fingerprint. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set labels. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -4861,7 +5378,7 @@ class SetLegacyAbacRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4877,7 +5394,7 @@ class SetLegacyAbacRequest(proto.Message): Required. Whether ABAC authorization will be enabled in the cluster. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -4913,7 +5430,7 @@ class StartIPRotationRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4926,7 +5443,7 @@ class StartIPRotationRequest(proto.Message): This field has been deprecated and replaced by the name field. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. rotate_credentials (bool): @@ -4964,7 +5481,7 @@ class CompleteIPRotationRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4977,7 +5494,7 @@ class CompleteIPRotationRequest(proto.Message): This field has been deprecated and replaced by the name field. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5015,6 +5532,10 @@ class AcceleratorConfig(proto.Message): Size of partitions to create on the GPU. Valid values are described in the NVIDIA `mig user guide `__. + gpu_sharing_config (google.cloud.container_v1.types.GPUSharingConfig): + The configuration for GPU sharing options. + + This field is a member of `oneof`_ ``_gpu_sharing_config``. """ accelerator_count = proto.Field( @@ -5029,6 +5550,44 @@ class AcceleratorConfig(proto.Message): proto.STRING, number=3, ) + gpu_sharing_config = proto.Field( + proto.MESSAGE, + number=5, + optional=True, + message="GPUSharingConfig", + ) + + +class GPUSharingConfig(proto.Message): + r"""GPUSharingConfig represents the GPU sharing configuration for + Hardware Accelerators. + + Attributes: + max_shared_clients_per_gpu (int): + The max number of containers that can share a + physical GPU. + gpu_sharing_strategy (google.cloud.container_v1.types.GPUSharingConfig.GPUSharingStrategy): + The type of GPU sharing strategy to enable on + the GPU node. + + This field is a member of `oneof`_ ``_gpu_sharing_strategy``. + """ + + class GPUSharingStrategy(proto.Enum): + r"""The type of GPU sharing strategy currently provided.""" + GPU_SHARING_STRATEGY_UNSPECIFIED = 0 + TIME_SHARING = 1 + + max_shared_clients_per_gpu = proto.Field( + proto.INT64, + number=1, + ) + gpu_sharing_strategy = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum=GPUSharingStrategy, + ) class WorkloadMetadataConfig(proto.Message): @@ -5064,7 +5623,7 @@ class SetNetworkPolicyRequest(proto.Message): project_id (str): Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -5080,7 +5639,7 @@ class SetNetworkPolicyRequest(proto.Message): Required. Configuration options for the NetworkPolicy feature. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5116,7 +5675,7 @@ class SetMaintenancePolicyRequest(proto.Message): project_id (str): Required. The Google Developers Console `project ID or project - number `__. + number `__. zone (str): Required. The name of the Google Compute Engine `zone `__ @@ -5128,7 +5687,7 @@ class SetMaintenancePolicyRequest(proto.Message): for the cluster. An empty field clears the existing maintenance policy. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5379,8 +5938,8 @@ class GetJSONWebKeysRequest(proto.Message): Attributes: parent (str): - The cluster (project, location, cluster id) to get keys for. - Specified in the format + The cluster (project, location, cluster name) to get keys + for. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5603,6 +6162,23 @@ class WorkloadIdentityConfig(proto.Message): ) +class IdentityServiceConfig(proto.Message): + r"""IdentityServiceConfig is configuration for Identity Service + which allows customers to use external identity providers with + the K8S API + + Attributes: + enabled (bool): + Whether to enable the Identity Service + component + """ + + enabled = proto.Field( + proto.BOOL, + number=1, + ) + + class MeshCertificates(proto.Message): r"""Configuration for issuance of mTLS keys and certificates to Kubernetes pods. @@ -6025,8 +6601,8 @@ class ConfidentialNodes(proto.Message): Attributes: enabled (bool): - Whether Confidential Nodes feature is enabled - for all nodes in this cluster. + Whether Confidential Nodes feature is + enabled. """ enabled = proto.Field( @@ -6267,6 +6843,9 @@ class MonitoringConfig(proto.Message): Attributes: component_config (google.cloud.container_v1.types.MonitoringComponentConfig): Monitoring components configuration + managed_prometheus_config (google.cloud.container_v1.types.ManagedPrometheusConfig): + Enable Google Cloud Managed Service for + Prometheus in the cluster. """ component_config = proto.Field( @@ -6274,6 +6853,11 @@ class MonitoringConfig(proto.Message): number=1, message="MonitoringComponentConfig", ) + managed_prometheus_config = proto.Field( + proto.MESSAGE, + number=2, + message="ManagedPrometheusConfig", + ) class MonitoringComponentConfig(proto.Message): @@ -6290,6 +6874,9 @@ class Component(proto.Enum): r"""GKE components exposing metrics""" COMPONENT_UNSPECIFIED = 0 SYSTEM_COMPONENTS = 1 + APISERVER = 3 + SCHEDULER = 4 + CONTROLLER_MANAGER = 5 enable_components = proto.RepeatedField( proto.ENUM, @@ -6298,4 +6885,19 @@ class Component(proto.Enum): ) +class ManagedPrometheusConfig(proto.Message): + r"""ManagedPrometheusConfig defines the configuration for + Google Cloud Managed Service for Prometheus. + + Attributes: + enabled (bool): + Enable Managed Collection. + """ + + enabled = proto.Field( + proto.BOOL, + number=1, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/__init__.py b/packages/google-cloud-container/google/cloud/container_v1beta1/__init__.py index fd68ddf737d6..97b62fda3abf 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/__init__.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/__init__.py @@ -24,6 +24,7 @@ AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, BinaryAuthorization, + BlueGreenSettings, CancelOperationRequest, ClientCertificateConfig, CloudRunConfig, @@ -32,8 +33,10 @@ ClusterTelemetry, ClusterUpdate, CompleteIPRotationRequest, + CompleteNodePoolUpgradeRequest, ConfidentialNodes, ConfigConnectorConfig, + CostManagementConfig, CreateClusterRequest, CreateNodePoolRequest, DailyMaintenanceWindow, @@ -57,6 +60,7 @@ GetOperationRequest, GetServerConfigRequest, GkeBackupAgentConfig, + GPUSharingConfig, HorizontalPodAutoscaling, HttpLoadBalancing, IdentityServiceConfig, @@ -104,8 +108,10 @@ NodeManagement, NodeNetworkConfig, NodePool, + NodePoolAutoConfig, NodePoolAutoscaling, NodePoolDefaults, + NodePoolUpdateStrategy, NodeTaint, NodeTaints, NotificationConfig, @@ -115,6 +121,7 @@ PrivateClusterConfig, PrivateClusterMasterGlobalAccessConfig, PrivateIPv6GoogleAccess, + ProtectConfig, RecurringTimeWindow, ReleaseChannel, ReservationAffinity, @@ -154,7 +161,9 @@ VerticalPodAutoscaling, VirtualNIC, WindowsVersions, + WorkloadALTSConfig, WorkloadCertificates, + WorkloadConfig, WorkloadIdentityConfig, WorkloadMetadataConfig, ) @@ -169,6 +178,7 @@ "Autopilot", "AutoprovisioningNodePoolDefaults", "BinaryAuthorization", + "BlueGreenSettings", "CancelOperationRequest", "ClientCertificateConfig", "CloudRunConfig", @@ -178,8 +188,10 @@ "ClusterTelemetry", "ClusterUpdate", "CompleteIPRotationRequest", + "CompleteNodePoolUpgradeRequest", "ConfidentialNodes", "ConfigConnectorConfig", + "CostManagementConfig", "CreateClusterRequest", "CreateNodePoolRequest", "DNSConfig", @@ -191,6 +203,7 @@ "DeleteNodePoolRequest", "DnsCacheConfig", "EphemeralStorageConfig", + "GPUSharingConfig", "GcePersistentDiskCsiDriverConfig", "GcfsConfig", "GcpFilestoreCsiDriverConfig", @@ -250,8 +263,10 @@ "NodeManagement", "NodeNetworkConfig", "NodePool", + "NodePoolAutoConfig", "NodePoolAutoscaling", "NodePoolDefaults", + "NodePoolUpdateStrategy", "NodeTaint", "NodeTaints", "NotificationConfig", @@ -261,6 +276,7 @@ "PrivateClusterConfig", "PrivateClusterMasterGlobalAccessConfig", "PrivateIPv6GoogleAccess", + "ProtectConfig", "RecurringTimeWindow", "ReleaseChannel", "ReservationAffinity", @@ -300,7 +316,9 @@ "VerticalPodAutoscaling", "VirtualNIC", "WindowsVersions", + "WorkloadALTSConfig", "WorkloadCertificates", + "WorkloadConfig", "WorkloadIdentityConfig", "WorkloadMetadataConfig", ) diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_metadata.json b/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_metadata.json index b03644e05330..4e4299615f7c 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_metadata.json +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/gapic_metadata.json @@ -20,6 +20,11 @@ "complete_ip_rotation" ] }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, "CreateCluster": { "methods": [ "create_cluster" @@ -190,6 +195,11 @@ "complete_ip_rotation" ] }, + "CompleteNodePoolUpgrade": { + "methods": [ + "complete_node_pool_upgrade" + ] + }, "CreateCluster": { "methods": [ "create_cluster" diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py index 212e56e4d789..91fbb176596f 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/async_client.py @@ -245,7 +245,7 @@ async def sample_list_clusters(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -370,7 +370,7 @@ async def sample_get_cluster(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -514,7 +514,7 @@ async def sample_create_cluster(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -640,7 +640,7 @@ async def sample_update_cluster(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -938,7 +938,7 @@ async def sample_set_logging_service(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1088,7 +1088,7 @@ async def sample_set_monitoring_service(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1239,7 +1239,7 @@ async def sample_set_addons_config(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1380,7 +1380,7 @@ async def sample_set_locations(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1529,7 +1529,7 @@ async def sample_update_master(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1767,7 +1767,7 @@ async def sample_delete_cluster(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1903,7 +1903,7 @@ async def sample_list_operations(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2028,7 +2028,7 @@ async def sample_get_operation(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2161,7 +2161,7 @@ async def sample_cancel_operation(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2275,7 +2275,7 @@ async def sample_get_server_config(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2399,7 +2399,7 @@ async def sample_list_node_pools(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2614,7 +2614,7 @@ async def sample_get_node_pool(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2801,7 +2801,7 @@ async def sample_create_node_pool(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2936,7 +2936,7 @@ async def sample_delete_node_pool(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3042,6 +3042,67 @@ async def sample_delete_node_pool(): # Done; return the response. return response + async def complete_node_pool_upgrade( + self, + request: Union[cluster_service.CompleteNodePoolUpgradeRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. code-block:: python + + from google.cloud import container_v1beta1 + + async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + Args: + request (Union[google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest, dict]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete upgrade. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.complete_node_pool_upgrade, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + async def rollback_node_pool_upgrade( self, request: Union[cluster_service.RollbackNodePoolUpgradeRequest, dict] = None, @@ -3089,7 +3150,7 @@ async def sample_rollback_node_pool_upgrade(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3230,7 +3291,7 @@ async def sample_set_node_pool_management(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3384,7 +3445,7 @@ async def sample_set_labels(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3540,7 +3601,7 @@ async def sample_set_legacy_abac(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3677,7 +3738,7 @@ async def sample_start_ip_rotation(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3803,7 +3864,7 @@ async def sample_complete_ip_rotation(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -4012,7 +4073,7 @@ async def sample_set_network_policy(): project_id (:class:`str`): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -4148,7 +4209,7 @@ async def sample_set_maintenance_policy(): project_id (:class:`str`): Required. The Google Developers Console `project ID or project - number `__. + number `__. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py index 50360b33eb9c..811d7c853d1e 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/client.py @@ -423,6 +423,7 @@ def __init__( quota_project_id=client_options.quota_project_id, client_info=client_info, always_use_jwt_access=True, + api_audience=client_options.api_audience, ) def list_clusters( @@ -464,7 +465,7 @@ def sample_list_clusters(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -579,7 +580,7 @@ def sample_get_cluster(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -713,7 +714,7 @@ def sample_create_cluster(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -839,7 +840,7 @@ def sample_update_cluster(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1141,7 +1142,7 @@ def sample_set_logging_service(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1291,7 +1292,7 @@ def sample_set_monitoring_service(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1442,7 +1443,7 @@ def sample_set_addons_config(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1583,7 +1584,7 @@ def sample_set_locations(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1732,7 +1733,7 @@ def sample_update_master(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -1971,7 +1972,7 @@ def sample_delete_cluster(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2097,7 +2098,7 @@ def sample_list_operations(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2212,7 +2213,7 @@ def sample_get_operation(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2335,7 +2336,7 @@ def sample_cancel_operation(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2449,7 +2450,7 @@ def sample_get_server_config(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2563,7 +2564,7 @@ def sample_list_node_pools(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -2769,7 +2770,7 @@ def sample_get_node_pool(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -2946,7 +2947,7 @@ def sample_create_node_pool(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. @@ -3081,7 +3082,7 @@ def sample_delete_node_pool(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3177,6 +3178,70 @@ def sample_delete_node_pool(): # Done; return the response. return response + def complete_node_pool_upgrade( + self, + request: Union[cluster_service.CompleteNodePoolUpgradeRequest, dict] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + .. code-block:: python + + from google.cloud import container_v1beta1 + + def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + Args: + request (Union[google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest, dict]): + The request object. CompleteNodePoolUpgradeRequest sets + the name of target node pool to complete upgrade. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a cluster_service.CompleteNodePoolUpgradeRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, cluster_service.CompleteNodePoolUpgradeRequest): + request = cluster_service.CompleteNodePoolUpgradeRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.complete_node_pool_upgrade + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + def rollback_node_pool_upgrade( self, request: Union[cluster_service.RollbackNodePoolUpgradeRequest, dict] = None, @@ -3224,7 +3289,7 @@ def sample_rollback_node_pool_upgrade(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3367,7 +3432,7 @@ def sample_set_node_pool_management(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3521,7 +3586,7 @@ def sample_set_labels(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3676,7 +3741,7 @@ def sample_set_legacy_abac(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3813,7 +3878,7 @@ def sample_start_ip_rotation(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -3939,7 +4004,7 @@ def sample_complete_ip_rotation(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -4149,7 +4214,7 @@ def sample_set_network_policy(): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. @@ -4285,7 +4350,7 @@ def sample_set_maintenance_policy(): project_id (str): Required. The Google Developers Console `project ID or project - number `__. + number `__. This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py index 2d54204dd86a..1cc5de64171d 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/base.py @@ -55,6 +55,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, **kwargs, ) -> None: """Instantiate the transport. @@ -82,11 +83,6 @@ def __init__( be used for service account credentials. """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} # Save the scopes. @@ -107,6 +103,11 @@ def __init__( credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id ) + # Don't apply audience if the credentials file passed from user. + if hasattr(credentials, "with_gdch_audience"): + credentials = credentials.with_gdch_audience( + api_audience if api_audience else host + ) # If the credentials are service account credentials, then always try to use self signed JWT. if ( @@ -119,6 +120,11 @@ def __init__( # Save the credentials. self._credentials = credentials + # Save the hostname. Default to port 443 (HTTPS) if none is specified. + if ":" not in host: + host += ":443" + self._host = host + def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -322,6 +328,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=20.0, client_info=client_info, ), + self.complete_node_pool_upgrade: gapic_v1.method.wrap_method( + self.complete_node_pool_upgrade, + default_timeout=None, + client_info=client_info, + ), self.rollback_node_pool_upgrade: gapic_v1.method.wrap_method( self.rollback_node_pool_upgrade, default_timeout=45.0, @@ -618,6 +629,15 @@ def delete_node_pool( ]: raise NotImplementedError() + @property + def complete_node_pool_upgrade( + self, + ) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], + ]: + raise NotImplementedError() + @property def rollback_node_pool_upgrade( self, diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py index 311b145bc0ab..de6c192662aa 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc.py @@ -58,6 +58,7 @@ def __init__( quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -153,6 +154,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: @@ -849,6 +851,33 @@ def delete_node_pool( ) return self._stubs["delete_node_pool"] + @property + def complete_node_pool_upgrade( + self, + ) -> Callable[[cluster_service.CompleteNodePoolUpgradeRequest], empty_pb2.Empty]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "complete_node_pool_upgrade" not in self._stubs: + self._stubs["complete_node_pool_upgrade"] = self.grpc_channel.unary_unary( + "/google.container.v1beta1.ClusterManager/CompleteNodePoolUpgrade", + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["complete_node_pool_upgrade"] + @property def rollback_node_pool_upgrade( self, diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py index 38bc7c68c1cf..bbe069a2b6a5 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/services/cluster_manager/transports/grpc_asyncio.py @@ -103,6 +103,7 @@ def __init__( quota_project_id=None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, + api_audience: Optional[str] = None, ) -> None: """Instantiate the transport. @@ -198,6 +199,7 @@ def __init__( quota_project_id=quota_project_id, client_info=client_info, always_use_jwt_access=always_use_jwt_access, + api_audience=api_audience, ) if not self._grpc_channel: @@ -885,6 +887,35 @@ def delete_node_pool( ) return self._stubs["delete_node_pool"] + @property + def complete_node_pool_upgrade( + self, + ) -> Callable[ + [cluster_service.CompleteNodePoolUpgradeRequest], Awaitable[empty_pb2.Empty] + ]: + r"""Return a callable for the complete node pool upgrade method over gRPC. + + CompleteNodePoolUpgrade will signal an on-going node + pool upgrade to complete. + + Returns: + Callable[[~.CompleteNodePoolUpgradeRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "complete_node_pool_upgrade" not in self._stubs: + self._stubs["complete_node_pool_upgrade"] = self.grpc_channel.unary_unary( + "/google.container.v1beta1.ClusterManager/CompleteNodePoolUpgrade", + request_serializer=cluster_service.CompleteNodePoolUpgradeRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["complete_node_pool_upgrade"] + @property def rollback_node_pool_upgrade( self, diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/types/__init__.py b/packages/google-cloud-container/google/cloud/container_v1beta1/types/__init__.py index c477bff16f9a..6f2971294448 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/types/__init__.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/types/__init__.py @@ -22,6 +22,7 @@ AutoprovisioningNodePoolDefaults, AutoUpgradeOptions, BinaryAuthorization, + BlueGreenSettings, CancelOperationRequest, ClientCertificateConfig, CloudRunConfig, @@ -30,8 +31,10 @@ ClusterTelemetry, ClusterUpdate, CompleteIPRotationRequest, + CompleteNodePoolUpgradeRequest, ConfidentialNodes, ConfigConnectorConfig, + CostManagementConfig, CreateClusterRequest, CreateNodePoolRequest, DailyMaintenanceWindow, @@ -55,6 +58,7 @@ GetOperationRequest, GetServerConfigRequest, GkeBackupAgentConfig, + GPUSharingConfig, HorizontalPodAutoscaling, HttpLoadBalancing, IdentityServiceConfig, @@ -102,8 +106,10 @@ NodeManagement, NodeNetworkConfig, NodePool, + NodePoolAutoConfig, NodePoolAutoscaling, NodePoolDefaults, + NodePoolUpdateStrategy, NodeTaint, NodeTaints, NotificationConfig, @@ -113,6 +119,7 @@ PrivateClusterConfig, PrivateClusterMasterGlobalAccessConfig, PrivateIPv6GoogleAccess, + ProtectConfig, RecurringTimeWindow, ReleaseChannel, ReservationAffinity, @@ -152,7 +159,9 @@ VerticalPodAutoscaling, VirtualNIC, WindowsVersions, + WorkloadALTSConfig, WorkloadCertificates, + WorkloadConfig, WorkloadIdentityConfig, WorkloadMetadataConfig, ) @@ -166,6 +175,7 @@ "AutoprovisioningNodePoolDefaults", "AutoUpgradeOptions", "BinaryAuthorization", + "BlueGreenSettings", "CancelOperationRequest", "ClientCertificateConfig", "CloudRunConfig", @@ -174,8 +184,10 @@ "ClusterTelemetry", "ClusterUpdate", "CompleteIPRotationRequest", + "CompleteNodePoolUpgradeRequest", "ConfidentialNodes", "ConfigConnectorConfig", + "CostManagementConfig", "CreateClusterRequest", "CreateNodePoolRequest", "DailyMaintenanceWindow", @@ -198,6 +210,7 @@ "GetOperationRequest", "GetServerConfigRequest", "GkeBackupAgentConfig", + "GPUSharingConfig", "HorizontalPodAutoscaling", "HttpLoadBalancing", "IdentityServiceConfig", @@ -245,6 +258,7 @@ "NodeManagement", "NodeNetworkConfig", "NodePool", + "NodePoolAutoConfig", "NodePoolAutoscaling", "NodePoolDefaults", "NodeTaint", @@ -255,6 +269,7 @@ "PodSecurityPolicyConfig", "PrivateClusterConfig", "PrivateClusterMasterGlobalAccessConfig", + "ProtectConfig", "RecurringTimeWindow", "ReleaseChannel", "ReservationAffinity", @@ -293,10 +308,13 @@ "VerticalPodAutoscaling", "VirtualNIC", "WindowsVersions", + "WorkloadALTSConfig", "WorkloadCertificates", + "WorkloadConfig", "WorkloadIdentityConfig", "WorkloadMetadataConfig", "DatapathProvider", + "NodePoolUpdateStrategy", "PrivateIPv6GoogleAccess", "UpgradeResourceType", ) diff --git a/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py b/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py index 542f625c0572..e5ad3797ba68 100644 --- a/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py +++ b/packages/google-cloud-container/google/cloud/container_v1beta1/types/cluster_service.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import code_pb2 # type: ignore @@ -24,8 +25,9 @@ package="google.container.v1beta1", manifest={ "PrivateIPv6GoogleAccess", - "DatapathProvider", "UpgradeResourceType", + "NodePoolUpdateStrategy", + "DatapathProvider", "LinuxNodeConfig", "NodeKubeletConfig", "NodeConfig", @@ -66,8 +68,11 @@ "AuthenticatorGroupsConfig", "ClusterTelemetry", "Cluster", + "WorkloadConfig", + "ProtectConfig", "NodePoolDefaults", "NodeConfigDefaults", + "NodePoolAutoConfig", "ClusterUpdate", "Operation", "OperationProgress", @@ -96,6 +101,7 @@ "DeleteNodePoolRequest", "ListNodePoolsRequest", "GetNodePoolRequest", + "BlueGreenSettings", "NodePool", "NodeManagement", "AutoUpgradeOptions", @@ -107,6 +113,7 @@ "DailyMaintenanceWindow", "SetNodePoolManagementRequest", "SetNodePoolSizeRequest", + "CompleteNodePoolUpgradeRequest", "RollbackNodePoolUpgradeRequest", "ListNodePoolsResponse", "ClusterAutoscaling", @@ -118,6 +125,7 @@ "StartIPRotationRequest", "CompleteIPRotationRequest", "AcceleratorConfig", + "GPUSharingConfig", "ManagedPrometheusConfig", "WorkloadMetadataConfig", "SetNetworkPolicyRequest", @@ -139,6 +147,7 @@ "DNSConfig", "MaxPodsConstraint", "WorkloadIdentityConfig", + "WorkloadALTSConfig", "WorkloadCertificates", "MeshCertificates", "DatabaseEncryption", @@ -151,6 +160,7 @@ "Jwk", "GetJSONWebKeysResponse", "ReleaseChannel", + "CostManagementConfig", "TpuConfig", "Master", "Autopilot", @@ -178,16 +188,6 @@ class PrivateIPv6GoogleAccess(proto.Enum): PRIVATE_IPV6_GOOGLE_ACCESS_BIDIRECTIONAL = 3 -class DatapathProvider(proto.Enum): - r"""The datapath provider selects the implementation of the - Kubernetes networking // model for service resolution and - network policy enforcement. - """ - DATAPATH_PROVIDER_UNSPECIFIED = 0 - LEGACY_DATAPATH = 1 - ADVANCED_DATAPATH = 2 - - class UpgradeResourceType(proto.Enum): r"""UpgradeResourceType is the resource type that is upgrading. It is used in upgrade notifications. @@ -197,6 +197,23 @@ class UpgradeResourceType(proto.Enum): NODE_POOL = 2 +class NodePoolUpdateStrategy(proto.Enum): + r"""Strategy used for node pool update.""" + NODE_POOL_UPDATE_STRATEGY_UNSPECIFIED = 0 + BLUE_GREEN = 2 + SURGE = 3 + + +class DatapathProvider(proto.Enum): + r"""The datapath provider selects the implementation of the + Kubernetes networking model for service resolution and network + policy enforcement. + """ + DATAPATH_PROVIDER_UNSPECIFIED = 0 + LEGACY_DATAPATH = 1 + ADVANCED_DATAPATH = 2 + + class LinuxNodeConfig(proto.Message): r"""Parameters that can be configured on Linux nodes. @@ -207,17 +224,32 @@ class LinuxNodeConfig(proto.Message): The following parameters are supported. + net.core.busy_poll net.core.busy_read net.core.netdev_max_backlog net.core.rmem_max net.core.wmem_default net.core.wmem_max net.core.optmem_max net.core.somaxconn net.ipv4.tcp_rmem net.ipv4.tcp_wmem net.ipv4.tcp_tw_reuse + cgroup_mode (google.cloud.container_v1beta1.types.LinuxNodeConfig.CgroupMode): + cgroup_mode specifies the cgroup mode to be used on the + node. """ + class CgroupMode(proto.Enum): + r"""Possible cgroup modes that can be used.""" + CGROUP_MODE_UNSPECIFIED = 0 + CGROUP_MODE_V1 = 1 + CGROUP_MODE_V2 = 2 + sysctls = proto.MapField( proto.STRING, proto.STRING, number=1, ) + cgroup_mode = proto.Field( + proto.ENUM, + number=2, + enum=CgroupMode, + ) class NodeKubeletConfig(proto.Message): @@ -257,6 +289,12 @@ class NodeKubeletConfig(proto.Message): optional fraction and a unit suffix, such as "300ms". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The value must be a positive duration. + pod_pids_limit (int): + Set the Pod PID limits. See + https://kubernetes.io/docs/concepts/policy/pid-limiting/#pod-pid-limits + Controls the maximum number of processes allowed + to run in a pod. The value must be greater than + or equal to 1024 and less than 4194304. """ cpu_manager_policy = proto.Field( @@ -272,11 +310,20 @@ class NodeKubeletConfig(proto.Message): proto.STRING, number=3, ) + pod_pids_limit = proto.Field( + proto.INT64, + number=4, + ) class NodeConfig(proto.Message): r"""Parameters that describe the nodes in a cluster. + GKE Autopilot clusters do not recognize parameters in + ``NodeConfig``. Use + [AutoprovisioningNodePoolDefaults][google.container.v1beta1.AutoprovisioningNodePoolDefaults] + instead. + Attributes: machine_type (str): The name of a Google Compute Engine `machine @@ -453,6 +500,10 @@ class NodeConfig(proto.Message): spot (bool): Spot flag for enabling Spot VM, which is a rebrand of the existing preemptible flag. + confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. """ machine_type = proto.Field( @@ -577,6 +628,11 @@ class NodeConfig(proto.Message): proto.BOOL, number=32, ) + confidential_nodes = proto.Field( + proto.MESSAGE, + number=35, + message="ConfidentialNodes", + ) class AdvancedMachineFeatures(proto.Message): @@ -649,8 +705,47 @@ class NodeNetworkConfig(proto.Message): This field cannot be changed after the node pool has been created. + network_performance_config (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig): + Network bandwidth tier configuration. + + This field is a member of `oneof`_ ``_network_performance_config``. """ + class NetworkPerformanceConfig(proto.Message): + r"""Configuration of all network bandwidth tiers + + Attributes: + total_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): + Specifies the total network bandwidth tier + for the NodePool. + + This field is a member of `oneof`_ ``_total_egress_bandwidth_tier``. + external_ip_egress_bandwidth_tier (google.cloud.container_v1beta1.types.NodeNetworkConfig.NetworkPerformanceConfig.Tier): + Specifies the network bandwidth tier for the + NodePool for traffic to external/public IP + addresses. + + This field is a member of `oneof`_ ``_external_ip_egress_bandwidth_tier``. + """ + + class Tier(proto.Enum): + r"""Node network tier""" + TIER_UNSPECIFIED = 0 + TIER_1 = 1 + + total_egress_bandwidth_tier = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum="NodeNetworkConfig.NetworkPerformanceConfig.Tier", + ) + external_ip_egress_bandwidth_tier = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum="NodeNetworkConfig.NetworkPerformanceConfig.Tier", + ) + create_pod_range = proto.Field( proto.BOOL, number=4, @@ -663,6 +758,12 @@ class NodeNetworkConfig(proto.Message): proto.STRING, number=6, ) + network_performance_config = proto.Field( + proto.MESSAGE, + number=11, + optional=True, + message=NetworkPerformanceConfig, + ) class ShieldedInstanceConfig(proto.Message): @@ -1623,8 +1724,31 @@ class IPAllocationPolicy(proto.Message): true if use_ip_aliases is true. If both use_ip_aliases and use_routes are false, then the server picks the default IP allocation mode + stack_type (google.cloud.container_v1beta1.types.IPAllocationPolicy.StackType): + IP stack type + ipv6_access_type (google.cloud.container_v1beta1.types.IPAllocationPolicy.IPv6AccessType): + The ipv6 access type (internal or external) when + create_subnetwork is true + subnet_ipv6_cidr_block (str): + Output only. [Output only] The subnet's IPv6 CIDR block used + by nodes and pods. + services_ipv6_cidr_block (str): + Output only. [Output only] The services IPv6 CIDR block for + the cluster. """ + class StackType(proto.Enum): + r"""IP stack type""" + STACK_TYPE_UNSPECIFIED = 0 + IPV4 = 1 + IPV4_IPV6 = 2 + + class IPv6AccessType(proto.Enum): + r"""IPv6 access type""" + IPV6_ACCESS_TYPE_UNSPECIFIED = 0 + INTERNAL = 1 + EXTERNAL = 2 + use_ip_aliases = proto.Field( proto.BOOL, number=1, @@ -1681,6 +1805,24 @@ class IPAllocationPolicy(proto.Message): proto.BOOL, number=15, ) + stack_type = proto.Field( + proto.ENUM, + number=16, + enum=StackType, + ) + ipv6_access_type = proto.Field( + proto.ENUM, + number=17, + enum=IPv6AccessType, + ) + subnet_ipv6_cidr_block = proto.Field( + proto.STRING, + number=22, + ) + services_ipv6_cidr_block = proto.Field( + proto.STRING, + number=23, + ) class BinaryAuthorization(proto.Message): @@ -1690,13 +1832,29 @@ class BinaryAuthorization(proto.Message): enabled (bool): Enable Binary Authorization for this cluster. If enabled, all container images will be - validated by Google Binauthz. + validated by Binary Authorization. + evaluation_mode (google.cloud.container_v1beta1.types.BinaryAuthorization.EvaluationMode): + Mode of operation for binauthz policy + evaluation. Currently the only options are + equivalent to enable/disable. If unspecified, + defaults to DISABLED. """ + class EvaluationMode(proto.Enum): + r"""Binary Authorization mode of operation.""" + EVALUATION_MODE_UNSPECIFIED = 0 + DISABLED = 1 + PROJECT_SINGLETON_POLICY_ENFORCE = 2 + enabled = proto.Field( proto.BOOL, number=1, ) + evaluation_mode = proto.Field( + proto.ENUM, + number=2, + enum=EvaluationMode, + ) class PodSecurityPolicyConfig(proto.Message): @@ -1955,6 +2113,12 @@ class Cluster(proto.Message): mesh_certificates (google.cloud.container_v1beta1.types.MeshCertificates): Configuration for issuance of mTLS keys and certificates to Kubernetes pods. + workload_alts_config (google.cloud.container_v1beta1.types.WorkloadALTSConfig): + Configuration for direct-path (via ALTS) with + workload identity. + cost_management_config (google.cloud.container_v1beta1.types.CostManagementConfig): + Configuration for the fine-grained cost + management feature. cluster_telemetry (google.cloud.container_v1beta1.types.ClusterTelemetry): Telemetry integration for the cluster. tpu_config (google.cloud.container_v1beta1.types.TpuConfig): @@ -1962,7 +2126,9 @@ class Cluster(proto.Message): notification_config (google.cloud.container_v1beta1.types.NotificationConfig): Notification configuration of the cluster. confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): - Configuration of Confidential Nodes + Configuration of Confidential Nodes. + All the nodes in the cluster will be + Confidential VM once enabled. identity_service_config (google.cloud.container_v1beta1.types.IdentityServiceConfig): Configuration for Identity Service component. self_link (str): @@ -2074,6 +2240,16 @@ class Cluster(proto.Message): Logging configuration for the cluster. monitoring_config (google.cloud.container_v1beta1.types.MonitoringConfig): Monitoring configuration for the cluster. + node_pool_auto_config (google.cloud.container_v1beta1.types.NodePoolAutoConfig): + Node pool configs that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + protect_config (google.cloud.container_v1beta1.types.ProtectConfig): + Enable/Disable Protect API features for the + cluster. + + This field is a member of `oneof`_ ``_protect_config``. """ class Status(proto.Enum): @@ -2258,6 +2434,16 @@ class Status(proto.Enum): number=67, message="MeshCertificates", ) + workload_alts_config = proto.Field( + proto.MESSAGE, + number=53, + message="WorkloadALTSConfig", + ) + cost_management_config = proto.Field( + proto.MESSAGE, + number=45, + message="CostManagementConfig", + ) cluster_telemetry = proto.Field( proto.MESSAGE, number=46, @@ -2392,6 +2578,65 @@ class Status(proto.Enum): number=133, message="MonitoringConfig", ) + node_pool_auto_config = proto.Field( + proto.MESSAGE, + number=136, + message="NodePoolAutoConfig", + ) + protect_config = proto.Field( + proto.MESSAGE, + number=137, + optional=True, + message="ProtectConfig", + ) + + +class WorkloadConfig(proto.Message): + r"""WorkloadConfig defines the flags to enable or disable the + workload configurations for the cluster. + + Attributes: + audit_mode (google.cloud.container_v1beta1.types.WorkloadConfig.Mode): + Sets which mode of auditing should be used + for the cluster's workloads. + + This field is a member of `oneof`_ ``_audit_mode``. + """ + + class Mode(proto.Enum): + r"""Mode defines how to audit the workload configs.""" + MODE_UNSPECIFIED = 0 + DISABLED = 1 + BASIC = 4 + BASELINE = 2 + RESTRICTED = 3 + + audit_mode = proto.Field( + proto.ENUM, + number=1, + optional=True, + enum=Mode, + ) + + +class ProtectConfig(proto.Message): + r"""ProtectConfig defines the flags needed to enable/disable + features for the Protect API. + + Attributes: + workload_config (google.cloud.container_v1beta1.types.WorkloadConfig): + WorkloadConfig defines which actions are + enabled for a cluster's workload configurations. + + This field is a member of `oneof`_ ``_workload_config``. + """ + + workload_config = proto.Field( + proto.MESSAGE, + number=1, + optional=True, + message="WorkloadConfig", + ) class NodePoolDefaults(proto.Message): @@ -2415,7 +2660,7 @@ class NodeConfigDefaults(proto.Message): Attributes: gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): - GCFS (Google Container File System, a.k.a + GCFS (Google Container File System, a.k.a. Riptide) options. """ @@ -2426,6 +2671,28 @@ class NodeConfigDefaults(proto.Message): ) +class NodePoolAutoConfig(proto.Message): + r"""node pool configs that apply to all auto-provisioned node + pools in autopilot clusters and node auto-provisioning enabled + clusters + + Attributes: + network_tags (google.cloud.container_v1beta1.types.NetworkTags): + The list of instance tags applied to all + nodes. Tags are used to identify valid sources + or targets for network firewalls and are + specified by the client during cluster creation. + Each tag within the list must comply with + RFC1035. + """ + + network_tags = proto.Field( + proto.MESSAGE, + number=1, + message="NetworkTags", + ) + + class ClusterUpdate(proto.Message): r"""ClusterUpdate describes an update to the cluster. Exactly one update can be applied to a cluster with each request, so at most @@ -2570,8 +2837,14 @@ class ClusterUpdate(proto.Message): desired_mesh_certificates (google.cloud.container_v1beta1.types.MeshCertificates): Configuration for issuance of mTLS keys and certificates to Kubernetes pods. + desired_workload_alts_config (google.cloud.container_v1beta1.types.WorkloadALTSConfig): + Configuration for direct-path (via ALTS) with + workload identity. desired_shielded_nodes (google.cloud.container_v1beta1.types.ShieldedNodes): Configuration for Shielded Nodes. + desired_cost_management_config (google.cloud.container_v1beta1.types.CostManagementConfig): + The desired configuration for the + fine-grained cost management feature. desired_master (google.cloud.container_v1beta1.types.Master): Configuration for master components. desired_dns_config (google.cloud.container_v1beta1.types.DNSConfig): @@ -2590,6 +2863,16 @@ class ClusterUpdate(proto.Message): desired_identity_service_config (google.cloud.container_v1beta1.types.IdentityServiceConfig): The desired Identity Service component configuration. + desired_node_pool_auto_config_network_tags (google.cloud.container_v1beta1.types.NetworkTags): + The desired network tags that apply to all + auto-provisioned node pools in autopilot + clusters and node auto-provisioning enabled + clusters. + desired_protect_config (google.cloud.container_v1beta1.types.ProtectConfig): + Enable/Disable Protect API features for the + cluster. + + This field is a member of `oneof`_ ``_desired_protect_config``. """ desired_node_version = proto.Field( @@ -2735,11 +3018,21 @@ class ClusterUpdate(proto.Message): number=67, message="MeshCertificates", ) + desired_workload_alts_config = proto.Field( + proto.MESSAGE, + number=62, + message="WorkloadALTSConfig", + ) desired_shielded_nodes = proto.Field( proto.MESSAGE, number=48, message="ShieldedNodes", ) + desired_cost_management_config = proto.Field( + proto.MESSAGE, + number=49, + message="CostManagementConfig", + ) desired_master = proto.Field( proto.MESSAGE, number=52, @@ -2775,6 +3068,17 @@ class ClusterUpdate(proto.Message): number=66, message="IdentityServiceConfig", ) + desired_node_pool_auto_config_network_tags = proto.Field( + proto.MESSAGE, + number=110, + message="NetworkTags", + ) + desired_protect_config = proto.Field( + proto.MESSAGE, + number=112, + optional=True, + message="ProtectConfig", + ) class Operation(proto.Message): @@ -3026,7 +3330,7 @@ class CreateClusterRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -3068,7 +3372,7 @@ class GetClusterRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3111,7 +3415,7 @@ class UpdateClusterRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3161,7 +3465,7 @@ class UpdateNodePoolRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3231,8 +3535,14 @@ class UpdateNodePoolRequest(proto.Message): nodes. kubelet_config (google.cloud.container_v1beta1.types.NodeKubeletConfig): Node kubelet configs. + node_network_config (google.cloud.container_v1beta1.types.NodeNetworkConfig): + Node network config. gcfs_config (google.cloud.container_v1beta1.types.GcfsConfig): GCFS config. + confidential_nodes (google.cloud.container_v1beta1.types.ConfidentialNodes): + Confidential nodes config. + All the nodes in the node pool will be + Confidential VM once enabled. gvnic (google.cloud.container_v1beta1.types.VirtualNIC): Enable or disable gvnic on the node pool. """ @@ -3304,11 +3614,21 @@ class UpdateNodePoolRequest(proto.Message): number=20, message="NodeKubeletConfig", ) + node_network_config = proto.Field( + proto.MESSAGE, + number=21, + message="NodeNetworkConfig", + ) gcfs_config = proto.Field( proto.MESSAGE, number=22, message="GcfsConfig", ) + confidential_nodes = proto.Field( + proto.MESSAGE, + number=23, + message="ConfidentialNodes", + ) gvnic = proto.Field( proto.MESSAGE, number=29, @@ -3324,7 +3644,7 @@ class SetNodePoolAutoscalingRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3384,7 +3704,7 @@ class SetLoggingServiceRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3446,7 +3766,7 @@ class SetMonitoringServiceRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3508,7 +3828,7 @@ class SetAddonsConfigRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3559,7 +3879,7 @@ class SetLocationsRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3615,7 +3935,7 @@ class UpdateMasterRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3675,7 +3995,7 @@ class SetMasterAuthRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3740,7 +4060,7 @@ class DeleteClusterRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3783,7 +4103,7 @@ class ListClustersRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -3841,7 +4161,7 @@ class GetOperationRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3884,7 +4204,7 @@ class ListOperationsRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -3920,7 +4240,7 @@ class CancelOperationRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -3988,7 +4308,7 @@ class GetServerConfigRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4176,7 +4496,7 @@ class CreateNodePoolRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -4191,7 +4511,7 @@ class CreateNodePoolRequest(proto.Message): node_pool (google.cloud.container_v1beta1.types.NodePool): Required. The node pool to create. parent (str): - The parent (project, location, cluster id) where the node + The parent (project, location, cluster name) where the node pool will be created. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -4226,7 +4546,7 @@ class DeleteNodePoolRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4277,7 +4597,7 @@ class ListNodePoolsRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the parent field. zone (str): @@ -4290,7 +4610,7 @@ class ListNodePoolsRequest(proto.Message): cluster. This field has been deprecated and replaced by the parent field. parent (str): - The parent (project, location, cluster id) where the node + The parent (project, location, cluster name) where the node pools will be listed. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -4320,7 +4640,7 @@ class GetNodePoolRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4364,6 +4684,81 @@ class GetNodePoolRequest(proto.Message): ) +class BlueGreenSettings(proto.Message): + r"""Settings for blue-green upgrade. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + standard_rollout_policy (google.cloud.container_v1beta1.types.BlueGreenSettings.StandardRolloutPolicy): + Standard policy for the blue-green upgrade. + + This field is a member of `oneof`_ ``rollout_policy``. + node_pool_soak_duration (google.protobuf.duration_pb2.Duration): + Time needed after draining entire blue pool. + After this period, blue pool will be cleaned up. + + This field is a member of `oneof`_ ``_node_pool_soak_duration``. + """ + + class StandardRolloutPolicy(proto.Message): + r"""Standard rollout policy is the default policy for blue-green. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + batch_percentage (float): + Percentage of the bool pool nodes to drain in a batch. The + range of this field should be (0.0, 1.0]. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_node_count (int): + Number of blue nodes to drain in a batch. + + This field is a member of `oneof`_ ``update_batch_size``. + batch_soak_duration (google.protobuf.duration_pb2.Duration): + Soak time after each batch gets drained. + Default to zero. + + This field is a member of `oneof`_ ``_batch_soak_duration``. + """ + + batch_percentage = proto.Field( + proto.FLOAT, + number=1, + oneof="update_batch_size", + ) + batch_node_count = proto.Field( + proto.INT32, + number=2, + oneof="update_batch_size", + ) + batch_soak_duration = proto.Field( + proto.MESSAGE, + number=3, + optional=True, + message=duration_pb2.Duration, + ) + + standard_rollout_policy = proto.Field( + proto.MESSAGE, + number=1, + oneof="rollout_policy", + message=StandardRolloutPolicy, + ) + node_pool_soak_duration = proto.Field( + proto.MESSAGE, + number=2, + optional=True, + message=duration_pb2.Duration, + ) + + class NodePool(proto.Message): r"""NodePool contains the name and configuration for a cluster's node pool. Node pools are a set of nodes (i.e. VM's), with a @@ -4430,7 +4825,9 @@ class NodePool(proto.Message): instance_group_urls (Sequence[str]): [Output only] The resource URLs of the `managed instance groups `__ - associated with this node pool. + associated with this node pool. During the node pool + blue-green upgrade operation, the URLs contain both blue and + green resources. status (google.cloud.container_v1beta1.types.NodePool.Status): [Output only] The status of the nodes in this pool instance. status_message (str): @@ -4459,6 +4856,9 @@ class NodePool(proto.Message): of the upgrade. placement_policy (google.cloud.container_v1beta1.types.NodePool.PlacementPolicy): Specifies the node placement policy. + update_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo): + Output only. [Output only] Update info contains relevant + information during a node pool update. """ class Status(proto.Enum): @@ -4472,7 +4872,33 @@ class Status(proto.Enum): ERROR = 6 class UpgradeSettings(proto.Message): - r""" + r"""These upgrade settings configure the upgrade strategy for the node + pool. Use strategy to switch between the strategies applied to the + node pool. + + If the strategy is SURGE, use max_surge and max_unavailable to + control the level of parallelism and the level of disruption caused + by upgrade. + + 1. maxSurge controls the number of additional nodes that can be + added to the node pool temporarily for the time of the upgrade to + increase the number of available nodes. + 2. maxUnavailable controls the number of nodes that can be + simultaneously unavailable. + 3. (maxUnavailable + maxSurge) determines the level of parallelism + (how many nodes are being upgraded at the same time). + + If the strategy is BLUE_GREEN, use blue_green_settings to configure + the blue-green upgrade related settings. + + 1. standard_rollout_policy is the default policy. The policy is used + to control the way blue pool gets drained. The draining is + executed in the batch mode. The batch size could be specified as + either percentage of the node pool size or the number of nodes. + batch_soak_duration is the soak time after each batch gets + drained. + 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. Attributes: max_surge (int): @@ -4484,6 +4910,14 @@ class UpgradeSettings(proto.Message): simultaneously unavailable during the upgrade process. A node is considered available if its status is Ready. + strategy (google.cloud.container_v1beta1.types.NodePoolUpdateStrategy): + Update strategy of the node pool. + + This field is a member of `oneof`_ ``_strategy``. + blue_green_settings (google.cloud.container_v1beta1.types.BlueGreenSettings): + Settings for blue-green upgrade strategy. + + This field is a member of `oneof`_ ``_blue_green_settings``. """ max_surge = proto.Field( @@ -4494,6 +4928,92 @@ class UpgradeSettings(proto.Message): proto.INT32, number=2, ) + strategy = proto.Field( + proto.ENUM, + number=3, + optional=True, + enum="NodePoolUpdateStrategy", + ) + blue_green_settings = proto.Field( + proto.MESSAGE, + number=4, + optional=True, + message="BlueGreenSettings", + ) + + class UpdateInfo(proto.Message): + r"""UpdateInfo contains resource (instance groups, etc), status + and other intermediate information relevant to a node pool + upgrade. + + Attributes: + blue_green_info (google.cloud.container_v1beta1.types.NodePool.UpdateInfo.BlueGreenInfo): + Information of a blue-green upgrade. + """ + + class BlueGreenInfo(proto.Message): + r"""Information relevant to blue-green upgrade. + + Attributes: + phase (google.cloud.container_v1beta1.types.NodePool.UpdateInfo.BlueGreenInfo.Phase): + Current blue-green upgrade phase. + blue_instance_group_urls (Sequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with blue pool. + green_instance_group_urls (Sequence[str]): + The resource URLs of the [managed instance groups] + (/compute/docs/instance-groups/creating-groups-of-managed-instances) + associated with green pool. + blue_pool_deletion_start_time (str): + Time to start deleting blue pool to complete blue-green + upgrade, in + `RFC3339 `__ text + format. + green_pool_version (str): + Version of green pool. + """ + + class Phase(proto.Enum): + r"""Phase represents the different stages blue-green upgrade is + running in. + """ + PHASE_UNSPECIFIED = 0 + UPDATE_STARTED = 1 + CREATING_GREEN_POOL = 2 + CORDONING_BLUE_POOL = 3 + DRAINING_BLUE_POOL = 4 + NODE_POOL_SOAKING = 5 + DELETING_BLUE_POOL = 6 + ROLLBACK_STARTED = 7 + + phase = proto.Field( + proto.ENUM, + number=1, + enum="NodePool.UpdateInfo.BlueGreenInfo.Phase", + ) + blue_instance_group_urls = proto.RepeatedField( + proto.STRING, + number=2, + ) + green_instance_group_urls = proto.RepeatedField( + proto.STRING, + number=3, + ) + blue_pool_deletion_start_time = proto.Field( + proto.STRING, + number=4, + ) + green_pool_version = proto.Field( + proto.STRING, + number=5, + ) + + blue_green_info = proto.Field( + proto.MESSAGE, + number=1, + message="NodePool.UpdateInfo.BlueGreenInfo", + ) class PlacementPolicy(proto.Message): r"""PlacementPolicy defines the placement policy used by the node @@ -4592,6 +5112,11 @@ class Type(proto.Enum): number=108, message=PlacementPolicy, ) + update_info = proto.Field( + proto.MESSAGE, + number=109, + message=UpdateInfo, + ) class NodeManagement(proto.Message): @@ -4877,7 +5402,7 @@ class SetNodePoolManagementRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4936,7 +5461,7 @@ class SetNodePoolSizeRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -4987,6 +5512,23 @@ class SetNodePoolSizeRequest(proto.Message): ) +class CompleteNodePoolUpgradeRequest(proto.Message): + r"""CompleteNodePoolUpgradeRequest sets the name of target node + pool to complete upgrade. + + Attributes: + name (str): + The name (project, location, cluster, node pool id) of the + node pool to complete upgrade. Specified in the format + 'projects/*/locations/*/clusters/*/nodePools/*'. + """ + + name = proto.Field( + proto.STRING, + number=1, + ) + + class RollbackNodePoolUpgradeRequest(proto.Message): r"""RollbackNodePoolUpgradeRequest rollbacks the previously Aborted or Failed NodePool upgrade. This will be an no-op if the @@ -4996,7 +5538,7 @@ class RollbackNodePoolUpgradeRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -5016,6 +5558,9 @@ class RollbackNodePoolUpgradeRequest(proto.Message): The name (project, location, cluster, node pool id) of the node poll to rollback upgrade. Specified in the format ``projects/*/locations/*/clusters/*/nodePools/*``. + respect_pdb (bool): + Option for rollback to ignore the + PodDisruptionBudget. Default value is false. """ project_id = proto.Field( @@ -5038,6 +5583,10 @@ class RollbackNodePoolUpgradeRequest(proto.Message): proto.STRING, number=6, ) + respect_pdb = proto.Field( + proto.BOOL, + number=7, + ) class ListNodePoolsResponse(proto.Message): @@ -5145,15 +5694,17 @@ class AutoprovisioningNodePoolDefaults(proto.Message): NodeManagement configuration for this NodePool. min_cpu_platform (str): - Minimum CPU platform to be used by this instance. The - instance may be scheduled on the specified or newer CPU - platform. Applicable values are the friendly names of CPU - platforms, such as ``minCpuPlatform: "Intel Haswell"`` or - ``minCpuPlatform: "Intel Sandy Bridge"``. For more + Deprecated. Minimum CPU platform to be used for NAP created + node pools. The instance may be scheduled on the specified + or newer CPU platform. Applicable values are the friendly + names of CPU platforms, such as minCpuPlatform: Intel + Haswell or minCpuPlatform: Intel Sandy Bridge. For more information, read `how to specify min CPU platform `__ - To unset the min cpu platform field pass "automatic" as - field value. + This field is deprecated, min_cpu_platform should be + specified using cloud.google.com/requested-min-cpu-platform + label selector on the pod. To unset the min cpu platform + field pass "automatic" as field value. disk_size_gb (int): Size of the disk attached to each node, specified in GB. The smallest allowed disk size @@ -5271,7 +5822,28 @@ class NodePoolAutoscaling(proto.Message): scale up the cluster. autoprovisioned (bool): Can this node pool be deleted automatically. - """ + location_policy (google.cloud.container_v1beta1.types.NodePoolAutoscaling.LocationPolicy): + Location policy used when scaling up a + nodepool. + total_min_node_count (int): + Minimum number of nodes in the node pool. Must be greater + than 1 less than total_max_node_count. The + total_*_node_count fields are mutually exclusive with the + \*_node_count fields. + total_max_node_count (int): + Maximum number of nodes in the node pool. Must be greater + than total_min_node_count. There has to be enough quota to + scale up the cluster. The total_*_node_count fields are + mutually exclusive with the \*_node_count fields. + """ + + class LocationPolicy(proto.Enum): + r"""Location policy specifies how zones are picked when scaling + up the nodepool. + """ + LOCATION_POLICY_UNSPECIFIED = 0 + BALANCED = 1 + ANY = 2 enabled = proto.Field( proto.BOOL, @@ -5289,6 +5861,19 @@ class NodePoolAutoscaling(proto.Message): proto.BOOL, number=4, ) + location_policy = proto.Field( + proto.ENUM, + number=5, + enum=LocationPolicy, + ) + total_min_node_count = proto.Field( + proto.INT32, + number=6, + ) + total_max_node_count = proto.Field( + proto.INT32, + number=7, + ) class SetLabelsRequest(proto.Message): @@ -5300,7 +5885,7 @@ class SetLabelsRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -5323,7 +5908,7 @@ class SetLabelsRequest(proto.Message): changing labels. Make a ``get()`` request to the resource to get the latest fingerprint. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set labels. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5363,7 +5948,7 @@ class SetLegacyAbacRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -5379,7 +5964,7 @@ class SetLegacyAbacRequest(proto.Message): Required. Whether ABAC authorization will be enabled in the cluster. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set legacy abac. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5415,7 +6000,7 @@ class StartIPRotationRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -5428,7 +6013,7 @@ class StartIPRotationRequest(proto.Message): cluster. This field has been deprecated and replaced by the name field. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to start IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. rotate_credentials (bool): @@ -5466,7 +6051,7 @@ class CompleteIPRotationRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -5479,7 +6064,7 @@ class CompleteIPRotationRequest(proto.Message): cluster. This field has been deprecated and replaced by the name field. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to complete IP rotation. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5517,6 +6102,13 @@ class AcceleratorConfig(proto.Message): Size of partitions to create on the GPU. Valid values are described in the NVIDIA `mig user guide `__. + max_time_shared_clients_per_gpu (int): + The number of time-shared GPU resources to + expose for each physical GPU. + gpu_sharing_config (google.cloud.container_v1beta1.types.GPUSharingConfig): + The configuration for GPU sharing options. + + This field is a member of `oneof`_ ``_gpu_sharing_config``. """ accelerator_count = proto.Field( @@ -5531,6 +6123,48 @@ class AcceleratorConfig(proto.Message): proto.STRING, number=3, ) + max_time_shared_clients_per_gpu = proto.Field( + proto.INT64, + number=4, + ) + gpu_sharing_config = proto.Field( + proto.MESSAGE, + number=5, + optional=True, + message="GPUSharingConfig", + ) + + +class GPUSharingConfig(proto.Message): + r"""GPUSharingConfig represents the GPU sharing configuration for + Hardware Accelerators. + + Attributes: + max_shared_clients_per_gpu (int): + The max number of containers that can share a + physical GPU. + gpu_sharing_strategy (google.cloud.container_v1beta1.types.GPUSharingConfig.GPUSharingStrategy): + The type of GPU sharing strategy to enable on + the GPU node. + + This field is a member of `oneof`_ ``_gpu_sharing_strategy``. + """ + + class GPUSharingStrategy(proto.Enum): + r"""The type of GPU sharing strategy currently provided.""" + GPU_SHARING_STRATEGY_UNSPECIFIED = 0 + TIME_SHARING = 1 + + max_shared_clients_per_gpu = proto.Field( + proto.INT64, + number=1, + ) + gpu_sharing_strategy = proto.Field( + proto.ENUM, + number=2, + optional=True, + enum=GPUSharingStrategy, + ) class ManagedPrometheusConfig(proto.Message): @@ -5599,7 +6233,7 @@ class SetNetworkPolicyRequest(proto.Message): project_id (str): Required. Deprecated. The Google Developers Console `project ID or project - number `__. + number `__. This field has been deprecated and replaced by the name field. zone (str): @@ -5615,7 +6249,7 @@ class SetNetworkPolicyRequest(proto.Message): Required. Configuration options for the NetworkPolicy feature. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set networking policy. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -5651,7 +6285,7 @@ class SetMaintenancePolicyRequest(proto.Message): project_id (str): Required. The Google Developers Console `project ID or project - number `__. + number `__. zone (str): Required. The name of the Google Compute Engine `zone `__ @@ -5663,7 +6297,7 @@ class SetMaintenancePolicyRequest(proto.Message): for the cluster. An empty field clears the existing maintenance policy. name (str): - The name (project, location, cluster id) of the cluster to + The name (project, location, cluster name) of the cluster to set maintenance policy. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -6237,6 +6871,27 @@ class WorkloadIdentityConfig(proto.Message): ) +class WorkloadALTSConfig(proto.Message): + r"""Configuration for direct-path (via ALTS) with workload + identity. + + Attributes: + enable_alts (google.protobuf.wrappers_pb2.BoolValue): + enable_alts controls whether the alts handshaker should be + enabled or not for direct-path. + + Requires Workload Identity + ([workload_pool][google.container.v1beta1.WorkloadIdentityConfig.workload_pool] + must be non-empty). + """ + + enable_alts = proto.Field( + proto.MESSAGE, + number=1, + message=wrappers_pb2.BoolValue, + ) + + class WorkloadCertificates(proto.Message): r"""Configuration for issuance of mTLS keys and certificates to Kubernetes pods. @@ -6489,8 +7144,8 @@ class GetJSONWebKeysRequest(proto.Message): Attributes: parent (str): - The cluster (project, location, cluster id) to get keys for. - Specified in the format + The cluster (project, location, cluster name) to get keys + for. Specified in the format ``projects/*/locations/*/clusters/*``. """ @@ -6606,6 +7261,20 @@ class Channel(proto.Enum): ) +class CostManagementConfig(proto.Message): + r"""Configuration for fine-grained cost management feature. + + Attributes: + enabled (bool): + Whether the feature is enabled or not. + """ + + enabled = proto.Field( + proto.BOOL, + number=1, + ) + + class TpuConfig(proto.Message): r"""Configuration for Cloud TPU. @@ -6733,8 +7402,8 @@ class ConfidentialNodes(proto.Message): Attributes: enabled (bool): - Whether Confidential Nodes feature is enabled - for all nodes in this cluster. + Whether Confidential Nodes feature is + enabled. """ enabled = proto.Field( @@ -7016,6 +7685,9 @@ class Component(proto.Enum): COMPONENT_UNSPECIFIED = 0 SYSTEM_COMPONENTS = 1 WORKLOADS = 2 + APISERVER = 3 + SCHEDULER = 4 + CONTROLLER_MANAGER = 5 enable_components = proto.RepeatedField( proto.ENUM, diff --git a/packages/google-cloud-container/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py b/packages/google-cloud-container/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py new file mode 100644 index 000000000000..77b7649634fc --- /dev/null +++ b/packages/google-cloud-container/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CompleteNodePoolUpgrade +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] +from google.cloud import container_v1 + + +async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + +# [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async] diff --git a/packages/google-cloud-container/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py b/packages/google-cloud-container/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py new file mode 100644 index 000000000000..1ca4bfa30185 --- /dev/null +++ b/packages/google-cloud-container/samples/generated_samples/container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CompleteNodePoolUpgrade +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] +from google.cloud import container_v1 + + +def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + +# [END container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] diff --git a/packages/google-cloud-container/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py b/packages/google-cloud-container/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py new file mode 100644 index 000000000000..0f495599e5a6 --- /dev/null +++ b/packages/google-cloud-container/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CompleteNodePoolUpgrade +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] +from google.cloud import container_v1beta1 + + +async def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerAsyncClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + await client.complete_node_pool_upgrade(request=request) + + +# [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async] diff --git a/packages/google-cloud-container/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py b/packages/google-cloud-container/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py new file mode 100644 index 000000000000..6a7cf3c37199 --- /dev/null +++ b/packages/google-cloud-container/samples/generated_samples/container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for CompleteNodePoolUpgrade +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-cloud-container + + +# [START container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] +from google.cloud import container_v1beta1 + + +def sample_complete_node_pool_upgrade(): + # Create a client + client = container_v1beta1.ClusterManagerClient() + + # Initialize request argument(s) + request = container_v1beta1.CompleteNodePoolUpgradeRequest( + ) + + # Make the request + client.complete_node_pool_upgrade(request=request) + + +# [END container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_sync] diff --git a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1.json b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1.json index e2cd36d9d603..ec33bf31bd25 100644 --- a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1.json +++ b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1.json @@ -374,6 +374,153 @@ ], "title": "container_v1_generated_cluster_manager_complete_ip_rotation_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerAsyncClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_async", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1.ClusterManagerClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1_generated_ClusterManager_CompleteNodePoolUpgrade_sync", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1_generated_cluster_manager_complete_node_pool_upgrade_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1beta1.json b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1beta1.json index 850ebf588ee9..2045174a5709 100644 --- a/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1beta1.json +++ b/packages/google-cloud-container/samples/generated_samples/snippet_metadata_container_v1beta1.json @@ -358,6 +358,153 @@ ], "title": "container_v1beta1_generated_cluster_manager_complete_ip_rotation_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient", + "shortName": "ClusterManagerAsyncClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerAsyncClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_async", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient", + "shortName": "ClusterManagerClient" + }, + "fullName": "google.cloud.container_v1beta1.ClusterManagerClient.complete_node_pool_upgrade", + "method": { + "fullName": "google.container.v1beta1.ClusterManager.CompleteNodePoolUpgrade", + "service": { + "fullName": "google.container.v1beta1.ClusterManager", + "shortName": "ClusterManager" + }, + "shortName": "CompleteNodePoolUpgrade" + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.container_v1beta1.types.CompleteNodePoolUpgradeRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "complete_node_pool_upgrade" + }, + "description": "Sample for CompleteNodePoolUpgrade", + "file": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "container_v1beta1_generated_ClusterManager_CompleteNodePoolUpgrade_sync", + "segments": [ + { + "end": 41, + "start": 27, + "type": "FULL" + }, + { + "end": 41, + "start": 27, + "type": "SHORT" + }, + { + "end": 33, + "start": 31, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 37, + "start": 34, + "type": "REQUEST_INITIALIZATION" + }, + { + "start": 38, + "type": "REQUEST_EXECUTION" + }, + { + "end": 42, + "type": "RESPONSE_HANDLING" + } + ], + "title": "container_v1beta1_generated_cluster_manager_complete_node_pool_upgrade_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/packages/google-cloud-container/scripts/fixup_container_v1_keywords.py b/packages/google-cloud-container/scripts/fixup_container_v1_keywords.py index a7cf261c8a88..81c69248617b 100644 --- a/packages/google-cloud-container/scripts/fixup_container_v1_keywords.py +++ b/packages/google-cloud-container/scripts/fixup_container_v1_keywords.py @@ -41,6 +41,7 @@ class containerCallTransformer(cst.CSTTransformer): METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), + 'complete_node_pool_upgrade': ('name', ), 'create_cluster': ('cluster', 'project_id', 'zone', 'parent', ), 'create_node_pool': ('node_pool', 'project_id', 'zone', 'cluster_id', 'parent', ), 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), @@ -54,7 +55,7 @@ class containerCallTransformer(cst.CSTTransformer): 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), 'list_operations': ('project_id', 'zone', 'parent', ), 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), - 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'respect_pdb', ), 'set_addons_config': ('addons_config', 'project_id', 'zone', 'cluster_id', 'name', ), 'set_labels': ('resource_labels', 'label_fingerprint', 'project_id', 'zone', 'cluster_id', 'name', ), 'set_legacy_abac': ('enabled', 'project_id', 'zone', 'cluster_id', 'name', ), @@ -70,7 +71,7 @@ class containerCallTransformer(cst.CSTTransformer): 'start_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', 'rotate_credentials', ), 'update_cluster': ('update', 'project_id', 'zone', 'cluster_id', 'name', ), 'update_master': ('master_version', 'project_id', 'zone', 'cluster_id', 'name', ), - 'update_node_pool': ('node_version', 'image_type', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'locations', 'workload_metadata_config', 'upgrade_settings', 'linux_node_config', 'kubelet_config', 'gcfs_config', 'gvnic', ), + 'update_node_pool': ('node_version', 'image_type', 'project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'locations', 'workload_metadata_config', 'upgrade_settings', 'tags', 'taints', 'labels', 'linux_node_config', 'kubelet_config', 'node_network_config', 'gcfs_config', 'confidential_nodes', 'gvnic', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/packages/google-cloud-container/scripts/fixup_container_v1beta1_keywords.py b/packages/google-cloud-container/scripts/fixup_container_v1beta1_keywords.py index c30a4ee07c1c..79b635f76909 100644 --- a/packages/google-cloud-container/scripts/fixup_container_v1beta1_keywords.py +++ b/packages/google-cloud-container/scripts/fixup_container_v1beta1_keywords.py @@ -41,6 +41,7 @@ class containerCallTransformer(cst.CSTTransformer): METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { 'cancel_operation': ('project_id', 'zone', 'operation_id', 'name', ), 'complete_ip_rotation': ('project_id', 'zone', 'cluster_id', 'name', ), + 'complete_node_pool_upgrade': ('name', ), 'create_cluster': ('project_id', 'zone', 'cluster', 'parent', ), 'create_node_pool': ('project_id', 'zone', 'cluster_id', 'node_pool', 'parent', ), 'delete_cluster': ('project_id', 'zone', 'cluster_id', 'name', ), @@ -55,7 +56,7 @@ class containerCallTransformer(cst.CSTTransformer): 'list_node_pools': ('project_id', 'zone', 'cluster_id', 'parent', ), 'list_operations': ('project_id', 'zone', 'parent', ), 'list_usable_subnetworks': ('parent', 'filter', 'page_size', 'page_token', ), - 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', ), + 'rollback_node_pool_upgrade': ('project_id', 'zone', 'cluster_id', 'node_pool_id', 'name', 'respect_pdb', ), 'set_addons_config': ('project_id', 'zone', 'cluster_id', 'addons_config', 'name', ), 'set_labels': ('project_id', 'zone', 'cluster_id', 'resource_labels', 'label_fingerprint', 'name', ), 'set_legacy_abac': ('project_id', 'zone', 'cluster_id', 'enabled', 'name', ), @@ -71,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', 'gcfs_config', 'gvnic', ), + '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', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/packages/google-cloud-container/setup.py b/packages/google-cloud-container/setup.py index 0a5b009059ff..1f5384ffbba5 100644 --- a/packages/google-cloud-container/setup.py +++ b/packages/google-cloud-container/setup.py @@ -28,10 +28,7 @@ # 'Development Status :: 5 - Production/Stable' release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - # NOTE: Maintainers, please do not require google-api-core>=2.x.x - # Until this issue is closed - # https://github.com/googleapis/google-cloud-python/issues/10566 - "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", + "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", "proto-plus >= 1.15.0, <2.0.0dev", "protobuf >= 3.19.0, <4.0.0dev", diff --git a/packages/google-cloud-container/testing/constraints-3.6.txt b/packages/google-cloud-container/testing/constraints-3.6.txt deleted file mode 100644 index c4e0fd7dec6c..000000000000 --- a/packages/google-cloud-container/testing/constraints-3.6.txt +++ /dev/null @@ -1,12 +0,0 @@ -# This constraints file is used to check that lower bounds -# are correct in setup.py -# List *all* library dependencies and extras in this file. -# Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.31.5 -grpc-google-iam-v1==0.12.4 -proto-plus==1.15.0 -libcst==0.2.5 -protobuf==3.19.0 diff --git a/packages/google-cloud-container/testing/constraints-3.7.txt b/packages/google-cloud-container/testing/constraints-3.7.txt index c4e0fd7dec6c..39a7c58e1e8c 100644 --- a/packages/google-cloud-container/testing/constraints-3.7.txt +++ b/packages/google-cloud-container/testing/constraints-3.7.txt @@ -5,7 +5,7 @@ # # e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", # Then this file should have foo==1.14.0 -google-api-core==1.31.5 +google-api-core==1.32.0 grpc-google-iam-v1==0.12.4 proto-plus==1.15.0 libcst==0.2.5 diff --git a/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py b/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py index 755bafd3a572..e8b89d3b487a 100644 --- a/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py +++ b/packages/google-cloud-container/tests/unit/gapic/container_v1/test_cluster_manager.py @@ -31,6 +31,7 @@ from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import code_pb2 # type: ignore @@ -227,6 +228,7 @@ def test_cluster_manager_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -244,6 +246,7 @@ def test_cluster_manager_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -261,6 +264,7 @@ def test_cluster_manager_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -290,6 +294,25 @@ def test_cluster_manager_client_client_options( quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -357,6 +380,7 @@ def test_cluster_manager_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -391,6 +415,7 @@ def test_cluster_manager_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -413,6 +438,7 @@ def test_cluster_manager_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -527,6 +553,7 @@ def test_cluster_manager_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -565,6 +592,7 @@ def test_cluster_manager_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -585,6 +613,7 @@ def test_cluster_manager_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -623,6 +652,7 @@ def test_cluster_manager_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -6819,6 +6849,157 @@ async def test_delete_node_pool_flattened_error_async(): ) +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CompleteNodePoolUpgradeRequest, + dict, + ], +) +def test_complete_node_pool_upgrade(request_type, transport: str = "grpc"): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_complete_node_pool_upgrade_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + client.complete_node_pool_upgrade() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest() + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async( + transport: str = "grpc_asyncio", + request_type=cluster_service.CompleteNodePoolUpgradeRequest, +): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async_from_dict(): + await test_complete_node_pool_upgrade_async(request_type=dict) + + +def test_complete_node_pool_upgrade_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + call.return_value = None + client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + @pytest.mark.parametrize( "request_type", [ @@ -9900,6 +10081,7 @@ def test_cluster_manager_base_transport(): "get_node_pool", "create_node_pool", "delete_node_pool", + "complete_node_pool_upgrade", "rollback_node_pool_upgrade", "set_node_pool_management", "set_labels", @@ -9991,6 +10173,28 @@ def test_cluster_manager_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +def test_cluster_manager_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -10456,4 +10660,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) diff --git a/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py b/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py index f06b1a11d2fd..ee4a5380d806 100644 --- a/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py +++ b/packages/google-cloud-container/tests/unit/gapic/container_v1beta1/test_cluster_manager.py @@ -31,6 +31,7 @@ from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError from google.oauth2 import service_account +from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import code_pb2 # type: ignore @@ -227,6 +228,7 @@ def test_cluster_manager_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -244,6 +246,7 @@ def test_cluster_manager_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT is @@ -261,6 +264,7 @@ def test_cluster_manager_client_client_options( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case api_endpoint is not provided and GOOGLE_API_USE_MTLS_ENDPOINT has @@ -290,6 +294,25 @@ def test_cluster_manager_client_client_options( quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, + ) + # Check the case api_endpoint is provided + options = client_options.ClientOptions( + api_audience="https://language.googleapis.com" + ) + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + api_audience="https://language.googleapis.com", ) @@ -357,6 +380,7 @@ def test_cluster_manager_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case ADC client cert is provided. Whether client cert is used depends on @@ -391,6 +415,7 @@ def test_cluster_manager_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # Check the case client_cert_source and ADC client cert are not provided. @@ -413,6 +438,7 @@ def test_cluster_manager_client_mtls_env_auto( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -527,6 +553,7 @@ def test_cluster_manager_client_client_options_scopes( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -565,6 +592,7 @@ def test_cluster_manager_client_client_options_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -585,6 +613,7 @@ def test_cluster_manager_client_client_options_from_dict(): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) @@ -623,6 +652,7 @@ def test_cluster_manager_client_create_channel_credentials_file( quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, ) # test that the credentials from file are saved and used as the credentials. @@ -6657,6 +6687,157 @@ async def test_delete_node_pool_flattened_error_async(): ) +@pytest.mark.parametrize( + "request_type", + [ + cluster_service.CompleteNodePoolUpgradeRequest, + dict, + ], +) +def test_complete_node_pool_upgrade(request_type, transport: str = "grpc"): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_complete_node_pool_upgrade_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + client.complete_node_pool_upgrade() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest() + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async( + transport: str = "grpc_asyncio", + request_type=cluster_service.CompleteNodePoolUpgradeRequest, +): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == cluster_service.CompleteNodePoolUpgradeRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_async_from_dict(): + await test_complete_node_pool_upgrade_async(request_type=dict) + + +def test_complete_node_pool_upgrade_field_headers(): + client = ClusterManagerClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + call.return_value = None + client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_complete_node_pool_upgrade_field_headers_async(): + client = ClusterManagerAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = cluster_service.CompleteNodePoolUpgradeRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.complete_node_pool_upgrade), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.complete_node_pool_upgrade(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + @pytest.mark.parametrize( "request_type", [ @@ -10245,6 +10426,7 @@ def test_cluster_manager_base_transport(): "get_node_pool", "create_node_pool", "delete_node_pool", + "complete_node_pool_upgrade", "rollback_node_pool_upgrade", "set_node_pool_management", "set_labels", @@ -10337,6 +10519,28 @@ def test_cluster_manager_transport_auth_adc(transport_class): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.ClusterManagerGrpcTransport, + transports.ClusterManagerGrpcAsyncIOTransport, + ], +) +def test_cluster_manager_transport_auth_gdch_credentials(transport_class): + host = "https://language.com" + api_audience_tests = [None, "https://language2.com"] + api_audience_expect = [host, "https://language2.com"] + for t, e in zip(api_audience_tests, api_audience_expect): + with mock.patch.object(google.auth, "default", autospec=True) as adc: + gdch_mock = mock.MagicMock() + type(gdch_mock).with_gdch_audience = mock.PropertyMock( + return_value=gdch_mock + ) + adc.return_value = (gdch_mock, None) + transport_class(host=host, api_audience=t) + gdch_mock.with_gdch_audience.assert_called_once_with(e) + + @pytest.mark.parametrize( "transport_class,grpc_helpers", [ @@ -10802,4 +11006,5 @@ def test_api_key_credentials(client_class, transport_class): quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, always_use_jwt_access=True, + api_audience=None, )