adugeek commented on a change in pull request #4880:
URL: https://github.com/apache/apisix/pull/4880#discussion_r711915090



##########
File path: ci/install-ext-services-via-docker.sh
##########
@@ -87,4 +87,84 @@ until  [[ $(curl -s 
"127.0.0.1:8858/nacos/v1/ns/service/list?groupName=test_grou
     sleep 1;
 done
 
+# create kubernetes cluster using kind
+echo -e "
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+networking:
+  apiServerAddress: "127.0.0.1"
+  apiServerPort: 6443
+" > kind.yaml
+
+curl -Lo ./kind "https://kind.sigs.k8s.io/dl/v0.11.1/kind-$(uname)-amd64"
+chmod +x ./kind
+./kind delete cluster --name apisix-test
+./kind create cluster --name apisix-test --config ./kind.yaml
+
+echo -e "
+kind: ServiceAccount
+apiVersion: v1
+metadata:
+  name: apisix-test
+  namespace: default
+---
+kind: ClusterRole
+apiVersion: rbac.authorization.k8s.io/v1
+metadata:
+  name: apisix-test
+rules:
+  - apiGroups: [ \"\" ]
+    resources: [ endpoints ]
+    verbs: [ get,list,watch ]
+---
+
+apiVersion: rbac.authorization.k8s.io/v1
+kind: ClusterRoleBinding
+metadata:
+    name: apisix-test
+roleRef:
+  apiGroup: rbac.authorization.k8s.io
+  kind: ClusterRole
+  name: apisix-test
+subjects:
+  - kind: ServiceAccount
+    name: apisix-test
+    namespace: default
+" > apisix-test-rbac.yaml
+
+curl -Lo ./kubectl "https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl";
+chmod +x ./kubectl
+./kubectl apply -f ./apisix-test-rbac.yaml
+./kubectl proxy -p 6445 &
+
+curl -Lo ./jq 
https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
+chmod +x ./jq
+
+until [[ $(curl 
127.0.0.1:6445/api/v1/pods?fieldSelector=status.phase%21%3DRunning |./jq 
.items) == "[]" ]]; do

Review comment:
       maybe we can use like this:
   ```shell
   until [[ $(./kubectl get pods -A --field-selector status.phase!=Running) == 
"No resources found" ]]; do
     sleep 1;
   fi
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to