Skip to content

Commit a1c3486

Browse files
committed
fix: sanitize endpoint extraction in installation workflow for improved accuracy
Signed-off-by: Akash <[email protected]>
1 parent e0b2d7f commit a1c3486

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Diff for: .github/workflows/installation-chart.yaml

+2-6
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,15 @@ jobs:
127127
CMD=$(karmadactl token create --print-register-command --kubeconfig $KUBECONFIG)
128128
TOKEN=$(echo "$CMD" | grep -o '\--token [^ ]*' | cut -d' ' -f2)
129129
HASH=$(echo "$CMD" | grep -o '\--discovery-token-ca-cert-hash [^ ]*' | cut -d' ' -f2)
130-
# Extract server URL and ensure it's properly formatted
131-
ENDPOINT=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' | sed 's|//.*@|//|')
132-
echo "Extracted endpoint: $ENDPOINT"
133-
# Sanitize endpoint (remove any accidental leading/trailing spaces or quotes)
134-
ENDPOINT=$(echo "$ENDPOINT" | xargs)
130+
ENDPOINT=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' | sed 's|^https://||')
135131
echo "Sanitized endpoint: $ENDPOINT"
136132
echo "token=$TOKEN" >> $GITHUB_OUTPUT
137133
echo "hash=$HASH" >> $GITHUB_OUTPUT
138134
echo "endpoint=$ENDPOINT" >> $GITHUB_OUTPUT
139135
140136
- name: Register cluster
141137
run: |
142-
karmadactl register https://172.18.0.2:6443 \
138+
karmadactl register 172.18.0.2:6443 \
143139
--token ${{ steps.token.outputs.token }} \
144140
--discovery-token-ca-cert-hash ${{ steps.token.outputs.hash }} \
145141
--kubeconfig $HOME/.kube/karmada.config

0 commit comments

Comments
 (0)