Repository navigation
Description
Problem
The roadmap Service deploys with strategy: Recreate and 1 replica (k8s/devops/roadmap-service/deployment.yaml): the old pod drains for up to 600 s (grace 660 s) and stops, and only then the new pod starts. While no pod is ready, GitHub webhook deliveries fail: 5 of the 40 deliveries before 22:08Z on 2026-11-16 got HTTP 503, during the rollout of release 0.169.1. A failed delivery is not sent again by GitHub, so each rollout loses events, and a poll must repair them with GitHub budget. The project ships about 19 releases a day (owner decision of 2026-11-13), so the gap repeats often.
The Service holds singleton state: the home volume roadmap-service-home (ReadWriteOnce, local-path) with the schedule and budget files, and one in-process GitHub budget and set of rows. Two pods at once would run each row twice and spend the budget twice.
Owner, 2026-11-16: "we should do rolling releases with health checks before cutting traffic for the service".
Expected behavior
- A release of the Service rolls with no gap: the new pod starts, passes its readiness check, and gets traffic before the old pod stops getting it (
RollingUpdate,maxUnavailable: 0, readiness gates the traffic, a PodDisruptionBudget). - The webhook route answers during the whole rollout: no 5xx from the Service for a signed delivery (measured on the hook deliveries during a release).
- The rows run once at a time: one pod holds a Kubernetes Lease (or an equal lock), the new pod takes the rows only after the old pod releases them, and a kill of the holder lets the other pod take them after the lease ends.
- The state that two pods need is in Valkey or in the Lease, not on a ReadWriteOnce volume, or the design says why a part can stay.
- A test of the manifests holds the strategy and the probes; a live check of one release shows no 5xx on the hook.
Related
- feat(service): make the webhook router stateless #4575 (stateless webhook router), feat(service): share the GitHub budget and holds in Valkey #4563 (budget and holds in Valkey), feat(roadmap): move Service work to Workflows and Valkey #4517 (Service work to Workflows and Valkey), feat(roadmap): run each stage item in its own Job #4559 (jobs survive rollouts), fix(cloudflare): find the edge rule that answers 403 for the webhook route #5035 (webhook 403s, fixed 2026-11-16).
Proposed design
Problem statement
The Service runs one pod with strategy: Recreate. Each release drains the old pod for up to 600 s and starts no new pod. During that time GitHub webhook deliveries get HTTP 503, and GitHub does not send them again. The change makes the Deployment roll with two replicas, maxUnavailable: 0 and a readiness gate. It adds a PodDisruptionBudget and a Kubernetes Lease, so two pods never run a row twice.
Acceptance criteria
Requirement: Rolling update strategy
The roadmap-service Deployment SHALL run two replicas with RollingUpdate, maxUnavailable: 0 and maxSurge: 1.
Scenario: Manifest holds the rollout strategy
- WHEN The check reads
k8s/devops/roadmap-service/deployment.yaml. - THEN The check finds
replicas: 2,strategy.type: RollingUpdate,rollingUpdate.maxUnavailable: 0androllingUpdate.maxSurge: 1.
Requirement: Probes gate the traffic
The roadmap-service Deployment SHALL keep a readiness probe on /readyz and a liveness probe on /healthz, each on port 8000.
Scenario: Manifest holds both probes
- WHEN The check reads the container of the Deployment.
- THEN It finds the readiness probe path
/readyzand the liveness probe path/healthz, each on port 8000.
Requirement: Follower reports ready
A Service pod that does not hold the Lease SHALL answer /readyz with HTTP 200.
Scenario: Second pod is ready without the Lease
- WHEN Two Service instances start and the first takes the Lease.
- THEN
GET /readyzon the second returns 200, and the second runs no row.
Requirement: Only the holder runs a row
The Service SHALL run a row and write the schedule and budget files only on the pod that holds the Lease.
Scenario: Due row on both pods
- WHEN The Lease holder and the follower both have a due row.
- THEN Only the holder runs the row, and the follower runs none until it takes the Lease.
Requirement: Lease takeover after a kill
A Service pod SHALL take the Lease after the holder stops renewing it, and run each row once.
Scenario: Holder is killed
- WHEN The holder is killed with no release, and the other pod waits.
- THEN The other pod takes the Lease after
leaseDurationSecondsand runs the row once.
Requirement: Readiness fails on SIGTERM
On SIGTERM the Service SHALL fail /readyz at once, finish the current row, and release the Lease before the process exits.
Scenario: Stop during a row
- WHEN The pod receives SIGTERM while a row runs.
- THEN
/readyzreturns 503 at once, the row ends, the Lease is released, and the process exits withinterminationGracePeriodSeconds.
Requirement: Pod disruption budget
The manifest set SHALL hold a PodDisruptionBudget that keeps one roadmap-service pod available during a node drain.
Scenario: Budget selects the Service pods
- WHEN The check reads
k8s/devops/roadmap-service/pdb.yamlandk8s/devops/roadmap-service/kustomization.yaml. - THEN The budget selects
app.kubernetes.io/name: roadmap-servicewithminAvailable: 1, and the kustomization lists the file.
Requirement: Role grants the Lease
The roadmap-service Role SHALL grant get, create, update and patch on leases in the coordination.k8s.io API group.
Scenario: Role rule for leases
- WHEN The check reads
k8s/devops/roadmap-service/role.yaml. - THEN It finds a rule with
apiGroups: [coordination.k8s.io],resources: [leases]and the four verbs.
Requirement: Instance id per pod
Each roadmap-service pod SHALL set service.instance.id to its own pod name.
Scenario: Instance id comes from the pod
- WHEN The check reads the environment of the container.
- THEN
OTEL_RESOURCE_ATTRIBUTEStakes the downward API fieldmetadata.name, and no fixedservice.instance.id=roadmap-servicestays.
Requirement: No 5xx on the hook during a release
The Service SHALL answer each signed webhook delivery with no 5xx status during a release.
Scenario: One release rolls
- WHEN A release rolls and the check reads the recorded hook deliveries of its window.
- THEN No delivery has a 5xx status from the Service.
Requirement: Spec holds the two-replica requirement
The change SHALL replace the requirement The Service runs as one pod with the two-replica rollout requirement.
Scenario: Spec after the archive
- WHEN The change is archived.
- THEN
openspec/specs/roadmap-service-deployment/spec.mdholds the rollout requirement and no requirement that the Service runs as one pod.
Existing Tool Considered
No alternatives check has run. The need is a single-active-runner lock and a rolling Deployment. The open, maintained tool is the coordination.k8s.io/v1 Lease API, reached through the official kubernetes Python client that the Service already uses to reach the API server. It lacks a Python leader-election loop, because only client-go ships one. The project writes a renew loop of about 100 lines and its tests: about 25k tokens to build, keep and fix that code, and about one day of elapsed work. The Deployment, the PodDisruptionBudget and the probes need no code, because they are manifest fields.
Key questions
- Which rollout strategy and replica count does the Service use?: Use
RollingUpdatewithreplicas: 2,maxUnavailable: 0andmaxSurge: 1, and a PodDisruptionBudget withminAvailable: 1. ADR 0021 records this target for the Service, and the owner asked on 2026-11-16 for rolling releases with health checks before the traffic moves. (best practice) [sources: docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:33, k8s/devops/roadmap-service/deployment.yaml]- Chosen: RollingUpdate, 2 replicas, maxUnavailable 0. ADR 0021 names it, and one pod always answers the webhook route.
- Rejected: Recreate with a preStop hold. One pod stops before the next starts, so the webhook gap stays.
- Rejected: RollingUpdate, 1 replica, maxUnavailable 1. The only pod stops before the new pod is ready, so the gap stays.
- How does the Service keep the rows to one pod at a time?: The pod takes a
coordination.k8s.io/v1Lease before it runs a row, and it renews the Lease. Only the holder runs rows and writes the state files. The follower serves the webhook route and the read-only API, and it reports ready. UseleaseDurationSeconds: 30,renewDeadline: 20andretryPeriod: 5: a killed holder is replaced within 30 s, and a live holder keeps the Lease. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, k8s/devops/roadmap-service/role.yaml]- Chosen: Kubernetes Lease through the official Python client. The Service already holds a service account and an API token, and the Lease outlives a Valkey outage.
- Rejected: Valkey lock through the Valkey client. The Service already reaches Valkey, but the lock adds a second failure domain and no fencing token.
- Rejected: No lock, one pod by hand. Argo CD self-heals the replica count, and a rollout starts a second pod.
- Where do the schedule and budget files live while two pods run?: They stay on the
roadmap-service-homevolume. The local-path volume binds to the node where the pod first runs, so the second pod lands on that node and mounts the same files. The Lease makes the holder the only writer, so the follower writes no file and runs no row. The move to Valkey stays with feat(service): share the GitHub budget and holds in Valkey #4563 and feat(roadmap): move Service work to Workflows and Valkey #4517. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, k8s/devops/roadmap-service/pvc.yaml, docs/adr/0021-the-roadmap-service-is-a-webhook-router-cluster-pods-run-the-roadmap-jobs-and-valkey-holds-their-shared-state.md:33]- Chosen: Keep the volume, guard the writers with the Lease. The volume binds to one node, and one holder writes the files.
- Rejected: Move the files to Valkey in this change. feat(service): share the GitHub budget and holds in Valkey #4563 and feat(roadmap): move Service work to Workflows and Valkey #4517 own that move, and it makes this change too big.
- Rejected: Replace the volume with an emptyDir. A restart resets the hourly GitHub budget, and the spec requires that a deploy keeps it.
- Must
/readyzwait for the Lease?: No./readyzreports that the process can serve HTTP. If it waited for the Lease, the new pod would never be ready, and withmaxUnavailable: 0the old pod would never stop. The rollout would stall. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml]- Chosen: Readiness reports the HTTP server only. The new pod takes traffic before it takes the rows, so the gap closes.
- Rejected: Readiness includes the Lease. The old pod holds the Lease until SIGTERM, so the new pod is never ready and the rollout deadlocks.
- What must the pod do on SIGTERM?: Fail
/readyzat once, so the endpoint is removed. Finish the current row, release the Lease, drain the in-flight requests and exit. Keep the 600 s drain and the 660 s grace period: the new pod serves the webhook route during the drain, and fix(roadmap): a Service rollout stops stage rounds with no record #4485 set those values. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml]- Chosen: Fail readiness at once, then drain. The endpoint goes away before the pod stops, so no delivery reaches a draining pod.
- Rejected: Keep readiness true during the drain. New deliveries reach the draining pod and get 503.
- Rejected: Shorten the drain. A shorter drain cuts the rows that are in flight, and fix(roadmap): a Service rollout stops stage rounds with no record #4485 set the value.
- What changes in the metrics identity when two pods run?: Each pod sets
service.instance.idto its own pod name from the downward API fieldmetadata.name. The fixed valueroadmap-servicemerges two pods into one series. (best practice) [sources: k8s/devops/roadmap-service/deployment.yaml, CONTEXT.md]- Chosen: Set service.instance.id to the pod name. The manifest comment says the fixed id holds only for one replica and the Recreate strategy.
- Rejected: Keep the fixed service.instance.id. Prometheus then merges two pods into one series, and the breakdown panel shows one line.
- Which check holds the manifests?: Add a gate check under
tests/gate/k8s_checks/that reads the shipped manifests and asserts the strategy, the replicas, the probes, the PodDisruptionBudget, the Lease rule and the instance id. (best practice) [sources: tests/gate/k8s_checks/gateway_database.py, k8s/devops/roadmap-service/deployment.yaml]- Chosen: A gate check under tests/gate/k8s_checks/. The gate checks read the shipped manifests against the deployment requirements.
- Rejected: A unit test under tests/commands/k8s/. It tests the command, not the manifests that the cluster runs.
- Does the change update the spec requirement that the Service runs as one pod?: Yes. The change's spec delta replaces
The Service runs as one podwith the two-replica rollout requirement. Without that, the gate check and the spec contradict the manifest. (best practice) [sources: openspec/specs/roadmap-service-deployment/spec.md]- Chosen: Replace the requirement in the spec delta. The spec and the manifest then agree on two replicas and the rolling update.
- Rejected: Keep the requirement and the one-pod manifest. The Service keeps the gap, and the change delivers nothing.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 16, 2026
Webhook deliveries fail with 503 on every rollout (19 per day) and GitHub does not redeliver them, causing recurring data loss and increased error rate.Both change the roadmap Service Deployment from Recreate to RollingUpdate in the same file, but #4575 targets only the stateless router component while the candidate covers the full Service including stateful row execution, Lease locking, adevops-cli-service commentedon Nov 16, 2026
Waiting for the alternatives check to run. The next refine round looks at the item again after the check records a verdict.
dan-petty commentedon Nov 16, 2026
The service design patterns of #6059 (
docs/SERVICE_PATTERNS.md) give the rules that this item applies first. The points for the plan:RollingUpdatewithmaxUnavailable: 0, a PodDisruptionBudget, and readiness that gates the traffic. On SIGTERM the pod fails its readiness and drains insideterminationGracePeriodSeconds.no-rolling-update-strategy, the PodDisruptionBudget and probe checks; CI: ci(k8s): Run kube-linter on the rendered manifests in CI #6068). Check the Lease handover with an integration test of the lease code against a fake that keeps the contract of the Kubernetes API, or in the cluster. The live check reads the hook deliveries of one release and finds no 5xx.dan-petty commentedon Nov 17, 2026
Returned: this item cannot be built in one pull request as written
The owner comment of 2026-11-16 asks for RL1 to RL3, WK2, IN1 and ST2 of
docs/SERVICE_PATTERNS.md. IN1 and ST2 put the state that two pods share into the Valkey coordination keys of #4563, not on the ReadWriteOnce volume. That state is the list of ADR 0021 (line 87), and #4563, #4574 and #4575 own its move. Thus this item cannot meet RL1, IN1 and ST2 without their work. No code was written. Checked onmainat ddaa91c.What forces one pod and
Recreatetodayroadmap-service-home: ReadWriteOnce,local-path. The live PV hasnodeAffinitykubernetes.io/hostname In [condor].k8s/devops/roadmap-service/pvc.yaml:13-17,deployment.yaml:185-187minAvailable: 1then stops each drain of condor: the evicted pod cannot start on another node, so the second eviction never gets permission.k8s/devops/roadmap-service/cronjob-planner-run.yaml:104-107src/devops_cli/server/service.py:475-786,:922-955;src/devops_cli/server/routes/webhooks.py:265-323devops_cli_service_triggers_total) then wait for the next poll of the holder: 151 s, or 600 s for an idle repository (src/devops_cli/config/defaults.py:1315-1317). That breaks IN5.webhooks.py:347-363,:574;service.py:849service.py:210-353,:245;src/devops_cli/config/constants.py:1838service.py:356-472,:389-390,:462-464;constants.py:1837service.py:788-810,:837,:882-920src/devops_cli/roadmap/run.py:367,:573,:617,:646,:691,:916,:945,:1292,:2032;constants.py:3756-3768run.py:2145;src/devops_cli/roadmap/implement/consecutive_failures.py:134;src/devops_cli/roadmap/stage/stage_plan_record.py:208-214src/devops_cli/roadmap/stores/listing_snapshot.py:213-235;run.py:2167-2190;src/devops_cli/commands/serve.py:155uvicorn/server.py:284-311;service.py:1164-1169sleep(RL3).service.instance.id=roadmap-serviceis a fixed value.deployment.yaml:124-128openspec/specs/roadmap-service-deployment/spec.md:8-13Rows 3 to 10 are the state that two pods share. ADR 0021 (line 87) and #4563 move it to
valkey-roadmap. That instance does not exist:k8s/llm/holds onlyvalkey.yaml,valkey-devops.yamlandvalkey-runs.yaml. It needs three new passwords that a person pushes before the merge. #4563 gives its own cost as about 200,000 model tokens and 9 hours. ST2 does not let coordination keys go tovalkey-devops, because that instance can evict keys.Rejected options
maxUnavailable: 0the new pod never gets ready, so the rollout stops.patchon each pod of namespacedevops. During the 600 s drain no ready pod has the label, so the gap stays.Proposed split
Each step delivers value.
replicas: 1andRollingUpdatewithmaxSurge: 1andmaxUnavailable: 0. The new pod mounts the same volume on condor (ReadWriteOnce lets two pods on one node mount it). It passes/readyzand gets traffic before the old pod gets SIGTERM. A preStopsleepof 10 s lets the endpoint go before uvicorn closes its socket (10 + 600 + 30 s stays inside the grace period of 660 s). A Leaseroadmap-service-rows(coordination.k8s.io/v1) holds the rows: a pod reads the state files, removes the retired clones, and starts its workers and its poll only after it takes the Lease. It gives the Lease back afterdrain_and_stop, and a killed holder loses it afterleaseDurationSeconds. While a pod waits for the Lease, its lane queues keep the deliveries, and it runs them when it takes the Lease.service.instance.idcomes from the pod name.docs/CLUSTER.mdrecords the RL1 exception (one replica, no PodDisruptionBudget, a node drain still makes a gap) and links feat(service): make the webhook router stateless #4575. Value: no webhook gap at a release, about 19 times a day. It meets RL2, RL3, RL4 and WK2, and RL1 through its exception clause. It does not meet IN1 or ST2. It removes no setting and adds no credential.valkey-roadmap, with the windows, the holds, the halt and the delivery ids. A person runsdevops k8s push-secretsbefore the merge.minAvailable: 1, no volume. The Lease of step 1 goes. This step meets RL1 in full, IN1 and ST2, and it also closes the gap at a node drain.A person decides if step 1, with its RL1 exception, is acceptable. If yes, the refine job can write the design of this item again as step 1.
dan-petty commentedon Nov 17, 2026
Owner decision, 2026-11-17 (direct answer: "proceed as recommended"): build step 1 of the split in the return comment above as this item. Steps 2 to 4 stay with #4563, #4574 and #4575.
Scope of #6058 (step 1):
replicas: 1,RollingUpdatewithmaxSurge: 1andmaxUnavailable: 0. The new pod shares the RWO volume on the same node.sleepof 10 s before the 600 s drain, inside the 660 s grace period, because uvicorn closes its socket before the lifespan stop.roadmap-service-rows(coordination.k8s.io/v1): a pod reads its state files and starts its workers and the poll only when it holds the Lease. It gives the Lease back after the drain. A pod that waits for the Lease keeps deliveries in its lane queues, and runs them when it gets the Lease. Readiness does not wait for the Lease, so the rollout does not deadlock.service.instance.idcomes from the pod name.docs/CLUSTER.mdanddocs/SERVICE_PATTERNS.mdrecord the RL1 exception (one replica, no PDB, a node drain still makes a gap) and link feat(service): make the webhook router stateless #4575. The spec "The Service runs as one pod" changes to state the Lease holder.Proof: an integration test of the Lease handover and of a killed holder that loses the Lease after its duration, against a contract fake of the Lease API; an integration test that SIGTERM fails
/readyz, ends the drain and gives back the Lease;kubectl kustomizewith kubeconform for the manifest. No test that reads the manifest (#6060).Live check after the deploy: zero 5xx in the GitHub hook deliveries during one release, and one Lease holder at a time.
docs(openspec): Give the size of the Lease module of #6058
feat(service): Roll each Service release with no webhook gap
docs(openspec): Give the size of the Lease module of #6058
dan-petty commentedon Nov 17, 2026
Pull request #6112 (for #6068) runs kube-linter
no-rolling-update-strategyin CI. Deploymentdevops/roadmap-serviceholds the annotationignore-check.kube-linter.io/no-rolling-update-strategy(reason: Recreate until this item). When this item setsRollingUpdate, remove that annotation: thekube-linterrow ofdevops cithen checks the strategy, and the readiness probe withno-readiness-probe. No test that reads the manifest is necessary.devops-cli-service commentedon Nov 17, 2026
Released in v0.170.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.170.0
devops-cli-service commentedon Nov 17, 2026
Live since 2026-11-17 08:08 UTC