Skip to content

Commit

Permalink
Set spokeServer to an empty string if cluster-info ConfigMap not found (
Browse files Browse the repository at this point in the history
#22)

Signed-off-by: Rokibul Hasan <[email protected]>
  • Loading branch information
RokibulHasan7 authored Jul 18, 2024
1 parent dd96554 commit 43fe692
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions charts/cluster-manager-spoke/templates/klusterlets.cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ spec:
# 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 := default (dig "cluster" "server" "" (first $spokeConfig.clusters)) .Values.hub.apiServer -}}
{{- if not (or (hasPrefix "http://" $spokeServer) (hasPrefix "https://" $spokeServer)) }}
{{- $spokeServer = "" }}
{{- $spokeServer := "" }}
{{- with (lookup "v1" "ConfigMap" "kube-public" "cluster-info") }}
{{- $spokeConfig := .data.kubeconfig | fromYaml }}
{{- $spokeServer = default (dig "cluster" "server" "" (first $spokeConfig.clusters)) "" -}}
{{- end }}

apiVersion: operator.open-cluster-management.io/v1
Expand Down

0 comments on commit 43fe692

Please sign in to comment.