Compare commits
20 Commits
feat/files
...
ci/package
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
293e7f993e | ||
|
|
c3e476611e | ||
|
|
1058db0949 | ||
|
|
dd0dc814ee | ||
|
|
2c5c7c63d4 | ||
|
|
4ed5a64c7e | ||
|
|
a35cfb2d91 | ||
|
|
4c99f06a53 | ||
|
|
90ee131719 | ||
|
|
02a0db46b0 | ||
|
|
90903a8cb7 | ||
|
|
29fb6c3216 | ||
|
|
e1b9cb8f02 | ||
|
|
95b1ccc638 | ||
|
|
8424d5c591 | ||
|
|
e6d9e007a0 | ||
|
|
508f1d2783 | ||
|
|
7c647b803b | ||
|
|
0947131801 | ||
|
|
e0fdfc4e00 |
21
.github/workflows/push-to-s3.yaml
vendored
21
.github/workflows/push-to-s3.yaml
vendored
@@ -3,21 +3,32 @@ name: Push images to S3
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
jobs:
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 'Checkout source code'
|
||||
- name: "Checkout source code"
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# test
|
||||
- env:
|
||||
- env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: 'us-east-1'
|
||||
AWS_DEFAULT_REGION: "us-east-1"
|
||||
run: |
|
||||
bash scripts/image-manifest.sh && bash scripts/upload-images.sh .manifest/images.mf
|
||||
|
||||
|
||||
push-arm64:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: "Checkout source code"
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: "us-east-1"
|
||||
run: |
|
||||
bash scripts/image-manifest.sh && bash scripts/upload-images.sh .manifest/images.mf linux/arm64
|
||||
|
||||
117
.github/workflows/release.yaml
vendored
117
.github/workflows/release.yaml
vendored
@@ -1,19 +1,114 @@
|
||||
|
||||
|
||||
name: Install Wizard Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tags:
|
||||
description: 'Release Tags'
|
||||
description: "Release Tags"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: 'Checkout source code'
|
||||
- name: "Checkout source code"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tags }}
|
||||
|
||||
- env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: "us-east-1"
|
||||
run: |
|
||||
bash scripts/image-manifest.sh && bash scripts/upload-images.sh .manifest/images.mf
|
||||
|
||||
push-arm64:
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
- name: "Checkout source code"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tags }}
|
||||
|
||||
- env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: "us-east-1"
|
||||
run: |
|
||||
bash scripts/image-manifest.sh && bash scripts/upload-images.sh .manifest/images.mf linux/arm64
|
||||
|
||||
upload-full:
|
||||
needs: [push, push-arm64]
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# - name: Maximize build space
|
||||
# uses: easimon/maximize-build-space@master
|
||||
# with:
|
||||
# root-reserve-mb: 21200
|
||||
# swap-size-mb: 1024
|
||||
# remove-dotnet: 'true'
|
||||
# remove-android: 'true'
|
||||
# remove-haskell: 'true'
|
||||
# remove-codeql: 'true'
|
||||
|
||||
- name: "Checkout source code"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tags }}
|
||||
|
||||
- name: Package installer
|
||||
run: |
|
||||
bash scripts/build.sh ${{ github.event.inputs.tags }}
|
||||
|
||||
- name: Upload to S3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: "us-east-1"
|
||||
run: |
|
||||
aws s3 cp install-wizard-v${{ github.event.inputs.tags }}.tar.gz s3://terminus-os-install/install-wizard-v${{ github.event.inputs.tags }}.tar.gz --acl=public-read
|
||||
|
||||
upload-full-arm64:
|
||||
needs: [push, push-arm64]
|
||||
runs-on: self-hosted
|
||||
|
||||
steps:
|
||||
# - name: Maximize build space
|
||||
# uses: easimon/maximize-build-space@master
|
||||
# with:
|
||||
# root-reserve-mb: 21200
|
||||
# swap-size-mb: 1024
|
||||
# remove-dotnet: 'true'
|
||||
# remove-android: 'true'
|
||||
# remove-haskell: 'true'
|
||||
# remove-codeql: 'true'
|
||||
|
||||
- name: "Checkout source code"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tags }}
|
||||
|
||||
- name: Package installer
|
||||
run: |
|
||||
bash scripts/build.sh ${{ github.event.inputs.tags }} linux/arm64
|
||||
|
||||
- name: Upload to S3
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: "us-east-1"
|
||||
run: |
|
||||
aws s3 cp install-wizard-v${{ github.event.inputs.tags }}.tar.gz s3://terminus-os-install/install-wizard-${{ github.event.inputs.tags }}-arm64.tar.gz --acl=public-read
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [upload-full, upload-full-arm64]
|
||||
|
||||
steps:
|
||||
- name: "Checkout source code"
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.inputs.tags }}
|
||||
@@ -25,10 +120,10 @@ jobs:
|
||||
- name: Update version
|
||||
uses: eball/write-tag-to-version-file@latest
|
||||
with:
|
||||
filename: 'build/installer/wizard/config/settings/templates/terminus_cr.yaml'
|
||||
placeholder: '#__VERSION__'
|
||||
filename: "build/installer/wizard/config/settings/templates/terminus_cr.yaml"
|
||||
placeholder: "#__VERSION__"
|
||||
tag: ${{ github.event.inputs.tags }}
|
||||
|
||||
|
||||
- name: Update env
|
||||
working-directory: ./build/installer
|
||||
run: |
|
||||
@@ -37,11 +132,11 @@ jobs:
|
||||
- name: Update latest installer
|
||||
uses: eball/write-tag-to-version-file@latest
|
||||
with:
|
||||
filename: 'build/installer/publicInstaller.latest'
|
||||
placeholder: '#{{LATEST_VERSION}}'
|
||||
filename: "build/installer/publicInstaller.latest"
|
||||
placeholder: "#{{LATEST_VERSION}}"
|
||||
tag: ${{ github.event.inputs.tags }}
|
||||
|
||||
- name: 'Archives'
|
||||
- name: "Archives"
|
||||
working-directory: ./build/installer
|
||||
run: |
|
||||
mkdir -p /tmp/build
|
||||
|
||||
@@ -107,11 +107,15 @@ spec:
|
||||
cpu: "1"
|
||||
memory: 300Mi
|
||||
- name: yt-dlp
|
||||
image: "beclab/yt-dlp:v0.0.2"
|
||||
image: "beclab/yt-dlp:v0.0.4"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 3082
|
||||
env:
|
||||
- name: PUID
|
||||
value: "0"
|
||||
- name: PGID
|
||||
value: "0"
|
||||
- name: PG_USERNAME
|
||||
value: knowledge_{{ .Values.bfl.username }}
|
||||
- name: PG_PASSWORD
|
||||
@@ -136,7 +140,7 @@ spec:
|
||||
memory: 300Mi
|
||||
|
||||
- name: download-spider
|
||||
image: "beclab/download-spider:v0.0.2"
|
||||
image: "beclab/download-spider:v0.0.4"
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: PG_USERNAME
|
||||
@@ -190,6 +194,10 @@ spec:
|
||||
protocol: TCP
|
||||
port: 6800
|
||||
targetPort: 6800
|
||||
- name: ytdlp-server
|
||||
protocol: TCP
|
||||
port: 3082
|
||||
targetPort: 3082
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
{{- $files_redis_password := "" -}}
|
||||
{{ if $files_secret -}}
|
||||
{{ $files_redis_password = (index $files_secret "data" "redis_password") }}
|
||||
{{ $files_redis_password = (index $files_secret "data" "files_redis_password") }}
|
||||
{{ else -}}
|
||||
{{ $files_redis_password = randAlphaNum 16 | b64enc }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -116,7 +116,7 @@ spec:
|
||||
value: user_space_{{ .Values.bfl.username }}_knowledge
|
||||
containers:
|
||||
- name: knowledge
|
||||
image: "beclab/knowledge-base-api:v0.1.37"
|
||||
image: "beclab/knowledge-base-api:v0.1.38"
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 3010
|
||||
@@ -166,7 +166,7 @@ spec:
|
||||
memory: 1Gi
|
||||
|
||||
- name: backend-server
|
||||
image: "beclab/recommend-backend:v0.0.7"
|
||||
image: "beclab/recommend-backend:v0.0.9"
|
||||
imagePullPolicy: IfNotPresent
|
||||
env:
|
||||
- name: LISTEN_ADDR
|
||||
@@ -193,6 +193,8 @@ spec:
|
||||
value: "5432"
|
||||
- name: PG_DATABASE
|
||||
value: user_space_{{ .Values.bfl.username }}_knowledge
|
||||
- name: YT_DLP_API_URL
|
||||
value: http://download-svc.user-space-{{ .Values.bfl.username }}:3082/api/v1/get_metadata
|
||||
- name: DOWNLOAD_API_URL
|
||||
value: http://download-svc.user-space-{{ .Values.bfl.username }}:3080/api/termius/download
|
||||
|
||||
|
||||
@@ -66,12 +66,12 @@ spec:
|
||||
fieldPath: status.podIP
|
||||
containers:
|
||||
- name: appstore
|
||||
image: beclab/market-frontend:v0.2.10
|
||||
image: beclab/market-frontend:v0.2.12
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
- name: appstore-backend
|
||||
image: beclab/market-backend:v0.2.10
|
||||
image: beclab/market-backend:v0.2.12
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 81
|
||||
|
||||
@@ -68,7 +68,7 @@ spec:
|
||||
fieldPath: status.podIP
|
||||
containers:
|
||||
- name: dashboard-frontend
|
||||
image: beclab/dashboard-frontend-v1:v0.2.22
|
||||
image: beclab/dashboard-frontend-v1:v0.3.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
||||
@@ -66,7 +66,7 @@ spec:
|
||||
fieldPath: status.podIP
|
||||
containers:
|
||||
- name: control-hub-frontend
|
||||
image: beclab/admin-console-frontend-v1:v0.3.4
|
||||
image: beclab/admin-console-frontend-v1:v0.3.5
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
||||
@@ -68,7 +68,7 @@ spec:
|
||||
|
||||
containers:
|
||||
- name: frontend
|
||||
image: beclab/wise:v0.1.37
|
||||
image: beclab/wise:v0.1.42
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
||||
@@ -441,7 +441,6 @@ check_desktop(){
|
||||
|
||||
main() {
|
||||
get_shell_exec
|
||||
precheck_os
|
||||
|
||||
if [[ $(is_wsl) -eq 1 || $(is_macos) -eq 1 ]]; then
|
||||
ip=$1
|
||||
@@ -464,6 +463,8 @@ main() {
|
||||
exit 0
|
||||
fi
|
||||
|
||||
precheck_os
|
||||
|
||||
local storage_type="s3"
|
||||
if is_k3s; then
|
||||
if system_service_active "k3s" ; then
|
||||
@@ -505,4 +506,4 @@ main() {
|
||||
log_info 'Success to change the Terminus IP address!'
|
||||
}
|
||||
|
||||
main
|
||||
main $1
|
||||
|
||||
@@ -56,7 +56,7 @@ spec:
|
||||
command:
|
||||
- "/bin/sh"
|
||||
- "-c"
|
||||
- "umount -v /host-var-run-nvshare/libnvshare.so && rm /host-var-run-nvshare/libnvshare.so"
|
||||
- "umount -v /host-var-run-nvshare/libnvshare.so && rm -rf /host-var-run-nvshare/libnvshare.so"
|
||||
securityContext:
|
||||
# Necessary for mounts to work.
|
||||
privileged: true
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
set -o pipefail
|
||||
|
||||
VERSION="#__VERSION__"
|
||||
export VERSION="#__VERSION__"
|
||||
if [ "x${VERSION}" = "x" ]; then
|
||||
echo "Unable to get latest Install-Wizard version. Set VERSION env var and re-run. For example: export VERSION=1.0.0"
|
||||
echo ""
|
||||
@@ -63,6 +63,17 @@ echo ""
|
||||
if command -v tar &>/dev/null; then
|
||||
rm -rf ${foldername} && mkdir -p ${foldername} && cd ${foldername} && tar -xzf "../${filename}"
|
||||
|
||||
CLI_VERSION="0.1.11"
|
||||
CLI_FILE="terminus-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
if [ x"${os_type}" == x"Darwin" ]; then
|
||||
CLI_FILE="terminus-cli-v${CLI_VERSION}_darwin_${ARCH}.tar.gz"
|
||||
fi
|
||||
CLI_URL="https://github.com/beclab/Installer/releases/download/${CLI_VERSION}/${CLI_FILE}"
|
||||
|
||||
if [ ! -f ${CLI_FILE} ]; then
|
||||
curl -Lo ${CLI_FILE} ${CLI_URL}
|
||||
fi
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
if [[ x"$os_type" == x"Darwin" ]]; then
|
||||
bash ./uninstall_macos.sh
|
||||
|
||||
@@ -207,7 +207,7 @@ precheck_os() {
|
||||
# check os type and arch and os vesion
|
||||
os_type=$(uname -s)
|
||||
os_arch=$(uname -m)
|
||||
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')
|
||||
os_verion=$(lsb_release -r 2>&1 | awk -F'\t' '{print $2}')
|
||||
|
||||
case "$os_arch" in
|
||||
arm64) ARCH=arm64; ;;
|
||||
@@ -392,12 +392,12 @@ is_ubuntu() {
|
||||
|
||||
is_raspbian(){
|
||||
rasp=$(uname -a)
|
||||
lsb_release=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')
|
||||
lsb_release=$(lsb_release -r 2>&1 | awk -F'\t' '{print $2}')
|
||||
if [ -z "$lsb_release" ]; then
|
||||
echo 0
|
||||
return
|
||||
fi
|
||||
if [[ ${lsb_release} == *Raspbian* || ${rasp} == *raspberry* ]];then
|
||||
if [[ ${rasp} == *Raspbian* || ${rasp} == *raspbian* || ${rasp} == *raspberry* || ${rasp} == *Raspberry* ]];then
|
||||
case "$lsb_release" in
|
||||
*11* | *12*)
|
||||
echo 1
|
||||
@@ -549,9 +549,9 @@ run_install() {
|
||||
|
||||
log_info 'installing k8s and kubesphere'
|
||||
|
||||
if [ -d "$BASE_DIR/pkg" ]; then
|
||||
ensure_success $sh_c "ln -s ${BASE_DIR}/pkg ./"
|
||||
fi
|
||||
# if [ -d "$BASE_DIR/pkg" ]; then
|
||||
# ensure_success $sh_c "ln -s ${BASE_DIR}/pkg ./"
|
||||
# fi
|
||||
|
||||
if [[ $(is_wsl) -eq 1 ]]; then
|
||||
if [ -f /usr/lib/wsl/lib/nvidia-smi ]; then
|
||||
@@ -567,10 +567,15 @@ run_install() {
|
||||
if [ x"$KUBE_TYPE" == x"k3s" ]; then
|
||||
k8s_version=v1.22.16-k3s
|
||||
fi
|
||||
create_cmd="./terminus-cli terminus init --kube $KUBE_TYPE"
|
||||
# create_cmd="./kk create cluster --with-kubernetes $k8s_version --with-kubesphere $ks_version --container-manager containerd" # --with-addon ${ADDON_CONFIG_FILE}
|
||||
create_cmd="${BASE_DIR}/terminus-cli terminus init --kube $KUBE_TYPE"
|
||||
|
||||
|
||||
local extra
|
||||
# add env OS_LOCALIP
|
||||
local envs="export OS_LOCALIP=$local_ip && "
|
||||
if [[ ! -z ${TERMINUS_IS_CLOUD_VERSION} && "x${TERMINUS_IS_CLOUD_VERSION}" == x"true" ]]; then
|
||||
envs+="export TERMINUS_IS_CLOUD_VERSION=$TERMINUS_IS_CLOUD_VERSION && "
|
||||
fi
|
||||
|
||||
# env 'REGISTRY_MIRRORS' is a docker image cache mirrors, separated by commas
|
||||
# if [ x"$REGISTRY_MIRRORS" != x"" ]; then
|
||||
@@ -589,10 +594,9 @@ run_install() {
|
||||
# restore_resolv_conf
|
||||
# extra=" --registry-mirrors http://${PROXY}:5000"
|
||||
# fi
|
||||
create_cmd+=" $extra"
|
||||
|
||||
# add env OS_LOCALIP
|
||||
ensure_success $sh_c "export OS_LOCALIP=$local_ip && $create_cmd"
|
||||
create_cmd+=" $extra"
|
||||
ensure_success $sh_c "$envs $create_cmd"
|
||||
|
||||
log_info 'k8s and kubesphere installation is complete'
|
||||
|
||||
@@ -686,7 +690,8 @@ run_install() {
|
||||
retry_cmd $sh_c "${HELM} upgrade -i system ${BASE_DIR}/wizard/config/system -n os-system --force \
|
||||
--set kubesphere.redis_password=${ks_redis_pwd} --set backup.bucket=\"${BACKUP_CLUSTER_BUCKET}\" \
|
||||
--set backup.key_prefix=\"${BACKUP_KEY_PREFIX}\" --set backup.is_cloud_version=\"${TERMINUS_IS_CLOUD_VERSION}\" \
|
||||
--set backup.sync_secret=\"${BACKUP_SECRET}\" --set gpu=\"${GPU_TYPE}\" --set s3_bucket=\"${S3_BUCKET}\""
|
||||
--set backup.sync_secret=\"${BACKUP_SECRET}\" --set gpu=\"${GPU_TYPE}\" --set s3_bucket=\"${S3_BUCKET}\" \
|
||||
--set fs_type=\"${fs_type}\""
|
||||
|
||||
# save backup env to configmap
|
||||
cat > cm-backup-config.yaml << _END
|
||||
@@ -1344,7 +1349,7 @@ install_velero_plugin_terminus() {
|
||||
namespace="os-system"
|
||||
storage_location="terminus-cloud"
|
||||
bucket="terminus-cloud"
|
||||
velero_ver="v1.11.1"
|
||||
velero_ver="v1.11.3"
|
||||
velero_plugin_ver="v1.0.2"
|
||||
|
||||
if [[ "$provider" == x"" || "$namespace" == x"" || "$bucket" == x"" || "$velero_ver" == x"" || "$velero_plugin_ver" == x"" ]]; then
|
||||
@@ -1375,8 +1380,8 @@ install_velero_plugin_terminus() {
|
||||
velero_plugin_install_cmd+=" --no-default-backup-location --namespace $namespace"
|
||||
velero_plugin_install_cmd+=" --image beclab/velero:$velero_ver --use-volume-snapshots=false"
|
||||
velero_plugin_install_cmd+=" --no-secret --plugins beclab/velero-plugin-for-terminus:$velero_plugin_ver"
|
||||
velero_plugin_install_cmd+=" --velero-pod-cpu-request=50m --velero-pod-cpu-limit=500m"
|
||||
velero_plugin_install_cmd+=" --node-agent-pod-cpu-request=50m --node-agent-pod-cpu-limit=500m"
|
||||
velero_plugin_install_cmd+=" --velero-pod-cpu-request=10m --velero-pod-cpu-limit=200m"
|
||||
velero_plugin_install_cmd+=" --node-agent-pod-cpu-request=10m --node-agent-pod-cpu-limit=200m"
|
||||
velero_plugin_install_cmd+=" --wait --wait-minute 30"
|
||||
|
||||
if [[ $(is_raspbian) -eq 1 ]]; then
|
||||
@@ -1487,47 +1492,40 @@ install_containerd(){
|
||||
# fi
|
||||
# fi
|
||||
|
||||
if [ x"$KUBE_TYPE" == x"k3s" ]; then
|
||||
K3S_PRELOAD_IMAGE_PATH="/var/lib/images"
|
||||
$sh_c "mkdir -p ${K3S_PRELOAD_IMAGE_PATH} && rm -rf ${K3S_PRELOAD_IMAGE_PATH}/*"
|
||||
if [ -d ${BASE_DIR}/images ]; then
|
||||
$sh_c "cp -a ${BASE_DIR}/images/ ./images"
|
||||
fi
|
||||
|
||||
find $BASE_DIR/images -type f -name '*.tar.gz' | while read filename; do
|
||||
if [ x"$KUBE_TYPE" == x"k3s" ]; then
|
||||
local tgz=$(echo "${filename}"|awk -F'/' '{print $NF}')
|
||||
$sh_c "ln -s ${filename} ${K3S_PRELOAD_IMAGE_PATH}/${tgz}"
|
||||
else
|
||||
$sh_c "echo 'continue'"
|
||||
# $sh_c "gunzip -c ${filename} | $ctr_cmd -n k8s.io images import -"
|
||||
fi
|
||||
done
|
||||
# if [ x"$KUBE_TYPE" == x"k8s" ]; then
|
||||
# K8S_PRELOAD_IMAGE_PATH="./images"
|
||||
# $sh_c "mkdir -p ${K8S_PRELOAD_IMAGE_PATH} && rm -rf ${K8S_PRELOAD_IMAGE_PATH}/*"
|
||||
# fi
|
||||
|
||||
# if [ x"$KUBE_TYPE" == x"k3s" ]; then
|
||||
# K3S_PRELOAD_IMAGE_PATH="/var/lib/images"
|
||||
# $sh_c "mkdir -p ${K3S_PRELOAD_IMAGE_PATH} && rm -rf ${K3S_PRELOAD_IMAGE_PATH}/*"
|
||||
# fi
|
||||
|
||||
# find $BASE_DIR/images -type f -name '*.tar.gz' | while read filename; do
|
||||
# local tgz=$(echo "${filename}"|awk -F'/' '{print $NF}')
|
||||
# if [ x"$KUBE_TYPE" == x"k3s" ]; then
|
||||
# $sh_c "ln -s ${filename} ${K3S_PRELOAD_IMAGE_PATH}/${tgz}"
|
||||
# else
|
||||
# $sh_c "ln -s ${filename} ${K8S_PRELOAD_IMAGE_PATH}/${tgz}"
|
||||
# fi
|
||||
# done
|
||||
fi
|
||||
}
|
||||
|
||||
install_k8s_ks() {
|
||||
TERMINUS_CLI_VERSION=0.1.5
|
||||
|
||||
CLI_VERSION=0.1.11
|
||||
ensure_success $sh_c "mkdir -p /etc/kke"
|
||||
local kk_bin="${BASE_DIR}/components/terminus-cli"
|
||||
local kk_tar="${BASE_DIR}/components/terminus-cli-v${TERMINUS_CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
if [ ! -f "$kk_bin" ]; then
|
||||
if [ ! -f "$kk_tar" ]; then
|
||||
ensure_success $sh_c "curl ${CURL_TRY} -k -sfLO https://github.com/beclab/Installer/releases/download/${TERMINUS_CLI_VERSION}/terminus-cli-v${TERMINUS_CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
ensure_success $sh_c "tar xf terminus-cli-v${TERMINUS_CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
# if [ x"$PROXY" != x"" ]; then
|
||||
# ensure_success $sh_c "curl ${CURL_TRY} -k -sfLO https://github.com/beclab/kubekey-ext/releases/download/${TERMINUS_CLI_VERSION}/kubekey-ext-v${TERMINUS_CLI_VERSION}-linux-${ARCH}.tar.gz"
|
||||
# ensure_success $sh_c "tar xf kubekey-ext-v${TERMINUS_CLI_VERSION}-linux-${ARCH}.tar.gz"
|
||||
# else
|
||||
# ensure_success $sh_c "curl ${CURL_TRY} -sfL https://raw.githubusercontent.com/beclab/kubekey-ext/master/downloadKKE.sh | VERSION=${TERMINUS_CLI_VERSION} sh -"
|
||||
# fi
|
||||
else
|
||||
ensure_success $sh_c "cp ${kk_tar} terminus-cli-${TERMINUS_CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
ensure_success $sh_c "tar xf terminus-cli-${TERMINUS_CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
fi
|
||||
else
|
||||
ensure_success $sh_c "cp ${kk_bin} ./"
|
||||
local cli_name="terminus-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
if [ ! -f "${BASE_DIR}/${cli_name}" ]; then
|
||||
ensure_success $sh_c "curl ${CURL_TRY} -k -sfL -o ${BASE_DIR}/${cli_name} https://github.com/beclab/Installer/releases/download/${CLI_VERSION}/terminus-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
fi
|
||||
# ensure_success $sh_c "chmod +x kk"
|
||||
ensure_success $sh_c "tar xf ${BASE_DIR}/${cli_name} -C ${BASE_DIR}/"
|
||||
# ensure_success $sh_c "chmod +x terminus-cli"
|
||||
|
||||
log_info 'Setup your first user ...\n'
|
||||
setup_ws
|
||||
@@ -2141,6 +2139,35 @@ install_gpu(){
|
||||
ensure_success $sh_c "apt-get update && sudo apt-get install -y nvidia-container-toolkit jq"
|
||||
|
||||
if [ x"$KUBE_TYPE" == x"k3s" ]; then
|
||||
if [[ $(is_wsl) -eq 1 ]]; then
|
||||
local real_driver=$($sh_c "find /usr/lib/wsl/drivers/ -name libcuda.so.1.1|head -1")
|
||||
echo "found cuda driver in $real_driver"
|
||||
if [[ x"$real_driver" != x"" ]]; then
|
||||
local shellname="cuda_lib_fix.sh"
|
||||
cat << EOF > /tmp/${shellname}
|
||||
#!/bin/bash
|
||||
sh_c="sh -c"
|
||||
real_driver=\$(\$sh_c "find /usr/lib/wsl/drivers/ -name libcuda.so.1.1|head -1")
|
||||
if [[ x"\$real_driver" != x"" ]]; then
|
||||
\$sh_c "ln -s /usr/lib/wsl/lib/libcuda* /usr/lib/x86_64-linux-gnu/"
|
||||
\$sh_c "rm -f /usr/lib/x86_64-linux-gnu/libcuda.so"
|
||||
\$sh_c "rm -f /usr/lib/x86_64-linux-gnu/libcuda.so.1"
|
||||
\$sh_c "rm -f /usr/lib/x86_64-linux-gnu/libcuda.so.1.1"
|
||||
\$sh_c "cp -f \$real_driver /usr/lib/wsl/lib/libcuda.so"
|
||||
\$sh_c "cp -f \$real_driver /usr/lib/wsl/lib/libcuda.so.1"
|
||||
\$sh_c "cp -f \$real_driver /usr/lib/wsl/lib/libcuda.so.1.1"
|
||||
\$sh_c "ln -s \$real_driver /usr/lib/x86_64-linux-gnu/libcuda.so.1"
|
||||
\$sh_c "ln -s \$real_driver /usr/lib/x86_64-linux-gnu/libcuda.so.1.1"
|
||||
\$sh_c "ln -s /usr/lib/x86_64-linux-gnu/libcuda.so.1 /usr/lib/x86_64-linux-gnu/libcuda.so"
|
||||
fi
|
||||
EOF
|
||||
ensure_success $sh_c "mv -f /tmp/${shellname} /usr/local/bin/${shellname}"
|
||||
ensure_success $sh_c "chmod +x /usr/local/bin/${shellname}"
|
||||
ensure_success $sh_c "echo 'ExecStartPre=-/usr/local/bin/${shellname}' >> /etc/systemd/system/k3s.service"
|
||||
ensure_success $sh_c "systemctl daemon-reload"
|
||||
|
||||
fi
|
||||
fi
|
||||
ensure_success $sh_c "cp /var/lib/rancher/k3s/agent/etc/containerd/config.toml /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl"
|
||||
ensure_success $sh_c "nvidia-ctk runtime configure --runtime=containerd --set-as-default --config=/var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl"
|
||||
ensure_success $sh_c "systemctl restart k3s"
|
||||
@@ -2156,22 +2183,6 @@ install_gpu(){
|
||||
# waiting for kubesphere webhooks starting
|
||||
sleep_waiting 30
|
||||
|
||||
if [[ $(is_wsl) -eq 1 ]]; then
|
||||
local real_driver=$($sh_c "find /usr/lib/wsl/drivers/ -name libcuda.so.1.1|head -1")
|
||||
echo "found cuda driver in $real_driver"
|
||||
if [[ x"$real_driver" != x"" ]]; then
|
||||
$sh_c "ln -s /usr/lib/wsl/lib/libcuda* /usr/lib/x86_64-linux-gnu/"
|
||||
ensure_success $sh_c "rm -f /usr/lib/x86_64-linux-gnu/libcuda.so"
|
||||
ensure_success $sh_c "rm -f /usr/lib/x86_64-linux-gnu/libcuda.so.1"
|
||||
ensure_success $sh_c "rm -f /usr/lib/x86_64-linux-gnu/libcuda.so.1.1"
|
||||
ensure_success $sh_c "cp -f $real_driver /usr/lib/wsl/lib/libcuda.so"
|
||||
ensure_success $sh_c "cp -f $real_driver /usr/lib/wsl/lib/libcuda.so.1"
|
||||
ensure_success $sh_c "cp -f $real_driver /usr/lib/wsl/lib/libcuda.so.1.1"
|
||||
ensure_success $sh_c "ln -s $real_driver /usr/lib/x86_64-linux-gnu/libcuda.so.1"
|
||||
ensure_success $sh_c "ln -s $real_driver /usr/lib/x86_64-linux-gnu/libcuda.so.1.1"
|
||||
ensure_success $sh_c "ln -s /usr/lib/x86_64-linux-gnu/libcuda.so.1 /usr/lib/x86_64-linux-gnu/libcuda.so"
|
||||
fi
|
||||
fi
|
||||
|
||||
ensure_success $sh_c "${KUBECTL} create -f ${BASE_DIR}/deploy/nvidia-device-plugin.yml"
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ install_ks(){
|
||||
if [ -z $KUBE_TYPE ]; then
|
||||
KUBE_TYPE="k3s"
|
||||
fi
|
||||
TERMINUS_CLI_VERSION="0.1.7"
|
||||
TERMINUS_CLI_VERSION="0.1.8"
|
||||
|
||||
cmd="mkdir -p ${BASE_DIR}/components"
|
||||
[ ! -d "${BASE_DIR}/components" ] && ensure_success eval $($cmd)
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
|
||||
ERR_EXIT=1
|
||||
|
||||
CURL_TRY="--connect-timeout 30 --retry 5 --retry-delay 1 --retry-max-time 10 "
|
||||
|
||||
RM=$(command -v rm)
|
||||
KUBECTL=$(command -v kubectl)
|
||||
BASE_DIR=$(dirname $(realpath -s $0))
|
||||
CURL_TRY="--connect-timeout 30 --retry 5 --retry-delay 1 --retry-max-time 10 "
|
||||
KKE_FILE="/etc/kke/version"
|
||||
STS_ACCESS_KEY=""
|
||||
STS_SECRET_KEY=""
|
||||
STS_TOKEN=""
|
||||
STS_CLUSTER_ID=""
|
||||
|
||||
command_exists() {
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
@@ -77,70 +69,23 @@ log_info() {
|
||||
echo -e "\n\033[38;1m${now} [INFO] ${msg} \033[0m"
|
||||
}
|
||||
|
||||
get_kubelet_version() {
|
||||
[ ! -f $KUBECTL ] && {
|
||||
echo "kubectl does not exists"
|
||||
exit $ERR_EXIT
|
||||
}
|
||||
$sh_c "${KUBECTL} get nodes -o jsonpath='{.items[0].status.nodeInfo.kubeletVersion}'"
|
||||
}
|
||||
|
||||
find_version(){
|
||||
if [ -f "$KKE_FILE" ]; then
|
||||
KKE_VERSION=$(awk -F '=' '/KKE/{printf "%s",$2}' $KKE_FILE)
|
||||
KUBE_VERSION=$(awk -F '=' '/KUBE/{printf "%s",$2}' $KKE_FILE)
|
||||
|
||||
[ x"$KKE_VERSION" != x"" ] && [ x"$KUBE_VERSION" != x"" ] && return
|
||||
fi
|
||||
|
||||
KKE_VERSION=0.1.21 # don't need to change it, as long as it's greater than 0.1.6
|
||||
|
||||
local kube="$(get_kubelet_version)"
|
||||
if [ x"$kube" != x"" ]; then
|
||||
KUBE_VERSION="$kube"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Warning: file $KKE_FILE does not exists, and kube version not be found"
|
||||
}
|
||||
|
||||
find_storage_key(){
|
||||
STS_ACCESS_KEY=$($sh_c "${KUBECTL} get terminus terminus -o jsonpath='{.metadata.annotations.bytetrade\.io/s3-ak}'" &>/dev/null;true)
|
||||
STS_SECRET_KEY=$($sh_c "${KUBECTL} get terminus terminus -o jsonpath='{.metadata.annotations.bytetrade\.io/s3-sk}'" &>/dev/null;true)
|
||||
STS_TOKEN=$($sh_c "${KUBECTL} get terminus terminus -o jsonpath='{.metadata.annotations.bytetrade\.io/s3-sts}'" &>/dev/null;true)
|
||||
STS_CLUSTER_ID=$($sh_c "${KUBECTL} get terminus terminus -o jsonpath='{.metadata.labels.bytetrade\.io/cluster-id}'" &>/dev/null;true)
|
||||
}
|
||||
|
||||
remove_cluster(){
|
||||
if [ x"$KUBE_VERSION" == x"" ]; then
|
||||
KUBE_VERSION="v1.22.10"
|
||||
fi
|
||||
|
||||
#if [ x"$KKE_VERSION" == x"" ]; then
|
||||
KKE_VERSION="0.1.21"
|
||||
#fi
|
||||
|
||||
CLI_VERSION="0.1.11"
|
||||
forceUninstall="${FORCE_UNINSTALL_CLUSTER}"
|
||||
forceDeleteCache="false"
|
||||
|
||||
version="${TERMINUS_IS_CLOUD_VERSION}"
|
||||
storage="${STORAGE}"
|
||||
s3_bucket="${S3_BUCKET}"
|
||||
|
||||
log_info 'remove kubernetes cluster'
|
||||
|
||||
local kk_tar="${HOME}/install_wizard/components/kubekey-ext-v${KKE_VERSION}-linux-${ARCH}.tar.gz"
|
||||
|
||||
if [ x"$PROXY" != x"" ]; then
|
||||
ensure_success $sh_c "cat /etc/resolv.conf > /etc/resolv.conf.bak"
|
||||
ensure_success $sh_c "echo nameserver $PROXY > /etc/resolv.conf"
|
||||
# if download failed
|
||||
if [ -f "${kk_tar}" ]; then
|
||||
ensure_success $sh_c "cp ${kk_tar} ${INSTALL_DIR}"
|
||||
else
|
||||
ensure_success $sh_c "curl ${CURL_TRY} -kLO https://github.com/beclab/kubekey-ext/releases/download/${KKE_VERSION}/kubekey-ext-v${KKE_VERSION}-linux-${ARCH}.tar.gz"
|
||||
fi
|
||||
ensure_success $sh_c "tar xf kubekey-ext-v${KKE_VERSION}-linux-${ARCH}.tar.gz"
|
||||
ensure_success $sh_c "cat /etc/resolv.conf.bak > /etc/resolv.conf"
|
||||
else
|
||||
ensure_success $sh_c "curl -sfL https://raw.githubusercontent.com/beclab/kubekey-ext/master/downloadKKE.sh | VERSION=${KKE_VERSION} bash -"
|
||||
local cli_tar="${BASE_DIR}/terminus-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
if [ ! -f "${cli_tar}" ]; then
|
||||
ensure_success $sh_c "curl ${CURL_TRY} -kL -o ${BASE_DIR}/terminus-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz https://github.com/beclab/Installer/releases/download/${CLI_VERSION}/terminus-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz"
|
||||
fi
|
||||
ensure_success $sh_c "chmod +x kk"
|
||||
ensure_success $sh_c "tar xvf ${BASE_DIR}/terminus-cli-v${CLI_VERSION}_linux_${ARCH}.tar.gz -C ${BASE_DIR}"
|
||||
ensure_success $sh_c "chmod +x ${BASE_DIR}/terminus-cli"
|
||||
|
||||
if [ -z "$forceUninstall" ]; then
|
||||
echo
|
||||
@@ -152,168 +97,17 @@ remove_cluster(){
|
||||
fi
|
||||
fi
|
||||
|
||||
$sh_c "./kk delete cluster -A --with-kubernetes $KUBE_VERSION"
|
||||
|
||||
[ -f $KKE_FILE ] && $sh_c "${RM} -f $KKE_FILE"
|
||||
|
||||
if command_exists ipvsadm; then
|
||||
$sh_c "ipvsadm -C"
|
||||
fi
|
||||
$sh_c "iptables -F"
|
||||
|
||||
$sh_c "killall /usr/local/bin/containerd || true"
|
||||
}
|
||||
|
||||
docker_files=(/usr/bin/docker*
|
||||
/var/lib/docker
|
||||
/var/run/docker*
|
||||
/var/lib/dockershim
|
||||
/usr/local/bin/containerd
|
||||
/etc/docker
|
||||
/etc/cni/net.d)
|
||||
|
||||
clean_docker() {
|
||||
log_info 'destroy docker'
|
||||
|
||||
$sh_c "rm -f /var/run/docker.sock; true"
|
||||
|
||||
for srv in docker containerd; do
|
||||
$sh_c "systemctl stop $srv; systemctl disable $srv; true"
|
||||
done
|
||||
|
||||
$sh_c "killall -9 containerd dockerd 2>/dev/null; true"
|
||||
|
||||
local pids=$(ps -fea|grep containerd|grep -v grep|awk '{print $2}')
|
||||
if [ -n "$pids" ]; then
|
||||
$sh_c "kill -9 $pids 2>/dev/null; true"
|
||||
if [ ! -z "$forceUninstall" ]; then
|
||||
forceDeleteCache="true"
|
||||
fi
|
||||
|
||||
log_info 'clean docker files'
|
||||
|
||||
for i in "${docker_files[@]}"; do
|
||||
$sh_c "rm -rf $i >/dev/null; true"
|
||||
done
|
||||
}
|
||||
|
||||
terminus_files=(
|
||||
/usr/local/bin/redis-*
|
||||
/usr/bin/redis-*
|
||||
/sbin/mount.juicefs
|
||||
/etc/init.d/redis-server
|
||||
/usr/local/bin/juicefs
|
||||
/usr/local/bin/minio
|
||||
/usr/local/bin/velero
|
||||
/etc/systemd/system/redis-server.service
|
||||
/etc/systemd/system/minio.service
|
||||
/etc/systemd/system/minio-operator.service
|
||||
/etc/systemd/system/juicefs.service
|
||||
/etc/systemd/system/containerd.service
|
||||
/etc/default/minio
|
||||
)
|
||||
|
||||
remove_storage() {
|
||||
log_info 'destroy storage'
|
||||
|
||||
# stop and disable service
|
||||
for srv in juicefs minio minio-operator redis-server; do
|
||||
$sh_c "systemctl stop $srv 2>/dev/null; systemctl disable $srv 2>/dev/null; true"
|
||||
done
|
||||
local envs="export DELETE_CACHE=${forceDeleteCache} && "
|
||||
if [[ ! -z ${TERMINUS_IS_CLOUD_VERSION} && "x${TERMINUS_IS_CLOUD_VERSION}" == x"true" ]]; then
|
||||
envs+="export TERMINUS_IS_CLOUD_VERSION=$TERMINUS_IS_CLOUD_VERSION && "
|
||||
fi
|
||||
|
||||
$sh_c "killall -9 redis-server 2>/dev/null; true"
|
||||
$sh_c "rm -rf /var/jfsCache /terminus/jfscache 2>/dev/null; true"
|
||||
$sh_c "$envs ${BASE_DIR}/terminus-cli terminus uninstall --delete-cri --storage-type=${storage} --storage-bucket=${s3_bucket}"
|
||||
|
||||
# read -r -p "Retain the stored terminus data? [default: yes]: " ans </dev/tty
|
||||
# if [[ "$ans" == @("no"|"n"|"N"|"No") ]]; then
|
||||
$sh_c "unlink /usr/bin/redis-server 2>/dev/null; unlink /usr/bin/redis-cli 2>/dev/null; true"
|
||||
|
||||
log_info 'clean terminus files'
|
||||
|
||||
for i in "${terminus_files[@]}"; do
|
||||
$sh_c "rm -f $i 2>/dev/null; true"
|
||||
done
|
||||
|
||||
$sh_c "rm -rf /terminus 2>/dev/null; true"
|
||||
|
||||
if [ -d /osdata/terminus ]; then
|
||||
$sh_c "rm -rf /osdata/terminus 2>/dev/null; true"
|
||||
fi
|
||||
# fi
|
||||
}
|
||||
|
||||
remove_mount() {
|
||||
version="${TERMINUS_IS_CLOUD_VERSION}"
|
||||
storage="${STORAGE}"
|
||||
s3_bucket="${S3_BUCKET}"
|
||||
|
||||
if [ -z "$STS_ACCESS_KEY"]; then
|
||||
STS_ACCESS_KEY=${AWS_ACCESS_KEY_ID_SETUP}
|
||||
fi
|
||||
|
||||
if [ -z "$STS_SECRET_KEY"]; then
|
||||
STS_SECRET_KEY=${AWS_SECRET_ACCESS_KEY_SETUP}
|
||||
fi
|
||||
|
||||
if [ -z "$STS_TOKEN"]; then
|
||||
STS_TOKEN=${AWS_SESSION_TOKEN_SETUP}
|
||||
fi
|
||||
|
||||
if [ -z "$STS_CLUSTER_ID" ]; then
|
||||
STS_CLUSTER_ID=${CLUSTER_ID}
|
||||
fi
|
||||
|
||||
if [ x"$version" == x"true" ]; then
|
||||
log_info 'remove juicefs s3 mount'
|
||||
ensure_success $sh_c "apt install unzip"
|
||||
case "$storage" in
|
||||
"s3")
|
||||
local awscli_file="awscli-exe-linux-x86_64.zip"
|
||||
local awscli_tar="${HOME}/components/${awscli_file}"
|
||||
if ! command_exists aws; then
|
||||
if [ -f "${awscli_tar}" ]; then
|
||||
ensure_success $sh_c "cp ${awscli_tar} ."
|
||||
else
|
||||
ensure_success $sh_c 'curl ${CURL_TRY} -kLO "https://awscli.amazonaws.com/${awscli_file}"'
|
||||
fi
|
||||
ensure_success $sh_c "unzip -q ${awscli_file}"
|
||||
ensure_success $sh_c "./aws/install --update"
|
||||
fi
|
||||
|
||||
AWS=$(command -v aws)
|
||||
|
||||
s3=$($sh_c "echo $s3_bucket | rev | cut -d '.' -f 5 | rev")
|
||||
s3=$($sh_c "echo $s3 | sed 's/https/s3/'")
|
||||
|
||||
log_info 'clean juicefs s3 mount'
|
||||
ensure_success $sh_c "AWS_ACCESS_KEY_ID=${STS_ACCESS_KEY} AWS_SECRET_ACCESS_KEY=${STS_SECRET_KEY} AWS_SESSION_TOKEN=${STS_TOKEN} ${AWS} s3 rm $s3/${STS_CLUSTER_ID} --recursive"
|
||||
;;
|
||||
"oss")
|
||||
local osscli_file="ossutil-v1.7.18-linux-${ARCH}.zip"
|
||||
local osscli_tar="${HOME}/components/${osscli_file}"
|
||||
if ! command_exists ossutil64; then
|
||||
if [ -f "${osscli_tar}" ]; then
|
||||
ensure_success $sh_c "cp ${osscli_tar} ."
|
||||
else
|
||||
ensure_success $sh_c 'curl ${CURL_TRY} -kLO "https://github.com/aliyun/ossutil/releases/download/v1.7.18/${osscli_file}"'
|
||||
fi
|
||||
|
||||
ensure_success $sh_c "unzip -q ${osscli_file}"
|
||||
ensure_success $sh_c "mv ./ossutil-v1.7.18-linux-${ARCH}/* /usr/local/sbin/"
|
||||
|
||||
ensure_success $sh_c "chmod +x /usr/local/bin/ossutil*"
|
||||
fi
|
||||
|
||||
oss=$($sh_c "echo $s3_bucket | rev | cut -d '.' -f 4 | rev")
|
||||
oss=$($sh_c "echo $oss | sed 's/https/oss/'")
|
||||
endpoint=$($sh_c "echo $s3_bucket | awk -F[/.] '{print \"https://\"\$(NF-2)\".\"\$(NF-1)\".\"\$NF}'")
|
||||
|
||||
log_info 'clean juicefs oss mount'
|
||||
OSSUTIL=$(command -v ossutil64)
|
||||
ensure_success $sh_c "${OSSUTIL} rm ${oss}/${STS_CLUSTER_ID}/ --endpoint=${endpoint} --access-key-id=${STS_ACCESS_KEY} --access-key-secret=${STS_SECRET_KEY} --sts-token=${STS_TOKEN} -r -f >/dev/null"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
set -o pipefail
|
||||
@@ -332,20 +126,13 @@ INSTALL_DIR=/tmp/install_log
|
||||
mkdir -p ${INSTALL_DIR} && cd ${INSTALL_DIR}
|
||||
|
||||
log_info 'Uninstalling OS ...'
|
||||
find_version
|
||||
find_storage_key
|
||||
remove_cluster
|
||||
remove_storage
|
||||
remove_mount
|
||||
[[ ! -z $CLEAN_ALL ]] && clean_docker
|
||||
|
||||
cd -
|
||||
$sh_c "${RM} -rf /tmp/install_log"
|
||||
[[ -d install-wizard ]] && ${RM} -rf install-wizard
|
||||
set +o pipefail
|
||||
ls |grep install-wizard*.tar.gz | while read ar; do ${RM} -f ${ar}; done
|
||||
|
||||
[[ -f /usr/local/bin/k3s-uninstall.sh ]] && $sh_c "/usr/local/bin/k3s-uninstall.sh"
|
||||
[[ -f .installed ]] && $sh_c "rm -f .installed"
|
||||
|
||||
log_info 'Uninstall OS success! '
|
||||
|
||||
@@ -1,4 +1,82 @@
|
||||
#!/bin/bash
|
||||
|
||||
# TODO: uninstall special cluster
|
||||
minikube stop --all && minikube delete --all
|
||||
command_exists() {
|
||||
command -v "$@" > /dev/null 2>&1
|
||||
}
|
||||
|
||||
precheck_os() {
|
||||
local ip os_type os_arch
|
||||
|
||||
# check os type and arch and os vesion
|
||||
os_type=$(uname -s)
|
||||
os_arch=$(uname -m)
|
||||
os_verion=$(lsb_release -d 2>&1 | awk -F'\t' '{print $2}')
|
||||
|
||||
case "$os_arch" in
|
||||
arm64) ARCH=arm64; ;;
|
||||
x86_64) ARCH=amd64; ;;
|
||||
armv7l) ARCH=arm; ;;
|
||||
aarch64) ARCH=arm64; ;;
|
||||
ppc64le) ARCH=ppc64le; ;;
|
||||
s390x) ARCH=s390x; ;;
|
||||
*) echo "unsupported arch, exit ...";
|
||||
exit -1; ;;
|
||||
esac
|
||||
|
||||
OS_ARCH="$os_arch"
|
||||
}
|
||||
|
||||
|
||||
get_shell_exec(){
|
||||
user="$(id -un 2>/dev/null || true)"
|
||||
|
||||
sh_c='sh -c'
|
||||
if [ "$user" != 'root' ]; then
|
||||
if command_exists sudo && command_exists su; then
|
||||
sh_c='sudo su -c'
|
||||
else
|
||||
cat >&2 <<-'EOF'
|
||||
Error: this installer needs the ability to run commands as root.
|
||||
We are unable to find either "sudo" or "su" available to make this happen.
|
||||
EOF
|
||||
exit $ERR_EXIT
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
ensure_success() {
|
||||
"$@"
|
||||
local ret=$?
|
||||
|
||||
if [ $ret -ne 0 ]; then
|
||||
echo "Fatal error, command: '$*'"
|
||||
exit $ret
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
log_info() {
|
||||
local msg now
|
||||
|
||||
msg="$*"
|
||||
now=$(date +'%Y-%m-%d %H:%M:%S.%N %z')
|
||||
echo -e "\n\033[38;1m${now} [INFO] ${msg} \033[0m"
|
||||
}
|
||||
|
||||
get_shell_exec
|
||||
precheck_os
|
||||
|
||||
CLI_VERSION="0.1.11"
|
||||
CLI_FILENAME="terminus-cli-v${CLI_VERSION}_darwin_${ARCH}.tar.gz"
|
||||
CLI_URL="https://github.com/beclab/Installer/releases/download/${CLI_VERSION}/terminus-cli-v${CLI_VERSION}_darwin_${ARCH}.tar.gz"
|
||||
|
||||
|
||||
cli_tar="terminus-cli-v${CLI_VERSION}_darwin_${ARCH}.tar.gz"
|
||||
if [ ! -f "${CLI_FILENAME}" ]; then
|
||||
curl -Lo ${CLI_FILENAME} ${CLI_URL}
|
||||
fi
|
||||
tar xvf terminus-cli-v${CLI_VERSION}_darwin_${ARCH}.tar.gz; chmod +x terminus-cli
|
||||
|
||||
./terminus-cli terminus uninstall --minikube
|
||||
@@ -31,7 +31,14 @@ kubesphere/kube-scheduler:v1.22.10
|
||||
kubesphere/kube-scheduler:v1.21.4
|
||||
kubesphere/pause:3.5
|
||||
kubesphere/pause:3.4.1
|
||||
k8s.gcr.io/pause:3.5
|
||||
k8s.gcr.io/pause:3.6
|
||||
k8s.gcr.io/kube-scheduler:v1.22.10
|
||||
k8s.gcr.io/kube-proxy:v1.22.10
|
||||
k8s.gcr.io/kube-controller-manager:v1.22.10
|
||||
k8s.gcr.io/kube-apiserver:v1.22.10
|
||||
k8s.gcr.io/etcd:3.5.0-0
|
||||
k8s.gcr.io/coredns/coredns:v1.8.4
|
||||
registry.k8s.io/pause:3.5
|
||||
kubesphere/prometheus-config-reloader:v0.55.1
|
||||
kubesphere/prometheus-operator:v0.55.1
|
||||
@@ -46,13 +53,13 @@ quay.io/argoproj/argocli:v3.5.0
|
||||
quay.io/argoproj/argoexec:v3.5.0
|
||||
quay.io/argoproj/workflow-controller:v3.5.0
|
||||
redis:5.0.14-alpine
|
||||
beclab/velero:v1.11.0
|
||||
beclab/velero:v1.11.1
|
||||
beclab/velero:v1.11.3
|
||||
beclab/velero-plugin-for-terminus:v1.0.1
|
||||
beclab/velero-plugin-for-terminus:v1.0.2
|
||||
rancher/coredns-coredns:1.8.3
|
||||
beclab/l4-bfl-proxy:v0.2.6
|
||||
gcr.io/k8s-minikube/storage-provisioner:v5
|
||||
owncloudci/wait-for:latest
|
||||
beclab/recommend-argotask:v0.0.5
|
||||
rancher/mirrored-coredns-coredns:1.9.1
|
||||
beclab/auth:0.1.32
|
||||
beclab/market-backend:v0.2.10
|
||||
|
||||
@@ -93,6 +93,8 @@ data:
|
||||
port: 6379
|
||||
# This secret can also be set using the env variables AUTHELIA_SESSION_REDIS_PASSWORD_FILE
|
||||
password: {{ $redis_password | b64dec }}
|
||||
maximum_active_connections: 100
|
||||
minimum_idle_connections: 30
|
||||
|
||||
regulation:
|
||||
max_retries: 3
|
||||
@@ -272,9 +274,17 @@ spec:
|
||||
spec:
|
||||
serviceAccountName: os-internal
|
||||
serviceAccount: os-internal
|
||||
containers:
|
||||
initContainers:
|
||||
- args:
|
||||
- -it
|
||||
- authelia-storage-svc:6379,redis.kubesphere-system:6379
|
||||
image: owncloudci/wait-for:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: check-redis
|
||||
|
||||
containers:
|
||||
- name: authelia
|
||||
image: beclab/auth:0.1.32
|
||||
image: beclab/auth:0.1.34
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 9091
|
||||
|
||||
Reference in New Issue
Block a user