Repository navigation
fix(mesh): proactive SVID near-expiry detection + SPIRE TTL right-sizing + 503 docs (Part of #1899) - #2464
Conversation
…03 docs (Part of rossoctl#1899) Design spec for the remaining rossoctl#1899 items after Parts A (rossoctl#2179) and B (rossoctl#2452): proactive near-expiry SVID/CA detection (advisory WARN via k8s:health), Kind-only SPIRE TTL right-sizing, and a 503-after-suspend troubleshooting doc. Assisted-By: Claude Code Signed-off-by: cwiklik <[email protected]>
…octl#1899) Add check_cert_expiry() + advisory WARN status (exit 4) to mesh-recover.sh: openssl -checkend on the SPIRE trust-bundle CA warns before the mesh 503s. No restart (advisory). Degrades to INCONCLUSIVE where openssl is absent. Assisted-By: Claude Code Signed-off-by: cwiklik <[email protected]>
…soctl#1899) Assisted-By: Claude Code Signed-off-by: cwiklik <[email protected]>
…t of rossoctl#1899) Set CA TTL 7d and x509 SVID TTL 24h on the Kind SPIRE install so an overnight laptop suspend no longer expires every mesh credential at once. Kind-dev-only. Assisted-By: Claude Code Signed-off-by: cwiklik <[email protected]>
…(Part of rossoctl#1899) Assisted-By: Claude Code Signed-off-by: cwiklik <[email protected]>
… on re-probe (Part of rossoctl#1899) check_cert_expiry()'s two "can't check" branches (no openssl, trust-bundle ConfigMap not found) were recording status INCONCLUSIVE. record() maps INCONCLUSIVE to the INCONCLUSIVE flag, which the final exit line promotes to exit code 3 — so a healthy mesh on the tool-less CronJob image (alpine/k8s, no openssl) would exit 3 and the remediator would emit a false MeshInconclusive Warning every tick, even though nothing is actually wrong. Introduce a neutral SKIP status for these "graceful skip, non-fatal" cases. record() already falls through on any status it doesn't recognize, so SKIP sets no flag by construction; add a comment documenting that OK/SKIP intentionally set no flag. Also reset NEAR_EXPIRY=false alongside DEGRADED/INCONCLUSIVE on the --fix re-probe, so a successful recovery doesn't leave a stale warn:true from the pre-recovery probe. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: cwiklik <[email protected]>
…ot CA (Part of rossoctl#1899) Live testing showed the openssl-on-trust-bundle approach only ever reads the 10-year Istio root CA (the SPIRE bundle is JWKS, not PEM), so it never warned before a real rossoctl#1899 outage. Rework check_cert_expiry to read the soonest-expiring ztunnel workload SVID from ztunnel's admin config_dump (the data istioctl ztunnel-config certificates surfaces), via kubectl exec + jq, with jq doing the time math (portable, no date(1)). Degrades to a non-fatal SKIP when jq is absent or exec is denied (the CronJob SA has no pods/exec) — proactive warning stays a manual / k8s:health capability, CronJob stays reactive-only, no new RBAC. Drop the now-unused HAVE_OPENSSL. Docs updated to match. Verified live on kind-rossoctl: WARN reports the real ~24h SVID expiry (exit 4); OK exits 0; CronJob path SKIPs (exec denied) and a healthy mesh emits MeshHealthy. Assisted-By: Claude Code Signed-off-by: cwiklik <[email protected]>
…octl#6 line) (Part of rossoctl#1899) Assisted-By: Claude Code Signed-off-by: cwiklik <[email protected]>
pdettori
left a comment
There was a problem hiding this comment.
Clean, well-documented maintainer PR advancing #1899 with proactive SVID near-expiry detection, Kind-only SPIRE TTL right-sizing, and troubleshooting docs. All CI checks pass; no blocking issues.
Reviewed: Shell (mesh-recover.sh + chart copy, mesh-selfheal-wrapper.sh), Helm/Kind setup (caTTL/ClusterSPIFFEID ttl), docs, and the .claude/skills/k8s:health/SKILL.md change (inspected in full — benign doc-only blockquote, no hooks/commands/executables).
Verified good:
scripts/k8s/mesh-recover.shandcharts/rossoctl-deps/files/mesh-recover.share byte-identical (sync guard intact).- Exit-code precedence
DEGRADED(2) > INCONCLUSIVE(3) > WARN(4) > OK(0)is correct, andOK/SKIPcorrectly set no flag. - All
check_cert_expirydegradation paths (nojq, nopods/exec, empty/unparseableconfig_dump) are non-fatalSKIPs — a healthy mesh never flips offOK.
One minor accuracy suggestion inline (design-pivot leftover); non-blocking.
Assisted-By: Claude Code
| 0) emit_event Normal MeshHealthy "gateway reachable, mesh certs OK"; exit 0 ;; | ||
| 3) emit_event Warning MeshInconclusive "cannot confirm mesh health (restart would not help): ${summary}"; exit 0 ;; | ||
| 2) : ;; # degraded/recoverable — fall through to gating | ||
| 4) emit_event Warning MeshNearExpiry "trust-bundle CA nearing expiry (advisory; no restart): ${summary}"; exit 0 ;; |
There was a problem hiding this comment.
suggestion (non-blocking): stale wording from the design pivot. This MeshNearExpiry Event message says "trust-bundle CA nearing expiry", but per the PR's design-pivot note (and commit d730b9b) check_cert_expiry now reads the workload SVID expiry, not the trust-bundle CA. If this branch ever fires, the emitted Kubernetes Warning Event would be misleading. Suggest something like "workload SVID nearing expiry".
(The docs/superpowers/specs/... doc is fine to leave as-is — it's intentionally kept as the historical CA-approach record.)
Summary
Advances #1899 (mesh-wide 503 from expired SPIRE SVIDs after a long host suspend) beyond the merged reactive self-heal (Part A #2179 / Part B #2452) with three additions. This is "Part of #1899", not a close — the root cause (SPIRE re-attest deadlock / ztunnel not re-fetching) is upstream istio/ztunnel#1679.
What & why
Proactive near-expiry detection (
scripts/k8s/mesh-recover.sh) — a newcheck_cert_expiry()reads the soonest-expiring ztunnel workload SVID from ztunnel's adminconfig_dump(the dataistioctl ztunnel-config certificatessurfaces), viakubectl exec+jq. It emits a new advisoryWARNstatus → exit code 4 → the CronJob wrapper emits aMeshNearExpiryWarning Event. Advisory only — never restarts. Degrades to a non-fatalSKIPwhenjqis absent orkubectl execis denied (the CronJob ServiceAccount has nopods/exec), so proactive warning is a manual /k8s:health-path capability and the CronJob stays reactive-only — no new RBAC.SPIRE TTL right-sizing (Kind-dev-only) (
scripts/kind/setup-rossoctl.sh) — CA TTL24h → 168h (7d), x509 SVID TTL→ 24h, so a normal overnight suspend no longer expires every mesh credential at once. OpenShift path untouched.Troubleshooting docs — a "503 after host suspend" section in
docs/users-guides/troubleshooting.mdand a proactive-detection note in thek8s:healthskill.Exit-code semantics
DEGRADED(2) > INCONCLUSIVE(3) > WARN/near-expiry(4) > OK(0). A skipped near-expiry check is neutral (does not flip a healthy mesh offOK).Validation (live,
kind-rossoctl)cert-expiry: SKIP→MeshHealthy(not a falseMeshInconclusive).rc=4→MeshNearExpiryWarning Event with the full JSON summary, no rollout restart (ztunnel restart count unchanged).mesh-recover.shchart-copy sync guard passes.Caveats / notes for reviewers
helm templateconfirmsca_ttl: 168hand ClusterSPIFFEIDttl: 24hrender correctly; a live SPIRE reinstall was intentionally skipped to avoid disrupting a running cluster, so it takes effect on the next fresh Kind install.docs/superpowers/specs/2026-08-24-…) describes anopenssl-on-trust-bundle-CA approach. Live testing showed that only ever reads the 10-year Istio root CA (the SPIRE bundle is JWKS, not PEM), so it would never warn before a real outage; the implementation was reworked to read the actual short-lived workload SVID instead. The spec is left as the historical record.mesh-recover.sh check_spire_agentuses-l app=spire-agent, which matches no pods (real labelapp.kubernetes.io/name=agent); it only runs under--include-spire. Worth a separate fix.Assisted-By: Claude Code