48. The sweep CronJobs fail fast with a bounded retry and quit the sidecar on every exit
Status
Accepted (2026-10-13). Amends ADR-0037 (how the CronJob calls the endpoint; the schedules and the default-on decision are unchanged). Final-gaps decision E4.
Context
ADR-0037's CronJobs ran busybox wget -T 30 --post-data= against the api
Service. In the warehouse kind cluster, both Jobs repeatedly ended in
DeadlineExceeded after activeDeadlineSeconds (120 s), with the pod deleted
and no logs, whenever the api was unavailable or rolling. It happened to both
sweeps at the same time, and it happened again during a rollout. The inline
wget:
- had no bounded retry, so a rolling api gave the sweep one chance;
- had no overall bound we could prove: busybox's
-Tis a read timeout, and a connection that the mesh accepted but never answered was not cut reliably; - left no log line explaining the failure;
- never told the Istio sidecar to exit. The namespace runs Istio 1.30 native sidecars, which Kubernetes stops when the main container ends, so the quit is not needed on that path. A classic (non-native) sidecar keeps the pod Running until the deadline unless it is told to quit.
Decision
- The Job runs a dedicated entrypoint,
cmd/sweep(/app/sweepin the same image). It POSTsSWEEP_URLwith an empty body:- each attempt is bounded end to end by
SWEEP_REQUEST_TIMEOUT(default 15 s; context deadline on connect, request and response); - connect errors, timeouts,
429and5xxare retried, up toSWEEP_MAX_ATTEMPTS(default 4), after a backoff that starts atSWEEP_RETRY_BACKOFF(1 s) and doubles up toSWEEP_MAX_BACKOFF(8 s); - any other non-2xx response is not retried;
- exit codes:
0success,1give-up or rejection,2bad configuration. A non-zero exit withbackoffLimit: 0FAILS the Job, and its logs survive (failedJobsHistoryLimit: 3).
- each attempt is bounded end to end by
- On EVERY exit path (success, give-up, rejection, configuration error) the
entrypoint POSTs
SIDECAR_QUIT_URL(defaulthttp://127.0.0.1:15020/quitquitquit, the Istio agent's quit endpoint). The call is best effort and bounded by 2 s, and a refused connection (no sidecar) is ignored. An empty value disables it. - The chart renders the settings from
sweeps.requestTimeoutSeconds,sweeps.maxAttempts,sweeps.retryBackoffSeconds,sweeps.maxBackoffSecondsandsweeps.sidecarQuitUrl. It fails the render when the worst case, `maxAttempts × requestTimeoutSeconds + (maxAttempts −- × maxBackoffSeconds
, is not belowactiveDeadlineSeconds`. The defaults give 4 × 15 + 3 × 8 = 84 s against 120 s, so the Job always ends on its own exit code, never on the deadline.
- × maxBackoffSeconds
Consequences
- An unavailable api now produces a failed Job with a log line
(
sweep: failed; exiting non-zero so the Job fails fast) within about 84 seconds. A short rollout is absorbed by the retries. The next scheduled run (one minute or five minutes later) tries again, as before. - The unit tests in
cmd/sweep/sweep_test.gocover the give-up path against an unreachable endpoint, a server that never answers, no retry on 4xx, and the quit call on every path. The chart testcharts/fulfillment-execution/tests/test_sweeps_cronjob.pyassertsbackoffLimit: 0, the deadline, the entrypoint, the env, the quit URL and the budget guard. - The image carries one more small static binary.