Skip to content

milab v1.2.3: parallel reconciles, MissingComponent fix, CI push to quay - #1

Merged
mike-ainsel merged 4 commits into
milabfrom
feat/v1.2.3-concurrency-quay-ci
Nov 25, 2026
Merged

mike-ainsel merged 4 commits into
milabfrom
feat/v1.2.3-concurrency-quay-ci

Conversation

@mike-ainsel

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

Copy link
Copy Markdown
Member

Starts our own release line of AppWrapper: branch milab = upstream v1.2.3 (pushed as the base of this PR), plus our changes and a CI that pushes the controller image to quay. Replaces the hand-built appwrapper-v1.2.0-milab-6881 image.

Changes

  1. Confirm a missing component with an uncached read before failing — our existing fix (cherry-picked from fix/missing-component-stale-cache, upstream PR Confirm a missing component with an uncached read before failing project-codeflare/appwrapper#417, still open and not in v1.2.3). One conflict in fixtures_test.go (both sides added helpers), resolved by keeping both.
  2. appwrapper.maxConcurrentReconciles in the operator config. The controller reconciles all AppWrappers in one worker. Every AppWrapper that waits for pods is requeued every 5 s with a status patch, so during a burst of submissions the worker falls behind and creates Jobs late. The delay counts against admissionGracePeriod (1m by default), and healthy workloads then fail with InsufficientPodsReady ("0 pods pending; 0 pods running"). Unset/0 keeps upstream behaviour (1). It applies only to the AppWrapper controller; the node health monitor stays single-worker (it reads its maps without a lock in two places). The only state shared across AppWrapper reconciles (the node health maps) is read under its RWMutex, and controller-runtime never runs one object in two workers.
    • No QPS/burst settings: controller-runtime v0.25 already disables client-side rate limiting (QPS -1).
  3. CI .github/workflows/milab.yaml:
    • PR into / push to milab: make test (envtest) + image build for linux/amd64 and linux/arm64, no push.
    • Tag vX.Y.Z-milab.N: same, then push quay.io/milaboratories/pl-containers:appwrapper-vX.Y.Z-milab.N (org secrets QUAY_USERNAME / QUAY_ROBOT_TOKEN) and create a GitHub release with install.yaml pointing at that image.
    • Cross-compiles like make docker-buildx (no QEMU); no attestation manifests (provenance: false, sbom: false).
    • Third-party actions (docker/*, softprops/action-gh-release) are pinned to commit SHAs. The release runs in its own job with contents: write and no registry token; the image job holds the quay token with contents: read only.
    • The upstream workflows run only for main or only in project-codeflare, so they don't fire here.
  4. MILAB.md: our changes on top of upstream, the extra config key, release steps.

Tested locally

  • make test: controllers 16/16, webhooks 20/20, config 2/2 specs pass; new TestMaxConcurrentReconciles passes.
  • actionlint clean.
  • docker buildx build --platform linux/amd64 with the generated Dockerfile.cross from an arm64 Mac (cross-compile path): OK, image linux/amd64, /manager, user 65532.
  • make build-installer IMG=quay.io/milaboratories/pl-containers:appwrapper-…: install.yaml has our image; working tree stays clean.

After merge

  1. Tag the merge commit v1.2.3-milab.1 → CI pushes the image and creates the release.
  2. Roll out: set the image and appwrapper.maxConcurrentReconciles (proposed 8) plus faultTolerance.admissionGracePeriod: 300000000000 (5m) in the AppWrapper chart and installers, then on deployments.

Review notes

  • The quay robot must have write access to milaboratories/pl-containers. It already hosts appwrapper-v1.2.0-milab-6881, but I haven't verified the robot's permissions; the first tag will show it.
  • Keep appwrapper-* tags out of any registry pruner (we lost the hand-built image to a pruner once).

pvyazankin and others added 3 commits November 25, 2026 10:19
The Running phase treats `deployed != expected` as an externally deleted
component and fails the AppWrapper immediately -- deliberately with no grace
period and no retry, since an operator deleting a component will not
self-correct. That verdict is drawn from `getComponentStatus`, which reads
components through the cache-backed Client.

The cache is not a sound basis for a terminal verdict. It can lag the API
server, so "not in my cache yet" is indistinguishable from "deleted". Two
situations make the lag routine rather than exotic:

  * The controller creates components with `r.Create` (an uncached write) and
    the Resuming -> Running status patch re-reconciles within milliseconds, so
    the read can land before the watch event for the controller's own write.
  * The controller does not watch the component types it deploys, so their
    informers are created lazily on the first Get and their initial list is
    served at resourceVersion=0, which the API server may answer from an
    arbitrarily stale watch cache. Nothing later re-triggers reconciliation to
    correct the reading.

Observed in production on a batch/v1 Job: created successfully at T+0, then
`MissingComponent: Only found 0 deployed components, but was expecting 1` at
T+119ms, Failed at T+142ms, and the controller deleted the Job it had just
created. Reproducible by submitting ~20 AppWrappers while restarting the
controller mid-admission to cold-start its informer cache.

Fix: when the cached read reports a component missing, re-run
`getComponentStatus` against `mgr.GetAPIReader()` and only fail if the
uncached read agrees. `getComponentStatus` now takes the Reader to use, so the
same code serves both passes. The extra request is confined to the path that
was about to fail an AppWrapper, so the steady-state read pattern is unchanged.

Genuine external deletion still fails the AppWrapper with no grace period, as
before. Both behaviours are covered by new tests: the stale-cache test fails on
the unpatched controller with phase Failed instead of Running.
The controller reconciles AppWrappers in one worker (the controller-runtime
default). Every AppWrapper that waits for its pods is requeued every 5s and
gets a status patch, so during a burst of submissions the single worker can
fall behind and create a wrapped Job late. That delay counts against the
admission grace period and can fail healthy workloads with
InsufficientPodsReady.

Add appwrapper.maxConcurrentReconciles to the operator config. Unset or 0
keeps the current behaviour (1). It applies to the AppWrapper controller only;
the node health monitor stays single-worker. controller-runtime never
reconciles the same object in two workers at once, and the only state shared
across reconciles (the node health maps) is read under its RWMutex.

Client-side rate limiting is already disabled by controller-runtime
(QPS -1, relying on API priority and fairness), so no QPS settings are added.
Branch `milab` is our release line (an upstream release plus our changes).
The new workflow runs the envtest unit tests and a multi-arch image build
(linux/amd64, linux/arm64) for pull requests into and pushes to `milab`.
A tag vX.Y.Z-milab.N also pushes
quay.io/milaboratories/pl-containers:appwrapper-vX.Y.Z-milab.N and creates a
GitHub release with install.yaml pointing at that image. This replaces the
hand-built controller image.

MILAB.md lists our changes on top of upstream, the extra config key, and the
release steps.
@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.

The release job holds contents: write and no registry token; the image job
holds the quay token and only contents: read.
@mike-ainsel
mike-ainsel merged commit 179e111 into milab Nov 25, 2026
3 checks passed
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.

3 participants