This is an automated email from the ASF dual-hosted git repository.
casion 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 1e6c50b42 fix(linkis-dist): optimized the install-kubernetes.sh script
(#3629)
1e6c50b42 is described below
commit 1e6c50b42cc4804791aaf36d37e4ac1b03d361bd
Author: jacktao007 <[email protected]>
AuthorDate: Thu Oct 13 20:51:23 2022 +0800
fix(linkis-dist): optimized the install-kubernetes.sh script (#3629)
---
linkis-dist/bin/install-kubernetes.sh | 29 ----
linkis-dist/bin/install-linkis-to-kubernetes.sh | 199 ++++++++++++++++++++++++
2 files changed, 199 insertions(+), 29 deletions(-)
diff --git a/linkis-dist/bin/install-kubernetes.sh
b/linkis-dist/bin/install-kubernetes.sh
deleted file mode 100644
index e80ec7b4b..000000000
--- a/linkis-dist/bin/install-kubernetes.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.apache.org/licenses/LICENSE-2.0
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-docker pull ghcr.io/apache/incubator-linkis/linkis-ldh:latest
-docker pull ghcr.io/apache/incubator-linkis/linkis:latest
-docker pull ghcr.io/apache/incubator-linkis/linkis-web:latest
-docker tag ghcr.io/apache/incubator-linkis/linkis:latest linkis:dev
-docker tag ghcr.io/apache/incubator-linkis/linkis-web:latest linkis-web:dev
-docker tag ghcr.io/apache/incubator-linkis/linkis-ldh:latest linkis-ldh:dev
-../docker/scripts/make-linikis-image-with-mysql-jdbc.sh
-docker tag linkis:with-jdbc linkis:dev
-../helm/scripts/create-kind-cluster.sh
-../helm/scripts/install-mysql.shl
-../helm/scripts/install-ldh.sh
-../helm/scripts/install-linkis.sh
-kubectl get pods -A
diff --git a/linkis-dist/bin/install-linkis-to-kubernetes.sh
b/linkis-dist/bin/install-linkis-to-kubernetes.sh
new file mode 100644
index 000000000..6a7e7d5bb
--- /dev/null
+++ b/linkis-dist/bin/install-linkis-to-kubernetes.sh
@@ -0,0 +1,199 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#variable
+WORK_DIR=`cd $(dirname $0); pwd -P`
+MIRRORS="ghcr.io"
+TAG="latest"
+COMMAND="pull-install"
+DEBUG=false
+WITH_LDH=false
+
+#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 "help print help info"
+ echo ""
+ echo "Params Describe"
+ echo "-m url (default:ghcr.io , eg: ghcr.dockerproxy.com)"
+ echo "-d print debug info"
+ echo "-l install linkis with ldh"
+ 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"
+}
+
+#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}
+}
+#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
+}
+#create an image to carry mysql
+make_linikis_image_with_mysql_jdbc(){
+ ${WORK_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
+}
+#mysql installation
+install_mysql(){
+ ${WORK_DIR}/helm/scripts/install-mysql.sh
+}
+#ldh installation
+install_ldh(){
+ ${WORK_DIR}/helm/scripts/install-ldh.sh
+}
+#linkis installation
+install_linkis(){
+ if [ $WITH_LDH = true ];then
+ ${WORK_DIR}/helm/scripts/install-charts-with-ldh.sh
+ else
+ ${WORK_DIR}/helm/scripts/install-linkis.sh
+ fi
+}
+#display pods
+display_pods(){
+ kubectl get pods -a
+}
+
+install(){
+ tag
+ make_linikis_image_with_mysql_jdbc
+ create_kind_cluster
+ install_mysql
+ install_ldh
+ install_linkis
+ 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
+}
+
+
+check_docker(){
+ docker -v >> /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "Docker is not installed!"
+ exit 1
+ fi
+}
+
+check_kind(){
+ kind --version >> /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "kind is not installed!"
+ exit 1
+ fi
+}
+
+check_kubectl(){
+ kubectl version >> /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "kubectl is not installed!"
+ exit 1
+ fi
+}
+
+check_helm(){
+ helm version >> /dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ echo "helm is not installed!"
+ exit 1
+ fi
+}
+
+
+#entrance to the program
+main(){
+
+ #environmental testing
+ check_docker
+ check_kind
+ check_kubectl
+ check_helm
+
+ #argument parsing
+ long_opts="debug,mirrors:"
+ getopt_cmd=$(getopt -o dmlt: \
+ -n $(basename $0) -- "$@") || \
+ { echo -e "\nERROR: Getopt failed. Extra args\n"; exit 1;}
+
+ eval set -- "$getopt_cmd"
+ while true; do
+ case "$1" in
+ -d) DEBUG=true;;
+ -m) MIRRORS=$2;;
+ -l) WITH_LDH=true;;
+ -t) TAG=$2;;
+ --) shift; break;;
+ esac
+ shift
+ done
+
+ debug "params num:"$#
+
+ #command parsing
+ if [ $# -eq 0 ]; then
+ COMMAND="pull-install"
+ else
+ COMMAND=$1
+ fi
+
+ debug "command is:"$COMMAND
+
+ if [ $COMMAND = "pull-install" ]; then
+ pull
+ install
+ fi
+
+ if [ $COMMAND = "install" ]; then
+ install
+ fi
+
+ if [ $COMMAND = "pull" ]; then
+ pull
+ fi
+
+ if [ $COMMAND = "help" ]; then
+ help
+ fi
+}
+
+main $@
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]