Skip to content

Commit

Permalink
fix: enhance token retrieval process in installation workflow for imp…
Browse files Browse the repository at this point in the history
…roved accuracy

Signed-off-by: Akash <[email protected]>
  • Loading branch information
SkySingh04 committed Feb 2, 2025
1 parent cc9d564 commit 2eda0fa
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/installation-chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,21 @@ jobs:
ls -la $HOME/.kube/karmada.config
cat $HOME/.kube/karmada.config
- name: Register cluster
- name: Get token info
id: token
run: |
export KUBECONFIG=$HOME/.kube/karmada.config
$(karmadactl token create --print-register-command --kubeconfig $HOME/.kube/karmada.config)
CMD=$(karmadactl token create --print-register-command)
TOKEN=$(echo "$CMD" | grep -o '\--token [^ ]*' | cut -d' ' -f2)
HASH=$(echo "$CMD" | grep -o '\--discovery-token-ca-cert-hash [^ ]*' | cut -d' ' -f2)
ENDPOINT=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')
echo "token=$TOKEN" >> $GITHUB_OUTPUT
echo "hash=$HASH" >> $GITHUB_OUTPUT
echo "endpoint=$ENDPOINT" >> $GITHUB_OUTPUT
- name: Register cluster
run: |
karmadactl register ${{ steps.token.outputs.endpoint }} \
--token ${{ steps.token.outputs.token }} \
--discovery-token-ca-cert-hash ${{ steps.token.outputs.hash }} \
--kubeconfig $HOME/.kube/karmada.config

0 comments on commit 2eda0fa

Please sign in to comment.