Skip to content

feat(site): Run each site's Kea centrally - #197

Merged
scotwells merged 17 commits into
feat/manual-inventory-recordsfrom
feat/boot-network-site-dhcp
Nov 29, 2026
Merged

scotwells merged 17 commits into
feat/manual-inventory-recordsfrom
feat/boot-network-site-dhcp

Conversation

@scotwells

@scotwells scotwells commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Each site's DHCP service can now run in a central cluster: several Kea instances behind one address that the site's relays reach over its WAN link, each fed the site's reservations by a synchronizer, with the reservation feed beside the site's boot service. A synchronized site names the DHCP instances it expects, and a reservation counts as withdrawn only once every one of them reports a feed issued after it, so retiring an instance means stopping it and then removing its name. It also adds a Redfish lab mode where Kea is the guest's only DHCP, which has not passed a run yet. Stacked on #194.

Related to #186

How it stays inactive

Nothing deploys it. Only the DHCP components, their render example and the lab's synchronized mode include any of it, no environment configuration sets a site to synchronized DHCP, and the feed refuses to start for a site whose enrollment leaves DHCP to the site. A new CI check renders every configuration root in the repository and fails if any other root starts a Kea server, the synchronizer, the feed, a DHCP listener, a synchronized enrollment or lab switch, or grants IPAM permissions. Adding the feed to a site without its two Secrets stops that site's boot service, so nothing but an explicit choice may include it.

Decisions for a person

  • Who is on call for the central DHCP service.
  • The central cluster must route to every site relay, and each relay must accept Kea's replies from the cluster's egress address.
  • Every network boot at a synchronized site depends on the central cluster and the site's WAN link.
  • An enrollment with synchronized DHCP must now list its DHCP instances, or it no longer parses. No enrollment in the repository is synchronized.
  • The feed cannot see the cluster's Pods, so a replica whose synchronizer stopped while its Kea keeps serving is not detected; stopping Kea before removing its name rests on the operator.

Test plan

  • The feed refuses undeclared instances, and the withdrawal proof stays unproven with a silent, stale or removed-but-polling instance
  • The central DHCP render has one UDP 67 load balancer, no TFTP, and expected instances matching the replicas
  • Every gh pr checks entry green on the head, including the default-off render check and the multi-plane acceptance
  • Synchronized Redfish acceptance and the Kea lab pass

🤖 Generated with Claude Code

@scotwells
scotwells requested review from ecv and kevwilliams November 25, 2026 16:26
@scotwells
scotwells force-pushed the feat/boot-network-site-dhcp branch from 02cfd99 to a67a47f Compare November 25, 2026 17:14
@scotwells
scotwells force-pushed the feat/boot-network-inputs branch from dcd1e10 to 9cf7324 Compare November 25, 2026 17:30
@scotwells
scotwells force-pushed the feat/boot-network-site-dhcp branch from a67a47f to 7133e23 Compare November 25, 2026 17:30
@scotwells
scotwells force-pushed the feat/boot-network-inputs branch from 9cf7324 to 8338335 Compare November 25, 2026 20:37
@scotwells
scotwells force-pushed the feat/boot-network-site-dhcp branch 4 times, most recently from 7a1d49b to 6bc39b4 Compare November 26, 2026 03:43
@scotwells scotwells changed the title feat(site): Ship Kea and the synchronizer as a site component feat(site): Run each site's Kea centrally Nov 26, 2026
@scotwells
scotwells force-pushed the feat/boot-network-inputs branch from 83393e9 to b30485e Compare November 28, 2026 23:02
@scotwells
scotwells force-pushed the feat/boot-network-site-dhcp branch 3 times, most recently from f417f2d to ce8b479 Compare November 29, 2026 02:03
@scotwells scotwells added the multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners label Nov 29, 2026
@scotwells
scotwells marked this pull request as ready for review November 29, 2026 02:59
@scotwells
scotwells requested a review from a team as a code owner November 29, 2026 02:59
@scotwells
scotwells removed the request for review from a team November 29, 2026 02:59

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

Central Kea per site is isolated by construction and well guarded: the base config has no pools (only reserved MACs are answered, asserted in hack/validate-site-dhcp-render.sh), each site runs its own Kea StatefulSet (two replicas), base subnets and relay filter, Feed refuses a duplicate MAC or address, and the feed serves only names in the enrollment's expected set. Nothing deploys it, and the new CI check renders every root to prove that. I mutated the instance-name check on the feed, the served-feed echo check, the issued-after-publish gate, the rejected-contact gate, the Serves check on published reservations, the two-subnets check and the duplicate-address check; each failed a test.

  • Outage behavior is fail-safe for address reuse, not for exposure: when the feed or WAN is down, Kea keeps serving its last applied reservation past Expires and after the boot closed, because dhcpsync.config ignores Expires. The address stays claimed (withdrawal cannot be proven, so the operation goes unknown and the hold keeps the claim), so it cannot reach another Device, but the stale reservation stays live for as long as the outage lasts.

Follow-ups:

  • Drop reservations whose Expires has passed in the synchronizer, so a feed outage ends a boot window at the DHCP server and not only in the bookkeeping.
  • One bearer token is shared by every instance of a site and the instance name is a self-asserted header, so any instance (or token holder) can fetch and report under a sibling's name and complete the withdrawal proof for it. Instance names also repeat across sites (fleet-site-dhcp-0/-1), so separation between sites rests only on each site's feed URL, token and CA: a Kea handed another site's credentials is accepted as that site's instance. Issue a token per instance and bind the site and instance name to it.
  • The Kea container runs as UID 0 with only NET_BIND_SERVICE added; the render check should also assert a NetworkPolicy limiting ingress to UDP 67 and egress to the feed on 8081, since the central namespace is shared with other work. The namespace is a fixed fleet-site, so two sites in one central cluster collide; say how a second site is namespaced.
  • "Synchronized Redfish acceptance and the Kea lab pass" is unchecked. Keep it unchecked until a run passes, and record it before any site is set to synchronized.
  • A replica whose synchronizer stopped while Kea keeps serving is undetected (already noted in the body); an on-call alert on a missing report from any expected instance is the cheap mitigation.

@scotwells
scotwells requested a review from ecv November 29, 2026 04:32

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still approved at 283073c: nothing has changed since my last review.

Base automatically changed from feat/boot-network-inputs to feat/manual-inventory-records November 29, 2026 06:24
scotwells and others added 5 commits November 29, 2026 00:34
Add a site DHCP component: the reservation feed beside the boot service,
now served only over TLS, and Kea DHCPv4 instances with their
synchronizers on host-networked nodes. The synchronizer gains a CA
option and Kea 2.6's socket path. A render check runs in CI, and a lab
runs real Kea, the synchronizer and the feed with a DHCP client to prove
a boot NIC is answered only while its admission is open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Kea 2.6 refuses a control socket directory that is not 0750, and an
emptyDir is created 0777, so Kea's command sets the mode first. The lab
now runs Kea with the component's capabilities and socket directory and
requires the client's "no lease" for every refusal. The render check
covers the mode, volume mounts and selectors, and the docs state the
relay filter, required Secrets, rotation, and what the lab proves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The feed reads only the site store and writes reports beside the boot
evidence, but it built a full boot server, so it needed a boot origin
and the installer artifacts that the feed container does not have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add run.sh --redfish --synced-dhcp. The lab network loses its own DHCP;
Kea and the synchronizer run in the runtime Pod on the lab bridge, the
reservation feed runs beside the boot service, and a synthetic IPAM
stand-in binds boot address claims. A new phase requires each install
and wipe to carry its own claim, Kea to serve each reservation only
while its boot is open, and firmware to lease from Kea, not dnsmasq.
The feed becomes its own component, shared with the site Kea one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Require a Kea lease for the boot MAC at each operation's address granted
inside that operation's boot window, for every operation that powered
on for a network boot, two installations and two wipes. Start Kea only
once the lab bridge has its address, describe the held second
installation plainly, and mark the synced mode as not yet run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scotwells and others added 12 commits November 29, 2026 00:34
Operations no longer carry their claim's UID, so the synced DHCP phase
requires distinct claim names, which derive from distinct operations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DHCP no longer runs at the site. The Kea component deploys once per
site to a central cluster: no host networking, Kea on a UDP socket for
relayed requests only and not authoritative, and several replicas behind
one UDP 67 load-balancer address that the site's relays reach over the
WAN link. Client-IP affinity keeps each relay on one replica, so the
replicas give availability, not load sharing per relay. The synchronizer
reaches the site's feed over TLS at FLEET_DHCP_FEED_URL, and the feed
component stays beside the boot service.

The example base configuration drops the TFTP server and answers the
UEFI HTTP boot vendor class with the boot service's loader URL. The
docs state the reply path, the WAN dependency, why the fence and the
withdrawal proof still hold, and that serving the HTTP boot loader from
a central boot service is still proposed. The render check covers the
new shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A synced Redfish enrollment now names its expected DHCP instances
(dhcpInstances). The workers and the reservation feed read the same
enrollment. The feed serves a feed only to an expected instance, named
on the request, and refuses and does not retain a report from any
other.

Every served feed carries the time it was issued, outside its revision.
Withdrawal is proven only when every expected instance's latest report
is of a feed issued after the admission was stored and serves none of
the Device's reservations. An expected instance that never reported,
or that fetched the reservation and stopped before reporting, keeps the
outcome unknown. The admission records when it was stored (published),
because its creation time is read before the store write.

Retiring an instance is now only shrinking the expected set; the
dhcp-retire command and the lab's retire path are gone, and retained
retirement records are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Removing a name from dhcpInstances drops that instance from the
withdrawal proof, but not its replica, which could keep serving its last
reservations behind the shared load balancer.

The feed now retains each authenticated contact it refuses for a missing
or undeclared instance, {at, instance, rejected: true}, synced before the
403, at most once per instance name every 30 seconds. A failure to
retain still refuses; unauthenticated requests are never recorded.

The withdrawal gate blocks while any refused contact was retained at or
after the admission was published, and passes no earlier than 45
seconds after it, so the rate limit cannot hide a replica that is still
polling. Refused contacts are never evidence of serving or withdrawal.
A replica whose synchronizer stopped while Kea keeps serving is still
not seen; the docs state that limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Client-IP affinity sends all of one relay's traffic to one Kea instance,
so the replicas give availability, not load sharing per relay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An expected instance that applied the empty feed before an admission was
published and never fetched the reservation's revision kept a latest
report issued before publication, and never reported again, so the
withdrawal proof waited forever on a healthy instance.

The synchronizer now also reports its applied feed again, with the issue
time of its latest fetch, once that time is newer than its last report's
and the refresh interval (default 30 s, -refresh) has passed. A changed
revision is still reported at once, and a refused report is not taken
as sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A token holder could post an empty feed with any issue time and satisfy
the withdrawal proof. The feed now remembers, in memory, the last 32
(issue time, revision) pairs it served to each instance and refuses with
409, without retaining it, a report matching none. After a feed restart
reports are refused until the instance fetches again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The withdrawal rule compares against the admission's publication time.
The single-clock assumption rests on the feed and workers sharing a
ReadWriteOnce volume, so one node. State the refresh interval and the
log growth it causes, the 409 for unbound reports, and that production
Kea uses a UDP socket with NET_BIND_SERVICE only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The site now keys each admission's records by its kind, name and fence,
not by the operation's object UID. The synchronized DHCP check reads each
operation's boot record and boot log under that key, and runs only in the
scenario groups that release the lab target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A render check builds every kustomization root under config/ and fails if
any root other than the DHCP components, their example and the Redfish
lab's synchronized mode renders a Kea server, the synchronizer, the
reservation feed, a UDP 67 listener or a synced enrollment. Each opt-in
root must render one, so the list stays exact. CI runs it beside the DHCP
render check.

The feed's refusal of a static enrollment moves into one function with a
test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The check now finds the feed and the synchronizer by binary name, by path
or inside a shell command, and Kea by image or command. It flags UDP 67 on
a container or a Service's target port, the lab's synced DHCP switch, and
any role granting IPAM permissions outside the boot address roles. It also
renders roots under every kustomization file name.

The synchronized DHCP evidence skips refused contacts, which carry no
feed, and the boot network doc says which lab mode sets a boot address
class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scotwells
scotwells force-pushed the feat/boot-network-site-dhcp branch from 283073c to 5617a92 Compare November 29, 2026 07:18
@scotwells scotwells added multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners and removed multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners labels Nov 29, 2026
@scotwells
scotwells requested a review from ecv November 29, 2026 07:19

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve.

Rebase onto the merged power stack. Range-diff against my last review shows only conflict resolutions: the site component now sits after redfishKinds, and the lab coordinator role gains devicepoweroperations alongside the other kinds. No behaviour change in this PR's own commits.

@scotwells
scotwells merged commit ed144ec into feat/manual-inventory-records Nov 29, 2026
20 checks passed
@scotwells
scotwells deleted the feat/boot-network-site-dhcp branch November 29, 2026 09:01
@scotwells
scotwells requested a review from ecv November 29, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

multiplane-acceptance Run the multiplane acceptance suites on GitHub-hosted runners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants