You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by le...@apache.org on 2022/10/15 07:01:01 UTC

[incubator-linkis] branch dev-1.3.0 updated: fix(linkis-dist): fix the install-linkis-to-kubernetes.sh error (#3658)

This is an automated email from the ASF dual-hosted git repository.

legendtkl pushed a commit to branch dev-1.3.0
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.3.0 by this push:
     new d69a234ec fix(linkis-dist): fix the install-linkis-to-kubernetes.sh error (#3658)
d69a234ec is described below

commit d69a234eccf37c38ac2e71f623f428175541512f
Author: jacktao007 <ja...@gmail.com>
AuthorDate: Sat Oct 15 15:00:53 2022 +0800

    fix(linkis-dist): fix the install-linkis-to-kubernetes.sh error (#3658)
    
    * fix(linkis-dist): fix the install-linkis-to-kubernetes.sh exception
    
    * fix(linkis-dist): fixed an error getting pods
    
    * fix(linkis-dist): add reset command
    
    * fix(linkis-dist): fix error
---
 linkis-dist/bin/install-linkis-to-kubernetes.sh | 74 +++++++++++++++----------
 1 file changed, 45 insertions(+), 29 deletions(-)

diff --git a/linkis-dist/bin/install-linkis-to-kubernetes.sh b/linkis-dist/bin/install-linkis-to-kubernetes.sh
index 6a7e7d5bb..dbc54de70 100644
--- a/linkis-dist/bin/install-linkis-to-kubernetes.sh
+++ b/linkis-dist/bin/install-linkis-to-kubernetes.sh
@@ -16,18 +16,32 @@
 
 #variable
 WORK_DIR=`cd $(dirname $0); pwd -P`
+ROOT_DIR=${WORK_DIR}/..
 MIRRORS="ghcr.io"
 TAG="latest"
 COMMAND="pull-install"
 DEBUG=false
 WITH_LDH=false
 
+
+debug(){
+    if [ $DEBUG = true ]; then
+        echo $(date "+%Y-%m-%d %H:%M:%S") "debug: "$1
+    fi
+}
+
+info(){
+    echo $(date "+%Y-%m-%d %H:%M:%S") "info: "$1
+}
+
+
 #help info
 help() {
     echo "Command        Describe"
     echo "pull-install   pull and install linkis images"
     echo "install        pull linkis images"
     echo "pull           pull linkis images"
+    echo "reset          delete the test-helm cluster of kind"
     echo "help           print help info"
     echo ""
     echo "Params         Describe"
@@ -37,53 +51,56 @@ help() {
     echo "-t             tag name "
     echo ""
     echo "example:"
-    echo "./install-kubernetes.sh pull                                   pull image with ghcr.io"
-    echo "./install-kubernetes.sh -t latest                              pull image with tag"
-    echo "./install-kubernetes.sh pull -m ghcr.dockerproxy.com           pull image with ghcr.dockerproxy.com"
-    echo "./install-kubernetes.sh install                                install linkis to kind and kubernetes"
-    echo "./install-kubernetes.sh pull-install -m ghcr.dockerproxy.com   pull image and install linkis to kind and kubernetes"
+    echo "./install-linkis-to-kubernetes.sh pull                                  pull image with ghcr.io"
+    echo "./install-linkis-to-kubernetes.sh -tlatest                              pull image with tag"
+    echo "./install-linkis-to-kubernetes.sh pull -mghcr.dockerproxy.com           pull image with ghcr.dockerproxy.com or ghcr.nju.edu.cn"
+    echo "./install-linkis-to-kubernetes.sh install -l -mghcr.dockerproxy.com     install linkis to kind and kubernetes with ldh"
+    echo "./install-linkis-to-kubernetes.sh pull-install -mghcr.dockerproxy.com   pull image and install linkis to kind and kubernetes"
 }
 
 #pull the container image of the linkis
 pull(){
-    docker pull $MIRRORS/apache/incubator-linkis/linkis-ldh:${TAG}
-    docker pull $MIRRORS/apache/incubator-linkis/linkis:${TAG}
-    docker pull $MIRRORS/apache/incubator-linkis/linkis-web:${TAG}
+    debug ${MIRRORS}/apache/incubator-linkis/linkis-ldh:${TAG}
+    docker pull ${MIRRORS}/apache/incubator-linkis/linkis-ldh:${TAG}
+    debug ${MIRRORS}/apache/incubator-linkis/linkis:${TAG}
+    docker pull ${MIRRORS}/apache/incubator-linkis/linkis:${TAG}
+    debug ${MIRRORS}/apache/incubator-linkis/linkis-web:${TAG}
+    docker pull ${MIRRORS}/apache/incubator-linkis/linkis-web:${TAG}
 }
 #change the label
 tag(){
-    docker tag  $MIRRORS/apache/incubator-linkis/linkis:${TAG} linkis:dev
-    docker tag  $MIRRORS/apache/incubator-linkis/linkis-web:${TAG} linkis-web:dev
-    docker tag  $MIRRORS/apache/incubator-linkis/linkis-ldh:${TAG} linkis-ldh:dev
+    docker tag  ${MIRRORS}/apache/incubator-linkis/linkis:${TAG} linkis:dev
+    docker tag  ${MIRRORS}/apache/incubator-linkis/linkis-web:${TAG} linkis-web:dev
+    docker tag  ${MIRRORS}/apache/incubator-linkis/linkis-ldh:${TAG} linkis-ldh:dev
 }
 #create an image to carry mysql
 make_linikis_image_with_mysql_jdbc(){
-    ${WORK_DIR}/docker/scripts/make-linikis-image-with-mysql-jdbc.sh
+    ${ROOT_DIR}/docker/scripts/make-linikis-image-with-mysql-jdbc.sh
     docker tag linkis:with-jdbc linkis:dev
 }
 #creating a kind cluster
 create_kind_cluster(){
-    ${WORK_DIR}/helm/scripts/create-kind-cluster.sh
+    ${ROOT_DIR}/helm/scripts/create-kind-cluster.sh
 }
 #mysql installation
 install_mysql(){
-    ${WORK_DIR}/helm/scripts/install-mysql.sh
+    ${ROOT_DIR}/helm/scripts/install-mysql.sh
 }
 #ldh installation
 install_ldh(){
-    ${WORK_DIR}/helm/scripts/install-ldh.sh
+    ${ROOT_DIR}/helm/scripts/install-ldh.sh
 }
 #linkis installation
 install_linkis(){
     if [ $WITH_LDH = true ];then
-      ${WORK_DIR}/helm/scripts/install-charts-with-ldh.sh
+      ${ROOT_DIR}/helm/scripts/install-charts-with-ldh.sh
     else
-      ${WORK_DIR}/helm/scripts/install-linkis.sh
+      ${ROOT_DIR}/helm/scripts/install-linkis.sh
     fi
 }
 #display pods
 display_pods(){
-    kubectl get pods -a
+    kubectl get pods -A
 }
 
 install(){
@@ -96,14 +113,8 @@ install(){
     display_pods
 }
 
-debug(){
-    if [ $DEBUG = true ]; then
-        echo $(date "+%Y-%m-%d %H:%M:%S") "debug: "$1
-    fi
-}
-
-info(){
-    echo $(date "+%Y-%m-%d %H:%M:%S") "info: "$1
+reset(){
+    kind delete clusters test-helm
 }
 
 
@@ -124,7 +135,7 @@ check_kind(){
 }
 
 check_kubectl(){
-    kubectl version >> /dev/null 2>&1
+    kubectl >> /dev/null 2>&1
     if [ $? -ne  0 ]; then
         echo "kubectl is not installed!"
         exit 1
@@ -140,6 +151,8 @@ check_helm(){
 }
 
 
+debug $WORK_DIR
+
 #entrance to the program
 main(){
 
@@ -151,8 +164,7 @@ main(){
 
     #argument parsing
     long_opts="debug,mirrors:"
-    getopt_cmd=$(getopt -o dmlt: \
-                -n $(basename $0) -- "$@") || \
+    getopt_cmd=$(getopt -o dm:lt: -n $(basename $0) -- "$@") || \
                 { echo -e "\nERROR: Getopt failed. Extra args\n"; exit 1;}
 
     eval set -- "$getopt_cmd"
@@ -191,6 +203,10 @@ main(){
         pull
     fi
 
+    if [ $COMMAND = "reset" ]; then
+        reset
+    fi
+
     if [ $COMMAND = "help" ]; then
         help
     fi


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org