mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
phase36: define operations actionability contract
This commit is contained in:
1 parent
13263d4d3a
commit
77053e0dbf
9 files changed
+510
-14
No files matched your search
@@ -70,6 +70,89 @@ spec:
|
||||
nodeCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
nodes:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- schedulable
|
||||
- ready
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
kubernetesNode:
|
||||
type: string
|
||||
internalIP:
|
||||
type: string
|
||||
schedulable:
|
||||
type: boolean
|
||||
ready:
|
||||
type: boolean
|
||||
status:
|
||||
type: string
|
||||
reasonCode:
|
||||
type: string
|
||||
lastHeartbeatAt:
|
||||
type: string
|
||||
format: date-time
|
||||
replicaCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
requiredImages:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
missingImages:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
conditions:
|
||||
type: array
|
||||
items:
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- status
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
enum:
|
||||
- Ready
|
||||
- Recovered
|
||||
- Recovering
|
||||
- Blocked
|
||||
- Invalid
|
||||
- CleanupRequired
|
||||
- EvidenceStale
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- "True"
|
||||
- "False"
|
||||
- Unknown
|
||||
reason:
|
||||
type: string
|
||||
severity:
|
||||
type: string
|
||||
enum:
|
||||
- info
|
||||
- warning
|
||||
- error
|
||||
message:
|
||||
type: string
|
||||
lastTransitionTime:
|
||||
type: string
|
||||
format: date-time
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
volumeCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
@@ -128,3 +211,65 @@ spec:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
supportBundleRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
cleanup:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
type: string
|
||||
k8sResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
iscsiResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
multipathResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
processResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
hostPathResidueCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
failureCount:
|
||||
type: integer
|
||||
minimum: 0
|
||||
failedPhase:
|
||||
type: string
|
||||
reasonCodes:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
evidenceRef:
|
||||
type: string
|
||||
safeNextSteps:
|
||||
type: array
|
||||
items:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- mode
|
||||
- mutationAllowed
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
mode:
|
||||
type: string
|
||||
enum:
|
||||
- read_only
|
||||
- dry_run
|
||||
- scripted
|
||||
command:
|
||||
type: string
|
||||
reasonCode:
|
||||
type: string
|
||||
mutationAllowed:
|
||||
type: boolean
|
||||
evidenceRefs:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
@@ -117,6 +117,38 @@ func TestPhase35D1SwBlockVolumeConditionEnumCoversContract(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase36D1SwBlockClusterActionabilitySchema(t *testing.T) {
|
||||
doc := readYAMLMap(t, "charts/seaweed-block/crds/swblockclusters.block.seaweedfs.com.yaml")
|
||||
statusProperties := crdStatusProperties(t, doc)
|
||||
for _, want := range []string{"nodes", "cleanup", "supportBundleRefs", "safeNextSteps"} {
|
||||
if _, ok := statusProperties[want]; !ok {
|
||||
t.Fatalf("SwBlockCluster status schema missing %s", want)
|
||||
}
|
||||
}
|
||||
|
||||
nodeProperties := yamlMap(t, yamlMap(t, statusProperties, "nodes"), "items")
|
||||
nodeProperties = yamlMap(t, nodeProperties, "properties")
|
||||
for _, want := range []string{"name", "kubernetesNode", "internalIP", "schedulable", "ready", "status", "reasonCode", "conditions", "evidenceRefs"} {
|
||||
if _, ok := nodeProperties[want]; !ok {
|
||||
t.Fatalf("SwBlockCluster.status.nodes[] schema missing %s", want)
|
||||
}
|
||||
}
|
||||
|
||||
cleanupProperties := yamlMap(t, yamlMap(t, statusProperties, "cleanup"), "properties")
|
||||
for _, want := range []string{"status", "k8sResidueCount", "iscsiResidueCount", "multipathResidueCount", "processResidueCount", "hostPathResidueCount", "failureCount", "evidenceRef"} {
|
||||
if _, ok := cleanupProperties[want]; !ok {
|
||||
t.Fatalf("SwBlockCluster.status.cleanup schema missing %s", want)
|
||||
}
|
||||
}
|
||||
|
||||
stepProperties := yamlMap(t, yamlMap(t, yamlMap(t, statusProperties, "safeNextSteps"), "items"), "properties")
|
||||
for _, want := range []string{"type", "mode", "command", "reasonCode", "mutationAllowed", "evidenceRefs"} {
|
||||
if _, ok := stepProperties[want]; !ok {
|
||||
t.Fatalf("SwBlockCluster.status.safeNextSteps[] schema missing %s", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase35D1OperatorStatusRBACIsStatusOnly(t *testing.T) {
|
||||
raw := readRepoFile(t, "charts/seaweed-block/templates/operator-status-rbac.yaml")
|
||||
required := []string{
|
||||
@@ -154,6 +186,21 @@ func TestPhase35D1OperatorStatusRBACDefaultDisabled(t *testing.T) {
|
||||
assertYAMLBool(t, rbac, "create", true)
|
||||
}
|
||||
|
||||
func crdStatusProperties(t *testing.T, doc map[string]any) map[string]any {
|
||||
t.Helper()
|
||||
return yamlMap(t,
|
||||
yamlMap(t,
|
||||
yamlMap(t,
|
||||
yamlMap(t,
|
||||
yamlMap(t,
|
||||
yamlSlice(t, yamlMap(t, doc, "spec"), "versions")[0].(map[string]any),
|
||||
"schema"),
|
||||
"openAPIV3Schema"),
|
||||
"properties"),
|
||||
"status"),
|
||||
"properties")
|
||||
}
|
||||
|
||||
func TestPhase35D3OperatorStatusDeploymentCanRunDryRunOrStatusWriteMode(t *testing.T) {
|
||||
raw := readRepoFile(t, "charts/seaweed-block/templates/operator-status.yaml")
|
||||
for _, want := range []string{
|
||||
|
||||
@@ -63,7 +63,10 @@ func ManagedVolumeCRDContractDefinition() ManagedVolumeCRDContract {
|
||||
"repair",
|
||||
"rebuild",
|
||||
"failback",
|
||||
"create_pvc",
|
||||
"delete_pvc",
|
||||
"delete_storage",
|
||||
"delete_iscsi_session",
|
||||
"cleanup_live_state",
|
||||
},
|
||||
MutatingStorageVerbsAllowed: false,
|
||||
@@ -84,12 +87,16 @@ func ManagedVolumeCRDContractDefinition() ManagedVolumeCRDContract {
|
||||
"status.conditions",
|
||||
"status.observedAt",
|
||||
"status.nodeCount",
|
||||
"status.nodes",
|
||||
"status.volumeCount",
|
||||
"status.readyVolumeCount",
|
||||
"status.blockedVolumeCount",
|
||||
"status.staleVolumeCount",
|
||||
"status.observedGeneration",
|
||||
"status.evidenceRefs",
|
||||
"status.supportBundleRefs",
|
||||
"status.cleanup",
|
||||
"status.safeNextSteps",
|
||||
},
|
||||
NonClaims: []string{
|
||||
"no_mutating_storage_actions",
|
||||
|
||||
@@ -48,6 +48,43 @@ func TestManagedVolumeCRDContract_StatusOnlyResources(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestManagedVolumeCRDContract_Phase36ActionabilityFields(t *testing.T) {
|
||||
contract := ManagedVolumeCRDContractDefinition()
|
||||
var cluster ManagedVolumeCRDKind
|
||||
for _, resource := range contract.Resources {
|
||||
if resource.Kind == SwBlockClusterKind {
|
||||
cluster = resource
|
||||
break
|
||||
}
|
||||
}
|
||||
if cluster.Kind == "" {
|
||||
t.Fatalf("missing %s resource", SwBlockClusterKind)
|
||||
}
|
||||
for _, want := range []string{
|
||||
"status.nodes",
|
||||
"status.cleanup",
|
||||
"status.supportBundleRefs",
|
||||
"status.safeNextSteps",
|
||||
} {
|
||||
if !stringSliceContains(cluster.StatusPaths, want) {
|
||||
t.Fatalf("cluster status contract missing %s in %+v", want, cluster.StatusPaths)
|
||||
}
|
||||
}
|
||||
for _, forbidden := range []string{
|
||||
"create_pvc",
|
||||
"delete_pvc",
|
||||
"delete_iscsi_session",
|
||||
"cleanup_live_state",
|
||||
"repair",
|
||||
"rebuild",
|
||||
"failback",
|
||||
} {
|
||||
if !stringSliceContains(contract.RBAC.ForbiddenActions, forbidden) {
|
||||
t.Fatalf("phase36 forbidden action %s missing from %+v", forbidden, contract.RBAC.ForbiddenActions)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestManagedVolumeCRDContract_ConditionVocabularyCoversProjection(t *testing.T) {
|
||||
contract := ManagedVolumeCRDContractDefinition()
|
||||
for _, condition := range []string{
|
||||
|
||||
@@ -34,17 +34,77 @@ type SwBlockClusterCRDStatus struct {
|
||||
ObservedAt time.Time `json:"observedAt,omitempty"`
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
NodeCount int `json:"nodeCount"`
|
||||
Nodes []SwBlockNodeCRDStatus `json:"nodes,omitempty"`
|
||||
VolumeCount int `json:"volumeCount"`
|
||||
ReadyVolumeCount int `json:"readyVolumeCount"`
|
||||
BlockedVolumeCount int `json:"blockedVolumeCount"`
|
||||
StaleVolumeCount int `json:"staleVolumeCount"`
|
||||
Conditions []ObservationCondition `json:"conditions,omitempty"`
|
||||
EvidenceRefs []string `json:"evidenceRefs,omitempty"`
|
||||
SupportBundleRefs []string `json:"supportBundleRefs,omitempty"`
|
||||
Cleanup *SwBlockCleanupStatus `json:"cleanup,omitempty"`
|
||||
SafeNextSteps []SwBlockSafeNextStep `json:"safeNextSteps,omitempty"`
|
||||
MutationAllowed bool `json:"mutationAllowed"`
|
||||
AllowedActionModes []string `json:"allowedActionModes,omitempty"`
|
||||
NonClaims []string `json:"nonClaims,omitempty"`
|
||||
}
|
||||
|
||||
type SwBlockNodeCRDStatus struct {
|
||||
Name string `json:"name"`
|
||||
KubernetesNode string `json:"kubernetesNode,omitempty"`
|
||||
InternalIP string `json:"internalIP,omitempty"`
|
||||
Schedulable bool `json:"schedulable"`
|
||||
Ready bool `json:"ready"`
|
||||
Status string `json:"status,omitempty"`
|
||||
ReasonCode string `json:"reasonCode,omitempty"`
|
||||
LastHeartbeatAt time.Time `json:"lastHeartbeatAt,omitempty"`
|
||||
ReplicaCount int `json:"replicaCount,omitempty"`
|
||||
RequiredImages []string `json:"requiredImages,omitempty"`
|
||||
MissingImages []string `json:"missingImages,omitempty"`
|
||||
Conditions []ObservationCondition `json:"conditions,omitempty"`
|
||||
EvidenceRefs []string `json:"evidenceRefs,omitempty"`
|
||||
}
|
||||
|
||||
type SwBlockSafeNextStep struct {
|
||||
Type string `json:"type"`
|
||||
Mode string `json:"mode"`
|
||||
Command string `json:"command,omitempty"`
|
||||
ReasonCode string `json:"reasonCode,omitempty"`
|
||||
MutationAllowed bool `json:"mutationAllowed"`
|
||||
EvidenceRefs []string `json:"evidenceRefs,omitempty"`
|
||||
}
|
||||
|
||||
type SwBlockCleanupStatus struct {
|
||||
Status string `json:"status"`
|
||||
KubernetesResidueCount int `json:"k8sResidueCount,omitempty"`
|
||||
ISCSIResidueCount int `json:"iscsiResidueCount,omitempty"`
|
||||
MultipathResidueCount int `json:"multipathResidueCount,omitempty"`
|
||||
ProcessResidueCount int `json:"processResidueCount,omitempty"`
|
||||
HostPathResidueCount int `json:"hostPathResidueCount,omitempty"`
|
||||
FailureCount int `json:"failureCount,omitempty"`
|
||||
FailedPhase string `json:"failedPhase,omitempty"`
|
||||
ReasonCodes []string `json:"reasonCodes,omitempty"`
|
||||
EvidenceRef string `json:"evidenceRef,omitempty"`
|
||||
}
|
||||
|
||||
func swBlockCleanupStatus(cleanup *CleanupEvidence) *SwBlockCleanupStatus {
|
||||
if cleanup == nil {
|
||||
return nil
|
||||
}
|
||||
return &SwBlockCleanupStatus{
|
||||
Status: cleanup.Status,
|
||||
KubernetesResidueCount: cleanup.KubernetesResidueCount,
|
||||
ISCSIResidueCount: cleanup.ISCSIResidueCount,
|
||||
MultipathResidueCount: cleanup.MultipathResidueCount,
|
||||
ProcessResidueCount: cleanup.ProcessResidueCount,
|
||||
HostPathResidueCount: cleanup.HostPathResidueCount,
|
||||
FailureCount: cleanup.FailureCount,
|
||||
FailedPhase: cleanup.FailedPhase,
|
||||
ReasonCodes: append([]string(nil), cleanup.ReasonCodes...),
|
||||
EvidenceRef: cleanup.EvidenceRef,
|
||||
}
|
||||
}
|
||||
|
||||
type SwBlockVolumeCRDStatus struct {
|
||||
VolumeID string `json:"volumeID,omitempty"`
|
||||
PVCName string `json:"pvcName,omitempty"`
|
||||
@@ -133,6 +193,7 @@ func (r OperatorStatusReconciler) Reconcile(ctx context.Context) (OperatorStatus
|
||||
if snapshot.Cluster.Cleanup != nil && snapshot.Cluster.Cleanup.EvidenceRef != "" {
|
||||
clusterStatus.EvidenceRefs = append(clusterStatus.EvidenceRefs, snapshot.Cluster.Cleanup.EvidenceRef)
|
||||
}
|
||||
clusterStatus.Cleanup = swBlockCleanupStatus(snapshot.Cluster.Cleanup)
|
||||
if err := r.Writer.WriteClusterStatus(ctx, clusterRef, clusterStatus); err != nil {
|
||||
return OperatorStatusReconcileResult{}, err
|
||||
}
|
||||
|
||||
@@ -260,6 +260,53 @@ func TestOperatorStatusReconcilerWALIntegrityFaultIsNeverReady(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOperatorStatusReconcilerCleanupStatusUsesCRDFieldNames(t *testing.T) {
|
||||
source := fakeOperatorStatusSource{cluster: ClusterEvidence{
|
||||
SchemaVersion: ObservationSchemaVersion,
|
||||
CapturedAt: time.Date(2026, 6, 5, 12, 0, 0, 0, time.UTC),
|
||||
Status: ObservationStatusOK,
|
||||
Cleanup: &CleanupEvidence{
|
||||
Status: "failed",
|
||||
KubernetesResidueCount: 1,
|
||||
ISCSIResidueCount: 2,
|
||||
MultipathResidueCount: 3,
|
||||
ProcessResidueCount: 4,
|
||||
HostPathResidueCount: 5,
|
||||
FailureCount: 6,
|
||||
FailedPhase: "verify",
|
||||
ReasonCodes: []string{"iscsi_node_records_present"},
|
||||
EvidenceRef: "cleanup-summary.txt",
|
||||
},
|
||||
}}
|
||||
writer := &fakeOperatorStatusWriter{}
|
||||
|
||||
_, err := (OperatorStatusReconciler{
|
||||
Source: source,
|
||||
Writer: writer,
|
||||
}).Reconcile(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: %v", err)
|
||||
}
|
||||
if writer.cluster.Cleanup == nil || writer.cluster.Cleanup.ISCSIResidueCount != 2 {
|
||||
t.Fatalf("cleanup status=%+v", writer.cluster.Cleanup)
|
||||
}
|
||||
rawStatus, err := json.Marshal(writer.cluster)
|
||||
if err != nil {
|
||||
t.Fatalf("marshal cluster status: %v", err)
|
||||
}
|
||||
raw := string(rawStatus)
|
||||
for _, want := range []string{`"k8sResidueCount":1`, `"iscsiResidueCount":2`, `"hostPathResidueCount":5`, `"evidenceRef":"cleanup-summary.txt"`} {
|
||||
if !strings.Contains(raw, want) {
|
||||
t.Fatalf("cluster cleanup status missing %s: %s", want, raw)
|
||||
}
|
||||
}
|
||||
for _, forbidden := range []string{"k8s_residue_count", "iscsi_residue_count", "hostpath_residue_count", "evidence_ref"} {
|
||||
if strings.Contains(raw, forbidden) {
|
||||
t.Fatalf("CRD cleanup status must not use report snake_case field %q: %s", forbidden, raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestOperatorStatusReconcilerEventFailureDoesNotBlockLaterStatusWrites(t *testing.T) {
|
||||
source := fakeOperatorStatusSource{cluster: ClusterEvidence{
|
||||
SchemaVersion: ObservationSchemaVersion,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Current Plan: Phase 36 - Productized Operations Actionability
|
||||
|
||||
Status: active, 0% complete. Started on 2026-06-05.
|
||||
Status: active, 16% complete. Started on 2026-06-05.
|
||||
|
||||
Branch: `phase33-testops-failure-hardening`
|
||||
|
||||
@@ -61,7 +61,7 @@ or CRD spec.
|
||||
|
||||
Goal: define the exact Phase 36 status vocabulary before code changes.
|
||||
|
||||
Status: pending.
|
||||
Status: PASS.
|
||||
|
||||
Deliverables:
|
||||
|
||||
@@ -75,12 +75,12 @@ Deliverables:
|
||||
Acceptance:
|
||||
|
||||
```text
|
||||
[ ] field contract names `SwBlockCluster.status.nodes[]`
|
||||
[ ] field contract names cleanup visibility and residue counters
|
||||
[ ] field contract names evidence refs and support-bundle pointers
|
||||
[ ] field contract names safe next-step / dry-run action hints
|
||||
[ ] internal review confirms no field implies mutating operator ownership
|
||||
[ ] scoped unit tests fail first for any new status projection contract
|
||||
[done] field contract names `SwBlockCluster.status.nodes[]`
|
||||
[done] field contract names cleanup visibility and residue counters
|
||||
[done] field contract names evidence refs and support-bundle pointers
|
||||
[done] field contract names safe next-step / dry-run action hints
|
||||
[done] internal review confirms no field implies mutating operator ownership
|
||||
[done] scoped unit tests fail first for any new status projection contract
|
||||
```
|
||||
|
||||
Verification:
|
||||
@@ -267,8 +267,13 @@ PM wording review if README/release note changes
|
||||
- 0%: Phase 36 plan opened. Scope is read-only control-plane operations
|
||||
actionability: node readiness, support evidence refs, cleanup visibility,
|
||||
surface agreement, and release-claim alignment.
|
||||
- 16%: D1 contract closed. The Go CRD contract, `SwBlockCluster` CRD schema,
|
||||
and operator readiness document now define node readiness, cleanup visibility,
|
||||
support-bundle refs, and safe next-step fields while preserving the
|
||||
status/events-only mutation boundary. Focused tests failed first on missing
|
||||
fields, then passed after the structural contract landed.
|
||||
|
||||
## Next Step
|
||||
|
||||
Start D1 with a contract review and tests before implementation. Do not add
|
||||
mutating controller behavior in this phase.
|
||||
Start D2 by wiring real node readiness/preflight evidence into
|
||||
`SwBlockCluster.status.nodes[]`. Do not add mutating controller behavior.
|
||||
@@ -1,7 +1,7 @@
|
||||
# Operator Readiness Contract
|
||||
|
||||
Status: Phase 35 D1 seed. Read-only CRD/status contract only; no controller
|
||||
implementation yet.
|
||||
Status: Phase 36 D1. Read-only CRD/status contract plus actionable operations
|
||||
fields. The controller may publish status and Events only.
|
||||
|
||||
## Purpose
|
||||
|
||||
@@ -9,7 +9,7 @@ This document defines how the Phase 22 `ManagedVolume` read model can feed a
|
||||
future Kubernetes operator without letting the operator rediscover volume state
|
||||
or bypass authority.
|
||||
|
||||
The contract is:
|
||||
The base contract is:
|
||||
|
||||
```text
|
||||
ManagedVolumeProjection
|
||||
@@ -25,6 +25,22 @@ It is not:
|
||||
- a mutating admin workflow,
|
||||
- a repair/rebuild/failback implementation.
|
||||
|
||||
Phase 36 extends the same contract with actionable read-only operations fields:
|
||||
|
||||
```text
|
||||
node readiness facts
|
||||
-> SwBlockCluster.status.nodes[]
|
||||
support/evidence pointers
|
||||
-> SwBlockCluster.status.supportBundleRefs[] / evidenceRefs[]
|
||||
cleanup verifier facts
|
||||
-> SwBlockCluster.status.cleanup + CleanupRequired condition
|
||||
safe next-step hints
|
||||
-> SwBlockCluster.status.safeNextSteps[]
|
||||
```
|
||||
|
||||
These fields are still observation and advice. They do not transfer lifecycle
|
||||
ownership to the operator.
|
||||
|
||||
The Phase 35 D1 CRD schema lives in:
|
||||
|
||||
- `charts/seaweed-block/crds/swblockclusters.block.seaweedfs.com.yaml`
|
||||
@@ -50,6 +66,9 @@ Truth ownership remains:
|
||||
| Replica durability | blockvolume / master evidence | expose readiness and blockers |
|
||||
| Host path | host initiator/kernel tools | expose transparent path state |
|
||||
| Workload check | user/TestOps/app evidence | expose data-check proof |
|
||||
| Node readiness | Kubernetes + preflight/verifier evidence | expose schedulability, image, iSCSI, multipath, and hostPath readiness |
|
||||
| Cleanup residue | cleanup verifier / host evidence | expose residue type and safe next step |
|
||||
| Support bundle | CLI/TestOps bundle collector | expose evidence refs and collection/replay commands |
|
||||
|
||||
The operator may publish Conditions/Events. It may not mint authority or decide
|
||||
promotion.
|
||||
@@ -90,12 +109,52 @@ The Kubernetes CRD projection keeps the same vocabulary:
|
||||
Cluster-level aggregate fields map to `SwBlockCluster.status.*`:
|
||||
|
||||
- `nodeCount`
|
||||
- `nodes[]`
|
||||
- `volumeCount`
|
||||
- `readyVolumeCount`
|
||||
- `blockedVolumeCount`
|
||||
- `staleVolumeCount`
|
||||
- `conditions[]`
|
||||
- `evidenceRefs[]`
|
||||
- `supportBundleRefs[]`
|
||||
- `cleanup`
|
||||
- `safeNextSteps[]`
|
||||
|
||||
Phase 36 cluster node status fields are:
|
||||
|
||||
| Field | Owner Input | Meaning | Stability |
|
||||
|---|---|---|---|
|
||||
| `status.nodes[].name` | Kubernetes / inventory | product node identity | stable |
|
||||
| `status.nodes[].kubernetesNode` | Kubernetes API | Kubernetes node name when known | stable |
|
||||
| `status.nodes[].internalIP` | Kubernetes API / inventory | observed node IP | stable |
|
||||
| `status.nodes[].schedulable` | Kubernetes API | scheduling availability fact | stable |
|
||||
| `status.nodes[].ready` | Kubernetes API / heartbeat | node Ready fact | stable |
|
||||
| `status.nodes[].status` | operator-status aggregate | ready/blocked/unknown-style node status | provisional |
|
||||
| `status.nodes[].reasonCode` | operator-status aggregate | stable reason for non-ready node | provisional |
|
||||
| `status.nodes[].conditions[]` | operator-status aggregate | Kubernetes-style node readiness conditions | provisional |
|
||||
| `status.nodes[].evidenceRefs[]` | evidence producer | supporting artifact paths | stable |
|
||||
|
||||
Phase 36 cleanup status fields are:
|
||||
|
||||
| Field | Owner Input | Meaning | Stability |
|
||||
|---|---|---|---|
|
||||
| `status.cleanup.status` | cleanup verifier | `ok` or `failed` cleanup verdict | stable |
|
||||
| `status.cleanup.*ResidueCount` | cleanup verifier | residue counters by category | stable |
|
||||
| `status.cleanup.failureCount` | cleanup verifier | total cleanup verifier failures | stable |
|
||||
| `status.cleanup.failedPhase` | cleanup verifier | failed cleanup/verifier phase | provisional |
|
||||
| `status.cleanup.reasonCodes[]` | cleanup verifier | stable residue reason codes | provisional |
|
||||
| `status.cleanup.evidenceRef` | cleanup verifier | cleanup summary artifact | stable |
|
||||
|
||||
Safe next-step fields are advisory only:
|
||||
|
||||
| Field | Meaning |
|
||||
|---|---|
|
||||
| `status.safeNextSteps[].type` | action identifier such as `observe.collect_bundle` |
|
||||
| `status.safeNextSteps[].mode` | `read_only`, `dry_run`, or `scripted` |
|
||||
| `status.safeNextSteps[].command` | suggested command text when safe to print |
|
||||
| `status.safeNextSteps[].reasonCode` | reason that made the step relevant |
|
||||
| `status.safeNextSteps[].mutationAllowed` | must remain `false` in Phase 36 |
|
||||
| `status.safeNextSteps[].evidenceRefs[]` | evidence backing the suggestion |
|
||||
|
||||
All Phase 23 actions are non-executing:
|
||||
|
||||
@@ -153,8 +212,12 @@ Examples:
|
||||
| `safe_k8s.reinstall_external_iscsi` | `dry_run` | installer or operator |
|
||||
| `safe_k8s.import_csi_image` | `dry_run` | installer or operator |
|
||||
| `observe.inspect_host_path` | `dry_run` | ops / host diagnostics |
|
||||
| `observe.verify_cleanup` | `scripted` | user/TestOps cleanup verifier |
|
||||
| `authority.request_promotion` | not emitted by Phase 23 for execution | blockmaster recovery only |
|
||||
|
||||
In Phase 36, `scripted` still means user-initiated and outside the operator
|
||||
reconcile loop. It must not be executed automatically by operator-status.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
This contract does not deliver:
|
||||
@@ -162,6 +225,9 @@ This contract does not deliver:
|
||||
- controller reconciliation,
|
||||
- mutating actions,
|
||||
- automatic repair/rebuild,
|
||||
- automatic cleanup,
|
||||
- CR object ownership or finalizers,
|
||||
- support-bundle upload,
|
||||
- dashboard buttons,
|
||||
- production RBAC/audit.
|
||||
|
||||
@@ -174,9 +240,10 @@ Pinned by:
|
||||
- `core/ops/managed_volume_operator_contract_test.go`
|
||||
- `core/ops/managed_volume_crd_contract_test.go`
|
||||
- `core/ops/kubernetes_crd_manifests_test.go`
|
||||
- `core/ops/operator_status_controller_test.go`
|
||||
|
||||
Regression:
|
||||
|
||||
```text
|
||||
go test ./core/ops -run "ManagedVolumeOperatorContract|ManagedVolumeCRDContract|Phase35D1" -count=1
|
||||
go test ./core/ops -run "ManagedVolumeOperatorContract|ManagedVolumeCRDContract|Phase35D1|Phase36D1|OperatorStatusReconciler" -count=1
|
||||
```
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
# Phase 36 D1 Operations Model Contract Review
|
||||
|
||||
Status: PASS.
|
||||
|
||||
Date: 2026-06-05.
|
||||
|
||||
## Scope Reviewed
|
||||
|
||||
Phase 36 D1 defines the read-only operations actionability contract. It does
|
||||
not wire live node readiness or cleanup projection yet.
|
||||
|
||||
Reviewed artifacts:
|
||||
|
||||
- `internal/docs/current-plan.md`
|
||||
- `internal/docs/product-roadmap.md`
|
||||
- `internal/docs/protocol/operator-readiness-contract.md`
|
||||
- `core/ops/managed_volume_crd_contract.go`
|
||||
- `core/ops/operator_status_controller.go`
|
||||
- `charts/seaweed-block/crds/swblockclusters.block.seaweedfs.com.yaml`
|
||||
|
||||
## Contract Additions
|
||||
|
||||
`SwBlockCluster.status` now has typed/schema-backed places for:
|
||||
|
||||
- `nodes[]`: node readiness/preflight facts and node-level conditions,
|
||||
- `supportBundleRefs[]`: support evidence pointers,
|
||||
- `cleanup`: cleanup verifier status and residue counters,
|
||||
- `safeNextSteps[]`: read-only, dry-run, or user-scripted next-step hints.
|
||||
|
||||
## Boundary Review
|
||||
|
||||
The fields are observation and advice only.
|
||||
|
||||
They do not imply:
|
||||
|
||||
- CR object ownership,
|
||||
- finalizers,
|
||||
- automatic cleanup,
|
||||
- storage mutation,
|
||||
- workload mutation,
|
||||
- PVC/PV mutation,
|
||||
- iSCSI/multipath/hostPath mutation,
|
||||
- promote/repair/rebuild/failback/delete/backup/restore execution.
|
||||
|
||||
`safeNextSteps[].mutationAllowed` is required in the CRD schema and must remain
|
||||
`false` for Phase 36.
|
||||
|
||||
## TDD Evidence
|
||||
|
||||
Focused tests were added first and failed on the missing contract/schema:
|
||||
|
||||
```text
|
||||
TestManagedVolumeCRDContract_Phase36ActionabilityFields
|
||||
TestPhase36D1SwBlockClusterActionabilitySchema
|
||||
```
|
||||
|
||||
After implementing the structural contract, the focused tests passed.
|
||||
|
||||
## Regression Checks
|
||||
|
||||
```text
|
||||
go test ./core/ops ./cmd/sw-block
|
||||
helm lint charts/seaweed-block
|
||||
helm template sw-block charts/seaweed-block --namespace kube-system --include-crds \
|
||||
--set operatorStatus.create=true --set operatorStatus.dryRun=false
|
||||
```
|
||||
|
||||
All passed.
|
||||
|
||||
## Findings
|
||||
|
||||
No blocking findings.
|
||||
|
||||
Non-blocking:
|
||||
|
||||
- D1 is structural only. D2 must prove real node evidence populates
|
||||
`SwBlockCluster.status.nodes[]`.
|
||||
- D3 must prove support-bundle refs are not just schema fields but usable
|
||||
cold-reader evidence pointers.
|
||||
- D4 must prove cleanup visibility does not become automatic cleanup.
|
||||
Reference in new issue
Block a user