Skip to content

Commit

Permalink
Optimize the install script
Browse files Browse the repository at this point in the history
1. Add some usage doc comment.
2. Install Sedna latest release version when unspecified.

Signed-off-by: llhuii <[email protected]>
  • Loading branch information
llhuii committed Sep 14, 2021
1 parent e110ac7 commit 29f17b1
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions scripts/installation/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,46 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# Influential env vars:
#
# SEDNA_GM_NODE | required | The node which Sedna gm will be deployed at
# SEDNA_ACTION | optional | 'create'/'clean', default is 'create'
# SEDNA_VERSION | optional | The Sedna version to be installed.
# if not specified, it will get latest release version.
# SEDNA_ROOT | optional | The Sedna offline directory

set -o errexit
set -o nounset
set -o pipefail

SEDNA_VERSION=v0.3.0
KB_VERSION=v0.3.0

TMP_DIR=$(mktemp -d --suffix=.sedna)
SEDNA_ROOT=${SEDNA_ROOT:-$TMP_DIR}

GM_NODE_NAME=${SEDNA_GM_NODE:-}
KB_NODE_NAME=${SEDNA_GM_NODE:-}

DEFAULT_SEDNA_VERSION=v0.4.0


trap "rm -rf '$TMP_DIR'" EXIT

get_latest_version() {
# get Sedna latest release version
local repo=kubeedge/sedna
# output of this latest page:
# ...
# "tag_name": "v1.0.0",
# ...
{
curl -s https://api.github.com/repos/$repo/releases/latest |
awk '/"tag_name":/&&$0=$2' |
sed 's/[",]//g'
} || echo $DEFAULT_SEDNA_VERSION # fallback
}

: ${SEDNA_VERSION:=$(get_latest_version)}
: ${KB_VERSION:=v0.3.0}

_download_yamls() {

yaml_dir=$1
Expand Down Expand Up @@ -332,6 +356,7 @@ delete_lc() {
}

wait_ok() {
echo "Waiting control components to be ready..."
kubectl -n sedna wait --for=condition=available --timeout=600s deployment/gm
kubectl -n sedna wait pod --for=condition=Ready --selector=sedna
kubectl -n sedna get pod
Expand Down Expand Up @@ -396,6 +421,7 @@ do_check
prepare
case "$action" in
create)
echo "Installing Sedna $SEDNA_VERSION..."
prepare_install
create_crds
create_kb
Expand Down

0 comments on commit 29f17b1

Please sign in to comment.