From a644477266b1618e9ea68fa346c39ce5f7ca87f9 Mon Sep 17 00:00:00 2001 From: RainbowMango Date: Fri, 1 Nov 2024 17:34:21 +0800 Subject: [PATCH] Restrict supported service types of Karamda APIServer provisioned by karmada-operator. Signed-off-by: RainbowMango --- .../crds/operator.karmada.io_karmadas.yaml | 12 +++++++++--- .../config/crds/operator.karmada.io_karmadas.yaml | 12 +++++++++--- operator/pkg/apis/operator/v1alpha1/type.go | 8 ++++++-- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/charts/karmada-operator/crds/operator.karmada.io_karmadas.yaml b/charts/karmada-operator/crds/operator.karmada.io_karmadas.yaml index f191d3d18ee5..16814fa36fbf 100644 --- a/charts/karmada-operator/crds/operator.karmada.io_karmadas.yaml +++ b/charts/karmada-operator/crds/operator.karmada.io_karmadas.yaml @@ -2539,9 +2539,15 @@ spec: Defaults to "10.96.0.0/12". type: string serviceType: - description: |- - ServiceType represents the service type of karmada apiserver. - it is ClusterIP by default. + default: ClusterIP + description: |- + ServiceType represents the service type of Karmada API server. + Valid options are: "ClusterIP", "NodePort", "LoadBalancer". + Defaults to "ClusterIP". + enum: + - ClusterIP + - NodePort + - LoadBalancer type: string type: object karmadaAggregatedAPIServer: diff --git a/operator/config/crds/operator.karmada.io_karmadas.yaml b/operator/config/crds/operator.karmada.io_karmadas.yaml index f191d3d18ee5..16814fa36fbf 100644 --- a/operator/config/crds/operator.karmada.io_karmadas.yaml +++ b/operator/config/crds/operator.karmada.io_karmadas.yaml @@ -2539,9 +2539,15 @@ spec: Defaults to "10.96.0.0/12". type: string serviceType: - description: |- - ServiceType represents the service type of karmada apiserver. - it is ClusterIP by default. + default: ClusterIP + description: |- + ServiceType represents the service type of Karmada API server. + Valid options are: "ClusterIP", "NodePort", "LoadBalancer". + Defaults to "ClusterIP". + enum: + - ClusterIP + - NodePort + - LoadBalancer type: string type: object karmadaAggregatedAPIServer: diff --git a/operator/pkg/apis/operator/v1alpha1/type.go b/operator/pkg/apis/operator/v1alpha1/type.go index 954f95c571b5..adeed796a528 100644 --- a/operator/pkg/apis/operator/v1alpha1/type.go +++ b/operator/pkg/apis/operator/v1alpha1/type.go @@ -277,8 +277,12 @@ type KarmadaAPIServer struct { // +optional ServiceSubnet *string `json:"serviceSubnet,omitempty"` - // ServiceType represents the service type of karmada apiserver. - // it is ClusterIP by default. + // ServiceType represents the service type of Karmada API server. + // Valid options are: "ClusterIP", "NodePort", "LoadBalancer". + // Defaults to "ClusterIP". + // + // +kubebuilder:default="ClusterIP" + // +kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer // +optional ServiceType corev1.ServiceType `json:"serviceType,omitempty"`