From 57232b6b38c004c5136a8ad8051fa1f667d2353d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 05:49:51 -0500 Subject: [PATCH] feat: [google-cloud-gke-multicloud] added support for optionally disabling built-in GKE metrics (#13383) - [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: added support for optionally disabling built-in GKE metrics feat: added tag bindings support for Attached Clusters docs: updated comments of existing fields END_COMMIT_OVERRIDE PiperOrigin-RevId: 708397945 Source-Link: https://github.com/googleapis/googleapis/commit/09b3c838b7758dc3fc1dbcc9dc6d3d5516beb544 Source-Link: https://github.com/googleapis/googleapis-gen/commit/822c2acaf7af07dfbb7f86ce2e2e0f2e744b72e5 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZS1tdWx0aWNsb3VkLy5Pd2xCb3QueWFtbCIsImgiOiI4MjJjMmFjYWY3YWYwN2RmYmI3Zjg2Y2UyZTJlMGYyZTc0NGI3MmU1In0= --------- Co-authored-by: Owl Bot --- .../google/cloud/gke_multicloud/__init__.py | 2 + .../cloud/gke_multicloud/gapic_version.py | 2 +- .../cloud/gke_multicloud_v1/__init__.py | 2 + .../cloud/gke_multicloud_v1/gapic_version.py | 2 +- .../attached_clusters/async_client.py | 1 + .../services/attached_clusters/client.py | 1 + .../cloud/gke_multicloud_v1/types/__init__.py | 2 + .../types/attached_resources.py | 25 ++++++++++++ .../types/attached_service.py | 1 + .../types/common_resources.py | 40 +++++++++++++++++-- ...etadata_google.cloud.gkemulticloud.v1.json | 2 +- .../test_attached_clusters.py | 12 +++++- .../gke_multicloud_v1/test_aws_clusters.py | 10 ++++- .../gke_multicloud_v1/test_azure_clusters.py | 10 ++++- 14 files changed, 100 insertions(+), 12 deletions(-) diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/__init__.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/__init__.py index bd6a6e31b887..92ba1ed33ad7 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/__init__.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/__init__.py @@ -168,6 +168,7 @@ ) from google.cloud.gke_multicloud_v1.types.common_resources import ( BinaryAuthorization, + CloudMonitoringConfig, Fleet, Jwk, LoggingComponentConfig, @@ -308,6 +309,7 @@ "UpdateAzureClusterRequest", "UpdateAzureNodePoolRequest", "BinaryAuthorization", + "CloudMonitoringConfig", "Fleet", "Jwk", "LoggingComponentConfig", diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/gapic_version.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/gapic_version.py index a22e7bbe7e4a..558c8aab67c5 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/gapic_version.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.6.16" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/__init__.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/__init__.py index 88648899fa1c..64e8356572a3 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/__init__.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/__init__.py @@ -156,6 +156,7 @@ ) from .types.common_resources import ( BinaryAuthorization, + CloudMonitoringConfig, Fleet, Jwk, LoggingComponentConfig, @@ -235,6 +236,7 @@ "AzureServicesAuthentication", "AzureSshConfig", "BinaryAuthorization", + "CloudMonitoringConfig", "CreateAttachedClusterRequest", "CreateAwsClusterRequest", "CreateAwsNodePoolRequest", diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/gapic_version.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/gapic_version.py index a22e7bbe7e4a..558c8aab67c5 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/gapic_version.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.6.16" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/async_client.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/async_client.py index b077a13a26cc..2c8b1c35160c 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/async_client.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/async_client.py @@ -568,6 +568,7 @@ async def sample_update_attached_cluster(): - ``proxy_config.kubernetes_secret.name``. - ``proxy_config.kubernetes_secret.namespace``. - ``security_posture_config.vulnerability_mode`` + - ``monitoring_config.cloud_monitoring_config.enabled`` This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/client.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/client.py index a03435a90514..94d36cb915c4 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/client.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/services/attached_clusters/client.py @@ -972,6 +972,7 @@ def sample_update_attached_cluster(): - ``proxy_config.kubernetes_secret.name``. - ``proxy_config.kubernetes_secret.namespace``. - ``security_posture_config.vulnerability_mode`` + - ``monitoring_config.cloud_monitoring_config.enabled`` This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/__init__.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/__init__.py index 1f7c9d3c38e8..5c8f43585423 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/__init__.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/__init__.py @@ -145,6 +145,7 @@ ) from .common_resources import ( BinaryAuthorization, + CloudMonitoringConfig, Fleet, Jwk, LoggingComponentConfig, @@ -279,6 +280,7 @@ "UpdateAzureClusterRequest", "UpdateAzureNodePoolRequest", "BinaryAuthorization", + "CloudMonitoringConfig", "Fleet", "Jwk", "LoggingComponentConfig", diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_resources.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_resources.py index de4ea8f3bddc..516e387a4ada 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_resources.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_resources.py @@ -137,6 +137,22 @@ class AttachedCluster(proto.Message): security_posture_config (google.cloud.gke_multicloud_v1.types.SecurityPostureConfig): Optional. Security Posture configuration for this cluster. + tags (MutableMapping[str, str]): + Optional. Input only. Tag keys/values directly bound to this + resource. + + Tag key must be specified in the format / where the tag + namespace is the ID of the organization or name of the + project that the tag key is defined in. The short name of a + tag key or value can have a maximum length of 256 + characters. The permitted character set for the short name + includes UTF-8 encoded Unicode characters except single + quotes ('), double quotes ("), backslashes (), and forward + slashes (/). + + See + `Tags `__ + for more details on Google Cloud Platform tags. """ class State(proto.Enum): @@ -280,6 +296,11 @@ class State(proto.Enum): number=26, message=common_resources.SecurityPostureConfig, ) + tags: MutableMapping[str, str] = proto.MapField( + proto.STRING, + proto.STRING, + number=27, + ) class AttachedClustersAuthorization(proto.Message): @@ -449,6 +470,10 @@ class AttachedProxyConfig(proto.Message): the HTTP(S) proxy configuration. The secret must be a JSON encoded proxy configuration as described in + https://cloud.google.com/kubernetes-engine/multi-cloud/docs/attached/eks/how-to/use-a-proxy#configure-proxy-support + for EKS clusters and + https://cloud.google.com/kubernetes-engine/multi-cloud/docs/attached/aks/how-to/use-a-proxy#configure-proxy-support + for AKS clusters. """ kubernetes_secret: "KubernetesSecret" = proto.Field( diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_service.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_service.py index e0791affdff6..83b8dabe186d 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_service.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/attached_service.py @@ -273,6 +273,7 @@ class UpdateAttachedClusterRequest(proto.Message): - ``proxy_config.kubernetes_secret.name``. - ``proxy_config.kubernetes_secret.namespace``. - ``security_posture_config.vulnerability_mode`` + - ``monitoring_config.cloud_monitoring_config.enabled`` """ attached_cluster: attached_resources.AttachedCluster = proto.Field( diff --git a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/common_resources.py b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/common_resources.py index 58f053bff12c..17caf8d9ee8b 100644 --- a/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/common_resources.py +++ b/packages/google-cloud-gke-multicloud/google/cloud/gke_multicloud_v1/types/common_resources.py @@ -34,6 +34,7 @@ "LoggingComponentConfig", "MonitoringConfig", "ManagedPrometheusConfig", + "CloudMonitoringConfig", "BinaryAuthorization", "SecurityPostureConfig", }, @@ -172,9 +173,11 @@ class OperationMetadata(proto.Message): requested_cancellation (bool): Output only. Identifies whether it has been requested cancellation for the operation. Operations that have - successfully been cancelled have [Operation.error][] value - with a [google.rpc.Status.code][google.rpc.Status.code] of - 1, corresponding to ``Code.CANCELLED``. + successfully been cancelled have + [google.longrunning.Operation.error][google.longrunning.Operation.error] + value with a + [google.rpc.Status.code][google.rpc.Status.code] of 1, + corresponding to ``Code.CANCELLED``. """ create_time: timestamp_pb2.Timestamp = proto.Field( @@ -448,6 +451,9 @@ class MonitoringConfig(proto.Message): managed_prometheus_config (google.cloud.gke_multicloud_v1.types.ManagedPrometheusConfig): Enable Google Cloud Managed Service for Prometheus in the cluster. + cloud_monitoring_config (google.cloud.gke_multicloud_v1.types.CloudMonitoringConfig): + Optionally enable GKE metrics. + Only for Attached Clusters. """ managed_prometheus_config: "ManagedPrometheusConfig" = proto.Field( @@ -455,6 +461,11 @@ class MonitoringConfig(proto.Message): number=2, message="ManagedPrometheusConfig", ) + cloud_monitoring_config: "CloudMonitoringConfig" = proto.Field( + proto.MESSAGE, + number=4, + message="CloudMonitoringConfig", + ) class ManagedPrometheusConfig(proto.Message): @@ -472,6 +483,29 @@ class ManagedPrometheusConfig(proto.Message): ) +class CloudMonitoringConfig(proto.Message): + r"""CloudMonitoringConfig defines the configuration for + built-in Cloud Logging and Monitoring. + Only for Attached Clusters. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + enabled (bool): + Enable GKE-native logging and metrics. + Only for Attached Clusters. + + This field is a member of `oneof`_ ``_enabled``. + """ + + enabled: bool = proto.Field( + proto.BOOL, + number=1, + optional=True, + ) + + class BinaryAuthorization(proto.Message): r"""Configuration for Binary Authorization. diff --git a/packages/google-cloud-gke-multicloud/samples/generated_samples/snippet_metadata_google.cloud.gkemulticloud.v1.json b/packages/google-cloud-gke-multicloud/samples/generated_samples/snippet_metadata_google.cloud.gkemulticloud.v1.json index 778818fc5c8a..34b757edefd0 100644 --- a/packages/google-cloud-gke-multicloud/samples/generated_samples/snippet_metadata_google.cloud.gkemulticloud.v1.json +++ b/packages/google-cloud-gke-multicloud/samples/generated_samples/snippet_metadata_google.cloud.gkemulticloud.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-gke-multicloud", - "version": "0.6.16" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.py b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.py index 9fd037b70d5d..7b50156fb1cb 100644 --- a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.py +++ b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_attached_clusters.py @@ -7006,12 +7006,16 @@ def test_create_attached_cluster_rest_call_success(request_type): "admin_users": [{"username": "username_value"}], "admin_groups": [{"group": "group_value"}], }, - "monitoring_config": {"managed_prometheus_config": {"enabled": True}}, + "monitoring_config": { + "managed_prometheus_config": {"enabled": True}, + "cloud_monitoring_config": {"enabled": True}, + }, "proxy_config": { "kubernetes_secret": {"name": "name_value", "namespace": "namespace_value"} }, "binary_authorization": {"evaluation_mode": 1}, "security_posture_config": {"vulnerability_mode": 1}, + "tags": {}, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -7235,12 +7239,16 @@ def test_update_attached_cluster_rest_call_success(request_type): "admin_users": [{"username": "username_value"}], "admin_groups": [{"group": "group_value"}], }, - "monitoring_config": {"managed_prometheus_config": {"enabled": True}}, + "monitoring_config": { + "managed_prometheus_config": {"enabled": True}, + "cloud_monitoring_config": {"enabled": True}, + }, "proxy_config": { "kubernetes_secret": {"name": "name_value", "namespace": "namespace_value"} }, "binary_authorization": {"evaluation_mode": 1}, "security_posture_config": {"vulnerability_mode": 1}, + "tags": {}, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency diff --git a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.py b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.py index 390452b49155..419889085025 100644 --- a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.py +++ b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_aws_clusters.py @@ -10849,7 +10849,10 @@ def test_create_aws_cluster_rest_call_success(request_type): "fleet": {"project": "project_value", "membership": "membership_value"}, "logging_config": {"component_config": {"enable_components": [1]}}, "errors": [{"message": "message_value"}], - "monitoring_config": {"managed_prometheus_config": {"enabled": True}}, + "monitoring_config": { + "managed_prometheus_config": {"enabled": True}, + "cloud_monitoring_config": {"enabled": True}, + }, "binary_authorization": {"evaluation_mode": 1}, } # The version of a generated dependency at test runtime may differ from the version used during generation. @@ -11113,7 +11116,10 @@ def test_update_aws_cluster_rest_call_success(request_type): "fleet": {"project": "project_value", "membership": "membership_value"}, "logging_config": {"component_config": {"enable_components": [1]}}, "errors": [{"message": "message_value"}], - "monitoring_config": {"managed_prometheus_config": {"enabled": True}}, + "monitoring_config": { + "managed_prometheus_config": {"enabled": True}, + "cloud_monitoring_config": {"enabled": True}, + }, "binary_authorization": {"evaluation_mode": 1}, } # The version of a generated dependency at test runtime may differ from the version used during generation. diff --git a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.py b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.py index bea7ba54bd5c..9ca701c0310d 100644 --- a/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.py +++ b/packages/google-cloud-gke-multicloud/tests/unit/gapic/gke_multicloud_v1/test_azure_clusters.py @@ -13899,7 +13899,10 @@ def test_create_azure_cluster_rest_call_success(request_type): }, "logging_config": {"component_config": {"enable_components": [1]}}, "errors": [{"message": "message_value"}], - "monitoring_config": {"managed_prometheus_config": {"enabled": True}}, + "monitoring_config": { + "managed_prometheus_config": {"enabled": True}, + "cloud_monitoring_config": {"enabled": True}, + }, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency @@ -14166,7 +14169,10 @@ def test_update_azure_cluster_rest_call_success(request_type): }, "logging_config": {"component_config": {"enable_components": [1]}}, "errors": [{"message": "message_value"}], - "monitoring_config": {"managed_prometheus_config": {"enabled": True}}, + "monitoring_config": { + "managed_prometheus_config": {"enabled": True}, + "cloud_monitoring_config": {"enabled": True}, + }, } # The version of a generated dependency at test runtime may differ from the version used during generation. # Delete any fields which are not present in the current runtime dependency