Skip to content

staging hub-ha stage 1: leader election on the single hub - #118

Merged
tekn0ir merged 4 commits into
teknoir-cloudfrom
staging-hub-ha-1
Oct 22, 2026
Merged

tekn0ir merged 4 commits into
teknoir-cloudfrom
staging-hub-ha-1

Conversation

@tekn0ir

@tekn0ir tekn0ir commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Anders 2026-10-22: "Hub HA on staging".

Stage 1 of active-passive hub HA (plans/ztna-later.md hub-ha): wg-hub sha-b563d89 (wg-tunnel #8) with LEADER_ELECTION, a Lease, a hub Role that patches the pod role label, and a wg-hub-pods Service; still one replica. Expect one last ~1.5 min device blip (the old image has no handover). Gate before stage 2: the pod shows hub-role=leader and holds the lease.

charts/ztna/tests/run.sh and scripts/tests/run.sh green; Opus reviews clean.

🤖 Generated with Claude Code

tekn0ir and others added 4 commits October 22, 2026 14:42
Fail-safe first stage: nothing selects on the new label yet, the Deployment
stays one pod with Recreate.

- hub pods carry app.kubernetes.io/component=hub and ztna.teknoir.org/hub-role
  (standby at start; the hub moves it), env POD_NAME, LEADER_ELECTION=wg-hub
  and the timings, HANDOVER_WAIT 0s with one replica (hub.replicas), 10s else.
- new headless Service wg-hub-pods (UDP 51820, publishNotReadyAddresses,
  selector name + component=hub, so not the pull secret pods).
- RBAC: Lease create and get/update on wg-hub, pods get/patch.
- admission: ztna-workloads lets the hub SA UPDATE a hub pod, changing only
  the hub-role label (leader|standby) and the pod-deletion-cost annotation
  (0|100); new ztna-hub-lease reserves the Lease to the hub (and teardown).
- stunner: the UDPRoute lists wg-hub and wg-hub-pods.
- tests: unittest asserts, run.sh structural sets, vap-test.sh (hub allowed
  only on the two keys of hub pods; other labels, annotations, image,
  ownerReferences, finalizers, pull secret pods, lookalike pod, Backstage and
  others denied; Lease hub-only).

hub.image.tag is not changed: the pin follows the wg-tunnel merge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…lection

Review fixes for hub-ha stage 1: the hub only patches its own pod, so drop get
from the pods rule (it could read the spec of other teknoir-ztna pods). Note at
the image pin that it must be replaced by a leader-election build before release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…derElection pin flag

A k3s API outage over renewDeadline makes the only hub lose its lease and drop all
sessions; vpro k3s restarts take a minute or two. The timings now outlast that.
hub.image.leaderElection records that the pin carries leader election (gate in stage 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wg-tunnel #8 (b563d89): leader election, role label, planned handover.
leaderElection: true goes with this pin (the image sets the hub-role label).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tekn0ir
tekn0ir merged commit 1619be9 into teknoir-cloud Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant