yangwwei commented on a change in pull request #229:
URL: 
https://github.com/apache/incubator-yunikorn-k8shim/pull/229#discussion_r569617775



##########
File path: deployments/examples/gang/cmd/gangDeploy.sh
##########
@@ -26,46 +26,22 @@ set -o pipefail
 JOBAMOUNT=$1
 GANGMEMBER=$2
 RUNTIMESEC=$3
+TIMEOUT=0
+
+# create service and job counter web server
+WORKDIR=$(cd "$(dirname "$0")"; pwd)
+kubectl apply -f $WORKDIR/../gang-coordinator.yaml
 
-# create service
-kubectl create -f <(cat << EOF
-apiVersion: v1
-kind: Service
-metadata:
-  name: gangservice
-  labels:
-    app: gang
-spec:
-  selector:
-    app: gang
-  type: ClusterIP
-  ports:
-  - protocol: TCP
-    port: 8863
-    targetPort: 8863
-EOF) 
-# create job counter web server
-kubectl create -f <(cat << EOF
-apiVersion: v1
-kind: Pod
-metadata:
-  name: gangweb
-  labels:
-    app: gang
-    queue: root.sandbox
-spec:
-  schedulerName: yunikorn
-  containers:
-    - name: gangweb
-      image: apache/yunikorn:simulation-gang-coordinator-latest
-      imagePullPolicy: Never
-      ports:
-        - containerPort: 8863
-EOF)
 # wait for web server to be running
-until grep 'Running' <(kubectl get pod gangweb -o=jsonpath='{.status.phase}'); 
do
+until grep -q 'Running' <(kubectl get pod gangweb 
-o=jsonpath='{.status.phase}'); do
   sleep 1
+  TIMEOUT=$(($TIMEOUT+1))
+  if [ $TIMEOUT -ge 20 ]; then
+    echo "Timeout for waiting web server"

Review comment:
       before exit, can we delete the resources it created earlier?
   ```
   kubectl delete -f $WORKDIR/../gang-coordinator.yaml
   ```

##########
File path: deployments/examples/gang/cmd/gangDeploy.sh
##########
@@ -26,46 +26,22 @@ set -o pipefail
 JOBAMOUNT=$1
 GANGMEMBER=$2
 RUNTIMESEC=$3
+TIMEOUT=0
+
+# create service and job counter web server
+WORKDIR=$(cd "$(dirname "$0")"; pwd)
+kubectl apply -f $WORKDIR/../gang-coordinator.yaml

Review comment:
       please add a check here in case the `gang-coordinator.yaml` is not in 
the right place.
   we can explicitly fail with an error: "gang-coordinator.yaml is not found in 
path xxxx"




----------------------------------------------------------------
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.

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


Reply via email to