package kea import _ "embed" type ctrlAgentRoot struct { ControlAgent controlAgent `json:"Control-agent"` } type controlAgent struct { HTTPHost string `json:"http-host"` HTTPPort int `json:"http-port"` ControlSockets map[string]map[string]any `json:"control-sockets"` Loggers []logger `json:"loggers"` } // RenderCtrlAgent renders the deterministic kea-ctrl-agent.conf JSON. The // control agent exposes the HA/REST control channel on CtrlAgentPort and // forwards to kea-dhcp4 over the shared unix socket. func RenderCtrlAgent() (string, error) { return marshal(ctrlAgentRoot{ControlAgent: controlAgent{ HTTPHost: "0.0.0.0", HTTPPort: CtrlAgentPort, ControlSockets: map[string]map[string]any{ "dhcp4": {"socket-type": "unix", "socket-name": CtrlSocketPath}, }, Loggers: loggers("kea-ctrl-agent"), }}) } // initScript is the initContainer entrypoint. It is a committed, shellcheck-clean // shell file (no fmt.Sprintf interpolation) parameterised entirely by the // environment variables the operator sets on the initContainer. It prepares the // shared run dir, finalises this pod's kea-dhcp4 config from the StatefulSet // ordinal, and bounded-waits for the HA peer DNS to resolve before the main // kea-dhcp4 / kea-ctrl-agent containers exec kea directly. // //go:embed scripts/init.sh var initScript string // InitScript returns the initContainer entrypoint shell script. func InitScript() string { return initScript }