phase37: define live node evidence contract

This commit is contained in:
pingqiu committed 2026-06-06 23:54:22 -07:00
1 parent caef258ecf
commit 4252c3b4e0
5 files changed
+238 -13

No files matched your search

@@ -360,6 +360,125 @@ func ManagedVolumeFactContract() []ManagedVolumeFactContractEntry {
}
}
func LiveNodeEvidenceFactContract() []ManagedVolumeFactContractEntry {
return []ManagedVolumeFactContractEntry{
{
Path: "node.kubernetes_ready",
Stability: ManagedVolumeFieldStable,
Participant: "kubernetes_node_watcher",
FactAuthority: FactAuthorityKubernetesObject,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Ready",
EvidenceRequired: "kubernetes_node_ready_condition",
},
{
Path: "node.scheduling_disabled",
Stability: ManagedVolumeFieldStable,
Participant: "kubernetes_node_watcher",
FactAuthority: FactAuthorityKubernetesObject,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "kubernetes_node_unschedulable_field",
},
{
Path: "node.csi_node_pod_ready",
Stability: ManagedVolumeFieldStable,
Participant: "kubernetes_pod_watcher",
FactAuthority: FactAuthorityKubernetesObject,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "csi_node_daemonset_pod_status",
},
{
Path: "node.csi_driver_exists",
Stability: ManagedVolumeFieldStable,
Participant: "kubernetes_csi_watcher",
FactAuthority: FactAuthorityKubernetesObject,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "csidriver_object",
},
{
Path: "node.csi_node_driver_registered",
Stability: ManagedVolumeFieldStable,
Participant: "kubernetes_csi_watcher",
FactAuthority: FactAuthorityKubernetesObject,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "csinode_driver_entry",
},
{
Path: "node.required_image_presence",
Stability: ManagedVolumeFieldProvisional,
Participant: "image_inventory_observer",
FactAuthority: FactAuthorityObservation,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "node_image_inventory_or_pod_image_pull_status",
},
{
Path: "node.image_pull_status",
Stability: ManagedVolumeFieldStable,
Participant: "kubernetes_pod_watcher",
FactAuthority: FactAuthorityKubernetesObject,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "pod_container_waiting_reason",
},
{
Path: "node.iscsi_prereq",
Stability: ManagedVolumeFieldProvisional,
Participant: "host_prereq_observer",
FactAuthority: FactAuthorityHostPath,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "iscsiadm_or_preflight_artifact",
},
{
Path: "node.multipath_prereq",
Stability: ManagedVolumeFieldProvisional,
Participant: "host_prereq_observer",
FactAuthority: FactAuthorityHostPath,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "multipath_or_preflight_artifact",
},
{
Path: "node.loopback_publish_target_cross_node",
Stability: ManagedVolumeFieldStable,
Participant: "managed_volume_projector",
FactAuthority: FactAuthorityObservation,
Master: MasterManagedVolume,
AggregationMode: FactAggregationPassive,
ConditionSurface: "SwBlockCluster.status.nodes[].Blocked",
EvidenceRequired: "publish_target_and_consumer_node_evidence",
},
}
}
func LiveNodeEvidenceReasonCodes() []string {
return []string{
ReasonNodeReady,
ReasonNodeNotReady,
ReasonNodeSchedulingDisabled,
ReasonCSINodePodNotReady,
ReasonCSIDriverNotRegistered,
ReasonImageMissingOnNode,
ReasonISCSIPrereqMissing,
ReasonMultipathPrereqMissing,
ReasonPublishTargetLoopbackCrossNode,
}
}
func ManagedVolumeActionContract() []ManagedVolumeActionContractEntry {
return []ManagedVolumeActionContractEntry{
{
+4
View File
@@ -25,7 +25,11 @@ const (
ReasonCandidateFrontierBehind = "candidate_frontier_behind"
ReasonStatusEndpointUnreachable = "status_endpoint_unreachable"
ReasonCSINodeImagePullFailed = "csi_node_image_pull_failed"
ReasonCSIDriverNotRegistered = "csi_driver_not_registered"
ReasonCSINodePodNotReady = "csi_node_pod_not_ready"
ReasonImageMissingOnNode = "image_missing_on_node"
ReasonISCSIPrereqMissing = "iscsi_prereq_missing"
ReasonMultipathPrereqMissing = "multipath_prereq_missing"
ReasonNodeReady = "node_ready"
ReasonNodeNotReady = "node_not_ready"
ReasonNodeSchedulingDisabled = "node_scheduling_disabled"
@@ -0,0 +1,77 @@
package ops
import "testing"
func TestPhase37D1LiveNodeEvidenceContractCoversRequiredFacts(t *testing.T) {
byPath := managedVolumeContractByPath(LiveNodeEvidenceFactContract())
required := map[string]string{
"node.kubernetes_ready": FactAuthorityKubernetesObject,
"node.scheduling_disabled": FactAuthorityKubernetesObject,
"node.csi_node_pod_ready": FactAuthorityKubernetesObject,
"node.csi_driver_exists": FactAuthorityKubernetesObject,
"node.csi_node_driver_registered": FactAuthorityKubernetesObject,
"node.required_image_presence": FactAuthorityObservation,
"node.image_pull_status": FactAuthorityKubernetesObject,
"node.iscsi_prereq": FactAuthorityHostPath,
"node.multipath_prereq": FactAuthorityHostPath,
"node.loopback_publish_target_cross_node": FactAuthorityObservation,
}
for path, authority := range required {
entry, ok := byPath[path]
if !ok {
t.Fatalf("missing live node evidence contract path %q", path)
}
if entry.FactAuthority != authority {
t.Fatalf("path %s authority=%s want %s", path, entry.FactAuthority, authority)
}
if entry.Master != MasterManagedVolume {
t.Fatalf("path %s master=%s want %s", path, entry.Master, MasterManagedVolume)
}
if entry.EvidenceRequired == "" || entry.ConditionSurface == "" {
t.Fatalf("path %s missing evidence/surface contract: %+v", path, entry)
}
}
}
func TestPhase37D1LiveNodeEvidenceContractIsReadOnlyPassiveObservation(t *testing.T) {
for _, entry := range LiveNodeEvidenceFactContract() {
if entry.Path == "" || entry.Participant == "" || entry.FactAuthority == "" {
t.Fatalf("incomplete live node evidence entry: %+v", entry)
}
if entry.AggregationMode != FactAggregationPassive {
t.Fatalf("phase37 node evidence must be passive observation, got %+v", entry)
}
if entry.ProbeAllowed || entry.ProbeTrigger != "" {
t.Fatalf("phase37 D1 must not authorize active mutation/probe behavior: %+v", entry)
}
switch entry.Stability {
case ManagedVolumeFieldStable, ManagedVolumeFieldProvisional, ManagedVolumeFieldTestOnly:
default:
t.Fatalf("path %s has invalid stability %q", entry.Path, entry.Stability)
}
}
}
func TestPhase37D1LiveNodeEvidenceReasonVocabulary(t *testing.T) {
reasons := LiveNodeEvidenceReasonCodes()
for _, want := range []string{
ReasonNodeReady,
ReasonNodeNotReady,
ReasonNodeSchedulingDisabled,
ReasonCSINodePodNotReady,
ReasonCSIDriverNotRegistered,
ReasonImageMissingOnNode,
ReasonISCSIPrereqMissing,
ReasonMultipathPrereqMissing,
ReasonPublishTargetLoopbackCrossNode,
} {
if !stringSliceContains(reasons, want) {
t.Fatalf("missing phase37 node reason %s in %+v", want, reasons)
}
}
for _, reason := range reasons {
if reason == "" {
t.Fatalf("empty phase37 node reason in %+v", reasons)
}
}
}
+12 -8
View File
@@ -1,6 +1,6 @@
# Current Plan: Phase 37 - Live Node Evidence Hardening
Status: active, 0% complete. Started on 2026-06-06.
Status: active, 16% complete. Started on 2026-06-06.
Branch: `phase33-testops-failure-hardening`
@@ -55,7 +55,7 @@ multipath maps, hostPath data, Helm releases, image state, or CRD spec.
Goal: define the exact live node facts and stable reason codes before code
changes.
Status: pending.
Status: complete.
Required facts:
@@ -71,14 +71,14 @@ Required facts:
Acceptance:
```text
[ ] each fact has one truth source and one projection path
[ ] reason codes are named for node_not_ready, node_scheduling_disabled,
[x] each fact has one truth source and one projection path
[x] reason codes are named for node_not_ready, node_scheduling_disabled,
csi_node_pod_not_ready, csi_driver_not_registered,
image_missing_on_node, iscsi_prereq_missing,
multipath_prereq_missing, publish_target_loopback_cross_node
[ ] contract states which fields are stable/provisional/test-only
[ ] contract preserves read-only boundary
[ ] focused tests fail first for any missing projection field
[x] contract states which fields are stable/provisional/test-only
[x] contract preserves read-only boundary
[x] focused tests fail first for any missing projection field
```
Verification:
@@ -233,9 +233,13 @@ QA strict rerun from clean lab
- 0%: Phase 37 opened. Scope is live node evidence hardening only:
Kubernetes node readiness, CSI registration, image readiness, iSCSI/multipath
prerequisites, loopback cross-node blocker, and cross-surface agreement.
- 16%: D1 live node evidence contract complete. `core/ops` now pins the
passive read-only node fact contract and reason vocabulary for Kubernetes
Ready/SchedulingDisabled, CSI pod/driver registration, image readiness,
iSCSI/multipath prerequisites, and loopback cross-node blockers.
## Next Step
Start D1 contract review and focused failing tests. Do not implement
Start D2 Kubernetes Node and CSI registration evidence. Do not implement
finalizers, cleanup automation, rebuild/failback, backup/restore, or NVMe ANA
parity in this phase.
@@ -1,6 +1,6 @@
# Operator Readiness Contract
Status: Phase 36 D1. Read-only CRD/status contract plus actionable operations
Status: Phase 37 D1. Read-only CRD/status contract plus actionable operations
fields. The controller may publish status and Events only.
## Purpose
@@ -41,6 +41,10 @@ safe next-step hints
These fields are still observation and advice. They do not transfer lifecycle
ownership to the operator.
Phase 37 tightens the node-readiness side of the contract. Node status must be
derived from live Kubernetes, CSI, image, host-prerequisite, and publish-target
facts, not replay-only bundles or helper summaries.
The Phase 35 D1 CRD schema lives in:
- `charts/seaweed-block/crds/swblockclusters.block.seaweedfs.com.yaml`
@@ -120,7 +124,7 @@ Cluster-level aggregate fields map to `SwBlockCluster.status.*`:
- `cleanup`
- `safeNextSteps[]`
Phase 36 cluster node status fields are:
Phase 36/37 cluster node status fields are:
| Field | Owner Input | Meaning | Stability |
|---|---|---|---|
@@ -134,8 +138,24 @@ Phase 36 cluster node status fields are:
| `status.nodes[].conditions[]` | operator-status aggregate | Kubernetes-style node readiness conditions | provisional |
| `status.nodes[].evidenceRefs[]` | evidence producer | supporting artifact paths | stable |
Initial Phase 36 node reason codes are `node_ready`, `node_not_ready`,
`node_scheduling_disabled`, and `image_missing_on_node`.
Phase 36 introduced the initial node reason codes `node_ready`,
`node_not_ready`, `node_scheduling_disabled`, and `image_missing_on_node`.
Phase 37 adds the live node blocker vocabulary:
| Reason Code | Meaning |
|---|---|
| `csi_node_pod_not_ready` | CSI node pod is absent, not Ready, or blocked by image/runtime state |
| `csi_driver_not_registered` | CSIDriver or per-node CSINode driver registration is missing |
| `iscsi_prereq_missing` | node iSCSI prerequisite evidence is missing or unhealthy |
| `multipath_prereq_missing` | node multipath prerequisite evidence is missing or unhealthy |
| `publish_target_loopback_cross_node` | loopback publish target would be consumed from another node |
The Phase 37 live node evidence contract is pinned in
`core/ops.LiveNodeEvidenceFactContract()`. Each fact names one authority,
one participant, a stability level, and the user-visible projection surface.
The contract is passive and read-only; it does not authorize probes or
operator-executed host changes.
Phase 36 cleanup status fields are:
@@ -249,9 +269,10 @@ Pinned by:
- `core/ops/managed_volume_crd_contract_test.go`
- `core/ops/kubernetes_crd_manifests_test.go`
- `core/ops/operator_status_controller_test.go`
- `core/ops/phase37_node_evidence_contract_test.go`
Regression:
```text
go test ./core/ops -run "ManagedVolumeOperatorContract|ManagedVolumeCRDContract|Phase35D1|Phase36D1|OperatorStatusReconciler" -count=1
go test ./core/ops -run "ManagedVolumeOperatorContract|ManagedVolumeCRDContract|Phase35D1|Phase36D1|Phase37D1|OperatorStatusReconciler" -count=1
```