Skip to content

Commit 07dc525

Browse files
committed
* update k3s installation scripts for improved datastore handling
1 parent b4251b2 commit 07dc525

4 files changed

Lines changed: 17 additions & 3 deletions

File tree

common/const.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ ExecStart=/usr/local/bin/k3s \
161161
{{- if .DataStore }}
162162
{{- if ne .DataStore "local"}}
163163
--datastore-endpoint {{ .DataStore }} \
164-
{{-end}}
164+
{{- end}}
165165
{{- else}}
166166
--cluster-init \
167167
--etcd-expose-metrics \
@@ -176,7 +176,7 @@ ExecStart=/usr/local/bin/k3s \
176176
{{- else}}
177177
agent \
178178
{{- end }}
179-
{{if not .Master0 -}}
179+
{{if not .Master0 }}
180180
--server https://{{ .KubeAPI }}:6443 \
181181
{{ end }}
182182
--token {{ .KubeToken }} \

hack/scripts/devops/devops.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
# - USEPHP7
5252
# Use PHP7 when install Zentao DevOPS.
5353
# Defaults to 'false'
54+
# - DATASTORE
55+
# Use datastore when install k3s cluster.
56+
# Defaults to '', support 'local(sqlite)', default use etcd as datastore
57+
# If STORAGE_TYPE is 'local', use 'sqlite(local)' as datastore
5458

5559
set -e
5660
set -o noglob
@@ -235,6 +239,9 @@ install_zentao_devops() {
235239
if [ -n "${STORAGE_PATH}" ]; then
236240
INSTALL_COMMAND="${INSTALL_COMMAND} --storage-path ${STORAGE_PATH}"
237241
fi
242+
if [ -z "${DATASTORE}" ]; then
243+
export DATASTORE="local"
244+
fi
238245
fi
239246
if [ -n "${EX_DB_HOST}" ] && [ -n "${EX_DB_PASSWORD}" ]; then
240247
INSTALL_COMMAND="${INSTALL_COMMAND} --ext-db-host ${EX_DB_HOST} --ext-db-password ${EX_DB_PASSWORD}"
@@ -248,6 +255,9 @@ install_zentao_devops() {
248255
if [ -n "${USEPHP7}" ] && [ "$(echo "${USEPHP7}" | tr '[:upper:]' '[:lower:]')" != "false" ]; then
249256
INSTALL_COMMAND="${INSTALL_COMMAND} --use-php7"
250257
fi
258+
if [ -n "${DATASTORE}" ]; then
259+
INSTALL_COMMAND="${INSTALL_COMMAND} --datastore ${DATASTORE}"
260+
fi
251261
if [ -n "${DEBUG}" ]; then
252262
INSTALL_COMMAND="${INSTALL_COMMAND} --debug"
253263
fi

hack/scripts/devops/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
# - USEPHP7
5252
# Use PHP7 when install Zentao DevOPS.
5353
# Defaults to 'false'
54+
# - DATASTORE
55+
# Use datastore when install k3s cluster.
56+
# Defaults to '', support 'local(sqlite)', default use etcd as datastore
57+
# If STORAGE_TYPE is 'local', use 'sqlite(local)' as datastore
5458

5559
set -e
5660
set -o noglob

internal/pkg/cli/k3stpl/k3stpl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func EmbedCommand(f factory.Factory) *cobra.Command {
9191
rootCmd.Flags().StringVar(&k3sargs.PodCIDR, "pod-cidr", common.DefaultClusterPodCidr, "cluster cidr")
9292
rootCmd.Flags().StringVar(&k3sargs.ServiceCIDR, "service-cidr", common.DefaultClusterServiceCidr, "service cidr")
9393
rootCmd.Flags().StringVar(&k3sargs.DataDir, "data-dir", "", "data dir")
94-
rootCmd.Flags().StringVar(&k3sargs.DataStore, "data", "", "data type")
94+
rootCmd.Flags().StringVar(&k3sargs.DataStore, "datastore", "", "datastore")
9595
rootCmd.Flags().StringVar(&k3sargs.KubeAPI, "kubeapi", "", "kubeapi")
9696
rootCmd.Flags().BoolVar(&k3sargs.TypeMaster, "master", true, "master type")
9797
rootCmd.Flags().BoolVar(&k3sargs.Master0, "master0", false, "master0")

0 commit comments

Comments
 (0)