Skip to content

Commit ba97a43

Browse files
author
lijianguo
committed
chore(workflow): set k3s and longhorn data path
1 parent d739f5f commit ba97a43

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

_scripts/install.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ function install_k3s_server {
120120
configure_mirrors
121121
install_cin_plugins
122122
INSTALL_K3S_EXEC="server ${INSTALL_K3S_EXEC} --flannel-backend=none --disable=traefik --disable=local-storage --disable=servicelb --cluster-cidr=10.233.0.0/16"
123+
if [[ -n "${K3S_DATA_DIR}" ]] ; then
124+
INSTALL_K3S_EXEC="$INSTALL_K3S_EXEC --data-dir=${K3S_DATA_DIR}/rancher/k3s"
125+
fi
123126
if [[ -z "${K3S_URL}" ]] ; then
124127
INSTALL_K3S_EXEC="$INSTALL_K3S_EXEC --cluster-init"
125128
fi
@@ -130,6 +133,9 @@ function install_k3s_agent {
130133
configure_os
131134
configure_mirrors
132135
install_cin_plugins
136+
if [[ -n "${K3S_DATA_DIR}" ]] ; then
137+
INSTALL_K3S_EXEC="$INSTALL_K3S_EXEC --data-dir=${K3S_DATA_DIR}/rancher/k3s"
138+
fi
133139
curl -sfL "${k3s_install_url}" |INSTALL_K3S_EXEC="$INSTALL_K3S_EXEC" sh -s -
134140
}
135141

@@ -158,9 +164,13 @@ EOF
158164
}
159165

160166
function install_longhorn {
167+
if [[ -n "${LONGHORN_DATA_PATH}" ]] ; then
168+
LONGHORN_DATA_PATH="${LONGHORN_DATA_PATH}/longhorn"
169+
fi
161170
helm install longhorn drycc/longhorn --create-namespace \
162171
--set persistence.defaultClass=true \
163172
--set persistence.defaultClassReplicaCount=1 \
173+
--set defaultSettings.defaultDataPath=${LONGHORN_DATA_PATH:-""} \
164174
--namespace longhorn-system --wait
165175
}
166176

@@ -173,7 +183,7 @@ function check_drycc_env {
173183
echo -e "\\033[31m---> For example, the current server IP is 8.8.8.8\\033[0m"
174184
echo -e "\\033[31m---> Please point *.drycc.cc to 8.8.8.8\\033[0m"
175185
exit 1
176-
fi
186+
fi
177187

178188
if [[ -z "${DRYCC_ADMIN_USERNAME}" || -z "${DRYCC_ADMIN_PASSWORD}" ]] ; then
179189
echo -e "\\033[31m---> Please set the DRYCC_ADMIN_USERNAME and DRYCC_ADMIN_PASSWORD variable.\\033[0m"

_scripts/uninstall.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ shopt -s expand_aliases
55
/usr/local/bin/k3s-killall.sh
66
/usr/local/bin/k3s-uninstall.sh
77

8+
if [[ -n "${K3S_DATA_DIR}" ]] ; then
9+
rm -rf "${K3S_DATA_DIR}/rancher"
10+
fi
11+
12+
if [[ -n "${LONGHORN_DATA_PATH}" ]] ; then
13+
rm -rf "${LONGHORN_DATA_PATH}/longhorn"
14+
fi
15+
816
rm -rf /etc/rancher
917
rm -rf /var/lib/longhorn
1018
rm -rf /usr/local/bin/helm ~/.config/helm

src/quickstart/install-workflow.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ $ export PLATFORM_DOMAIN=59.46.3.190.nip.io
124124

125125
## Install
126126

127-
Before installation, please make sure whether your installation environment is a public network.
127+
Before installation, please make sure whether your installation environment is a public network.
128128
If it is an intranet environment and there is no public IP, you need to disable the automatic certificate.
129129

130130
```
@@ -146,7 +146,7 @@ $ curl -sfL https://drycc.cc/install.sh | bash -
146146

147147
### Install Node
148148

149-
Node can be a simple agent or a server; Server has the function of agent. Multiple servers have high availability, but the number of servers should not
149+
Node can be a simple agent or a server; Server has the function of agent. Multiple servers have high availability, but the number of servers should not
150150
exceed 7 at most. There is no limit to the number of agents.
151151

152152
* First, check the cluster token of the master.
@@ -210,9 +210,11 @@ RABBITMQ_PERSISTENCE_SIZE | The size of the persistence space a
210210
RABBITMQ_PERSISTENCE_STORAGE_CLASS | StorangeClass of `rabbitmq`; default storangeclass is used by default
211211
HELMBROKER_PERSISTENCE_SIZE | The size of the persistence space allocated to `helmbroker`, which is `5Gi` by default
212212
HELMBROKER_PERSISTENCE_STORAGE_CLASS | StorangeClass of `helmbroker`; default storangeclass is used by default
213+
K3S_DATA_DIR | The config of k3s data dir; If not set, the default path is used
214+
LONGHORN_DATA_PATH | The defaultDataPath of longhorn; If not set, the default path is used
213215

214216
Since the installation script will install k3s, other environment variables can refer to k3s installation [environment variables](https://rancher.com/docs/k3s/latest/en/installation/install-options/).
215-
217+
216218
## Uninstall
217219

218220
If you installed drycc using an installation script, you can uninstall the entire drycc using this script.

0 commit comments

Comments
 (0)