#!/usr/bin/execlineb -P
# kube-proxy runs only with its configuration: /etc/default/kube-proxy, written by Puppet
# (role aep-minion). The package ships no defaults any more, like the other
# units of this package. Without the file the unit says so and exits;
# .permafail stops the restart loop.
#
# Readiness: data/probe (the healthz port, 10256 unless configured otherwise,
# accepts connections), asked by s6-notifyoncheck every second for up to 120 s;
# the answer goes to the unit log via check-report (data/check).
ifelse -n { test -r /etc/default/kube-proxy } {
  foreground { echo "kube-proxy: /etc/default/kube-proxy is missing -- not starting (Puppet writes it, role aep-minion)" }
  exit 1
}
s6-notifyoncheck -d -w 1000 -n 120 --
run-script-daemon kube-proxy
