Skip to content

Commit 917ba48

Browse files
committed
CORS-3841: Add custom Endpoints to CAPG
** Update the api and configs
1 parent 9dd62eb commit 917ba48

8 files changed

+174
-0
lines changed

api/v1beta1/endpoints.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta1
18+
19+
// ServiceEndpoints contains all the gcp service endpoints that the user may override. Each field corresponds to
20+
// a service where the expected value is the url that is used to override the default API endpoint.
21+
type ServiceEndpoints struct {
22+
// ComputeServiceEndpoint is the custom endpoint url for the Compute Service
23+
// +kubebuilder:validation:Type=string
24+
// +kubebuilder:validation:Format=uri
25+
// +kubebuilder:validation:Pattern=`^https://`
26+
// +optional
27+
ComputeServiceEndpoint string `json:"compute,omitempty"`
28+
29+
// ContainerServiceEndpoint is the custom endpoint url for the Container Service
30+
// +kubebuilder:validation:Type=string
31+
// +kubebuilder:validation:Format=uri
32+
// +kubebuilder:validation:Pattern=`^https://`
33+
// +optional
34+
ContainerServiceEndpoint string `json:"container,omitempty"`
35+
36+
// IAMServiceEndpoint is the custom endpoint url for the IAM Service
37+
// +kubebuilder:validation:Type=string
38+
// +kubebuilder:validation:Format=uri
39+
// +kubebuilder:validation:Pattern=`^https://`
40+
// +optional
41+
IAMServiceEndpoint string `json:"iam,omitempty"`
42+
43+
// ResourceManagerServiceEndpoint is the custom endpoint url for the Resource Manager Service
44+
// +kubebuilder:validation:Type=string
45+
// +kubebuilder:validation:Format=uri
46+
// +kubebuilder:validation:Pattern=`^https://`
47+
// +optional
48+
ResourceManagerServiceEndpoint string `json:"resourceManager,omitempty"`
49+
}

api/v1beta1/gcpcluster_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ type GCPClusterSpec struct {
6868
// LoadBalancer contains configuration for one or more LoadBalancers.
6969
// +optional
7070
LoadBalancer LoadBalancerSpec `json:"loadBalancer,omitempty"`
71+
72+
// ServiceEndpoints contains the custom GCP Service Endpoint urls for each applicable service.
73+
// For instance, the user can specify a new endpoint for the compute service.
74+
// +optional
75+
ServiceEndpoints *ServiceEndpoints `json:"serviceEndpoints,omitempty"`
7176
}
7277

7378
// GCPClusterStatus defines the observed state of GCPCluster.

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpclusters.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,36 @@ spec:
324324
- value
325325
type: object
326326
type: array
327+
serviceEndpoints:
328+
description: |-
329+
ServiceEndpoints contains the custom GCP Service Endpoint urls for each applicable service.
330+
For instance, the user can specify a new endpoint for the compute service.
331+
properties:
332+
compute:
333+
description: ComputeServiceEndpoint is the custom endpoint url
334+
for the Compute Service
335+
format: uri
336+
pattern: ^https://
337+
type: string
338+
container:
339+
description: ContainerServiceEndpoint is the custom endpoint url
340+
for the Container Service
341+
format: uri
342+
pattern: ^https://
343+
type: string
344+
iam:
345+
description: IAMServiceEndpoint is the custom endpoint url for
346+
the IAM Service
347+
format: uri
348+
pattern: ^https://
349+
type: string
350+
resourceManager:
351+
description: ResourceManagerServiceEndpoint is the custom endpoint
352+
url for the Resource Manager Service
353+
format: uri
354+
pattern: ^https://
355+
type: string
356+
type: object
327357
required:
328358
- project
329359
- region

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpclustertemplates.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,36 @@ spec:
341341
- value
342342
type: object
343343
type: array
344+
serviceEndpoints:
345+
description: |-
346+
ServiceEndpoints contains the custom GCP Service Endpoint urls for each applicable service.
347+
For instance, the user can specify a new endpoint for the compute service.
348+
properties:
349+
compute:
350+
description: ComputeServiceEndpoint is the custom endpoint
351+
url for the Compute Service
352+
format: uri
353+
pattern: ^https://
354+
type: string
355+
container:
356+
description: ContainerServiceEndpoint is the custom endpoint
357+
url for the Container Service
358+
format: uri
359+
pattern: ^https://
360+
type: string
361+
iam:
362+
description: IAMServiceEndpoint is the custom endpoint
363+
url for the IAM Service
364+
format: uri
365+
pattern: ^https://
366+
type: string
367+
resourceManager:
368+
description: ResourceManagerServiceEndpoint is the custom
369+
endpoint url for the Resource Manager Service
370+
format: uri
371+
pattern: ^https://
372+
type: string
373+
type: object
344374
required:
345375
- project
346376
- region

config/crd/bases/infrastructure.cluster.x-k8s.io_gcpmanagedclusters.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,36 @@ spec:
320320
- value
321321
type: object
322322
type: array
323+
serviceEndpoints:
324+
description: |-
325+
ServiceEndpoints contains the custom GCP Service Endpoint urls for each applicable service.
326+
For instance, the user can specify a new endpoint for the compute service.
327+
properties:
328+
compute:
329+
description: ComputeServiceEndpoint is the custom endpoint url
330+
for the Compute Service
331+
format: uri
332+
pattern: ^https://
333+
type: string
334+
container:
335+
description: ContainerServiceEndpoint is the custom endpoint url
336+
for the Container Service
337+
format: uri
338+
pattern: ^https://
339+
type: string
340+
iam:
341+
description: IAMServiceEndpoint is the custom endpoint url for
342+
the IAM Service
343+
format: uri
344+
pattern: ^https://
345+
type: string
346+
resourceManager:
347+
description: ResourceManagerServiceEndpoint is the custom endpoint
348+
url for the Resource Manager Service
349+
format: uri
350+
pattern: ^https://
351+
type: string
352+
type: object
323353
required:
324354
- project
325355
- region

exp/api/v1beta1/gcpmanagedcluster_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ type GCPManagedClusterSpec struct {
6363
// LoadBalancerSpec contains configuration for one or more LoadBalancers.
6464
// +optional
6565
LoadBalancer infrav1.LoadBalancerSpec `json:"loadBalancer,omitempty"`
66+
67+
// ServiceEndpoints contains the custom GCP Service Endpoint urls for each applicable service.
68+
// For instance, the user can specify a new endpoint for the compute service.
69+
// +optional
70+
ServiceEndpoints *infrav1.ServiceEndpoints `json:"serviceEndpoints,omitempty"`
6671
}
6772

6873
// GCPManagedClusterStatus defines the observed state of GCPManagedCluster.

exp/api/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)