mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
phase54: add authority executor negative gate
This commit is contained in:
1 parent
48844b011a
commit
24b4e8d7a0
6 files changed
+654
-8
No files matched your search
@@ -182,10 +182,10 @@ Recommended order from here:
|
||||
groups executor policy, the ACK eligibility mutation target, admission/RBAC,
|
||||
terminal evidence, failure states, multi-volume isolation, and a live close
|
||||
gate into one milestone. The first allowed mutation remains narrow:
|
||||
returned-replica ACK eligibility only. D1-D4 are implemented and live QA
|
||||
passed through the RBAC boundary plus executor call-site terminal-evidence
|
||||
gate; D5-D7 remain for broader failure states, multi-volume isolation, and
|
||||
the live returned-replica close gate.
|
||||
returned-replica ACK eligibility only. D1-D5 are implemented and live QA
|
||||
passed through the RBAC boundary, executor call-site terminal-evidence gate,
|
||||
and negative/hold matrix; D6-D7 remain for dedicated multi-volume isolation
|
||||
and the live returned-replica close gate.
|
||||
12. Add backup/restore and NVMe ANA parity after they can reuse the same action
|
||||
owner, evidence, and status model rather than creating another isolated
|
||||
control plane.
|
||||
|
||||
@@ -252,10 +252,19 @@ Acceptance:
|
||||
|
||||
### D5: Failure and Hold States
|
||||
|
||||
Status: pending. D4 already covers target-missing and terminal-evidence-missing
|
||||
holds; D5 should broaden the matrix to stale evidence, ambiguous targets,
|
||||
cross-volume identity mismatch, blocked preflight, and partial multi-contract
|
||||
behavior.
|
||||
Status: **QA PASS** on live m02 k3s run `20260623-112339-a395`
|
||||
(`authority-executor-negative-chain`, 26/26 actions).
|
||||
|
||||
Runner gate:
|
||||
|
||||
```text
|
||||
testops/scenarios/authority-executor-negative-chain.yaml
|
||||
scripts/run-phase54-authority-executor-negative-gate.sh
|
||||
```
|
||||
|
||||
D5 broadened the D4 holds to stale/frontier-behind evidence, unsafe frontend
|
||||
state, ambiguous targets, cross-volume identity mismatch, blocked preflight, and
|
||||
partial multi-contract behavior.
|
||||
|
||||
Cover negative cases:
|
||||
|
||||
@@ -275,6 +284,10 @@ Acceptance:
|
||||
|
||||
### D6: Multi-Volume Isolation
|
||||
|
||||
Status: pending. D5 includes a mixed partial reconcile smoke; D6 should make
|
||||
multi-volume isolation the primary gate with explicit no-contamination assertions
|
||||
across identities, target statuses, and cleanup.
|
||||
|
||||
Exercise at least three volumes:
|
||||
|
||||
```text
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
# Phase 54 D5 QA Sign-off: Authority Executor Negative Matrix
|
||||
|
||||
Verdict: **PASS**.
|
||||
|
||||
Validated live on m02 k3s with the current `sw-block:local` image built from
|
||||
the Phase 54 branch.
|
||||
|
||||
Runner:
|
||||
|
||||
```text
|
||||
C:\work\swblock.exe run -results-dir C:\work\seaweed_block\results C:\work\seaweed_block\testops\scenarios\authority-executor-negative-chain.yaml
|
||||
```
|
||||
|
||||
Run:
|
||||
|
||||
```text
|
||||
20260623-112339-a395
|
||||
authority-executor-negative-chain PASS, 26/26 actions
|
||||
```
|
||||
|
||||
## Evidence
|
||||
|
||||
Summary:
|
||||
|
||||
```text
|
||||
phase54_authority_executor_negative_status=running
|
||||
phase54_authority_executor_image=sw-block:local
|
||||
phase54_authority_executor_node=m02
|
||||
exec_patch_swblockreplicaeligibilities_status_allowed=yes
|
||||
exec_patch_swblockreplicaeligibilities_main_denied=no
|
||||
exec_patch_swblockvolumes_status_denied=no
|
||||
exec_create_events_denied=no
|
||||
exec_create_pods_denied=no
|
||||
exec_patch_pvc_denied=no
|
||||
exec_update_storageclass_denied=no
|
||||
blocked-preflight_blocked_reason=1
|
||||
blocked-preflight_mutation_attempts=0
|
||||
blocked-preflight_target_reason_absent=
|
||||
blocked-preflight_expected_hold=preflight_not_ready
|
||||
stale-frontier_blocked_reason=1
|
||||
stale-frontier_mutation_attempts=0
|
||||
stale-frontier_target_reason_absent=
|
||||
stale-frontier_expected_hold=durable_frontier_behind
|
||||
unsafe-frontend_blocked_reason=1
|
||||
unsafe-frontend_mutation_attempts=0
|
||||
unsafe-frontend_target_reason_absent=
|
||||
unsafe-frontend_expected_hold=frontend_no_longer_fenced
|
||||
ambiguous_target_missing_count=1
|
||||
ambiguous_target_mutation_attempts=0
|
||||
ambiguous_target_a_reason_absent=
|
||||
ambiguous_target_b_reason_absent=
|
||||
identity_mismatch_target_missing_count=1
|
||||
identity_mismatch_mutation_attempts=0
|
||||
identity_mismatch_target_reason_absent=
|
||||
partial_contracts=2
|
||||
partial_mutation_attempts=1
|
||||
partial_terminal_missing=1
|
||||
partial_a_reason=ack_eligibility_recorded
|
||||
partial_b_reason_absent=
|
||||
partial_c_no_target=0
|
||||
phase54_authority_executor_negative_status=ok
|
||||
```
|
||||
|
||||
## Gate Results
|
||||
|
||||
| Case | Result |
|
||||
| --- | --- |
|
||||
| Blocked preflight | PASS: held with zero mutation |
|
||||
| Stale/frontier-behind evidence | PASS: held with zero mutation |
|
||||
| Unsafe frontend state | PASS: held with zero mutation |
|
||||
| Ambiguous target | PASS: no target status written |
|
||||
| Cross-volume identity mismatch | PASS: no target status written |
|
||||
| Mixed reconcile | PASS: eligible A wrote `ack_eligibility_recorded`; blocked B held; no-contract C untouched |
|
||||
| Boundary carry-forward | PASS: only target status patch allowed; SwBlockVolume status, Events, pods, PVCs, storageclasses denied |
|
||||
| Cleanup | PASS: namespace/jobs/CRs/CRDs cleaned; no Phase 54 residue found |
|
||||
|
||||
## Verdict
|
||||
|
||||
D5 closes. The executor handles the negative/hold matrix without speculative
|
||||
mutation and can perform a partial reconcile without cross-volume contamination.
|
||||
|
||||
D6 should turn the mixed case into a dedicated multi-volume isolation gate with
|
||||
three or more volumes and explicit no-contamination assertions across identities
|
||||
and target statuses.
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
# Phase 54 D5 QA: Authority Executor Negative And Hold Matrix
|
||||
|
||||
Status: implemented and validated live.
|
||||
|
||||
Runner scenario:
|
||||
|
||||
```text
|
||||
testops/scenarios/authority-executor-negative-chain.yaml
|
||||
```
|
||||
|
||||
Gate script:
|
||||
|
||||
```text
|
||||
scripts/run-phase54-authority-executor-negative-gate.sh
|
||||
```
|
||||
|
||||
## Goal
|
||||
|
||||
Validate that the authority executor does not mutate ACK eligibility unless the
|
||||
D4 terminal-evidence contract is complete and exactly one target object matches
|
||||
the volume/replica identity.
|
||||
|
||||
## Cases
|
||||
|
||||
- blocked preflight holds,
|
||||
- stale/frontier-behind evidence holds,
|
||||
- unsafe frontend state holds,
|
||||
- ambiguous target holds,
|
||||
- cross-volume identity mismatch holds,
|
||||
- mixed multi-contract reconcile can write one eligible target while holding an
|
||||
unsafe target and ignoring a no-contract volume.
|
||||
|
||||
## Required Properties
|
||||
|
||||
- Unsafe/ambiguous/mismatched cases must show `mutation_attempts=0`.
|
||||
- Held targets must not gain `status.reasonCode`.
|
||||
- Mixed reconcile must report `authority_executor=partial`.
|
||||
- The eligible volume in the mixed reconcile must write
|
||||
`ack_eligibility_recorded`.
|
||||
- The blocked volume in the mixed reconcile must remain unchanged.
|
||||
- The no-contract volume must not create or mutate a target.
|
||||
- RBAC boundary remains D3/D4 narrow:
|
||||
- can patch `swblockreplicaeligibilities/status`,
|
||||
- cannot patch `SwBlockVolume.status`,
|
||||
- cannot create Events,
|
||||
- cannot mutate workloads/storage resources.
|
||||
@@ -0,0 +1,375 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PRODUCT_ROOT="${1:-$(pwd)}"
|
||||
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase54-authority-executor-negative-gate}"
|
||||
KUBECTL="${KUBECTL:-kubectl}"
|
||||
NAMESPACE="${SW_BLOCK_PHASE54_NAMESPACE:-sw-block-phase54-authority-executor-negative}"
|
||||
EXEC_SA="sw-block-authority-executor-exec"
|
||||
EXEC_USER="system:serviceaccount:${NAMESPACE}:${EXEC_SA}"
|
||||
IMAGE="${SW_BLOCK_PHASE54_IMAGE:-sw-block:local}"
|
||||
IMAGE_PULL_POLICY="${SW_BLOCK_PHASE54_IMAGE_PULL_POLICY:-IfNotPresent}"
|
||||
NODE_NAME="${SW_BLOCK_PHASE54_NODE_NAME:-m02}"
|
||||
SUMMARY="${ARTIFACT_DIR}/phase54-authority-executor-negative-summary.txt"
|
||||
|
||||
mkdir -p "${ARTIFACT_DIR}"
|
||||
: >"${SUMMARY}"
|
||||
|
||||
write_summary() {
|
||||
echo "$*" | tee -a "${SUMMARY}" >/dev/null
|
||||
}
|
||||
|
||||
run_capture() {
|
||||
local name="$1"
|
||||
shift
|
||||
"$@" >"${ARTIFACT_DIR}/${name}.stdout.txt" 2>"${ARTIFACT_DIR}/${name}.stderr.txt"
|
||||
}
|
||||
|
||||
run_expect_success() {
|
||||
local name="$1"
|
||||
shift
|
||||
if run_capture "$name" "$@"; then
|
||||
return 0
|
||||
fi
|
||||
echo "expected success for ${name}" >&2
|
||||
cat "${ARTIFACT_DIR}/${name}.stderr.txt" >&2 || true
|
||||
return 1
|
||||
}
|
||||
|
||||
jsonpath() {
|
||||
local resource="$1"
|
||||
local path="$2"
|
||||
"${KUBECTL}" get "${resource}" -n "${NAMESPACE}" -o "jsonpath=${path}" 2>/dev/null || true
|
||||
}
|
||||
|
||||
assert_eq() {
|
||||
local name="$1"
|
||||
local actual="$2"
|
||||
local expected="$3"
|
||||
write_summary "${name}=${actual}"
|
||||
if [ "${actual}" != "${expected}" ]; then
|
||||
echo "${name}: got ${actual}, expected ${expected}" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
can_i_as() {
|
||||
local name="$1"
|
||||
local expected="$2"
|
||||
shift 2
|
||||
run_capture "can-i-${name}" "${KUBECTL}" auth can-i "$@" --as "${EXEC_USER}" -n "${NAMESPACE}" || true
|
||||
local actual
|
||||
actual="$(tr -d '\r\n' <"${ARTIFACT_DIR}/can-i-${name}.stdout.txt")"
|
||||
assert_eq "${name}" "${actual}" "${expected}"
|
||||
}
|
||||
|
||||
cleanup_crds_if_empty() {
|
||||
local volume_count eligibility_count
|
||||
volume_count="$("${KUBECTL}" get swblockvolumes -A --no-headers 2>/dev/null | wc -l | tr -d ' ')"
|
||||
eligibility_count="$("${KUBECTL}" get swblockreplicaeligibilities -A --no-headers 2>/dev/null | wc -l | tr -d ' ')"
|
||||
if [ "${volume_count}" = "0" ] && [ "${eligibility_count}" = "0" ]; then
|
||||
"${KUBECTL}" delete crd swblockvolumes.block.seaweedfs.com swblockreplicaeligibilities.block.seaweedfs.com --ignore-not-found >/dev/null 2>&1 || true
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
set +e
|
||||
"${KUBECTL}" delete job -n "${NAMESPACE}" -l block.seaweedfs.com/phase54-negative=true --ignore-not-found >/dev/null 2>&1
|
||||
"${KUBECTL}" delete clusterrolebinding sw-block-phase54-authority-executor-negative --ignore-not-found >/dev/null 2>&1
|
||||
"${KUBECTL}" delete clusterrole sw-block-phase54-authority-executor-negative --ignore-not-found >/dev/null 2>&1
|
||||
"${KUBECTL}" delete namespace "${NAMESPACE}" --ignore-not-found >/dev/null 2>&1
|
||||
for _ in $(seq 1 30); do
|
||||
if ! "${KUBECTL}" get namespace "${NAMESPACE}" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
cleanup_crds_if_empty
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
write_summary "phase54_authority_executor_negative_status=running"
|
||||
write_summary "phase54_authority_executor_image=${IMAGE}"
|
||||
write_summary "phase54_authority_executor_node=${NODE_NAME}"
|
||||
|
||||
run_expect_success kubectl-version "${KUBECTL}" version --client=true
|
||||
run_expect_success apply-volume-crd "${KUBECTL}" apply -f "${PRODUCT_ROOT}/charts/seaweed-block/crds/swblockvolumes.block.seaweedfs.com.yaml"
|
||||
run_expect_success apply-eligibility-crd "${KUBECTL}" apply -f "${PRODUCT_ROOT}/charts/seaweed-block/crds/swblockreplicaeligibilities.block.seaweedfs.com.yaml"
|
||||
|
||||
cat >"${ARTIFACT_DIR}/namespace.yaml" <<YAML
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: ${NAMESPACE}
|
||||
labels:
|
||||
block.seaweedfs.com/phase54-gate: "true"
|
||||
YAML
|
||||
run_expect_success apply-namespace "${KUBECTL}" apply -f "${ARTIFACT_DIR}/namespace.yaml"
|
||||
|
||||
cat >"${ARTIFACT_DIR}/rbac.yaml" <<YAML
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: ${EXEC_SA}
|
||||
namespace: ${NAMESPACE}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: sw-block-phase54-authority-executor-negative
|
||||
rules:
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockvolumes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicaeligibilities"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["block.seaweedfs.com"]
|
||||
resources: ["swblockreplicaeligibilities/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: sw-block-phase54-authority-executor-negative
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: ${EXEC_SA}
|
||||
namespace: ${NAMESPACE}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: sw-block-phase54-authority-executor-negative
|
||||
YAML
|
||||
run_expect_success apply-rbac "${KUBECTL}" apply -f "${ARTIFACT_DIR}/rbac.yaml"
|
||||
|
||||
can_i_as "exec_patch_swblockreplicaeligibilities_status_allowed" "yes" patch swblockreplicaeligibilities --subresource=status
|
||||
can_i_as "exec_patch_swblockreplicaeligibilities_main_denied" "no" patch swblockreplicaeligibilities
|
||||
can_i_as "exec_patch_swblockvolumes_status_denied" "no" patch swblockvolumes --subresource=status
|
||||
can_i_as "exec_create_events_denied" "no" create events
|
||||
can_i_as "exec_create_pods_denied" "no" create pods
|
||||
can_i_as "exec_patch_pvc_denied" "no" patch pvc
|
||||
can_i_as "exec_update_storageclass_denied" "no" update storageclasses
|
||||
|
||||
clear_objects() {
|
||||
run_capture "delete-synthetic-objects" "${KUBECTL}" delete swblockvolumes,swblockreplicaeligibilities --all -n "${NAMESPACE}" --ignore-not-found || true
|
||||
}
|
||||
|
||||
apply_volume_status() {
|
||||
local name="$1"
|
||||
local volume_id="$2"
|
||||
local pvc_name="$3"
|
||||
local status_json="$4"
|
||||
cat >"${ARTIFACT_DIR}/${name}.yaml" <<YAML
|
||||
apiVersion: block.seaweedfs.com/v1alpha1
|
||||
kind: SwBlockVolume
|
||||
metadata:
|
||||
name: ${name}
|
||||
namespace: ${NAMESPACE}
|
||||
spec:
|
||||
pvcName: ${pvc_name}
|
||||
YAML
|
||||
run_expect_success "apply-volume-${name}" "${KUBECTL}" apply -f "${ARTIFACT_DIR}/${name}.yaml"
|
||||
printf '%s\n' "${status_json}" >"${ARTIFACT_DIR}/${name}-status.json"
|
||||
run_expect_success "patch-volume-status-${name}" "${KUBECTL}" patch swblockvolume "${name}" -n "${NAMESPACE}" --subresource=status --type=merge --patch-file "${ARTIFACT_DIR}/${name}-status.json"
|
||||
}
|
||||
|
||||
volume_status_json() {
|
||||
local volume_id="$1"
|
||||
local pvc_name="$2"
|
||||
local replica_id="$3"
|
||||
local contract_decision="$4"
|
||||
local contract_reason="$5"
|
||||
local preflight_decision="$6"
|
||||
local preflight_reason="$7"
|
||||
local frontend_fenced="$8"
|
||||
local frontend_primary_ready="$9"
|
||||
local ack_known="${10}"
|
||||
local ack_eligible="${11}"
|
||||
local durable_known="${12}"
|
||||
local durable_lsn="${13}"
|
||||
local required_known="${14}"
|
||||
local required_lsn="${15}"
|
||||
cat <<JSON
|
||||
{
|
||||
"status": {
|
||||
"volumeID": "${volume_id}",
|
||||
"pvcName": "${pvc_name}",
|
||||
"status": "unknown",
|
||||
"reasonCode": "returned_replica_frontend_fenced",
|
||||
"replicaReintegrations": [{
|
||||
"replicaID": "${replica_id}",
|
||||
"state": "fenced",
|
||||
"reasonCode": "returned_replica_frontend_fenced",
|
||||
"frontendFenced": ${frontend_fenced},
|
||||
"frontendPrimaryReady": ${frontend_primary_ready},
|
||||
"ackEligibilityKnown": ${ack_known},
|
||||
"ackEligible": ${ack_eligible},
|
||||
"durableFrontierKnown": ${durable_known},
|
||||
"durableFrontierLsn": ${durable_lsn},
|
||||
"requiredFrontierKnown": ${required_known},
|
||||
"requiredFrontierLsn": ${required_lsn},
|
||||
"evidenceRefs": ["${pvc_name}-returned-evidence.txt"]
|
||||
}],
|
||||
"executorContracts": [{
|
||||
"actionType": "authority.reintegrate_returned_replica",
|
||||
"replicaID": "${replica_id}",
|
||||
"decision": "${contract_decision}",
|
||||
"reason": "${contract_reason}",
|
||||
"ownerExecutor": "authority_recovery_executor",
|
||||
"executionEnabled": false,
|
||||
"mutationAllowed": false,
|
||||
"preflightDecision": "${preflight_decision}",
|
||||
"preflightReason": "${preflight_reason}",
|
||||
"allowedMutationClass": ["ack_eligibility"],
|
||||
"forbiddenMutationClass": ["frontend_publication", "rebuild_traffic", "failback"],
|
||||
"terminalEvidenceRequired": [
|
||||
"ack_eligibility_known",
|
||||
"ack_eligible_true",
|
||||
"frontend_fenced_after_execution",
|
||||
"primary_unchanged",
|
||||
"durable_frontier_covered",
|
||||
"no_cross_volume_identity_change"
|
||||
],
|
||||
"evidenceRefs": ["${pvc_name}-contract-evidence.txt"]
|
||||
}]
|
||||
}
|
||||
}
|
||||
JSON
|
||||
}
|
||||
|
||||
create_target() {
|
||||
local name="$1"
|
||||
local volume_name="$2"
|
||||
local volume_id="$3"
|
||||
local pvc_name="$4"
|
||||
local replica_id="$5"
|
||||
cat >"${ARTIFACT_DIR}/${name}.yaml" <<YAML
|
||||
apiVersion: block.seaweedfs.com/v1alpha1
|
||||
kind: SwBlockReplicaEligibility
|
||||
metadata:
|
||||
name: ${name}
|
||||
namespace: ${NAMESPACE}
|
||||
spec:
|
||||
volumeName: ${volume_name}
|
||||
volumeID: ${volume_id}
|
||||
pvcName: ${pvc_name}
|
||||
replicaID: ${replica_id}
|
||||
YAML
|
||||
run_expect_success "apply-target-${name}" "${KUBECTL}" apply -f "${ARTIFACT_DIR}/${name}.yaml"
|
||||
}
|
||||
|
||||
run_executor_job() {
|
||||
local case_name="$1"
|
||||
local job_name="phase54-negative-${case_name}"
|
||||
"${KUBECTL}" delete job "${job_name}" -n "${NAMESPACE}" --ignore-not-found >/dev/null 2>&1 || true
|
||||
cat >"${ARTIFACT_DIR}/${job_name}.yaml" <<YAML
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: ${job_name}
|
||||
namespace: ${NAMESPACE}
|
||||
labels:
|
||||
block.seaweedfs.com/phase54-negative: "true"
|
||||
spec:
|
||||
backoffLimit: 0
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
block.seaweedfs.com/phase54-negative: "true"
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/hostname: ${NODE_NAME}
|
||||
serviceAccountName: ${EXEC_SA}
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: authority-executor
|
||||
image: ${IMAGE}
|
||||
imagePullPolicy: ${IMAGE_PULL_POLICY}
|
||||
command: ["/usr/local/bin/sw-block"]
|
||||
args:
|
||||
- "ops"
|
||||
- "authority-executor"
|
||||
- "--namespace=${NAMESPACE}"
|
||||
- "--allowed-mutation-class=ack_eligibility"
|
||||
- "--execution-policy"
|
||||
- "--enable-execution"
|
||||
YAML
|
||||
run_expect_success "apply-job-${case_name}" "${KUBECTL}" apply -f "${ARTIFACT_DIR}/${job_name}.yaml"
|
||||
if ! run_capture "wait-job-${case_name}" "${KUBECTL}" wait --for=condition=complete "job/${job_name}" -n "${NAMESPACE}" --timeout=120s; then
|
||||
"${KUBECTL}" describe job "${job_name}" -n "${NAMESPACE}" >"${ARTIFACT_DIR}/${case_name}-job-describe.txt" 2>&1 || true
|
||||
"${KUBECTL}" logs "job/${job_name}" -n "${NAMESPACE}" >"${ARTIFACT_DIR}/${case_name}-executor.log" 2>&1 || true
|
||||
cat "${ARTIFACT_DIR}/${case_name}-executor.log" >&2 || true
|
||||
return 1
|
||||
fi
|
||||
run_expect_success "logs-job-${case_name}" "${KUBECTL}" logs "job/${job_name}" -n "${NAMESPACE}"
|
||||
cp "${ARTIFACT_DIR}/logs-job-${case_name}.stdout.txt" "${ARTIFACT_DIR}/${case_name}-executor.log"
|
||||
}
|
||||
|
||||
field_from_log() {
|
||||
local field="$1"
|
||||
local log="$2"
|
||||
grep -o "${field}=[^ ]*" "${log}" | head -1 | cut -d= -f2
|
||||
}
|
||||
|
||||
run_hold_case() {
|
||||
local case_name="$1"
|
||||
local expected_reason="$2"
|
||||
local status_json="$3"
|
||||
clear_objects
|
||||
apply_volume_status "${case_name}" "pvc-${case_name}" "pvc-${case_name}" "${status_json}"
|
||||
create_target "${case_name}-r1" "${case_name}" "pvc-${case_name}" "pvc-${case_name}" "r1"
|
||||
run_executor_job "${case_name}"
|
||||
local log="${ARTIFACT_DIR}/${case_name}-executor.log"
|
||||
if ! grep -q "authority_executor=blocked" "${log}"; then
|
||||
echo "${case_name} did not block" >&2
|
||||
exit 1
|
||||
fi
|
||||
assert_eq "${case_name}_blocked_reason" "$(field_from_log terminal_evidence_missing "${log}")" "1"
|
||||
assert_eq "${case_name}_mutation_attempts" "$(field_from_log mutation_attempts "${log}")" "0"
|
||||
assert_eq "${case_name}_target_reason_absent" "$(jsonpath "swblockreplicaeligibility/${case_name}-r1" '{.status.reasonCode}')" ""
|
||||
write_summary "${case_name}_expected_hold=${expected_reason}"
|
||||
}
|
||||
|
||||
run_hold_case "blocked-preflight" "preflight_not_ready" "$(volume_status_json "pvc-blocked-preflight" "pvc-blocked-preflight" "r1" "blocked" "preflight_not_ready" "hold" "returned_replica_ack_eligibility_unknown" "true" "false" "false" "false" "true" "52" "true" "52")"
|
||||
run_hold_case "stale-frontier" "durable_frontier_behind" "$(volume_status_json "pvc-stale-frontier" "pvc-stale-frontier" "r1" "disabled" "executor_policy_disabled" "ready" "preconditions_satisfied" "true" "false" "true" "false" "true" "51" "true" "52")"
|
||||
run_hold_case "unsafe-frontend" "frontend_no_longer_fenced" "$(volume_status_json "pvc-unsafe-frontend" "pvc-unsafe-frontend" "r1" "disabled" "executor_policy_disabled" "ready" "preconditions_satisfied" "false" "true" "true" "false" "true" "52" "true" "52")"
|
||||
|
||||
clear_objects
|
||||
apply_volume_status "ambiguous-target" "pvc-ambiguous-target" "pvc-ambiguous-target" "$(volume_status_json "pvc-ambiguous-target" "pvc-ambiguous-target" "r1" "disabled" "executor_policy_disabled" "ready" "preconditions_satisfied" "true" "false" "true" "false" "true" "52" "true" "52")"
|
||||
create_target "ambiguous-target-r1-a" "ambiguous-target" "pvc-ambiguous-target" "pvc-ambiguous-target" "r1"
|
||||
create_target "ambiguous-target-r1-b" "ambiguous-target" "pvc-ambiguous-target" "pvc-ambiguous-target" "r1"
|
||||
run_executor_job "ambiguous-target"
|
||||
assert_eq "ambiguous_target_missing_count" "$(field_from_log ack_eligibility_target_missing "${ARTIFACT_DIR}/ambiguous-target-executor.log")" "1"
|
||||
assert_eq "ambiguous_target_mutation_attempts" "$(field_from_log mutation_attempts "${ARTIFACT_DIR}/ambiguous-target-executor.log")" "0"
|
||||
assert_eq "ambiguous_target_a_reason_absent" "$(jsonpath swblockreplicaeligibility/ambiguous-target-r1-a '{.status.reasonCode}')" ""
|
||||
assert_eq "ambiguous_target_b_reason_absent" "$(jsonpath swblockreplicaeligibility/ambiguous-target-r1-b '{.status.reasonCode}')" ""
|
||||
|
||||
clear_objects
|
||||
apply_volume_status "identity-mismatch" "pvc-identity-mismatch" "pvc-identity-mismatch" "$(volume_status_json "pvc-identity-mismatch" "pvc-identity-mismatch" "r1" "disabled" "executor_policy_disabled" "ready" "preconditions_satisfied" "true" "false" "true" "false" "true" "52" "true" "52")"
|
||||
create_target "identity-mismatch-r1" "other-volume" "pvc-other" "pvc-other" "r1"
|
||||
run_executor_job "identity-mismatch"
|
||||
assert_eq "identity_mismatch_target_missing_count" "$(field_from_log ack_eligibility_target_missing "${ARTIFACT_DIR}/identity-mismatch-executor.log")" "1"
|
||||
assert_eq "identity_mismatch_mutation_attempts" "$(field_from_log mutation_attempts "${ARTIFACT_DIR}/identity-mismatch-executor.log")" "0"
|
||||
assert_eq "identity_mismatch_target_reason_absent" "$(jsonpath swblockreplicaeligibility/identity-mismatch-r1 '{.status.reasonCode}')" ""
|
||||
|
||||
clear_objects
|
||||
apply_volume_status "partial-a" "pvc-partial-a" "pvc-partial-a" "$(volume_status_json "pvc-partial-a" "pvc-partial-a" "r1" "disabled" "executor_policy_disabled" "ready" "preconditions_satisfied" "true" "false" "true" "false" "true" "52" "true" "52")"
|
||||
create_target "partial-a-r1" "partial-a" "pvc-partial-a" "pvc-partial-a" "r1"
|
||||
apply_volume_status "partial-b" "pvc-partial-b" "pvc-partial-b" "$(volume_status_json "pvc-partial-b" "pvc-partial-b" "r1" "blocked" "preflight_not_ready" "hold" "returned_replica_ack_eligibility_unknown" "true" "false" "false" "false" "true" "52" "true" "52")"
|
||||
create_target "partial-b-r1" "partial-b" "pvc-partial-b" "pvc-partial-b" "r1"
|
||||
apply_volume_status "partial-c" "pvc-partial-c" "pvc-partial-c" '{"status":{"volumeID":"pvc-partial-c","pvcName":"pvc-partial-c","status":"ready","reasonCode":"first_volume_verified","executorContracts":[]}}'
|
||||
run_executor_job "partial"
|
||||
if ! grep -q "authority_executor=partial" "${ARTIFACT_DIR}/partial-executor.log"; then
|
||||
echo "partial case did not report partial" >&2
|
||||
exit 1
|
||||
fi
|
||||
assert_eq "partial_contracts" "$(field_from_log contracts "${ARTIFACT_DIR}/partial-executor.log")" "2"
|
||||
assert_eq "partial_mutation_attempts" "$(field_from_log mutation_attempts "${ARTIFACT_DIR}/partial-executor.log")" "1"
|
||||
assert_eq "partial_terminal_missing" "$(field_from_log terminal_evidence_missing "${ARTIFACT_DIR}/partial-executor.log")" "1"
|
||||
assert_eq "partial_a_reason" "$(jsonpath swblockreplicaeligibility/partial-a-r1 '{.status.reasonCode}')" "ack_eligibility_recorded"
|
||||
assert_eq "partial_b_reason_absent" "$(jsonpath swblockreplicaeligibility/partial-b-r1 '{.status.reasonCode}')" ""
|
||||
assert_eq "partial_c_no_target" "$("${KUBECTL}" get swblockreplicaeligibilities -n "${NAMESPACE}" --no-headers 2>/dev/null | grep -c 'partial-c' || true)" "0"
|
||||
|
||||
clear_objects
|
||||
write_summary "phase54_authority_executor_negative_status=ok"
|
||||
@@ -0,0 +1,128 @@
|
||||
# Runner-native Phase 54 D5 gate: authority-executor negative/hold matrix.
|
||||
|
||||
name: authority-executor-negative-chain
|
||||
timeout: 10m
|
||||
|
||||
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: authority_executor_negative_gate
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 9m
|
||||
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative && cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative bash scripts/run-phase54-authority-executor-negative-gate.sh {{ product_root }}"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^phase54_authority_executor_negative_status=ok$"
|
||||
save_as: phase54_negative_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ phase54_negative_ok }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^blocked-preflight_mutation_attempts=0$"
|
||||
save_as: blocked_preflight_no_mutation
|
||||
- action: assert_greater
|
||||
actual: "{{ blocked_preflight_no_mutation }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^stale-frontier_mutation_attempts=0$"
|
||||
save_as: stale_frontier_no_mutation
|
||||
- action: assert_greater
|
||||
actual: "{{ stale_frontier_no_mutation }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^unsafe-frontend_mutation_attempts=0$"
|
||||
save_as: unsafe_frontend_no_mutation
|
||||
- action: assert_greater
|
||||
actual: "{{ unsafe_frontend_no_mutation }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^ambiguous_target_mutation_attempts=0$"
|
||||
save_as: ambiguous_no_mutation
|
||||
- action: assert_greater
|
||||
actual: "{{ ambiguous_no_mutation }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^identity_mismatch_mutation_attempts=0$"
|
||||
save_as: identity_mismatch_no_mutation
|
||||
- action: assert_greater
|
||||
actual: "{{ identity_mismatch_no_mutation }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^partial_mutation_attempts=1$"
|
||||
save_as: partial_one_mutation
|
||||
- action: assert_greater
|
||||
actual: "{{ partial_one_mutation }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^partial_terminal_missing=1$"
|
||||
save_as: partial_one_hold
|
||||
- action: assert_greater
|
||||
actual: "{{ partial_one_hold }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^partial_a_reason=ack_eligibility_recorded$"
|
||||
save_as: partial_a_written
|
||||
- action: assert_greater
|
||||
actual: "{{ partial_a_written }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^partial_b_reason_absent=$"
|
||||
save_as: partial_b_held
|
||||
- action: assert_greater
|
||||
actual: "{{ partial_b_held }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^exec_patch_swblockvolumes_status_denied=no$"
|
||||
save_as: boundary_volume_status_denied
|
||||
- action: assert_greater
|
||||
actual: "{{ boundary_volume_status_denied }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative/phase54-authority-executor-negative-summary.txt"
|
||||
pattern: "^exec_create_events_denied=no$"
|
||||
save_as: boundary_events_denied
|
||||
- action: assert_greater
|
||||
actual: "{{ boundary_events_denied }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: collect
|
||||
always: true
|
||||
actions:
|
||||
- action: collect_path
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase54-authority-executor-negative"
|
||||
name: "remote-phases"
|
||||
ignore_error: true
|
||||
Reference in new issue
Block a user