@@ -36,82 +36,20 @@ jobs:
36
36
uses : actions/setup-go@v5
37
37
with :
38
38
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
44
39
- name : run karmadactl init test
45
40
run : |
46
41
export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
47
-
48
- # init e2e environment
49
42
hack/cli-testing-environment.sh
50
-
51
- # run a single e2e
52
43
export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
53
44
GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo
54
45
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
-
106
46
- name : export logs
107
47
if : always()
108
48
run : |
109
49
export ARTIFACTS_PATH=${{ github.workspace }}/karmadactl-test-logs/${{ matrix.k8s }}/
110
50
mkdir -p $ARTIFACTS_PATH
111
-
112
51
mkdir -p $ARTIFACTS_PATH/karmada-host
113
52
kind export logs --name=karmada-host $ARTIFACTS_PATH/karmada-host
114
-
115
53
- name : upload logs
116
54
if : always()
117
55
uses : actions/upload-artifact@v4
125
63
strategy :
126
64
fail-fast : false
127
65
matrix :
128
- # Latest three minor releases of Kubernetes
129
66
k8s : [ v1.29.0, v1.30.0, v1.31.0 ]
130
67
steps :
131
68
- name : checkout code
@@ -136,31 +73,34 @@ jobs:
136
73
uses : actions/setup-go@v5
137
74
with :
138
75
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
150
77
run : |
151
78
export CLUSTER_VERSION=kindest/node:${{ matrix.k8s }}
152
79
hack/cli-testing-init-with-config.sh
153
80
export KUBECONFIG=${HOME}/karmada/karmada-apiserver.config
154
81
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
157
86
run : |
158
87
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
162
97
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
+
164
104
- name : export logs for config test
165
105
if : always()
166
106
run : |
0 commit comments