Skip to content

Commit d6e3182

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 7c9455f commit d6e3182

File tree

42 files changed

+1358
-11
lines changed

Some content is hidden

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

42 files changed

+1358
-11
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
@@ -2347,6 +2347,16 @@ spec:
23472347
rule: self == oldSelf
23482348
- message: issuerURL must be a valid absolute URL
23492349
rule: isURL(self)
2350+
kubeAPICustomName:
2351+
description: |-
2352+
kubeApiCustomName specifies the external name for the Kube API Server service.
2353+
This is used to configure the Kube API Server service to use a different name, so
2354+
the DNS should be configured to resolve the external name to the Kube API Server service.
2355+
maxLength: 253
2356+
type: string
2357+
x-kubernetes-validations:
2358+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2359+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
23502360
networking:
23512361
default:
23522362
clusterNetwork:
@@ -4170,6 +4180,24 @@ spec:
41704180
- host
41714181
- port
41724182
type: object
4183+
customKubeConfig:
4184+
description: |-
4185+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4186+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4187+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4188+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4189+
properties:
4190+
name:
4191+
default: ""
4192+
description: |-
4193+
Name of the referent.
4194+
This field is effectively required, but due to backwards compatibility is
4195+
allowed to be empty. Instances of this type with an empty value here are
4196+
almost certainly wrong.
4197+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4198+
type: string
4199+
type: object
4200+
x-kubernetes-map-type: atomic
41734201
ignitionEndpoint:
41744202
description: |-
41754203
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
@@ -2343,6 +2343,16 @@ spec:
23432343
rule: self == oldSelf
23442344
- message: issuerURL must be a valid absolute URL
23452345
rule: isURL(self)
2346+
kubeAPICustomName:
2347+
description: |-
2348+
kubeApiCustomName specifies the external name for the Kube API Server service.
2349+
This is used to configure the Kube API Server service to use a different name, so
2350+
the DNS should be configured to resolve the external name to the Kube API Server service.
2351+
maxLength: 253
2352+
type: string
2353+
x-kubernetes-validations:
2354+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2355+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
23462356
networking:
23472357
default:
23482358
clusterNetwork:
@@ -4415,6 +4425,24 @@ spec:
44154425
- host
44164426
- port
44174427
type: object
4428+
customKubeConfig:
4429+
description: |-
4430+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4431+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4432+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4433+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4434+
properties:
4435+
name:
4436+
default: ""
4437+
description: |-
4438+
Name of the referent.
4439+
This field is effectively required, but due to backwards compatibility is
4440+
allowed to be empty. Instances of this type with an empty value here are
4441+
almost certainly wrong.
4442+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4443+
type: string
4444+
type: object
4445+
x-kubernetes-map-type: atomic
44184446
ignitionEndpoint:
44194447
description: |-
44204448
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
@@ -2388,6 +2388,16 @@ spec:
23882388
rule: self == oldSelf
23892389
- message: issuerURL must be a valid absolute URL
23902390
rule: isURL(self)
2391+
kubeAPICustomName:
2392+
description: |-
2393+
kubeApiCustomName specifies the external name for the Kube API Server service.
2394+
This is used to configure the Kube API Server service to use a different name, so
2395+
the DNS should be configured to resolve the external name to the Kube API Server service.
2396+
maxLength: 253
2397+
type: string
2398+
x-kubernetes-validations:
2399+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2400+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
23912401
networking:
23922402
default:
23932403
clusterNetwork:
@@ -4203,6 +4213,24 @@ spec:
42034213
- host
42044214
- port
42054215
type: object
4216+
customKubeConfig:
4217+
description: |-
4218+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4219+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4220+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4221+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4222+
properties:
4223+
name:
4224+
default: ""
4225+
description: |-
4226+
Name of the referent.
4227+
This field is effectively required, but due to backwards compatibility is
4228+
allowed to be empty. Instances of this type with an empty value here are
4229+
almost certainly wrong.
4230+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4231+
type: string
4232+
type: object
4233+
x-kubernetes-map-type: atomic
42064234
ignitionEndpoint:
42074235
description: |-
42084236
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
@@ -2364,6 +2364,16 @@ spec:
23642364
rule: self == oldSelf
23652365
- message: issuerURL must be a valid absolute URL
23662366
rule: isURL(self)
2367+
kubeAPICustomName:
2368+
description: |-
2369+
kubeApiCustomName specifies the external name for the Kube API Server service.
2370+
This is used to configure the Kube API Server service to use a different name, so
2371+
the DNS should be configured to resolve the external name to the Kube API Server service.
2372+
maxLength: 253
2373+
type: string
2374+
x-kubernetes-validations:
2375+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2376+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
23672377
networking:
23682378
default:
23692379
clusterNetwork:
@@ -4179,6 +4189,24 @@ spec:
41794189
- host
41804190
- port
41814191
type: object
4192+
customKubeConfig:
4193+
description: |-
4194+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4195+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4196+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4197+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4198+
properties:
4199+
name:
4200+
default: ""
4201+
description: |-
4202+
Name of the referent.
4203+
This field is effectively required, but due to backwards compatibility is
4204+
allowed to be empty. Instances of this type with an empty value here are
4205+
almost certainly wrong.
4206+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4207+
type: string
4208+
type: object
4209+
x-kubernetes-map-type: atomic
41824210
ignitionEndpoint:
41834211
description: |-
41844212
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
@@ -2585,6 +2585,16 @@ spec:
25852585
rule: self == oldSelf
25862586
- message: issuerURL must be a valid absolute URL
25872587
rule: isURL(self)
2588+
kubeAPICustomName:
2589+
description: |-
2590+
kubeApiCustomName specifies the external name for the Kube API Server service.
2591+
This is used to configure the Kube API Server service to use a different name, so
2592+
the DNS should be configured to resolve the external name to the Kube API Server service.
2593+
maxLength: 253
2594+
type: string
2595+
x-kubernetes-validations:
2596+
- message: kubeApiCustomName must be a valid URL name (e.g., api.example.com)
2597+
rule: self == "" || self.matches('^(?:(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,}|[a-zA-Z0-9-]+)$')
25882598
networking:
25892599
default:
25902600
clusterNetwork:
@@ -4400,6 +4410,24 @@ spec:
44004410
- host
44014411
- port
44024412
type: object
4413+
customKubeConfig:
4414+
description: |-
4415+
CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret.
4416+
When set, it triggers the generation of a secret with the specified name containing a kubeconfig within the `HostedCluster` namespace.
4417+
This kubeconfig will also be referenced in the `HostedCluster.status` as `customKubeconfig`.
4418+
If removed during day-2 operations, all related secrets and status references will also be deleted.
4419+
properties:
4420+
name:
4421+
default: ""
4422+
description: |-
4423+
Name of the referent.
4424+
This field is effectively required, but due to backwards compatibility is
4425+
allowed to be empty. Instances of this type with an empty value here are
4426+
almost certainly wrong.
4427+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
4428+
type: string
4429+
type: object
4430+
x-kubernetes-map-type: atomic
44034431
ignitionEndpoint:
44044432
description: |-
44054433
IgnitionEndpoint is the endpoint injected in the ign config userdata.

0 commit comments

Comments
 (0)