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 22, 2025
1 parent 7c9455f commit c866941
Show file tree
Hide file tree
Showing 38 changed files with 710 additions and 11 deletions.
10 changes: 10 additions & 0 deletions api/hypershift/v1beta1/hosted_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ type HostedControlPlaneSpec struct {
// +optional
KubeConfig *KubeconfigSecretRef `json:"kubeconfig,omitempty"`

// kubeApiExternalName specifies the external name for the Kube API Server service.
// +kubebuilder:validation:MaxLength=100
// +kubebuilder:validation:MinLength=1
// +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 +306,10 @@ type HostedControlPlaneStatus struct {
// for this control plane.
KubeConfig *KubeconfigSecretRef `json:"kubeConfig,omitempty"`

// KubeConfigExt is a reference to the secret containing the external kubeconfig
// for this control plane.
KubeConfigExt *KubeconfigSecretRef `json:"kubeConfigExt,omitempty"`

// KubeadminPassword is a reference to the secret containing the initial kubeadmin password
// for the guest cluster.
// +optional
Expand Down
10 changes: 10 additions & 0 deletions api/hypershift/v1beta1/hostedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ 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
// +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 +1429,10 @@ type HostedClusterStatus struct {
// +optional
KubeConfig *corev1.LocalObjectReference `json:"kubeconfig,omitempty"`

// KubeConfigExt is a reference to the secret containing the external kubeconfig
// for this control plane.
KubeConfigExt *corev1.LocalObjectReference `json:"kubeconfigExt,omitempty"`

// KubeadminPassword is a reference to the secret that contains the initial
// kubeadmin user password for the guest cluster.
// +optional
Expand Down
10 changes: 10 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 @@ -4207,6 +4213,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
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 @@ -4452,6 +4458,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
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 @@ -4240,6 +4246,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
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 @@ -4216,6 +4222,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
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 @@ -4437,6 +4443,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
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 @@ -4208,6 +4214,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
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 @@ -4347,6 +4353,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
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 @@ -4683,6 +4689,22 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
kubeconfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
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
oauthCallbackURLTemplate:
description: |-
OAuthCallbackURLTemplate contains a template for the URL to use as a callback
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,12 @@ spec:
default value is kubernetes.default.svc, which only works for in-cluster
validation.
type: string
kubeApiExternalName:
description: kubeApiExternalName specifies the external name for the
Kube API Server service.
maxLength: 100
minLength: 1
type: string
kubeconfig:
description: KubeConfig specifies the name and key for the kubeconfig
secret
Expand Down Expand Up @@ -4029,6 +4035,19 @@ spec:
- key
- name
type: object
kubeConfigExt:
description: |-
KubeConfigExt is a reference to the secret containing the external kubeconfig
for this control plane.
properties:
key:
type: string
name:
type: string
required:
- key
- name
type: object
kubeadminPassword:
description: |-
KubeadminPassword is a reference to the secret containing the initial kubeadmin password
Expand Down
Loading

0 comments on commit c866941

Please sign in to comment.