diff --git a/apis/installer/v1alpha1/cluster_manager_spoke_types.go b/apis/installer/v1alpha1/cluster_manager_spoke_types.go
index 7819fddd..d86d88d3 100644
--- a/apis/installer/v1alpha1/cluster_manager_spoke_types.go
+++ b/apis/installer/v1alpha1/cluster_manager_spoke_types.go
@@ -50,10 +50,6 @@ type ClusterManagerSpokeSpec struct {
// +optional
Hub SpokeHub `json:"hub"`
- // Klusterlet is the klusterlet related configuration
- // +optional
- Klusterlet Klusterlet `json:"klusterlet"`
-
// Registry is the image registry related configuration
// +optional
Registry string `json:"registry"`
@@ -83,13 +79,6 @@ type SpokeHub struct {
KubeConfig string `json:"kubeConfig"`
}
-// Klusterlet is for templating klusterlet configuration
-type Klusterlet struct {
- // APIServer: The API Server external URL
- // +optional
- APIServer string `json:"apiServer"`
-}
-
type SpokeBundleVersion struct {
// registration image version
// +optional
diff --git a/apis/installer/v1alpha1/zz_generated.deepcopy.go b/apis/installer/v1alpha1/zz_generated.deepcopy.go
index 4ff68123..9c677fde 100644
--- a/apis/installer/v1alpha1/zz_generated.deepcopy.go
+++ b/apis/installer/v1alpha1/zz_generated.deepcopy.go
@@ -177,7 +177,6 @@ func (in *ClusterManagerSpokeList) DeepCopyObject() runtime.Object {
func (in *ClusterManagerSpokeSpec) DeepCopyInto(out *ClusterManagerSpokeSpec) {
*out = *in
out.Hub = in.Hub
- out.Klusterlet = in.Klusterlet
out.BundleVersion = in.BundleVersion
if in.RegistrationFeatures != nil {
in, out := &in.RegistrationFeatures, &out.RegistrationFeatures
@@ -246,21 +245,6 @@ func (in *HubInfo) DeepCopy() *HubInfo {
return out
}
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *Klusterlet) DeepCopyInto(out *Klusterlet) {
- *out = *in
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Klusterlet.
-func (in *Klusterlet) DeepCopy() *Klusterlet {
- if in == nil {
- return nil
- }
- out := new(Klusterlet)
- in.DeepCopyInto(out)
- return out
-}
-
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *SpokeBundleVersion) DeepCopyInto(out *SpokeBundleVersion) {
*out = *in
diff --git a/charts/cluster-manager-spoke/README.md b/charts/cluster-manager-spoke/README.md
index 213abf5b..4b2b75e8 100644
--- a/charts/cluster-manager-spoke/README.md
+++ b/charts/cluster-manager-spoke/README.md
@@ -50,7 +50,6 @@ The following table lists the configurable parameters of the `cluster-manager-sp
| clusterName | | ""
|
| hub.apiServer | | ""
|
| hub.kubeConfig | | ""
|
-| klusterlet.apiServer | | ""
|
| registry | | quay.io/open-cluster-management
|
| bundleVersion.registrationImageVersion | | ""
|
| bundleVersion.placementImageVersion | | ""
|
diff --git a/charts/cluster-manager-spoke/templates/klusterlets.cr.yaml b/charts/cluster-manager-spoke/templates/klusterlets.cr.yaml
index a0e98fba..fae4b943 100644
--- a/charts/cluster-manager-spoke/templates/klusterlets.cr.yaml
+++ b/charts/cluster-manager-spoke/templates/klusterlets.cr.yaml
@@ -45,6 +45,15 @@ data:
---
+# Test using:
+# helm install cluster-manager-spoke charts/cluster-manager-spoke --set hub.kubeConfig=abc --set clusterName=abc --dry-run=server
+
+{{- $spokeConfig := (lookup "v1" "ConfigMap" "kube-public" "cluster-info").data.kubeconfig | fromYaml -}}
+{{- $spokeServer := (dig "cluster" "server" "" (first $spokeConfig.clusters)) -}}
+{{- if not (or (hasPrefix "http://" $spokeServer) (hasPrefix "https://" $spokeServer)) }}
+{{- $spokeServer = "" }}
+{{- end }}
+
apiVersion: operator.open-cluster-management.io/v1
kind: Klusterlet
metadata:
@@ -57,10 +66,10 @@ spec:
imagePullSpec: {{ .Values.registry}}/registration-operator:{{ default .Chart.AppVersion .Values.bundleVersion.operatorImageVersion}}
clusterName: {{ required "A valid clusterName entry required!" .Values.clusterName }}
namespace: {{ $klusterletNamespace }}
+ {{- if $spokeServer }}
externalServerURLs:
- {{ if .Values.klusterlet.apiServer }}
- - url: {{ .Values.klusterlet.apiServer }}
- {{ end }}
+ - url: {{ $spokeServer }}
+ {{- end }}
{{if .Values.registrationFeatures}}
registrationConfiguration:
featureGates:
diff --git a/charts/cluster-manager-spoke/values.openapiv3_schema.yaml b/charts/cluster-manager-spoke/values.openapiv3_schema.yaml
index e19cb1ea..f6d30648 100644
--- a/charts/cluster-manager-spoke/values.openapiv3_schema.yaml
+++ b/charts/cluster-manager-spoke/values.openapiv3_schema.yaml
@@ -19,11 +19,6 @@ properties:
kubeConfig:
type: string
type: object
- klusterlet:
- properties:
- apiServer:
- type: string
- type: object
managedKubeconfig:
type: string
registrationFeatures:
diff --git a/charts/cluster-manager-spoke/values.yaml b/charts/cluster-manager-spoke/values.yaml
index c4f7b849..5a958e6c 100644
--- a/charts/cluster-manager-spoke/values.yaml
+++ b/charts/cluster-manager-spoke/values.yaml
@@ -4,9 +4,6 @@ hub:
apiServer: ""
kubeConfig: ""
-klusterlet:
- apiServer: ""
-
registry: quay.io/open-cluster-management
bundleVersion: