#!/usr/bin/execlineb -P
# kube-controller-manager runs only with its configuration: /etc/default/kube-controller-manager, written by Puppet
# (role k8s-api). The package ships no defaults any more -- those of 1.34.7
# and earlier used flags kube 1.34 no longer knows (--admission-control,
# --feature-gates CustomResourceValidation, scheduler --address). Without the
# file the unit says so and exits; .permafail stops the restart loop.
#
# Readiness: data/probe (port 10257 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-controller-manager } {
  foreground { echo "kube-controller-manager: /etc/default/kube-controller-manager is missing -- not starting (Puppet writes it, role k8s-api)" }
  exit 1
}
s6-notifyoncheck -d -w 1000 -n 120 --
run-script-daemon kube-controller-manager
