#!/sbin/openrc-run

export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

name="Bootstrap cluster"
description="Apply cluster configurations using node.env from /opt/monok8s/config"

command="/opt/scripts/bootstrap-cluster.sh"

LOG_DIR="/var/log/monok8s"
LOG_FILE="$LOG_DIR/bootstrap.log"

depend() {
    need apply-node-config
    use net
}

start() {
    checkpath --directory "$LOG_DIR"

    ebegin "Applying cluster config"
    "$command" >>"$LOG_FILE" 2>&1 &
    eend $?
}
