Skip to content

docs: correct session disruption protection and expire_after tag - #368

Merged
Lytol merged 1 commit into
mainfrom
fix-docs-kubernetes-pdb
Sep 23, 2026
Merged

Lytol merged 1 commit into
mainfrom
fix-docs-kubernetes-pdb

Conversation

@Lytol

@Lytol Lytol commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Description

Two independent documentation fixes in docs/infrastructure/kubernetes.md.

1. Session disruption protection was described incorrectly

Lines 159 and 299 claimed Workbench sessions are protected from node reclamation by the karpenter.sh/do-not-disrupt: "true" annotation. That annotation is set nowhere in this repositorygrep -rn "do-not-disrupt" . matched only those two doc lines.

The real mechanism is a PodDisruptionBudget created by team-operator: <component>-sessions (e.g. main-workbench-sessions), maxUnavailable: 0, in the posit-team namespace, selecting that product's launcher-created pods.

Crucially this is not Karpenter-specific. Both Karpenter and cluster-autoscaler drain nodes through the standard Kubernetes Eviction API (pods/eviction), which the API server itself enforces against PDBs. The same PDB protects sessions identically on EKS and AKS. The previous text implied AKS clusters had no equivalent protection, which was misleading.

This was verified empirically, not just by reading code: a server-side dry-run Eviction against a live session pod returns 429 TooManyRequests"Cannot evict pod as it would violate the pod's disruption budget."

Line 159 is a one-line summary in a section covering both clouds, so it is kept short and cloud-neutral with a link to the detailed passage. Line 299 sits under the Karpenter consolidation section where surrounding detail warranted a fuller explanation.

2. expireAfterexpire_after

The YAML examples and prose used expireAfter, but the actual struct tag on KarpenterNodePool in lib/types/workload.go is expire_after. Anyone copying these examples would have had the field silently ignored.

Fixed in five places (three YAML examples at lines 32, 176, 400; prose at 199 and 390) — three more than initially spotted. All other field names in those examples were checked against KarpenterNodePool, KarpenterRequirement, KarpenterNodePoolLimits and KarpenterTaint; no other mismatches found.

Note lib/steps/helm_aws.go:1535 sets nodepoolSpec[...]["expireAfter"] — that is correct as-is, being the upstream Karpenter CRD's own camelCase field, distinct from ptd.yaml's snake_case config key.

Category of change

  • Documentation: documentation changes

Two independent fixes in docs/infrastructure/kubernetes.md.

Workbench sessions are protected from node reclamation by a
PodDisruptionBudget that team-operator creates (<component>-sessions,
maxUnavailable: 0), not by a karpenter.sh/do-not-disrupt annotation.
That annotation is set nowhere in this repo. The PDB works identically
on Karpenter (EKS) and cluster-autoscaler (AKS), since both drain via
the standard Kubernetes Eviction API, which the API server enforces
against PDBs -- so the mechanism is not Karpenter-specific.

Also fix the KarpenterNodePool YAML tag in examples and prose:
the docs wrote expireAfter, but the struct tag in lib/types/workload.go
is expire_after.
@Lytol
Lytol marked this pull request as ready for review September 9, 2026 22:38
@Lytol
Lytol requested a review from a team as a code owner September 9, 2026 22:38
@claude

claude Bot commented Sep 9, 2026

Copy link
Copy Markdown

Claude finished @Lytol's task in 35s —— View job


PR Review

  • Read review guidelines
  • Read the changed file
  • Verify expire_after struct tag claim
  • Verify PDB claim (no do-not-disrupt annotation in repo)
  • Post review

Both changes are accurate and the PR description is well-documented. Verification:

  • grep -rn "do-not-disrupt" returns no matches outside the doc file — the old annotation text was fabricated.
  • lib/types/workload.go:332 confirms the struct tag is yaml:"expire_after", so the five expireAfterexpire_after fixes are all correct.
  • lib/steps/helm_aws.go:1535 sets nodepoolSpec[...]["expireAfter"] (the upstream Karpenter CRD's camelCase key), which is intentionally not changed — as the PR notes.

One minor nit on the session protection prose (line 299): The new paragraph is accurate but dense for a documentation page. The sentence "Karpenter drains nodes through the standard Kubernetes Eviction API, which the API server enforces against PDBs, so a maxUnavailable: 0 budget blocks the node hosting an active session from being voluntarily disrupted until the session ends" is long enough that some readers may need to parse it twice. Consider splitting it after "Karpenter drains nodes through the standard Kubernetes Eviction API" or simplifying slightly. Not a blocker.

Everything else looks good. The summary line at 159 (cloud-neutral, links to the detail section) and the full explanation at 299 complement each other well.

@Lytol
Lytol added this pull request to the merge queue Sep 23, 2026
Merged via the queue into main with commit 6444aa8 Sep 23, 2026
4 checks passed
@Lytol
Lytol deleted the fix-docs-kubernetes-pdb branch September 23, 2026 18:40
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.

2 participants