Repository navigation
milab v1.2.3: parallel reconciles, MissingComponent fix, CI push to quay - #1
Merged
Merged
Conversation
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.
|
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.
DenKoren
approved these changes
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-builtappwrapper-v1.2.0-milab-6881image.Changes
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 infixtures_test.go(both sides added helpers), resolved by keeping both.appwrapper.maxConcurrentReconcilesin 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 againstadmissionGracePeriod(1m by default), and healthy workloads then fail withInsufficientPodsReady("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..github/workflows/milab.yaml:milab:make test(envtest) + image build for linux/amd64 and linux/arm64, no push.vX.Y.Z-milab.N: same, then pushquay.io/milaboratories/pl-containers:appwrapper-vX.Y.Z-milab.N(org secretsQUAY_USERNAME/QUAY_ROBOT_TOKEN) and create a GitHub release withinstall.yamlpointing at that image.make docker-buildx(no QEMU); no attestation manifests (provenance: false,sbom: false).contents: writeand no registry token; the image job holds the quay token withcontents: readonly.mainor only in project-codeflare, so they don't fire here.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; newTestMaxConcurrentReconcilespasses.actionlintclean.docker buildx build --platform linux/amd64with the generatedDockerfile.crossfrom an arm64 Mac (cross-compile path): OK, image linux/amd64,/manager, user 65532.make build-installer IMG=quay.io/milaboratories/pl-containers:appwrapper-…:install.yamlhas our image; working tree stays clean.After merge
v1.2.3-milab.1→ CI pushes the image and creates the release.appwrapper.maxConcurrentReconciles(proposed 8) plusfaultTolerance.admissionGracePeriod: 300000000000(5m) in the AppWrapper chart and installers, then on deployments.Review notes
milaboratories/pl-containers. It already hostsappwrapper-v1.2.0-milab-6881, but I haven't verified the robot's permissions; the first tag will show it.appwrapper-*tags out of any registry pruner (we lost the hand-built image to a pruner once).