@@ -36,82 +36,20 @@ jobs:
3636 uses : actions/setup-go@v5
3737 with :
3838 go-version-file : go.mod
39- - name : Build karmadactl
40- run : |
41- mkdir -p ${HOME}/go/bin
42- go build -o ${HOME}/go/bin/karmadactl ./cmd/karmadactl
43- echo "${HOME}/go/bin" >> $GITHUB_PATH
4439 - name : run karmadactl init test
4540 run : |
4641 export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
47-
48- # init e2e environment
4942 hack/cli-testing-environment.sh
50-
51- # run a single e2e
5243 export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
5344 GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo
5445 ginkgo -v --race --trace -p --focus="[BasicPropagation] propagation testing deployment propagation testing" ./test/e2e/
55-
56- - name : Get token info
57- id : token
58- run : |
59- export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
60- CMD=$(karmadactl token create --print-register-command --kubeconfig $KUBECONFIG)
61- TOKEN=$(echo "$CMD" | grep -o '\--token [^ ]*' | cut -d' ' -f2)
62- HASH=$(echo "$CMD" | grep -o '\--discovery-token-ca-cert-hash [^ ]*' | cut -d' ' -f2)
63- ENDPOINT=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' | sed 's|^https://||')
64- echo "token=$TOKEN" >> $GITHUB_OUTPUT
65- echo "hash=$HASH" >> $GITHUB_OUTPUT
66- echo "endpoint=$ENDPOINT" >> $GITHUB_OUTPUT
67-
68- - name : Update /etc/hosts for karmada-host
69- run : |
70- ENDPOINT_IP=$(echo "${{ steps.token.outputs.endpoint }}" | cut -d':' -f1)
71- echo "$ENDPOINT_IP karmada-host-control-plane" | sudo tee -a /etc/hosts
72-
73- - name : Configure RBAC for certificate signing
74- run : |
75- export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
76- kubectl create clusterrolebinding karmada-bootstrap-csr \
77- --clusterrole=system:node-bootstrapper \
78- --group=system:bootstrappers
79-
80- - name : Configure CSR Auto-Approval
81- run : |
82- export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
83- kubectl apply -f - <<EOF
84- apiVersion: rbac.authorization.k8s.io/v1
85- kind: ClusterRoleBinding
86- metadata:
87- name: auto-approve-csrs-for-bootstrappers
88- roleRef:
89- apiGroup: rbac.authorization.k8s.io
90- kind: ClusterRole
91- name: system:certificates.k8s.io:certificatesigningrequests:nodeclient
92- subjects:
93- - kind: Group
94- name: system:bootstrappers
95- apiGroup: rbac.authorization.k8s.io
96- EOF
97-
98- - name : Register cluster
99- run : |
100- karmadactl register ${{ steps.token.outputs.endpoint }} \
101- --token ${{ steps.token.outputs.token }} \
102- --discovery-token-ca-cert-hash ${{ steps.token.outputs.hash }} \
103- --discovery-timeout=10m \
104- --kubeconfig ${HOME}/karmada/karmada-apiserver.config
105-
10646 - name : export logs
10747 if : always()
10848 run : |
10949 export ARTIFACTS_PATH=${{ github.workspace }}/karmadactl-test-logs/${{ matrix.k8s }}/
11050 mkdir -p $ARTIFACTS_PATH
111-
11251 mkdir -p $ARTIFACTS_PATH/karmada-host
11352 kind export logs --name=karmada-host $ARTIFACTS_PATH/karmada-host
114-
11553 - name : upload logs
11654 if : always()
11755 uses : actions/upload-artifact@v4
12563 strategy :
12664 fail-fast : false
12765 matrix :
128- # Latest three minor releases of Kubernetes
12966 k8s : [ v1.29.0, v1.30.0, v1.31.0 ]
13067 steps :
13168 - name : checkout code
@@ -136,31 +73,34 @@ jobs:
13673 uses : actions/setup-go@v5
13774 with :
13875 go-version-file : go.mod
139- - name : Build karmadactl
140- run : |
141- # Ensure the target directory exists and is writable
142- mkdir -p ${HOME}/go/bin
143-
144- # Build karmadactl to the user-controlled directory
145- go build -o ${HOME}/go/bin/karmadactl ./cmd/karmadactl
146-
147- # Add the binary directory to PATH
148- echo "${HOME}/go/bin" >> $GITHUB_PATH
149- - name : Run karmadactl init with config file test
76+ - name : run karmadactl init with config file test
15077 run : |
15178 export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
15279 hack/cli-testing-init-with-config.sh
15380 export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
15481 GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo
155- ginkgo -v --race --trace -p --focus="[BasicPropagation] propagation testing deployment propagation testing" ./test/e2e/
156- - name : Generate registration command
82+ ginkgo -v --race --trace -p --focus="[BasicPropagation] propagation testing deployment propagation testing" ./test/e2e/
83+
84+ - name : Get token info for registration
85+ id : token
15786 run : |
15887 export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
159- karmadactl token create --print-register-command > register-command.sh
160- chmod +x register-command.sh
161- - name : Register cluster in pull mode
88+ CMD=$(karmadactl token create --print-register-command --kubeconfig $KUBECONFIG)
89+ TOKEN=$(echo "$CMD" | grep -o '\--token [^ ]*' | cut -d' ' -f2)
90+ HASH=$(echo "$CMD" | grep -o '\--discovery-token-ca-cert-hash [^ ]*' | cut -d' ' -f2)
91+ ENDPOINT=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}' | sed 's|^https://||')
92+ echo "token=$TOKEN" >> $GITHUB_OUTPUT
93+ echo "hash=$HASH" >> $GITHUB_OUTPUT
94+ echo "endpoint=$ENDPOINT" >> $GITHUB_OUTPUT
95+
96+ - name : Register cluster using token
16297 run : |
163- ./register-command.sh --cluster-name ${{ matrix.k8s }} --kubeconfig ${HOME}/karmada/karmada-apiserver.config
98+ karmadactl register ${{ steps.token.outputs.endpoint }} \
99+ --token ${{ steps.token.outputs.token }} \
100+ --discovery-token-ca-cert-hash ${{ steps.token.outputs.hash }} \
101+ --discovery-timeout=10m \
102+ --kubeconfig ${HOME}/karmada/karmada-apiserver.config
103+
164104 - name : export logs for config test
165105 if : always()
166106 run : |
0 commit comments