mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
phase36: close cleanup visibility gate
This commit is contained in:
1 parent
1c5cc10de9
commit
4bc01b45f0
5 files changed
+174
-17
No files matched your search
@@ -163,7 +163,7 @@ func supportBundleRefsFromCluster(cluster ClusterEvidence) []string {
|
||||
|
||||
func safeNextStepsFromCluster(cluster ClusterEvidence, evidenceRefs []string) []SwBlockSafeNextStep {
|
||||
var steps []SwBlockSafeNextStep
|
||||
if len(evidenceRefs) > 0 || cluster.Status != ObservationStatusOK || cluster.Cleanup != nil {
|
||||
if shouldSuggestCollectBundle(cluster, evidenceRefs) {
|
||||
steps = append(steps, SwBlockSafeNextStep{
|
||||
Type: ManagedVolumeActionCollectBundle,
|
||||
Mode: ManagedVolumeActionModeReadOnly,
|
||||
@@ -179,6 +179,19 @@ func safeNextStepsFromCluster(cluster ClusterEvidence, evidenceRefs []string) []
|
||||
return steps
|
||||
}
|
||||
|
||||
func shouldSuggestCollectBundle(cluster ClusterEvidence, evidenceRefs []string) bool {
|
||||
if cluster.Status != ObservationStatusOK || cleanupRequired(cluster.Cleanup) {
|
||||
return true
|
||||
}
|
||||
if len(evidenceRefs) == 0 {
|
||||
return false
|
||||
}
|
||||
if cluster.Cleanup != nil && !cleanupRequired(cluster.Cleanup) && len(evidenceRefs) == 1 && evidenceRefs[0] == cluster.Cleanup.EvidenceRef {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func supportBundleReason(cluster ClusterEvidence) string {
|
||||
if cluster.Cleanup != nil && cluster.Cleanup.Status != "" && cluster.Cleanup.Status != "ok" {
|
||||
if len(cluster.Cleanup.ReasonCodes) > 0 {
|
||||
|
||||
@@ -459,13 +459,8 @@ func TestOperatorStatusReconcilerProjectsCleanCleanupCondition(t *testing.T) {
|
||||
t.Fatalf("reconcile: %v", err)
|
||||
}
|
||||
assertCondition(t, writer.cluster.Conditions, ConditionCleanupRequired, "False", ReasonCleanupVerified)
|
||||
for _, step := range writer.cluster.SafeNextSteps {
|
||||
if step.Type == ManagedVolumeActionVerifyCleanup {
|
||||
t.Fatalf("clean state must not ask for cleanup verifier: %+v", writer.cluster.SafeNextSteps)
|
||||
}
|
||||
if step.MutationAllowed {
|
||||
t.Fatalf("safe next step must remain non-mutating: %+v", step)
|
||||
}
|
||||
if len(writer.cluster.SafeNextSteps) != 0 {
|
||||
t.Fatalf("clean cleanup evidence must not suggest next steps: %+v", writer.cluster.SafeNextSteps)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Current Plan: Phase 36 - Productized Operations Actionability
|
||||
|
||||
Status: active, 70% complete. Started on 2026-06-05.
|
||||
Status: active, 78% complete. Started on 2026-06-05.
|
||||
|
||||
Branch: `phase33-testops-failure-hardening`
|
||||
|
||||
@@ -165,7 +165,7 @@ QA cold-reader review of generated bundle
|
||||
|
||||
Goal: project cleanup residue into status without performing cleanup.
|
||||
|
||||
Status: local PASS; QA pending.
|
||||
Status: PASS.
|
||||
|
||||
Required status behavior:
|
||||
|
||||
@@ -184,9 +184,10 @@ Acceptance:
|
||||
[done] clean scenario projects CleanupRequired=False
|
||||
[done] cleanup action hint is mode=read_only or mode=scripted, never mutation_allowed=true
|
||||
[done] support surfaces agree on residue counts locally
|
||||
[ ] live/TestOps cleanup-residue visibility gate passes
|
||||
[ ] live/TestOps clean cleanup visibility gate passes
|
||||
[ ] QA verifies no operator cleanup mutation occurred
|
||||
[done] live/TestOps cleanup-residue visibility gate passes
|
||||
[done] live/TestOps clean cleanup visibility gate passes
|
||||
[done] QA verifies no operator cleanup mutation occurred
|
||||
[done] clean cleanup evidence does not emit noisy cleanup or collect-bundle next steps
|
||||
```
|
||||
|
||||
Verification:
|
||||
@@ -305,8 +306,13 @@ PM wording review if README/release note changes
|
||||
`summary.txt`, report HTML, and `safeNextSteps[]`. Residue suggests
|
||||
`observe.verify_cleanup` with `mode=scripted` and
|
||||
`mutationAllowed=false`; the operator still performs no cleanup.
|
||||
- 78%: D4 QA passed. Clean verifier evidence projects
|
||||
`CleanupRequired=False/cleanup_verified` with no cleanup next step; residue
|
||||
evidence projects `CleanupRequired=True`, residue counters, and scripted
|
||||
`observe.verify_cleanup`. CRD status, operator-snapshot, summary, and HTML
|
||||
agree. QA verified the controller never runs cleanup or gains mutation power.
|
||||
|
||||
## Next Step
|
||||
|
||||
Run D4 QA cleanup-residue and clean-state gates. Track the live negative
|
||||
node-evidence follow-up; do not add mutating controller behavior.
|
||||
Continue D5 surface agreement and negative-first gates. Track the live
|
||||
negative node-evidence follow-up; do not add mutating controller behavior.
|
||||
@@ -410,8 +410,7 @@ phases rather than being mixed into the closed foundation.
|
||||
commands from status. Status: active in Phase 36; D3 QA passed.
|
||||
6. Cleanup visibility:
|
||||
`CleanupRequired=True`, residue type, and safe next step. Do not automate
|
||||
cleanup yet. Status: active in Phase 36; D4 local projection landed, QA
|
||||
pending.
|
||||
cleanup yet. Status: active in Phase 36; D4 QA passed.
|
||||
|
||||
### P2: Enter Mutating Lifecycle Carefully
|
||||
|
||||
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
# QA Sign-off - Phase 36 D4 Cleanup Visibility (Not Automatic Cleanup)
|
||||
|
||||
Verdict: **PASS.** Cleanup verifier evidence becomes user-visible status and safe
|
||||
next-step guidance, and the operator deletes nothing: clean state projects
|
||||
`CleanupRequired=False/cleanup_verified` with no `verify_cleanup` step; residue
|
||||
projects `CleanupRequired=True` with residue counts and a scripted
|
||||
`observe.verify_cleanup` step; all surfaces agree; and the controller never runs
|
||||
the verifier/uninstall and holds no mutation power. One minor non-blocking
|
||||
observation (a clean state still emits a `collect_bundle` step).
|
||||
|
||||
Date: 2026-06-05
|
||||
|
||||
Source commit: `e742f64 phase36: project cleanup visibility status`
|
||||
(branch `phase33-testops-failure-hardening`)
|
||||
|
||||
Environment: k3s `v1.34.4+k3s1`, write-mode operator-status, fresh `e742f64`
|
||||
images. Both cleanup summaries were produced by the **real**
|
||||
`scripts/verify-helm-cleanup.sh` (clean lab, and with a controlled stale
|
||||
`io.seaweedfs` iSCSI node DB record), then fed through from-bundle reconciles
|
||||
under dedicated cluster names so the live controller didn't race the gate.
|
||||
|
||||
## G1 — Clean State Projects CleanupRequired=False — PASS
|
||||
|
||||
Real verifier on the clean lab → `cleanup_status=ok`, all residue counts 0.
|
||||
Fed to `--cluster-name d4-clean`:
|
||||
|
||||
```text
|
||||
SwBlockCluster.status.cleanup = {"status":"ok","evidenceRef":"/tmp/g1bb/cleanup-summary.txt"}
|
||||
condition CleanupRequired: status=False reason=cleanup_verified
|
||||
safeNextSteps: observe.collect_bundle(read_only) <- no observe.verify_cleanup
|
||||
report summary.txt: cleanup_status=ok
|
||||
operator-snapshot.json: cluster.cleanup.status = "ok"
|
||||
index.html: "Lifecycle Cleanup" section present
|
||||
```
|
||||
|
||||
`cleanup.status=ok`, `CleanupRequired=False reason=cleanup_verified`, and **no
|
||||
`observe.verify_cleanup` step** in the clean state. PASS.
|
||||
|
||||
## G2 — Residue Projects CleanupRequired=True — PASS
|
||||
|
||||
Controlled residue: `iscsiadm -m node -o new -T iqn.2024-01.io.seaweedfs:d4-residue
|
||||
-p 127.0.0.1:3260` (a stale node DB record, no session — the exact safe residue
|
||||
the assignment suggests). Real verifier → `cleanup_status=failed,
|
||||
iscsi_residue_count=1, failure_count=1`. Stale record removed afterward. Fed to
|
||||
`--cluster-name d4-residue`:
|
||||
|
||||
```text
|
||||
SwBlockCluster.status.cleanup = {"status":"failed","iscsiResidueCount":1,"failureCount":1,
|
||||
"evidenceRef":"/tmp/g2bb/cleanup-summary.txt"}
|
||||
condition CleanupRequired: status=True reason=cleanup_required
|
||||
safeNextSteps:
|
||||
observe.collect_bundle mode=read_only mutationAllowed=false
|
||||
observe.verify_cleanup mode=scripted mutationAllowed=false
|
||||
command=bash scripts/verify-helm-cleanup.sh "$PWD"
|
||||
```
|
||||
|
||||
`cleanup.status=failed`, `iscsiResidueCount=1 > 0`, `CleanupRequired=True`, and
|
||||
the `observe.verify_cleanup` step has `mode=scripted`, `mutationAllowed=false`,
|
||||
command mentioning `verify-helm-cleanup.sh`. PASS.
|
||||
|
||||
(Reason is `cleanup_required` — the verifier's `cleanup-summary.txt` does not
|
||||
emit a `reason_codes` line, so the projection's documented fallback applies. The
|
||||
assignment requires the verifier reason "when present"; none was present.)
|
||||
|
||||
## G3 — Surface Agreement — PASS
|
||||
|
||||
Residue evidence through `sw-block ops report --from-bundle`:
|
||||
|
||||
```text
|
||||
summary.txt:
|
||||
cleanup_status=failed
|
||||
iscsi_residue_count=1
|
||||
safe_next_step=observe.verify_cleanup mode=scripted mutation_allowed=false
|
||||
command="bash scripts/verify-helm-cleanup.sh \"$PWD\"" reason=cleanup_required
|
||||
index.html: "Lifecycle Cleanup" (present)
|
||||
operator-snapshot.json: cluster.cleanup.status = "failed" (iscsi_residue_count=1)
|
||||
```
|
||||
|
||||
CRD `status.cleanup` counters == operator-snapshot `cluster.cleanup` ==
|
||||
summary.txt == index.html; the `safe_next_step` line matches the CRD
|
||||
`safeNextSteps[]`. Clean case agrees too (CRD/snapshot/summary all `ok`). PASS.
|
||||
|
||||
## G4 — Boundary — PASS
|
||||
|
||||
```text
|
||||
create events: yes
|
||||
create pods: no delete pods: no delete persistentvolumes: no
|
||||
patch swblockclusters (spec): no
|
||||
operator-status ran the verifier? cleanup dirs in operator-status pod: 0
|
||||
```
|
||||
|
||||
operator-status patches CRD status and creates Events only; it does **not** run
|
||||
`verify-helm-cleanup.sh` or `uninstall-k8s-alpha.sh` (no cleanup artifact dirs
|
||||
appeared in its pod), and cannot delete pods/PVCs/PVs/deployments/storageclasses
|
||||
or mutate CRD spec. The verifier/cleanup commands are *suggested as scripted
|
||||
next steps*, never executed by the controller. PASS.
|
||||
|
||||
## Final Cleanup Verifier — cleanup_status=ok
|
||||
|
||||
After teardown, the real verifier reports `cleanup_status=ok, iscsi_residue_count=0,
|
||||
k8s_residue_count=0, failure_count=0`. Pass criterion met.
|
||||
|
||||
## Minor Observation (non-blocking)
|
||||
|
||||
A **verified-clean** cleanup state still emits an `observe.collect_bundle`
|
||||
(`read_only`) safe next step. `safeNextStepsFromCluster`
|
||||
(`operator_status_controller.go:166`) adds the collect-bundle step whenever
|
||||
`cluster.Cleanup != nil` — i.e. whenever any cleanup evidence is present, even
|
||||
`status=ok` with zero residue. The D4 assertion (no `verify_cleanup` in clean) is
|
||||
satisfied, but suggesting "collect a support bundle" when everything is verified
|
||||
clean is slightly noisy. Consider gating the collect-bundle step on actual
|
||||
non-OK status / real evidence refs rather than mere presence of a (passing)
|
||||
cleanup summary. Not a blocker.
|
||||
|
||||
## Non-Claims Verified
|
||||
|
||||
No automatic cleanup, no finalizer/delete behavior, no host or iSCSI/multipath
|
||||
mutation by operator-status, no support-bundle upload. The controller only
|
||||
*shows* cleanup state and *points* to the scripted verifier/cleanup path.
|
||||
|
||||
## Lab State
|
||||
|
||||
Clean — both `SwBlockCluster` stubs deleted, helm uninstalled, both CRDs deleted,
|
||||
controlled iSCSI residue removed; final verifier `cleanup_status=ok`; 0 sw-block
|
||||
pods, 0 CRDs, 0 iSCSI residue.
|
||||
|
||||
## Bottom Line
|
||||
|
||||
- **D4 PASS.** Clean cleanup evidence → `CleanupRequired=False/cleanup_verified`,
|
||||
no `verify_cleanup` step; residue → `CleanupRequired=True`, `cleanup.status=failed`,
|
||||
`iscsiResidueCount=1`, and a scripted, non-mutating `observe.verify_cleanup`
|
||||
step pointing at `verify-helm-cleanup.sh`. CRD status, operator-snapshot,
|
||||
summary.txt and index.html all agree, and the controller performs no cleanup
|
||||
and holds no mutation power. Final lab verifier is `cleanup_status=ok`.
|
||||
- **One non-blocking polish:** suppress the `collect_bundle` safe step when the
|
||||
cleanup evidence is `status=ok` with no residue.
|
||||
- **D4 can close.**
|
||||
|
||||
## Post-QA Dev Polish
|
||||
|
||||
Follow-up commit suppresses the clean-state `observe.collect_bundle` next step
|
||||
when the only evidence is a passing cleanup summary. Clean cleanup evidence now
|
||||
projects `CleanupRequired=False/cleanup_verified` with no safe next steps; the
|
||||
residue path remains unchanged.
|
||||
Reference in new issue
Block a user