Commit 68382a7
fix(dstack-ingress): retry applying a renewed certificate until it sticks
Renewing and applying were treated as one step:
if [ "$changed" -eq 1 ]; then
collect_evidence || echo "Evidence generation failed" >&2
build_combined_pems || echo "Combined PEM build failed" >&2
haproxy_reload || true
fi
Every failure there is swallowed, and none of them set `failed`, so the
pass still reports success. Twelve hours later the ACME client sees a
fresh certificate on disk, reports "nothing to renew", `changed` is 0,
and the apply is never attempted again. HAProxy goes on serving the
pre-renewal certificate until it expires -- which is soon, because being
close to expiry is why it renewed in the first place. The symptom arrives
weeks after the cause, as an expired certificate, with nothing in the
logs at that moment to connect the two.
Separate the two: `APPLY_PENDING` is set when something renewed and only
cleared once evidence, PEMs and the reload have all succeeded, so a
failed apply is retried on the next pass instead of waiting for the next
renewal.
Quiet passes stay quiet. With nothing renewed and nothing pending the
block does not run at all, so this does not bring back the reload-on-
every-check behaviour that made HAProxy replace its worker twice a day.
Kept in both mode scripts rather than lifted into a library: the apply
steps are mode-specific (certbot and lego lay certificates out
differently), so a shared helper would have to call back into functions
its callers define, which is harder to follow than the dozen lines it
would save.1 parent ab6d7e1 commit 68382a7
2 files changed
Lines changed: 48 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
291 | 295 | | |
292 | 296 | | |
293 | 297 | | |
| |||
305 | 309 | | |
306 | 310 | | |
307 | 311 | | |
| 312 | + | |
| 313 | + | |
308 | 314 | | |
309 | | - | |
310 | | - | |
311 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
312 | 333 | | |
313 | 334 | | |
314 | 335 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
265 | 269 | | |
266 | 270 | | |
267 | 271 | | |
| |||
284 | 288 | | |
285 | 289 | | |
286 | 290 | | |
| 291 | + | |
| 292 | + | |
287 | 293 | | |
288 | | - | |
289 | | - | |
290 | | - | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
291 | 312 | | |
292 | 313 | | |
293 | 314 | | |
| |||
0 commit comments