Skip to content

Commit 1fd6696

Browse files
committed
HOSTEDCP-1960: Add KubeAPIExteralName api
This new API changes the value of the Kubeconfig External URL to points to your desired one Signed-off-by: Juan Manuel Parrilla Madrid <jparrill@redhat.com>
1 parent b1062d6 commit 1fd6696

File tree

48 files changed

+1474
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1474
-7
lines changed

Diff for: api/hypershift/v1beta1/hosted_controlplane.go

+30
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ type HostedControlPlaneSpec struct {
115115
// +optional
116116
KubeConfig *KubeconfigSecretRef `json:"kubeconfig,omitempty"`
117117

118+
// KubeAPICustomKubeconfig is a group that encompasses an additional KAS server address and the customKubeconfig generated for the kube-apiserver.
119+
// +optional
120+
KubeAPICustomKubeconfig *KubeAPICustomKubeconfig `json:"kubeAPICustomKubeconfig,omitempty"`
121+
118122
// Services defines metadata about how control plane services are published
119123
// in the management cluster.
120124
// +kubebuilder:validation:MaxItems=6
@@ -202,6 +206,26 @@ type HostedControlPlaneSpec struct {
202206
Labels map[string]string `json:"labels,omitempty"`
203207
}
204208

209+
// KubeAPICustomKubeconfig is a group that englobes an additional KAS server address and the customKubeconfig generated for the kube-apiserver.
210+
// +optional
211+
type KubeAPICustomKubeconfig struct {
212+
// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
213+
// When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
214+
// This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
215+
// If removed during day-2 operations, all related secrets and status references will also be deleted.
216+
// +optional
217+
CustomKubeConfig *KubeconfigSecretRef `json:"customkubeconfig,omitempty"`
218+
219+
// kubeApiCustomName specifies the external name for the Kube API Server service.
220+
// This is used to configure the Kube API Server service to use a different name, so
221+
// the DNS should be configured to resolve the external name to the Kube API Server service.
222+
// +kubebuilder:validation:XValidation:rule=`self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')`,message="kubeApiCustomName must be a valid URL name (e.g., api.example.com)"
223+
// +kubebuilder:validation:MaxLength=253
224+
// +kubebuilder:example: "api.example.com"
225+
// +optional
226+
KubeAPICustomName string `json:"kubeAPICustomName,omitempty"`
227+
}
228+
205229
// availabilityPolicy specifies a high level availability policy for components.
206230
// +kubebuilder:validation:Enum=HighlyAvailable;SingleReplica
207231
type AvailabilityPolicy string
@@ -300,6 +324,12 @@ type HostedControlPlaneStatus struct {
300324
// for this control plane.
301325
KubeConfig *KubeconfigSecretRef `json:"kubeConfig,omitempty"`
302326

327+
// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
328+
// This field is optional and only allowed if kubeApiExternalName is not empty. When set, they result in the generation of a secret with the given name containing a Kubeconfig within the hostedCluster namespace and a referenced by the hostedCluster.status object.
329+
// When removed day 2 the secret will be deleted and the kubeconfig will be removed from the hostedCluster.status object.
330+
// +optional
331+
CustomKubeConfig *KubeconfigSecretRef `json:"customkubeconfig,omitempty"`
332+
303333
// KubeadminPassword is a reference to the secret containing the initial kubeadmin password
304334
// for the guest cluster.
305335
// +optional

Diff for: api/hypershift/v1beta1/hostedcluster_types.go

+16
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,15 @@ type HostedClusterSpec struct {
432432
// +required
433433
Platform PlatformSpec `json:"platform"`
434434

435+
// kubeApiCustomName specifies the external name for the Kube API Server service.
436+
// This is used to configure the Kube API Server service to use a different name, so
437+
// the DNS should be configured to resolve the external name to the Kube API Server service.
438+
// +kubebuilder:validation:XValidation:rule=`self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')`,message="kubeApiCustomName must be a valid URL name (e.g., api.example.com)"
439+
// +kubebuilder:validation:MaxLength=253
440+
// +kubebuilder:example: "api.example.com"
441+
// +optional
442+
KubeAPICustomName string `json:"kubeAPICustomName,omitempty"`
443+
435444
// controllerAvailabilityPolicy specifies the availability policy applied to critical control plane components like the Kube API Server.
436445
// Possible values are HighlyAvailable and SingleReplica. The default value is HighlyAvailable.
437446
// +optional
@@ -1423,6 +1432,13 @@ type HostedClusterStatus struct {
14231432
// +optional
14241433
KubeConfig *corev1.LocalObjectReference `json:"kubeconfig,omitempty"`
14251434

1435+
// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
1436+
// When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
1437+
// This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
1438+
// If removed during day-2 operations, all related secrets and status references will also be deleted.
1439+
// +optional
1440+
CustomKubeConfig *corev1.LocalObjectReference `json:"customKubeConfig,omitempty"`
1441+
14261442
// KubeadminPassword is a reference to the secret that contains the initial
14271443
// kubeadmin user password for the guest cluster.
14281444
// +optional

Diff for: api/hypershift/v1beta1/zz_generated.deepcopy.go

+35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AAA_ungated.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -2358,6 +2358,16 @@ spec:
23582358
rule: self == oldSelf
23592359
- message: issuerURL must be a valid absolute URL
23602360
rule: isURL(self)
2361+
kubeAPICustomName:
2362+
description: |-
2363+
kubeApiCustomName specifies the external name for the Kube API Server service.
2364+
This is used to configure the Kube API Server service to use a different name, so
2365+
the DNS should be configured to resolve the external name to the Kube API Server service.
2366+
maxLength: 253
2367+
type: string
2368+
x-kubernetes-validations:
2369+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2370+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
23612371
networking:
23622372
default:
23632373
clusterNetwork:
@@ -4181,6 +4191,24 @@ spec:
41814191
- host
41824192
- port
41834193
type: object
4194+
customKubeConfig:
4195+
description: |-
4196+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4197+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4198+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4199+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4200+
properties:
4201+
name:
4202+
default: ""
4203+
description: |-
4204+
Name of the referent.
4205+
This field is effectively required, but due to backwards compatibility is
4206+
allowed to be empty. Instances of this type with an empty value here are
4207+
almost certainly wrong.
4208+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4209+
type: string
4210+
type: object
4211+
x-kubernetes-map-type: atomic
41844212
ignitionEndpoint:
41854213
description: |-
41864214
IgnitionEndpoint is the endpoint injected in the ign config userdata.

Diff for: api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AROHCPManagedIdentities.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -2354,6 +2354,16 @@ spec:
23542354
rule: self == oldSelf
23552355
- message: issuerURL must be a valid absolute URL
23562356
rule: isURL(self)
2357+
kubeAPICustomName:
2358+
description: |-
2359+
kubeApiCustomName specifies the external name for the Kube API Server service.
2360+
This is used to configure the Kube API Server service to use a different name, so
2361+
the DNS should be configured to resolve the external name to the Kube API Server service.
2362+
maxLength: 253
2363+
type: string
2364+
x-kubernetes-validations:
2365+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2366+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
23572367
networking:
23582368
default:
23592369
clusterNetwork:
@@ -4452,6 +4462,24 @@ spec:
44524462
- host
44534463
- port
44544464
type: object
4465+
customKubeConfig:
4466+
description: |-
4467+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4468+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4469+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4470+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4471+
properties:
4472+
name:
4473+
default: ""
4474+
description: |-
4475+
Name of the referent.
4476+
This field is effectively required, but due to backwards compatibility is
4477+
allowed to be empty. Instances of this type with an empty value here are
4478+
almost certainly wrong.
4479+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4480+
type: string
4481+
type: object
4482+
x-kubernetes-map-type: atomic
44554483
ignitionEndpoint:
44564484
description: |-
44574485
IgnitionEndpoint is the endpoint injected in the ign config userdata.

Diff for: api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/AutoNodeKarpenter.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -2399,6 +2399,16 @@ spec:
23992399
rule: self == oldSelf
24002400
- message: issuerURL must be a valid absolute URL
24012401
rule: isURL(self)
2402+
kubeAPICustomName:
2403+
description: |-
2404+
kubeApiCustomName specifies the external name for the Kube API Server service.
2405+
This is used to configure the Kube API Server service to use a different name, so
2406+
the DNS should be configured to resolve the external name to the Kube API Server service.
2407+
maxLength: 253
2408+
type: string
2409+
x-kubernetes-validations:
2410+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2411+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
24022412
networking:
24032413
default:
24042414
clusterNetwork:
@@ -4214,6 +4224,24 @@ spec:
42144224
- host
42154225
- port
42164226
type: object
4227+
customKubeConfig:
4228+
description: |-
4229+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4230+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4231+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4232+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4233+
properties:
4234+
name:
4235+
default: ""
4236+
description: |-
4237+
Name of the referent.
4238+
This field is effectively required, but due to backwards compatibility is
4239+
allowed to be empty. Instances of this type with an empty value here are
4240+
almost certainly wrong.
4241+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4242+
type: string
4243+
type: object
4244+
x-kubernetes-map-type: atomic
42174245
ignitionEndpoint:
42184246
description: |-
42194247
IgnitionEndpoint is the endpoint injected in the ign config userdata.

Diff for: api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/DynamicResourceAllocation.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -2375,6 +2375,16 @@ spec:
23752375
rule: self == oldSelf
23762376
- message: issuerURL must be a valid absolute URL
23772377
rule: isURL(self)
2378+
kubeAPICustomName:
2379+
description: |-
2380+
kubeApiCustomName specifies the external name for the Kube API Server service.
2381+
This is used to configure the Kube API Server service to use a different name, so
2382+
the DNS should be configured to resolve the external name to the Kube API Server service.
2383+
maxLength: 253
2384+
type: string
2385+
x-kubernetes-validations:
2386+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2387+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
23782388
networking:
23792389
default:
23802390
clusterNetwork:
@@ -4190,6 +4200,24 @@ spec:
41904200
- host
41914201
- port
41924202
type: object
4203+
customKubeConfig:
4204+
description: |-
4205+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4206+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4207+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4208+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4209+
properties:
4210+
name:
4211+
default: ""
4212+
description: |-
4213+
Name of the referent.
4214+
This field is effectively required, but due to backwards compatibility is
4215+
allowed to be empty. Instances of this type with an empty value here are
4216+
almost certainly wrong.
4217+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4218+
type: string
4219+
type: object
4220+
x-kubernetes-map-type: atomic
41934221
ignitionEndpoint:
41944222
description: |-
41954223
IgnitionEndpoint is the endpoint injected in the ign config userdata.

Diff for: api/hypershift/v1beta1/zz_generated.featuregated-crd-manifests/hostedclusters.hypershift.openshift.io/ExternalOIDC.yaml

+28
Original file line numberDiff line numberDiff line change
@@ -2596,6 +2596,16 @@ spec:
25962596
rule: self == oldSelf
25972597
- message: issuerURL must be a valid absolute URL
25982598
rule: isURL(self)
2599+
kubeAPICustomName:
2600+
description: |-
2601+
kubeApiCustomName specifies the external name for the Kube API Server service.
2602+
This is used to configure the Kube API Server service to use a different name, so
2603+
the DNS should be configured to resolve the external name to the Kube API Server service.
2604+
maxLength: 253
2605+
type: string
2606+
x-kubernetes-validations:
2607+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2608+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
25992609
networking:
26002610
default:
26012611
clusterNetwork:
@@ -4411,6 +4421,24 @@ spec:
44114421
- host
44124422
- port
44134423
type: object
4424+
customKubeConfig:
4425+
description: |-
4426+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4427+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4428+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4429+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4430+
properties:
4431+
name:
4432+
default: ""
4433+
description: |-
4434+
Name of the referent.
4435+
This field is effectively required, but due to backwards compatibility is
4436+
allowed to be empty. Instances of this type with an empty value here are
4437+
almost certainly wrong.
4438+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4439+
type: string
4440+
type: object
4441+
x-kubernetes-map-type: atomic
44144442
ignitionEndpoint:
44154443
description: |-
44164444
IgnitionEndpoint is the endpoint injected in the ign config userdata.

0 commit comments

Comments
 (0)