Skip to content

Commit

Permalink
HOSTEDCP-1960: Add KubeAPIExteralName api
Browse files Browse the repository at this point in the history
This new API changes the value of the Kubeconfig External URL to points to your desired one

Signed-off-by: Juan Manuel Parrilla Madrid <[email protected]>
  • Loading branch information
jparrill committed Jan 24, 2025
1 parent 7c9455f commit 0ecdf6a
Show file tree
Hide file tree
Showing 38 changed files with 943 additions and 11 deletions.
17 changes: 17 additions & 0 deletions api/hypershift/v1beta1/hosted_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ type HostedControlPlaneSpec struct {
// +optional
KubeConfig *KubeconfigSecretRef `json:"kubeconfig,omitempty"`

// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret
// +optional
CustomKubeConfig *KubeconfigSecretRef `json:"customKubeConfig,omitempty"`

// kubeApiExternalName specifies the external name for the Kube API Server service.
// This is used to configure the Kube API Server service to use a different name, so
// the DNS should be configured to resolve the external name to the Kube API Server service.
// +kubebuilder:validation:MaxLength=100
// +kubebuilder:validation:MinLength=1
// +kubebuilder:example: "api.example.com"
// +optional
KubeAPIExternalName string `json:"kubeApiExternalName,omitempty"`

// Services defines metadata about how control plane services are published
// in the management cluster.
// +kubebuilder:validation:MaxItems=6
Expand Down Expand Up @@ -300,6 +313,10 @@ type HostedControlPlaneStatus struct {
// for this control plane.
KubeConfig *KubeconfigSecretRef `json:"kubeConfig,omitempty"`

// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret
// +optional
CustomKubeConfig *KubeconfigSecretRef `json:"customKubeConfig,omitempty"`

// KubeadminPassword is a reference to the secret containing the initial kubeadmin password
// for the guest cluster.
// +optional
Expand Down
11 changes: 11 additions & 0 deletions api/hypershift/v1beta1/hostedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,13 @@ type HostedClusterSpec struct {
// +required
Platform PlatformSpec `json:"platform"`

// kubeApiExternalName specifies the external name for the Kube API Server service.
// +kubebuilder:validation:MaxLength=100
// +kubebuilder:validation:MinLength=1
// +kubebuilder:example: "api.example.com"
// +optional
KubeAPIExternalName string `json:"kubeApiExternalName,omitempty"`

// controllerAvailabilityPolicy specifies the availability policy applied to critical control plane components like the Kube API Server.
// Possible values are HighlyAvailable and SingleReplica. The default value is HighlyAvailable.
// +optional
Expand Down Expand Up @@ -1423,6 +1430,10 @@ type HostedClusterStatus struct {
// +optional
KubeConfig *corev1.LocalObjectReference `json:"kubeconfig,omitempty"`

// CustomKubeConfig specifies the name and key for the External Custom kubeconfig secret
// +optional
CustomKubeConfig *corev1.LocalObjectReference `json:"customKubeConfig,omitempty"`

// KubeadminPassword is a reference to the secret that contains the initial
// kubeadmin user password for the guest cluster.
// +optional
Expand Down
15 changes: 15 additions & 0 deletions api/hypershift/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
networking:
default:
clusterNetwork:
Expand Down Expand Up @@ -4170,6 +4176,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
networking:
default:
clusterNetwork:
Expand Down Expand Up @@ -4415,6 +4421,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
networking:
default:
clusterNetwork:
Expand Down Expand Up @@ -4203,6 +4209,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2364,6 +2364,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
networking:
default:
clusterNetwork:
Expand Down Expand Up @@ -4179,6 +4185,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2585,6 +2585,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
networking:
default:
clusterNetwork:
Expand Down Expand Up @@ -4400,6 +4406,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
labels:
additionalProperties:
type: string
Expand Down Expand Up @@ -4171,6 +4177,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
networking:
default:
clusterNetwork:
Expand Down Expand Up @@ -4310,6 +4316,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,12 @@ spec:
rule: self == oldSelf
- message: issuerURL must be a valid absolute URL
rule: isURL(self)
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
networking:
default:
clusterNetwork:
Expand Down Expand Up @@ -4646,6 +4652,21 @@ spec:
- host
- port
type: object
customKubeConfig:
description: CustomKubeConfig specifies the name and key for the External
Custom kubeconfig secret
properties:
name:
default: ""
description: |-
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
type: string
type: object
x-kubernetes-map-type: atomic
ignitionEndpoint:
description: |-
IgnitionEndpoint is the endpoint injected in the ign config userdata.
Expand Down
Loading

0 comments on commit 0ecdf6a

Please sign in to comment.