mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 18:17:16 +01:00
phase40: add status api conformance gate
This commit is contained in:
1 parent
b8c6efd906
commit
d4fafb467a
5 files changed
+412
-10
No files matched your search
@@ -1,6 +1,6 @@
|
||||
# Current Plan: Phase 40 - Operator Production Hardening
|
||||
|
||||
Status: active, 42% complete. Started on 2026-06-13.
|
||||
Status: active, 56% complete. Started on 2026-06-13.
|
||||
|
||||
Branch: `phase33-testops-failure-hardening`
|
||||
|
||||
@@ -146,15 +146,17 @@ helm template/lint
|
||||
|
||||
Goal: turn the live-only failures from Phases 35-39 into repeatable gates.
|
||||
|
||||
Status: dev-complete; QA/internal review pending.
|
||||
|
||||
Acceptance:
|
||||
|
||||
```text
|
||||
[ ] casing drift in status payload fails before QA
|
||||
[ ] enum drift in status conditions/actions fails before QA
|
||||
[ ] wrong CRD endpoint usage fails before QA
|
||||
[ ] RBAC boundary drift fails before QA
|
||||
[ ] blocked/releasable/delete-safety status gates still pass
|
||||
[ ] QA can run the gate from a clean lab or local envtest path
|
||||
[x] casing drift in status payload fails before QA
|
||||
[x] enum drift in status conditions/actions fails before QA
|
||||
[x] wrong CRD endpoint usage fails before QA
|
||||
[x] RBAC boundary drift fails before QA
|
||||
[x] blocked/releasable/delete-safety status gates still pass
|
||||
[x] QA can run the gate from a clean lab or local envtest path
|
||||
```
|
||||
|
||||
Verification:
|
||||
@@ -267,6 +269,11 @@ release PR or explicit hold note
|
||||
Drift can be `ok`, `mismatch`, or `unknown`; mismatch is negative-first
|
||||
`Blocked=True`, missing evidence is `EvidenceStale=True`, and the operator
|
||||
snapshot now explicitly carries `no_upgrade_execution`.
|
||||
- 56%: D4 dev-complete. Added `run-phase40-status-api-conformance` scripts for
|
||||
PowerShell and bash plus the `operator-status-api-conformance-chain` TestOps
|
||||
scenario. The gate runs the CRD/RBAC conformance tests that catch casing
|
||||
drift, enum drift, wrong endpoint usage, RBAC broadening, and delete-safety
|
||||
status regressions, then emits a summary file for QA assertions.
|
||||
|
||||
## Prerequisites / Risks
|
||||
|
||||
@@ -280,6 +287,7 @@ release PR or explicit hold note
|
||||
|
||||
## Next Step
|
||||
|
||||
Start D1 by adding the real Kubernetes API conformance harness for
|
||||
`KubernetesStatusClient`, then use it to lock the status payloads that previously
|
||||
failed only in live QA.
|
||||
Start D5 by aligning README, quickstart, release notes, and roadmap language to
|
||||
the status/events-only operator foundation. Keep the non-claims explicit: no
|
||||
finalizer owner, no automatic cleanup, no upgrade execution, no repair/rebuild,
|
||||
no failback, and no backup/restore.
|
||||
@@ -0,0 +1,121 @@
|
||||
# Phase 40 D4 QA: Operator-Status API Conformance Gate
|
||||
|
||||
## Goal
|
||||
|
||||
Validate that operator-status payloads fail fast against the real CRD schema and
|
||||
the status/events-only RBAC boundary before live release QA.
|
||||
|
||||
This is a regression gate for the live-only defects found in Phases 35-39:
|
||||
|
||||
- snake_case payload drift,
|
||||
- unsupported condition/action enum values,
|
||||
- wrong CRD endpoint usage,
|
||||
- RBAC boundary broadening,
|
||||
- delete-safety status regressions.
|
||||
|
||||
## Scope
|
||||
|
||||
In:
|
||||
|
||||
- local scripted gate,
|
||||
- TestOps runner gate,
|
||||
- CRD schema and RBAC-equivalent validation,
|
||||
- Helm render validation for operator-status write mode.
|
||||
|
||||
Out:
|
||||
|
||||
- live Helm install,
|
||||
- CRD finalizer mutation,
|
||||
- storage/workload/host mutation,
|
||||
- automatic cleanup,
|
||||
- upgrade execution.
|
||||
|
||||
## Minimal Local Gate
|
||||
|
||||
From the product repo:
|
||||
|
||||
```powershell
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/run-phase40-status-api-conformance.ps1
|
||||
```
|
||||
|
||||
Expected artifact:
|
||||
|
||||
```text
|
||||
results/phase40-status-api-conformance-*/phase40-status-api-conformance-summary.txt
|
||||
```
|
||||
|
||||
Required summary lines:
|
||||
|
||||
```text
|
||||
phase40_status_api_conformance_status=ok
|
||||
casing_drift_gate=ok
|
||||
enum_drift_gate=ok
|
||||
wrong_endpoint_gate=ok
|
||||
rbac_boundary_gate=ok
|
||||
delete_safety_status_gate=ok
|
||||
operator_status_mutation_scope=status_events_only
|
||||
finalizer_mutation_allowed=false
|
||||
```
|
||||
|
||||
## TestOps Gate
|
||||
|
||||
Run on the lab with the runner:
|
||||
|
||||
```text
|
||||
swblock run testops/scenarios/operator-status-api-conformance-chain.yaml
|
||||
```
|
||||
|
||||
If the product repo is not at `/tmp/seaweed_block` on `m02`, pass:
|
||||
|
||||
```text
|
||||
-env product_root=/path/to/seaweed_block
|
||||
```
|
||||
|
||||
Expected remote artifact:
|
||||
|
||||
```text
|
||||
/mnt/smb/work/share/g15d-k8s/<run-id>-operator-status-api-conformance/phase40-status-api-conformance-summary.txt
|
||||
```
|
||||
|
||||
## Failure Criteria
|
||||
|
||||
Fail D4 if any of the following happens:
|
||||
|
||||
- status payload casing drift is accepted,
|
||||
- unsupported condition/action enum drift is accepted,
|
||||
- main-object or `/finalizers` endpoint mutation is accepted,
|
||||
- operator-status gains main resource, storage, workload, or host mutation
|
||||
authority,
|
||||
- blocked/releasable delete-safety status tests fail,
|
||||
- Helm cannot render operator-status with `operatorStatus.dryRun=false`.
|
||||
|
||||
## Close Report Template
|
||||
|
||||
```text
|
||||
Phase 40 D4 Operator-Status API Conformance QA — PASS/FAIL
|
||||
|
||||
Source commit:
|
||||
Runner:
|
||||
Run ID:
|
||||
|
||||
Local/scripted gate:
|
||||
- phase40_status_api_conformance_status:
|
||||
- casing_drift_gate:
|
||||
- enum_drift_gate:
|
||||
- wrong_endpoint_gate:
|
||||
- rbac_boundary_gate:
|
||||
- delete_safety_status_gate:
|
||||
- finalizer_mutation_allowed:
|
||||
|
||||
TestOps gate:
|
||||
- scenario:
|
||||
- actions:
|
||||
- result:
|
||||
- artifact path:
|
||||
|
||||
Blocking findings:
|
||||
- ...
|
||||
|
||||
Non-blocking findings:
|
||||
- ...
|
||||
```
|
||||
@@ -0,0 +1,87 @@
|
||||
param(
|
||||
[string]$ProductRoot = (Get-Location).Path,
|
||||
[string]$ArtifactDir = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($ArtifactDir)) {
|
||||
$stamp = (Get-Date).ToUniversalTime().ToString("yyyyMMddTHHmmssZ")
|
||||
$ArtifactDir = Join-Path $ProductRoot "results\phase40-status-api-conformance-$stamp"
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $ArtifactDir | Out-Null
|
||||
|
||||
$summary = Join-Path $ArtifactDir "phase40-status-api-conformance-summary.txt"
|
||||
$result = Join-Path $ArtifactDir "result.json"
|
||||
$log = Join-Path $ArtifactDir "gate.log"
|
||||
Set-Content -Path $summary -Value "phase40_status_api_conformance_status=running"
|
||||
Set-Content -Path $log -Value ""
|
||||
|
||||
$status = "ok"
|
||||
|
||||
function Invoke-GateStep {
|
||||
param(
|
||||
[string]$Name,
|
||||
[string]$FilePath,
|
||||
[string[]]$Arguments
|
||||
)
|
||||
$stdout = Join-Path $ArtifactDir "$Name.stdout.txt"
|
||||
$stderr = Join-Path $ArtifactDir "$Name.stderr.txt"
|
||||
Add-Content -Path $log -Value ("[{0}] {1}" -f (Get-Date).ToUniversalTime().ToString("HH:mm:ss"), $Name)
|
||||
$process = Start-Process -FilePath $FilePath -ArgumentList $Arguments -WorkingDirectory $ProductRoot -NoNewWindow -Wait -PassThru -RedirectStandardOutput $stdout -RedirectStandardError $stderr
|
||||
if ($process.ExitCode -eq 0) {
|
||||
Add-Content -Path $summary -Value "$Name=ok"
|
||||
} else {
|
||||
Add-Content -Path $summary -Value "$Name=failed"
|
||||
$script:status = "failed"
|
||||
}
|
||||
}
|
||||
|
||||
Invoke-GateStep `
|
||||
-Name "status_conformance_go_test" `
|
||||
-FilePath "go" `
|
||||
-Arguments @(
|
||||
"test",
|
||||
"./core/ops",
|
||||
"-count=1",
|
||||
"-run",
|
||||
"TestPhase40D1KubernetesStatusClientConformsToCRDSchemaAndRBAC|TestPhase40D1StatusConformanceRejectsSchemaAndRBACDrift|TestOperatorStatusReconcilerProjectsDeleteSafetyWithoutFinalizerMutation|TestOperatorStatusReconcilerDeleteSafetyDoesNotContaminateOtherVolumes|TestPhase40D2VolumeStatusClearsStaleDeleteSafety"
|
||||
)
|
||||
|
||||
Invoke-GateStep `
|
||||
-Name "helm_operator_status_render" `
|
||||
-FilePath "helm" `
|
||||
-Arguments @(
|
||||
"template",
|
||||
"sw-block",
|
||||
"charts/seaweed-block",
|
||||
"--namespace",
|
||||
"kube-system",
|
||||
"--include-crds",
|
||||
"--set",
|
||||
"operatorStatus.create=true",
|
||||
"--set",
|
||||
"operatorStatus.dryRun=false"
|
||||
)
|
||||
|
||||
Add-Content -Path $summary -Value "phase40_status_api_conformance_status=$status"
|
||||
Add-Content -Path $summary -Value "casing_drift_gate=$status"
|
||||
Add-Content -Path $summary -Value "enum_drift_gate=$status"
|
||||
Add-Content -Path $summary -Value "wrong_endpoint_gate=$status"
|
||||
Add-Content -Path $summary -Value "rbac_boundary_gate=$status"
|
||||
Add-Content -Path $summary -Value "delete_safety_status_gate=$status"
|
||||
Add-Content -Path $summary -Value "operator_status_mutation_scope=status_events_only"
|
||||
Add-Content -Path $summary -Value "finalizer_mutation_allowed=false"
|
||||
|
||||
[ordered]@{
|
||||
schema_version = "1.0"
|
||||
scenario = "phase40-status-api-conformance"
|
||||
status = $status
|
||||
summary = "Phase 40 status API conformance gate $status"
|
||||
artifact_dir = $ArtifactDir
|
||||
} | ConvertTo-Json -Depth 4 | Set-Content -Path $result
|
||||
|
||||
if ($status -ne "ok") {
|
||||
exit 1
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
normalize_path() {
|
||||
local path="$1"
|
||||
if [[ "$path" =~ ^([A-Za-z]):/(.*)$ ]]; then
|
||||
local drive="${BASH_REMATCH[1],,}"
|
||||
if [[ -d "/mnt/$drive" ]]; then
|
||||
echo "/mnt/$drive/${BASH_REMATCH[2]}"
|
||||
else
|
||||
echo "/$drive/${BASH_REMATCH[2]}"
|
||||
fi
|
||||
return
|
||||
fi
|
||||
echo "$path"
|
||||
}
|
||||
|
||||
PRODUCT_ROOT="$(normalize_path "${1:-$(pwd)}")"
|
||||
ARTIFACT_DIR="$(normalize_path "${SW_BLOCK_ARTIFACT_DIR:-"$PRODUCT_ROOT/results/phase40-status-api-conformance-$(date -u +%Y%m%dT%H%M%SZ)"}")"
|
||||
GO_BIN="${SW_BLOCK_GO_BIN:-go}"
|
||||
HELM_BIN="${SW_BLOCK_HELM_BIN:-helm}"
|
||||
|
||||
go_minor_version() {
|
||||
local version
|
||||
version="$("$GO_BIN" version 2>/dev/null | awk '{print $3}' | sed -E 's/^go[0-9]+\.([0-9]+).*/\1/')"
|
||||
if [[ "$version" =~ ^[0-9]+$ ]]; then
|
||||
echo "$version"
|
||||
else
|
||||
echo 0
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "${SW_BLOCK_GO_BIN:-}" == "" ]] && [[ "$(go_minor_version)" -lt 24 ]] && command -v go.exe >/dev/null 2>&1; then
|
||||
GO_BIN="$(command -v go.exe)"
|
||||
fi
|
||||
|
||||
mkdir -p "$ARTIFACT_DIR"
|
||||
|
||||
SUMMARY="$ARTIFACT_DIR/phase40-status-api-conformance-summary.txt"
|
||||
RESULT="$ARTIFACT_DIR/result.json"
|
||||
LOG="$ARTIFACT_DIR/gate.log"
|
||||
: > "$LOG"
|
||||
|
||||
status="ok"
|
||||
|
||||
run_step() {
|
||||
local name="$1"
|
||||
shift
|
||||
local stdout="$ARTIFACT_DIR/$name.stdout.txt"
|
||||
local stderr="$ARTIFACT_DIR/$name.stderr.txt"
|
||||
echo "[$(date -u +%H:%M:%S)] $name" | tee -a "$LOG"
|
||||
if "$@" >"$stdout" 2>"$stderr"; then
|
||||
echo "${name}=ok" >> "$SUMMARY"
|
||||
else
|
||||
echo "${name}=failed" >> "$SUMMARY"
|
||||
status="failed"
|
||||
fi
|
||||
}
|
||||
|
||||
cd "$PRODUCT_ROOT"
|
||||
|
||||
echo "phase40_status_api_conformance_status=running" > "$SUMMARY"
|
||||
|
||||
run_step "status_conformance_go_test" "$GO_BIN" test ./core/ops -count=1 -run 'TestPhase40D1KubernetesStatusClientConformsToCRDSchemaAndRBAC|TestPhase40D1StatusConformanceRejectsSchemaAndRBACDrift|TestOperatorStatusReconcilerProjectsDeleteSafetyWithoutFinalizerMutation|TestOperatorStatusReconcilerDeleteSafetyDoesNotContaminateOtherVolumes|TestPhase40D2VolumeStatusClearsStaleDeleteSafety'
|
||||
|
||||
run_step "helm_operator_status_render" "$HELM_BIN" template sw-block charts/seaweed-block \
|
||||
--namespace kube-system \
|
||||
--include-crds \
|
||||
--set operatorStatus.create=true \
|
||||
--set operatorStatus.dryRun=false
|
||||
|
||||
{
|
||||
echo "phase40_status_api_conformance_status=$status"
|
||||
echo "casing_drift_gate=$status"
|
||||
echo "enum_drift_gate=$status"
|
||||
echo "wrong_endpoint_gate=$status"
|
||||
echo "rbac_boundary_gate=$status"
|
||||
echo "delete_safety_status_gate=$status"
|
||||
echo "operator_status_mutation_scope=status_events_only"
|
||||
echo "finalizer_mutation_allowed=false"
|
||||
} >> "$SUMMARY"
|
||||
|
||||
cat > "$RESULT" <<JSON
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"scenario": "phase40-status-api-conformance",
|
||||
"status": "$status",
|
||||
"summary": "Phase 40 status API conformance gate $status",
|
||||
"artifact_dir": "$ARTIFACT_DIR"
|
||||
}
|
||||
JSON
|
||||
|
||||
if [[ "$status" != "ok" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,91 @@
|
||||
# Runner-native Phase 40 D4 gate: operator-status API conformance.
|
||||
#
|
||||
# Goal:
|
||||
# Catch the CRD/RBAC failures that previously escaped mock tests and failed
|
||||
# only under live Kubernetes API validation:
|
||||
# snake_case status payload drift
|
||||
# unsupported condition/action enums
|
||||
# wrong CRD endpoint usage
|
||||
# RBAC boundary broadening
|
||||
# delete-safety status regression
|
||||
|
||||
name: operator-status-api-conformance-chain
|
||||
timeout: 8m
|
||||
|
||||
env:
|
||||
product_root: "/tmp/seaweed_block"
|
||||
ssh_key: "C:\\work\\dev_server\\testdev_key"
|
||||
|
||||
topology:
|
||||
nodes:
|
||||
m02:
|
||||
host: 192.168.1.184
|
||||
user: testdev
|
||||
key: "{{ ssh_key }}"
|
||||
|
||||
phases:
|
||||
- name: status_api_conformance
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 5m
|
||||
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance && cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance bash scripts/run-phase40-status-api-conformance.sh {{ product_root }}"
|
||||
|
||||
- name: status_api_conformance_asserts
|
||||
actions:
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance/phase40-status-api-conformance-summary.txt"
|
||||
pattern: "^phase40_status_api_conformance_status=ok$"
|
||||
save_as: gate_ok_count
|
||||
- action: assert_greater
|
||||
actual: "{{ gate_ok_count }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance/phase40-status-api-conformance-summary.txt"
|
||||
pattern: "^casing_drift_gate=ok$"
|
||||
save_as: casing_ok_count
|
||||
- action: assert_greater
|
||||
actual: "{{ casing_ok_count }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance/phase40-status-api-conformance-summary.txt"
|
||||
pattern: "^enum_drift_gate=ok$"
|
||||
save_as: enum_ok_count
|
||||
- action: assert_greater
|
||||
actual: "{{ enum_ok_count }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance/phase40-status-api-conformance-summary.txt"
|
||||
pattern: "^wrong_endpoint_gate=ok$"
|
||||
save_as: endpoint_ok_count
|
||||
- action: assert_greater
|
||||
actual: "{{ endpoint_ok_count }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance/phase40-status-api-conformance-summary.txt"
|
||||
pattern: "^rbac_boundary_gate=ok$"
|
||||
save_as: rbac_ok_count
|
||||
- action: assert_greater
|
||||
actual: "{{ rbac_ok_count }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance/phase40-status-api-conformance-summary.txt"
|
||||
pattern: "^delete_safety_status_gate=ok$"
|
||||
save_as: delete_safety_ok_count
|
||||
- action: assert_greater
|
||||
actual: "{{ delete_safety_ok_count }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-operator-status-api-conformance/phase40-status-api-conformance-summary.txt"
|
||||
pattern: "^finalizer_mutation_allowed=false$"
|
||||
save_as: finalizer_mutation_count
|
||||
- action: assert_greater
|
||||
actual: "{{ finalizer_mutation_count }}"
|
||||
threshold: "0"
|
||||
Reference in new issue
Block a user