Update ctl init to support env file

This commit is contained in:
2026-03-30 19:33:44 +08:00
parent 60a9ffeaf6
commit d9ffd1b446
12 changed files with 450 additions and 1191 deletions

View File

@@ -1,23 +0,0 @@
#!/sbin/openrc-run
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
name="Apply node config"
description="Apply node configurations using node.env from /opt/monok8s/config"
command="/opt/scripts/apply-node-config.sh"
LOG_DIR="/var/log/monok8s"
LOG_FILE="$LOG_DIR/apply-node-config.log"
depend() {
need localmount
}
start() {
checkpath --directory "$LOG_DIR"
ebegin "Applying node config"
"$command" >>"$LOG_FILE" 2>&1
eend $?
}

View File

@@ -2,23 +2,24 @@
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
name="Bootstrap cluster"
description="Apply cluster configurations using node.env from /opt/monok8s/config"
name="Bootstrap the Cluster"
description="Runs the ctl init bootstrap sequence"
command="/opt/scripts/bootstrap-cluster.sh"
command="/usr/local/bin/ctl"
command_args="init --env-file /opt/monok8s/config/cluster.env"
LOG_DIR="/var/log/monok8s"
LOG_FILE="$LOG_DIR/bootstrap.log"
LOG_FILE="$LOG_DIR/bootstrap-cluster.log"
depend() {
need apply-node-config
use net
need localmount
}
start() {
checkpath --directory "$LOG_DIR"
ebegin "Applying cluster config"
"$command" >>"$LOG_FILE" 2>&1 &
ebegin "Starting the bootstrap sequence"
start-stop-daemon --start \
--exec "$command" \
-- $command_args >>"$LOG_FILE" 2>&1
eend $?
}