Files
kea-operator/internal/kea/consts.go
T
unkinben d3fb5dcd1a
ci/woodpecker/pr/build Pipeline failed
ci/woodpecker/pr/pre-commit Pipeline failed
ci/woodpecker/pr/test Pipeline failed
Scaffold kea-operator: CRDs, controllers, config rendering, REST API, CI
Replace the ISC dhcpd PXE-boot VM with a Kea DHCP Kubernetes operator, modelled
on bind-operator. The operator renders kea-dhcp4 config from CRs and runs an HA
pair of kea-dhcp4 + kea-ctrl-agent servers behind an anycast Service.

- add KeaCluster/KeaSubnet/KeaClientClass/KeaAPI CRDs (group kea.unkin.net)
- render deterministic kea-dhcp4.conf + kea-ctrl-agent.conf into a ConfigMap and
  roll the StatefulSet via a config-hash annotation; best-effort hot-reload via
  the kea-ctrl-agent REST channel
- run HA hot-standby (memfile leases) with stable per-peer DNS identity from a
  StatefulSet; expose an anycast LoadBalancer Service for PureLB
- represent the full legacy dhcpd config: 198.18.13-17.0/24 pools, pool-less
  198.18.25.0/24, and the Legacy/UEFI-64 PXE arch classes (option 93)
- add the KeaAPI-spawned REST service: Terraform-friendly CRUD over subnet and
  client-class CRs (stable IDs, PUT upsert, 404 drift, bearer-token auth)
- add Makefile (patch/minor/major tag targets), distroless operator/api images,
  an AlmaLinux+EPEL kea workload image, and woodpecker CI with k8s resources +
  serviceAccountName on every step
- unit tests for config rendering, controller reconcile/config-hash, and the API

Claude-Session: https://claude.ai/code/session_01JUoARVdmhxKQHyyyp1pxeT
2026-08-02 18:42:46 +10:00

48 lines
1.7 KiB
Go

package kea
// Filesystem and binary paths inside the kea container image, plus the
// operator's label/annotation vocabulary.
const (
// ContainerDHCP4 is the kea-dhcp4 container name.
ContainerDHCP4 = "kea-dhcp4"
// ContainerCtrlAgent is the kea-ctrl-agent container name.
ContainerCtrlAgent = "kea-ctrl-agent"
// ConfigDir is where projected config is mounted read-only.
ConfigDir = "/etc/kea-operator"
// RunDir is a shared emptyDir for the config copy and control socket.
RunDir = "/run/kea"
// DHCP4ConfPath is the runtime kea-dhcp4 config.
DHCP4ConfPath = RunDir + "/kea-dhcp4.conf"
// CtrlAgentConfPath is the runtime kea-ctrl-agent config.
CtrlAgentConfPath = RunDir + "/kea-ctrl-agent.conf"
// CtrlSocketPath is the unix control socket between ctrl-agent and dhcp4.
CtrlSocketPath = RunDir + "/kea4-ctrl-socket"
// EntrypointPath is the generated container entrypoint.
EntrypointPath = ConfigDir + "/entrypoint.sh"
// DHCP4Bin is the kea-dhcp4 server binary.
DHCP4Bin = "/usr/sbin/kea-dhcp4"
// CtrlAgentBin is the kea-ctrl-agent binary.
CtrlAgentBin = "/usr/sbin/kea-ctrl-agent"
// HooksDir holds the Kea hook libraries.
HooksDir = "/usr/lib64/kea/hooks"
// HALibrary is the High Availability hook.
HALibrary = HooksDir + "/libdhcp_ha.so"
// LeaseCmdsLibrary is the lease commands hook (required by HA lease sync).
LeaseCmdsLibrary = HooksDir + "/libdhcp_lease_cmds.so"
// CtrlAgentPort is the REST control channel port.
CtrlAgentPort = 8000
// DHCP4Port is the DHCPv4 server port.
DHCP4Port = 67
// DefaultImage is the kea workload image built by this repo.
DefaultImage = "git.unkin.net/unkin/kea:latest"
// ClientArchOption is the DHCP option code carrying PXE client arch.
ClientArchOption = 93
)