diff --git a/.coveragerc b/.coveragerc index 3cef77b..2b3ad0f 100644 --- a/.coveragerc +++ b/.coveragerc @@ -4,7 +4,7 @@ branch = True [report] show_missing = True omit = - google/cloud/gkehub/multiclusteringress/__init__.py + google/cloud/gkehub/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER diff --git a/google/cloud/gkehub/__init__.py b/google/cloud/gkehub/__init__.py index 3faab2a..560d162 100644 --- a/google/cloud/gkehub/__init__.py +++ b/google/cloud/gkehub/__init__.py @@ -27,9 +27,12 @@ from google.cloud.gkehub_v1.types.membership import Authority from google.cloud.gkehub_v1.types.membership import GkeCluster from google.cloud.gkehub_v1.types.membership import KubernetesMetadata +from google.cloud.gkehub_v1.types.membership import KubernetesResource from google.cloud.gkehub_v1.types.membership import Membership from google.cloud.gkehub_v1.types.membership import MembershipEndpoint from google.cloud.gkehub_v1.types.membership import MembershipState +from google.cloud.gkehub_v1.types.membership import ResourceManifest +from google.cloud.gkehub_v1.types.membership import ResourceOptions from google.cloud.gkehub_v1.types.service import ConnectAgentResource from google.cloud.gkehub_v1.types.service import CreateFeatureRequest from google.cloud.gkehub_v1.types.service import CreateMembershipRequest @@ -61,9 +64,12 @@ "Authority", "GkeCluster", "KubernetesMetadata", + "KubernetesResource", "Membership", "MembershipEndpoint", "MembershipState", + "ResourceManifest", + "ResourceOptions", "ConnectAgentResource", "CreateFeatureRequest", "CreateMembershipRequest", diff --git a/google/cloud/gkehub_v1/__init__.py b/google/cloud/gkehub_v1/__init__.py index e233c40..121bc6b 100644 --- a/google/cloud/gkehub_v1/__init__.py +++ b/google/cloud/gkehub_v1/__init__.py @@ -27,9 +27,12 @@ from .types.membership import Authority from .types.membership import GkeCluster from .types.membership import KubernetesMetadata +from .types.membership import KubernetesResource from .types.membership import Membership from .types.membership import MembershipEndpoint from .types.membership import MembershipState +from .types.membership import ResourceManifest +from .types.membership import ResourceOptions from .types.service import ConnectAgentResource from .types.service import CreateFeatureRequest from .types.service import CreateMembershipRequest @@ -68,6 +71,7 @@ "GkeCluster", "GkeHubClient", "KubernetesMetadata", + "KubernetesResource", "ListFeaturesRequest", "ListFeaturesResponse", "ListMembershipsRequest", @@ -78,6 +82,8 @@ "MembershipFeatureState", "MembershipState", "OperationMetadata", + "ResourceManifest", + "ResourceOptions", "TypeMeta", "UpdateFeatureRequest", "UpdateMembershipRequest", diff --git a/google/cloud/gkehub_v1/services/gke_hub/async_client.py b/google/cloud/gkehub_v1/services/gke_hub/async_client.py index 905ba90..f531395 100644 --- a/google/cloud/gkehub_v1/services/gke_hub/async_client.py +++ b/google/cloud/gkehub_v1/services/gke_hub/async_client.py @@ -275,8 +275,8 @@ async def list_features( The request object. Request message for `GkeHub.ListFeatures` method. parent (:class:`str`): - The parent (project and location) where the Features - will be listed. Specified in the format + Required. The parent (project and location) where the + Features will be listed. Specified in the format ``projects/*/locations/*``. This corresponds to the ``parent`` field @@ -426,7 +426,7 @@ async def get_feature( The request object. Request message for `GkeHub.GetFeature` method. name (:class:`str`): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*`` This corresponds to the ``name`` field @@ -614,8 +614,8 @@ async def create_feature( The request object. Request message for the `GkeHub.CreateFeature` method. parent (:class:`str`): - The parent (project and location) where the Feature will - be created. Specified in the format + Required. The parent (project and location) where the + Feature will be created. Specified in the format ``projects/*/locations/*``. This corresponds to the ``parent`` field @@ -808,7 +808,7 @@ async def delete_feature( The request object. Request message for `GkeHub.DeleteFeature` method. name (:class:`str`): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*``. This corresponds to the ``name`` field @@ -1009,7 +1009,7 @@ async def update_feature( The request object. Request message for `GkeHub.UpdateFeature` method. name (:class:`str`): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*``. This corresponds to the ``name`` field diff --git a/google/cloud/gkehub_v1/services/gke_hub/client.py b/google/cloud/gkehub_v1/services/gke_hub/client.py index c54108f..3d60721 100644 --- a/google/cloud/gkehub_v1/services/gke_hub/client.py +++ b/google/cloud/gkehub_v1/services/gke_hub/client.py @@ -489,8 +489,8 @@ def list_features( The request object. Request message for `GkeHub.ListFeatures` method. parent (str): - The parent (project and location) where the Features - will be listed. Specified in the format + Required. The parent (project and location) where the + Features will be listed. Specified in the format ``projects/*/locations/*``. This corresponds to the ``parent`` field @@ -640,7 +640,7 @@ def get_feature( The request object. Request message for `GkeHub.GetFeature` method. name (str): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*`` This corresponds to the ``name`` field @@ -828,8 +828,8 @@ def create_feature( The request object. Request message for the `GkeHub.CreateFeature` method. parent (str): - The parent (project and location) where the Feature will - be created. Specified in the format + Required. The parent (project and location) where the + Feature will be created. Specified in the format ``projects/*/locations/*``. This corresponds to the ``parent`` field @@ -1022,7 +1022,7 @@ def delete_feature( The request object. Request message for `GkeHub.DeleteFeature` method. name (str): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*``. This corresponds to the ``name`` field @@ -1223,7 +1223,7 @@ def update_feature( The request object. Request message for `GkeHub.UpdateFeature` method. name (str): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*``. This corresponds to the ``name`` field diff --git a/google/cloud/gkehub_v1/types/__init__.py b/google/cloud/gkehub_v1/types/__init__.py index daf8db4..57019ee 100644 --- a/google/cloud/gkehub_v1/types/__init__.py +++ b/google/cloud/gkehub_v1/types/__init__.py @@ -26,9 +26,12 @@ Authority, GkeCluster, KubernetesMetadata, + KubernetesResource, Membership, MembershipEndpoint, MembershipState, + ResourceManifest, + ResourceOptions, ) from .service import ( ConnectAgentResource, @@ -61,9 +64,12 @@ "Authority", "GkeCluster", "KubernetesMetadata", + "KubernetesResource", "Membership", "MembershipEndpoint", "MembershipState", + "ResourceManifest", + "ResourceOptions", "ConnectAgentResource", "CreateFeatureRequest", "CreateMembershipRequest", diff --git a/google/cloud/gkehub_v1/types/membership.py b/google/cloud/gkehub_v1/types/membership.py index 499e17c..3480346 100644 --- a/google/cloud/gkehub_v1/types/membership.py +++ b/google/cloud/gkehub_v1/types/membership.py @@ -23,6 +23,9 @@ manifest={ "Membership", "MembershipEndpoint", + "KubernetesResource", + "ResourceOptions", + "ResourceManifest", "GkeCluster", "KubernetesMetadata", "MembershipState", @@ -138,12 +141,128 @@ class MembershipEndpoint(proto.Message): kubernetes_metadata (google.cloud.gkehub_v1.types.KubernetesMetadata): Output only. Useful Kubernetes-specific metadata. + kubernetes_resource (google.cloud.gkehub_v1.types.KubernetesResource): + Optional. The in-cluster Kubernetes Resources that should be + applied for a correctly registered cluster, in the steady + state. These resources: + + - Ensure that the cluster is exclusively registered to one + and only one Hub Membership. + - Propagate Workload Pool Information available in the + Membership Authority field. + - Ensure proper initial configuration of default Hub + Features. """ gke_cluster = proto.Field(proto.MESSAGE, number=1, message="GkeCluster",) kubernetes_metadata = proto.Field( proto.MESSAGE, number=2, message="KubernetesMetadata", ) + kubernetes_resource = proto.Field( + proto.MESSAGE, number=3, message="KubernetesResource", + ) + + +class KubernetesResource(proto.Message): + r"""KubernetesResource contains the YAML manifests and + configuration for Membership Kubernetes resources in the + cluster. After CreateMembership or UpdateMembership, these + resources should be re-applied in the cluster. + + Attributes: + membership_cr_manifest (str): + Input only. The YAML representation of the + Membership CR. This field is ignored for GKE + clusters where Hub can read the CR directly. + Callers should provide the CR that is currently + present in the cluster during CreateMembership + or UpdateMembership, or leave this field empty + if none exists. The CR manifest is used to + validate the cluster has not been registered + with another Membership. + membership_resources (Sequence[google.cloud.gkehub_v1.types.ResourceManifest]): + Output only. Additional Kubernetes resources + that need to be applied to the cluster after + Membership creation, and after every update. + This field is only populated in the Membership + returned from a successful long-running + operation from CreateMembership or + UpdateMembership. It is not populated during + normal GetMembership or ListMemberships + requests. To get the resource manifest after the + initial registration, the caller should make a + UpdateMembership call with an empty field mask. + connect_resources (Sequence[google.cloud.gkehub_v1.types.ResourceManifest]): + Output only. The Kubernetes resources for + installing the GKE Connect agent + This field is only populated in the Membership + returned from a successful long-running + operation from CreateMembership or + UpdateMembership. It is not populated during + normal GetMembership or ListMemberships + requests. To get the resource manifest after the + initial registration, the caller should make a + UpdateMembership call with an empty field mask. + resource_options (google.cloud.gkehub_v1.types.ResourceOptions): + Optional. Options for Kubernetes resource + generation. + """ + + membership_cr_manifest = proto.Field(proto.STRING, number=1,) + membership_resources = proto.RepeatedField( + proto.MESSAGE, number=2, message="ResourceManifest", + ) + connect_resources = proto.RepeatedField( + proto.MESSAGE, number=3, message="ResourceManifest", + ) + resource_options = proto.Field(proto.MESSAGE, number=4, message="ResourceOptions",) + + +class ResourceOptions(proto.Message): + r"""ResourceOptions represent options for Kubernetes resource + generation. + + Attributes: + connect_version (str): + Optional. The Connect agent version to use for + connect_resources. Defaults to the latest GKE Connect + version. The version must be a currently supported version, + obsolete versions will be rejected. + v1beta1_crd (bool): + Optional. Use ``apiextensions/v1beta1`` instead of + ``apiextensions/v1`` for CustomResourceDefinition resources. + This option should be set for clusters with Kubernetes + apiserver versions <1.16. + k8s_version (str): + Optional. Major version of the Kubernetes cluster. This is + only used to determine which version to use for the + CustomResourceDefinition resources, + ``apiextensions/v1beta1`` or\ ``apiextensions/v1``. + """ + + connect_version = proto.Field(proto.STRING, number=1,) + v1beta1_crd = proto.Field(proto.BOOL, number=2,) + k8s_version = proto.Field(proto.STRING, number=3,) + + +class ResourceManifest(proto.Message): + r"""ResourceManifest represents a single Kubernetes resource to + be applied to the cluster. + + Attributes: + manifest (str): + YAML manifest of the resource. + cluster_scoped (bool): + Whether the resource provided in the manifest is + ``cluster_scoped``. If unset, the manifest is assumed to be + namespace scoped. + + This field is used for REST mapping when applying the + resource in a cluster. + """ + + manifest = proto.Field(proto.STRING, number=1,) + cluster_scoped = proto.Field(proto.BOOL, number=2,) class GkeCluster(proto.Message): diff --git a/google/cloud/gkehub_v1/types/service.py b/google/cloud/gkehub_v1/types/service.py index d0aec24..2ae922b 100644 --- a/google/cloud/gkehub_v1/types/service.py +++ b/google/cloud/gkehub_v1/types/service.py @@ -360,8 +360,9 @@ class ListFeaturesRequest(proto.Message): Attributes: parent (str): - The parent (project and location) where the Features will be - listed. Specified in the format ``projects/*/locations/*``. + Required. The parent (project and location) where the + Features will be listed. Specified in the format + ``projects/*/locations/*``. page_size (int): When requesting a 'page' of resources, ``page_size`` specifies number of resources to return. If unspecified or @@ -428,7 +429,7 @@ class GetFeatureRequest(proto.Message): Attributes: name (str): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*`` """ @@ -440,8 +441,9 @@ class CreateFeatureRequest(proto.Message): Attributes: parent (str): - The parent (project and location) where the Feature will be - created. Specified in the format ``projects/*/locations/*``. + Required. The parent (project and location) where the + Feature will be created. Specified in the format + ``projects/*/locations/*``. feature_id (str): The ID of the feature to create. resource (google.cloud.gkehub_v1.types.Feature): @@ -477,7 +479,7 @@ class DeleteFeatureRequest(proto.Message): Attributes: name (str): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*``. force (bool): If set to true, the delete will ignore any outstanding @@ -514,7 +516,7 @@ class UpdateFeatureRequest(proto.Message): Attributes: name (str): - The Feature resource name in the format + Required. The Feature resource name in the format ``projects/*/locations/*/features/*``. update_mask (google.protobuf.field_mask_pb2.FieldMask): Mask of fields to update.