Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
67 lines
3.0 KiB
YAML
67 lines
3.0 KiB
YAML
# =============================================================================
|
|
# L3 FAULT-INJECTION SCAFFOLD — Hands-off update + rollback
|
|
# (R-UPD-01, R-UPD-02, R-UPD-03)
|
|
# Catalog: docs/14 "Hands-off update (R-UPD-01/02, L3)"; ADR-0009.
|
|
# R-UPD-02 (auto-rollback) is *SAFETY-CRITICAL*.
|
|
#
|
|
# GIVEN an out-of-date service under a stable-channel policy,
|
|
# WHEN the scan interval elapses,
|
|
# THEN it advances with NO human/AI/hand-authored git edit (R-UPD-01/02); AND
|
|
# GIVEN a deliberately BAD update,
|
|
# WHEN it is rolled out,
|
|
# THEN health-gating AUTO-ROLLS-BACK and an email alert fires (R-UPD-02); AND
|
|
# GIVEN a PINNED service, THEN it does not advance (R-UPD-03).
|
|
#
|
|
# STATUS: scaffold — needs T-4.5 (image-automation + per-service policy) + T-4.1
|
|
# (Alertmanager email). The bad-update injection is the R-TEST-05 fault case.
|
|
# =============================================================================
|
|
apiVersion: chainsaw.kyverno.io/v1alpha1
|
|
kind: Test
|
|
metadata:
|
|
name: hands-off-update
|
|
labels:
|
|
conformance.home.k3s/R-UPD-01: "true"
|
|
conformance.home.k3s/R-UPD-02: "true"
|
|
conformance.home.k3s/R-UPD-03: "true"
|
|
annotations:
|
|
conformance.home.k3s/requirements: "R-UPD-01, R-UPD-02, R-UPD-03"
|
|
conformance.home.k3s/layer: "L3"
|
|
conformance.home.k3s/safety-critical: "true"
|
|
conformance.home.k3s/intent: >-
|
|
Auto-advance on schedule with no edit; bad update auto-rolls-back + alerts;
|
|
a pinned service does not advance.
|
|
spec:
|
|
steps:
|
|
- name: given-out-of-date-service-on-stable-channel
|
|
try:
|
|
- script:
|
|
content: 'echo "TODO(T-4.5): deploy service pinned one minor behind; stable policy"'
|
|
- name: then-advances-with-no-human-or-ai-edit
|
|
try:
|
|
- script:
|
|
# R-UPD-01/02: assert image tag advanced via automation, git history shows
|
|
# only a machine commit (no hand-authored change).
|
|
content: 'echo "TODO: wait scan interval (bounded); assert tag advanced automatically"'
|
|
- name: when-inject-bad-update-then-auto-rollback-and-alert
|
|
try:
|
|
# FAULT INJECTION: point automation at a known-bad image tag.
|
|
- script:
|
|
content: |
|
|
set -euo pipefail
|
|
echo "TODO(T-4.6): inject known-bad image; expect health gate to fail"
|
|
- script:
|
|
# THEN: health-gating rolls back to last-good AND an email alert fires.
|
|
content: |
|
|
set -euo pipefail
|
|
echo "TODO: assert rolled back to last-good revision"
|
|
echo "TODO: assert Alertmanager delivered an email alert (see alerting test)"
|
|
echo "ROLLBACK_OK"
|
|
check: { ($stdout =~ 'ROLLBACK_OK'): true }
|
|
finally:
|
|
- script:
|
|
content: 'echo "TODO: reset automation to a good tag (self-cleaning)"'
|
|
- name: then-pinned-service-does-not-advance
|
|
try:
|
|
- script:
|
|
content: 'echo "TODO(R-UPD-03): a pinned service stays put across a scan cycle"'
|