Skip to content

Count the admission and warmup grace periods from component creation - #4

Open
mike-ainsel wants to merge 1 commit into
milabfrom
fix/admission-grace-from-component-creation
Open

mike-ainsel wants to merge 1 commit into
milabfrom
fix/admission-grace-from-component-creation

Conversation

@mike-ainsel

@mike-ainsel mike-ainsel commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Base: milab (after #1 and #2). Rebased onto #2: in the Running-phase grace check it uses #2's locked status write (statusPatch) together with the new start time (graceStart); MILAB.md keeps both new rows.

Problem

In the Running phase, both grace periods (admission: pods not created yet; warmup: pods not ready yet) count from the AppWrapper's ResourcesDeployed condition. That condition is set when the AppWrapper starts Resuming, before the controller creates the components. A busy controller can take a long time to get from there to creating the wrapped Job, and that time is counted against the admission grace period. The workload then fails with InsufficientPodsReady ("0 pods pending; 0 pods running; 0 pods succeeded") although the cluster had only part of the grace period to create the pods. The timer measures the controller's own backlog, not the cluster.

#1 (parallel reconciles) shortens that backlog; this PR stops counting it at all.

Change

  • New componentsCreatedAt: the latest LastTransitionTime of the components' ResourcesDeployed=True conditions (set when each component is created, reason ComponentCreatedSuccessfully). The Running phase measures both grace periods from it.
  • Reset/redeploy: a deleted component's condition goes to False, so the next create records a new time.
  • Fallback: when no component reports a creation time, the AppWrapper's ResourcesDeployed time is used, as before.
  • Unchanged: the Resuming phase still measures retries of a failed create from ResourcesDeployed (that is the time spent trying to create).
  • MILAB.md: new row.

Tests

  • New envtest "The admission grace period counts from the creation of the components, not from ResourcesDeployed": a JobSet AppWrapper (envtest runs no JobSet controller, so its pods never appear) with ResourcesDeployed backdated by 2m and a 1m admission grace period stays Running after its JobSet is created; once the component's creation time is backdated by 2m, it fails with InsufficientPodsReady.
  • The test fails on the previous code (the AppWrapper fails at the "stays Running" step).
  • go test -race ./internal/... ./pkg/... passes on the rebased code (envtest 1.37.0).

CI (milab workflow) is green on the rebased head.

@greptile-apps

greptile-apps Bot commented Nov 25, 2026

Copy link
Copy Markdown

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@mike-ainsel
mike-ainsel changed the base branch from feat/v1.2.3-concurrency-quay-ci to milab November 25, 2026 12:46
@mike-ainsel
mike-ainsel force-pushed the fix/admission-grace-from-component-creation branch from 6087ca7 to b824dab Compare November 25, 2026 12:48
The Running phase measured both grace periods from the AppWrapper's
ResourcesDeployed condition. That condition is set when the AppWrapper
starts Resuming, before the controller creates the components. A busy
controller can take a long time to get from that point to creating the
wrapped Job, and all of that time was counted against the admission grace
period: the workload then failed with InsufficientPodsReady
("0 pods pending; 0 pods running; 0 pods succeeded") although the cluster
had a fraction of the grace period to create its pods.

Count from the latest creation time of the components instead: the
LastTransitionTime of each component's ResourcesDeployed=True condition.
A component deleted on reset has that condition set to False, so a
redeployment records a new time. When no component reports a creation
time, the AppWrapper's ResourcesDeployed time is used as before.

The Resuming phase still measures retries of a failed create from
ResourcesDeployed: that is the time spent trying to create.

New envtest: an AppWrapper whose ResourcesDeployed is two minutes old
but whose JobSet was just created stays Running with no pods under a 1m
admission grace period, and fails with InsufficientPodsReady once its
component is two minutes old. The test fails on the previous code.
@mike-ainsel
mike-ainsel force-pushed the fix/admission-grace-from-component-creation branch from b824dab to e18cad7 Compare November 25, 2026 13:10
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