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
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: dhcp-system
|
||||
---
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaCluster
|
||||
metadata:
|
||||
name: pxe
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
replicas: 2
|
||||
image: git.unkin.net/unkin/kea:latest
|
||||
domainName: main.unkin.net
|
||||
defaultLeaseTime: 1200
|
||||
maxLeaseTime: 86400
|
||||
ha:
|
||||
mode: hot-standby
|
||||
service:
|
||||
type: LoadBalancer
|
||||
# Anycast address handed out by PureLB; router relays forward unicast here.
|
||||
loadBalancerIP: 198.18.19.53
|
||||
ipAddressPool: dhcp-anycast
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 512Mi
|
||||
@@ -0,0 +1,91 @@
|
||||
# Full translation of the legacy ISC dhcpd pools: 198.18.13-17.0/24 each with a
|
||||
# .200-.220 pool, plus 198.18.25.0/24 with no pool (declared so relayed requests
|
||||
# are still serviced). routers .1, dns 198.18.19.15, next-server 198.18.19.19.
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaSubnet
|
||||
metadata:
|
||||
name: net-198-18-13
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
subnet: 198.18.13.0/24
|
||||
pools:
|
||||
- 198.18.13.200 - 198.18.13.220
|
||||
routers: [198.18.13.1]
|
||||
dnsServers: [198.18.19.15]
|
||||
domainName: main.unkin.net
|
||||
nextServer: 198.18.19.19
|
||||
---
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaSubnet
|
||||
metadata:
|
||||
name: net-198-18-14
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
subnet: 198.18.14.0/24
|
||||
pools:
|
||||
- 198.18.14.200 - 198.18.14.220
|
||||
routers: [198.18.14.1]
|
||||
dnsServers: [198.18.19.15]
|
||||
domainName: main.unkin.net
|
||||
nextServer: 198.18.19.19
|
||||
---
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaSubnet
|
||||
metadata:
|
||||
name: net-198-18-15
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
subnet: 198.18.15.0/24
|
||||
pools:
|
||||
- 198.18.15.200 - 198.18.15.220
|
||||
routers: [198.18.15.1]
|
||||
dnsServers: [198.18.19.15]
|
||||
domainName: main.unkin.net
|
||||
nextServer: 198.18.19.19
|
||||
---
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaSubnet
|
||||
metadata:
|
||||
name: net-198-18-16
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
subnet: 198.18.16.0/24
|
||||
pools:
|
||||
- 198.18.16.200 - 198.18.16.220
|
||||
routers: [198.18.16.1]
|
||||
dnsServers: [198.18.19.15]
|
||||
domainName: main.unkin.net
|
||||
nextServer: 198.18.19.19
|
||||
---
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaSubnet
|
||||
metadata:
|
||||
name: net-198-18-17
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
subnet: 198.18.17.0/24
|
||||
pools:
|
||||
- 198.18.17.200 - 198.18.17.220
|
||||
routers: [198.18.17.1]
|
||||
dnsServers: [198.18.19.15]
|
||||
domainName: main.unkin.net
|
||||
nextServer: 198.18.19.19
|
||||
---
|
||||
# No pool: declared so relayed DHCP requests on this net are matched and get
|
||||
# options, but no dynamic address is allocated (subnet-mask derives from CIDR).
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaSubnet
|
||||
metadata:
|
||||
name: net-198-18-25
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
subnet: 198.18.25.0/24
|
||||
routers: [198.18.25.1]
|
||||
dnsServers: [198.18.19.15]
|
||||
domainName: main.unkin.net
|
||||
@@ -0,0 +1,21 @@
|
||||
# PXE boot classes matching the client architecture option (code 93), replacing
|
||||
# the legacy dhcpd "Legacy" and "UEFI-64" classes.
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaClientClass
|
||||
metadata:
|
||||
name: Legacy
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
archHex: ["0x0000"]
|
||||
bootFileName: /undionly.kpxe
|
||||
---
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaClientClass
|
||||
metadata:
|
||||
name: UEFI-64
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
clusterRef: pxe
|
||||
archHex: ["0x0007", "0x0009"]
|
||||
bootFileName: /ipxe.efi
|
||||
@@ -0,0 +1,21 @@
|
||||
# Optional: spawn the Terraform-friendly REST API that CRUDs KeaSubnet /
|
||||
# KeaClientClass CRs. Auth is a bearer token; the operator generates the token
|
||||
# Secret if absent, or it can be pre-seeded (e.g. by a Vault static secret).
|
||||
apiVersion: kea.unkin.net/v1alpha1
|
||||
kind: KeaAPI
|
||||
metadata:
|
||||
name: kea-api
|
||||
namespace: dhcp-system
|
||||
spec:
|
||||
replicas: 1
|
||||
image: git.unkin.net/unkin/kea-api:latest
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 256Mi
|
||||
Reference in New Issue
Block a user