summaryrefslogtreecommitdiff
path: root/sys-cluster/kube-router/files/kube-router.initd
blob: 9b96ec024f66ef710576bd74eef7bbee3f74c7d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/sbin/openrc-run
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

description="Kubernetes routing engine"
supervisor=supervise-daemon
command="/usr/bin/kube-router"
error_log='/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log'
pidfile="${pidfile:-/run/${RC_SVCNAME}.pid}"

command_args="--master=${K8S_APISERVER} --kubeconfig=${KUBECONFIG} \
              --run-service-proxy=${RUN_PROXY:-false} \
              --run-firewall=${RUN_FIREWALL:-false} \
              --run-router=${RUN_ROUTER:-false} \
              ${HOSTNAME:+--hostname-override=}${HOSTNAME} \
              ${EXTRA_ARGS}"

extra_commands="clear"

clear() {
    "${command}" --cleanup-config
}

if [[ -n "${KUBE_ROUTER_HEALTHCHECK_URI}" ]]; then
        healthcheck_delay=60
        healthcheck_timer=30

        healthcheck() {
                command -v wget || return 0
                wget -Oq- "${KUBE_ROUTER_HEALTHCHECK_URI}"
        }
fi