Skip to content

Commit 6f4ad75

Browse files
Google APIscopybara-github
authored andcommitted
feat: add kubernetes_resource field
docs: update API annotation PiperOrigin-RevId: 423151400
1 parent fb700a6 commit 6f4ad75

3 files changed

Lines changed: 139 additions & 43 deletions

File tree

google/cloud/gkehub/v1/BUILD.bazel

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ proto_library(
3333
"//google/cloud/gkehub/v1/configmanagement:configmanagement_proto",
3434
"//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_proto",
3535
"//google/longrunning:operations_proto",
36+
"@com_google_protobuf//:empty_proto",
3637
"@com_google_protobuf//:field_mask_proto",
3738
"@com_google_protobuf//:timestamp_proto",
3839
],
@@ -58,16 +59,6 @@ load(
5859
"java_proto_library",
5960
)
6061

61-
_JAVA_PROTO_SUBPACKAGE_DEPS = [
62-
"//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_java_proto",
63-
"//google/cloud/gkehub/v1/configmanagement:configmanagement_java_proto",
64-
]
65-
66-
_JAVA_GRPC_SUBPACKAGE_DEPS = [
67-
"//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_java_grpc",
68-
"//google/cloud/gkehub/v1/configmanagement:configmanagement_java_grpc",
69-
]
70-
7162
java_proto_library(
7263
name = "gkehub_java_proto",
7364
deps = [":gkehub_proto"],
@@ -76,19 +67,22 @@ java_proto_library(
7667
java_grpc_library(
7768
name = "gkehub_java_grpc",
7869
srcs = [":gkehub_proto"],
79-
deps = [":gkehub_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
70+
deps = [":gkehub_java_proto"],
8071
)
8172

8273
java_gapic_library(
8374
name = "gkehub_java_gapic",
8475
srcs = [":gkehub_proto_with_info"],
76+
gapic_yaml = None,
8577
grpc_service_config = "v1_grpc_service_config.json",
78+
service_yaml = "gkehub_v1.yaml",
8679
test_deps = [
8780
":gkehub_java_grpc",
88-
] + _JAVA_GRPC_SUBPACKAGE_DEPS,
81+
],
8982
deps = [
9083
":gkehub_java_proto",
91-
] + _JAVA_PROTO_SUBPACKAGE_DEPS,
84+
"//google/api:api_java_proto",
85+
],
9286
)
9387

9488
java_gapic_test(
@@ -107,7 +101,7 @@ java_gapic_assembly_gradle_pkg(
107101
":gkehub_java_grpc",
108102
":gkehub_java_proto",
109103
":gkehub_proto",
110-
] + _JAVA_PROTO_SUBPACKAGE_DEPS + _JAVA_GRPC_SUBPACKAGE_DEPS,
104+
],
111105
)
112106

113107
##############################################################################
@@ -139,13 +133,13 @@ go_gapic_library(
139133
srcs = [":gkehub_proto_with_info"],
140134
grpc_service_config = "v1_grpc_service_config.json",
141135
importpath = "cloud.google.com/go/gkehub/apiv1;gkehub",
142-
service_yaml = "gkehub_v1.yaml",
143136
metadata = True,
137+
service_yaml = "gkehub_v1.yaml",
144138
deps = [
145139
":gkehub_go_proto",
146140
"//google/longrunning:longrunning_go_proto",
147-
"@com_google_cloud_go//longrunning/autogen:go_default_library",
148141
"@com_google_cloud_go//longrunning:go_default_library",
142+
"@com_google_cloud_go//longrunning/autogen:go_default_library",
149143
],
150144
)
151145

@@ -161,8 +155,8 @@ go_gapic_assembly_pkg(
161155
name = "gapi-cloud-gkehub-v1-go",
162156
deps = [
163157
":gkehub_go_gapic",
164-
":gkehub_go_gapic_srcjar-test.srcjar",
165158
":gkehub_go_gapic_srcjar-metadata.srcjar",
159+
":gkehub_go_gapic_srcjar-test.srcjar",
166160
":gkehub_go_proto",
167161
],
168162
)
@@ -188,8 +182,6 @@ py_gapic_assembly_pkg(
188182
name = "gkehub-v1-py",
189183
deps = [
190184
":gkehub_py_gapic",
191-
"//google/cloud/gkehub/v1/configmanagement:configmanagement_py_gapic",
192-
"//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_py_gapic",
193185
],
194186
)
195187

@@ -261,8 +253,6 @@ nodejs_gapic_assembly_pkg(
261253
deps = [
262254
":gkehub_nodejs_gapic",
263255
":gkehub_proto",
264-
"//google/cloud/gkehub/v1/configmanagement:configmanagement_proto",
265-
"//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_proto",
266256
],
267257
)
268258

@@ -271,19 +261,15 @@ nodejs_gapic_assembly_pkg(
271261
##############################################################################
272262
load(
273263
"@com_google_googleapis_imports//:imports.bzl",
274-
"ruby_gapic_assembly_pkg",
275264
"ruby_cloud_gapic_library",
265+
"ruby_gapic_assembly_pkg",
276266
"ruby_grpc_library",
277267
"ruby_proto_library",
278268
)
279269

280270
ruby_proto_library(
281271
name = "gkehub_ruby_proto",
282-
deps = [
283-
":gkehub_proto",
284-
"//google/cloud/gkehub/v1/configmanagement:configmanagement_proto",
285-
"//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_proto",
286-
],
272+
deps = [":gkehub_proto"],
287273
)
288274

289275
ruby_grpc_library(

google/cloud/gkehub/v1/membership.proto

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ syntax = "proto3";
1616

1717
package google.cloud.gkehub.v1;
1818

19+
import "google/api/annotations.proto";
1920
import "google/api/field_behavior.proto";
2021
import "google/api/resource.proto";
2122
import "google/protobuf/timestamp.proto";
22-
import "google/api/annotations.proto";
2323

2424
option csharp_namespace = "Google.Cloud.GkeHub.V1";
2525
option go_package = "google.golang.org/genproto/googleapis/cloud/gkehub/v1;gkehub";
@@ -110,13 +110,92 @@ message MembershipEndpoint {
110110

111111
// Output only. Useful Kubernetes-specific metadata.
112112
KubernetesMetadata kubernetes_metadata = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
113+
114+
// Optional. The in-cluster Kubernetes Resources that should be applied for a correctly
115+
// registered cluster, in the steady state. These resources:
116+
//
117+
// * Ensure that the cluster is exclusively registered to one and only one
118+
// Hub Membership.
119+
// * Propagate Workload Pool Information available in the Membership
120+
// Authority field.
121+
// * Ensure proper initial configuration of default Hub Features.
122+
KubernetesResource kubernetes_resource = 3 [(google.api.field_behavior) = OPTIONAL];
123+
}
124+
125+
// KubernetesResource contains the YAML manifests and configuration for
126+
// Membership Kubernetes resources in the cluster. After CreateMembership or
127+
// UpdateMembership, these resources should be re-applied in the cluster.
128+
message KubernetesResource {
129+
// Input only. The YAML representation of the Membership CR. This field is ignored for GKE
130+
// clusters where Hub can read the CR directly.
131+
//
132+
// Callers should provide the CR that is currently present in the cluster
133+
// during CreateMembership or UpdateMembership, or leave this field empty if
134+
// none exists. The CR manifest is used to validate the cluster has not been
135+
// registered with another Membership.
136+
string membership_cr_manifest = 1 [(google.api.field_behavior) = INPUT_ONLY];
137+
138+
// Output only. Additional Kubernetes resources that need to be applied to the cluster
139+
// after Membership creation, and after every update.
140+
//
141+
// This field is only populated in the Membership returned from a successful
142+
// long-running operation from CreateMembership or UpdateMembership. It is not
143+
// populated during normal GetMembership or ListMemberships requests. To get
144+
// the resource manifest after the initial registration, the caller should
145+
// make a UpdateMembership call with an empty field mask.
146+
repeated ResourceManifest membership_resources = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
147+
148+
// Output only. The Kubernetes resources for installing the GKE Connect agent
149+
//
150+
// This field is only populated in the Membership returned from a successful
151+
// long-running operation from CreateMembership or UpdateMembership. It is not
152+
// populated during normal GetMembership or ListMemberships requests. To get
153+
// the resource manifest after the initial registration, the caller should
154+
// make a UpdateMembership call with an empty field mask.
155+
repeated ResourceManifest connect_resources = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
156+
157+
// Optional. Options for Kubernetes resource generation.
158+
ResourceOptions resource_options = 4 [(google.api.field_behavior) = OPTIONAL];
159+
}
160+
161+
// ResourceOptions represent options for Kubernetes resource generation.
162+
message ResourceOptions {
163+
// Optional. The Connect agent version to use for connect_resources. Defaults to the
164+
// latest GKE Connect version. The version must be a currently supported
165+
// version, obsolete versions will be rejected.
166+
string connect_version = 1 [(google.api.field_behavior) = OPTIONAL];
167+
168+
// Optional. Use `apiextensions/v1beta1` instead of `apiextensions/v1` for
169+
// CustomResourceDefinition resources.
170+
// This option should be set for clusters with Kubernetes apiserver versions
171+
// <1.16.
172+
bool v1beta1_crd = 2 [(google.api.field_behavior) = OPTIONAL];
173+
174+
// Optional. Major version of the Kubernetes cluster. This is only used to determine
175+
// which version to use for the CustomResourceDefinition resources,
176+
// `apiextensions/v1beta1` or`apiextensions/v1`.
177+
string k8s_version = 3 [(google.api.field_behavior) = OPTIONAL];
178+
}
179+
180+
// ResourceManifest represents a single Kubernetes resource to be applied to
181+
// the cluster.
182+
message ResourceManifest {
183+
// YAML manifest of the resource.
184+
string manifest = 1;
185+
186+
// Whether the resource provided in the manifest is `cluster_scoped`.
187+
// If unset, the manifest is assumed to be namespace scoped.
188+
//
189+
// This field is used for REST mapping when applying the resource in a
190+
// cluster.
191+
bool cluster_scoped = 2;
113192
}
114193

115194
// GkeCluster contains information specific to GKE clusters.
116195
message GkeCluster {
117196
// Immutable. Self-link of the GCP resource for the GKE cluster. For example:
118197
//
119-
// //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster
198+
// //container.googleapis.com/projects/my-project/locations/us-west1-a/clusters/my-cluster
120199
//
121200
// Zonal clusters are also supported.
122201
string resource_link = 1 [(google.api.field_behavior) = IMMUTABLE];

google/cloud/gkehub/v1/service.proto

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import "google/api/resource.proto";
2323
import "google/cloud/gkehub/v1/feature.proto";
2424
import "google/cloud/gkehub/v1/membership.proto";
2525
import "google/longrunning/operations.proto";
26+
import "google/protobuf/empty.proto";
2627
import "google/protobuf/field_mask.proto";
2728
import "google/protobuf/timestamp.proto";
2829

@@ -325,7 +326,12 @@ message DeleteMembershipRequest {
325326
message UpdateMembershipRequest {
326327
// Required. The Membership resource name in the format
327328
// `projects/*/locations/*/memberships/*`.
328-
string name = 1 [(google.api.field_behavior) = REQUIRED];
329+
string name = 1 [
330+
(google.api.field_behavior) = REQUIRED,
331+
(google.api.resource_reference) = {
332+
type: "gkehub.googleapis.com/Membership"
333+
}
334+
];
329335

330336
// Required. Mask of fields to update.
331337
google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
@@ -362,7 +368,12 @@ message UpdateMembershipRequest {
362368
message GenerateConnectManifestRequest {
363369
// Required. The Membership resource name the Agent will associate with, in the format
364370
// `projects/*/locations/*/memberships/*`.
365-
string name = 1 [(google.api.field_behavior) = REQUIRED];
371+
string name = 1 [
372+
(google.api.field_behavior) = REQUIRED,
373+
(google.api.resource_reference) = {
374+
type: "gkehub.googleapis.com/Membership"
375+
}
376+
];
366377

367378
// Optional. Namespace for GKE Connect agent resources. Defaults to `gke-connect`.
368379
//
@@ -423,9 +434,13 @@ message TypeMeta {
423434

424435
// Request message for `GkeHub.ListFeatures` method.
425436
message ListFeaturesRequest {
426-
// The parent (project and location) where the Features will be listed.
437+
// Required. The parent (project and location) where the Features will be listed.
427438
// Specified in the format `projects/*/locations/*`.
428-
string parent = 1;
439+
string parent = 1 [
440+
(google.api.resource_reference) = {
441+
child_type: "gkehub.googleapis.com/Feature"
442+
}
443+
];
429444

430445
// When requesting a 'page' of resources, `page_size` specifies number of
431446
// resources to return. If unspecified or set to 0, all resources will
@@ -473,16 +488,24 @@ message ListFeaturesResponse {
473488

474489
// Request message for `GkeHub.GetFeature` method.
475490
message GetFeatureRequest {
476-
// The Feature resource name in the format
491+
// Required. The Feature resource name in the format
477492
// `projects/*/locations/*/features/*`
478-
string name = 1;
493+
string name = 1 [
494+
(google.api.resource_reference) = {
495+
type: "gkehub.googleapis.com/Feature"
496+
}
497+
];
479498
}
480499

481500
// Request message for the `GkeHub.CreateFeature` method.
482501
message CreateFeatureRequest {
483-
// The parent (project and location) where the Feature will be created.
502+
// Required. The parent (project and location) where the Feature will be created.
484503
// Specified in the format `projects/*/locations/*`.
485-
string parent = 1;
504+
string parent = 1 [
505+
(google.api.resource_reference) = {
506+
child_type: "gkehub.googleapis.com/Feature"
507+
}
508+
];
486509

487510
// The ID of the feature to create.
488511
string feature_id = 2;
@@ -503,14 +526,18 @@ message CreateFeatureRequest {
503526
//
504527
// The request ID must be a valid UUID with the exception that zero UUID is
505528
// not supported (00000000-0000-0000-0000-000000000000).
506-
string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
529+
string request_id = 4;
507530
}
508531

509532
// Request message for `GkeHub.DeleteFeature` method.
510533
message DeleteFeatureRequest {
511-
// The Feature resource name in the format
534+
// Required. The Feature resource name in the format
512535
// `projects/*/locations/*/features/*`.
513-
string name = 1;
536+
string name = 1 [
537+
(google.api.resource_reference) = {
538+
type: "gkehub.googleapis.com/Feature"
539+
}
540+
];
514541

515542
// If set to true, the delete will ignore any outstanding resources for
516543
// this Feature (that is, `FeatureState.has_resources` is set to true). These
@@ -535,9 +562,13 @@ message DeleteFeatureRequest {
535562

536563
// Request message for `GkeHub.UpdateFeature` method.
537564
message UpdateFeatureRequest {
538-
// The Feature resource name in the format
565+
// Required. The Feature resource name in the format
539566
// `projects/*/locations/*/features/*`.
540-
string name = 1;
567+
string name = 1 [
568+
(google.api.resource_reference) = {
569+
type: "gkehub.googleapis.com/Feature"
570+
}
571+
];
541572

542573
// Mask of fields to update.
543574
google.protobuf.FieldMask update_mask = 2;
@@ -565,7 +596,7 @@ message UpdateFeatureRequest {
565596
//
566597
// The request ID must be a valid UUID with the exception that zero UUID is
567598
// not supported (00000000-0000-0000-0000-000000000000).
568-
string request_id = 4 [(google.api.field_behavior) = OPTIONAL];
599+
string request_id = 4;
569600
}
570601

571602
// Represents the metadata of the long-running operation.

0 commit comments

Comments
 (0)