phase76: add failback executor boundary

This commit is contained in:
pingqiu committed 2026-06-25 19:31:46 -07:00
1 parent 90697fa45e
commit a8a11deb37
16 files changed
+1108 -106

No files matched your search

@@ -0,0 +1,38 @@
{{- if and .Values.failbackExecutor.create .Values.failbackExecutor.rbac.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "seaweed-block.fullname" . }}-failback-executor
namespace: {{ .Release.Namespace }}
labels:
{{- include "seaweed-block.labels" . | nindent 4 }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "seaweed-block.fullname" . }}-failback-executor
labels:
{{- include "seaweed-block.labels" . | nindent 4 }}
rules:
- apiGroups: ["block.seaweedfs.com"]
resources: ["swblockreplicafailbacks"]
verbs: ["get", "list", "watch"]
- apiGroups: ["block.seaweedfs.com"]
resources: ["swblockreplicafailbacks/status"]
verbs: ["get", "update", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "seaweed-block.fullname" . }}-failback-executor
labels:
{{- include "seaweed-block.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ include "seaweed-block.fullname" . }}-failback-executor
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "seaweed-block.fullname" . }}-failback-executor
{{- end }}
@@ -0,0 +1,39 @@
{{- if .Values.failbackExecutor.create }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: sw-block-failback-executor
namespace: {{ .Release.Namespace }}
labels:
{{- include "seaweed-block.labels" . | nindent 4 }}
app: sw-block-failback-executor
spec:
replicas: 1
selector:
matchLabels:
app: sw-block-failback-executor
template:
metadata:
labels:
app: sw-block-failback-executor
{{- include "seaweed-block.labels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "seaweed-block.fullname" . }}-failback-executor
{{- with .Values.failbackExecutor.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: failback-executor
image: {{ include "seaweed-block.image" . | quote }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["/usr/local/bin/sw-block"]
args:
- "ops"
- "failback-executor"
- "--namespace={{ .Release.Namespace }}"
{{- if .Values.failbackExecutor.dryRun }}
- "--dry-run"
{{- end }}
- "--interval={{ .Values.failbackExecutor.interval }}"
{{- end }}
@@ -180,6 +180,17 @@ failbackTargetOwner:
create: true
nodeSelector: {}
failbackExecutor:
# Failback executor boundary. Disabled by default. This phase writes
# disabled/blocked SwBlockReplicaFailback.status only. It does not execute
# failback, advance authority, publish frontend paths, or mutate storage.
create: false
dryRun: true
interval: 30s
rbac:
create: true
nodeSelector: {}
frontendPublicationTargetOwner:
# Frontend publication target owner. Disabled by default. When enabled it
# creates SwBlockFrontendPublication target CRs from terminal ACK eligibility
+70 -1
View File
@@ -63,6 +63,9 @@ var (
opsFrontendPublicationExecutorClientFactory = func() (ops.FrontendPublicationExecutorClient, error) {
return ops.NewInClusterKubernetesStatusClient()
}
opsFailbackExecutorClientFactory = func() (ops.FailbackExecutorClient, error) {
return ops.NewInClusterKubernetesStatusClient()
}
)
func run(args []string, stdout, stderr io.Writer) int {
@@ -80,7 +83,7 @@ func run(args []string, stdout, stderr io.Writer) int {
return ops.VolumeStatusExitInvalid
}
if len(args) < 2 {
fmt.Fprintln(stderr, "sw-block: expected subcommand ops status|inventory|list|cluster|volumes|describe|timeline|explain|report|dashboard|generate-helm-values|operator-status|lifecycle-owner|authority-executor|rebuild-target-owner|failback-target-owner|frontend-publication-target-owner|frontend-publication-executor")
fmt.Fprintln(stderr, "sw-block: expected subcommand ops status|inventory|list|cluster|volumes|describe|timeline|explain|report|dashboard|generate-helm-values|operator-status|lifecycle-owner|authority-executor|rebuild-target-owner|failback-target-owner|failback-executor|frontend-publication-target-owner|frontend-publication-executor")
usage(stderr)
return ops.VolumeStatusExitInvalid
}
@@ -115,6 +118,8 @@ func run(args []string, stdout, stderr io.Writer) int {
return runOpsRebuildTargetOwner(args[2:], stdout, stderr)
case "failback-target-owner":
return runOpsFailbackTargetOwner(args[2:], stdout, stderr)
case "failback-executor":
return runOpsFailbackExecutor(args[2:], stdout, stderr)
case "frontend-publication-target-owner":
return runOpsFrontendPublicationTargetOwner(args[2:], stdout, stderr)
case "frontend-publication-executor":
@@ -189,6 +194,69 @@ func runOpsFrontendPublicationExecutor(args []string, stdout, stderr io.Writer)
}
}
func runOpsFailbackExecutor(args []string, stdout, stderr io.Writer) int {
fs := flag.NewFlagSet("sw-block ops failback-executor", flag.ContinueOnError)
fs.SetOutput(stderr)
var (
dryRun bool
namespace string
interval time.Duration
)
fs.BoolVar(&dryRun, "dry-run", false, "evaluate failback targets without writing SwBlockReplicaFailback status")
fs.StringVar(&namespace, "namespace", "default", "Kubernetes namespace containing SwBlockReplicaFailback objects")
fs.DurationVar(&interval, "interval", 0, "repeat failback-executor reconciliation at this interval; 0 runs once")
if err := fs.Parse(args); err != nil {
return ops.VolumeStatusExitInvalid
}
if fs.NArg() != 0 {
fmt.Fprintf(stderr, "sw-block ops failback-executor: unexpected args %s\n", strings.Join(fs.Args(), " "))
return ops.VolumeStatusExitInvalid
}
runOnce := func() int {
client, err := opsFailbackExecutorClientFactory()
if err != nil {
fmt.Fprintf(stderr, "sw-block ops failback-executor: %v\n", err)
return ops.VolumeStatusExitInvalid
}
result, err := (ops.FailbackExecutorReconciler{
Namespace: namespace,
Client: client,
DryRun: dryRun,
}).Reconcile(context.Background())
if err != nil {
fmt.Fprintf(stderr, "sw-block ops failback-executor: %v\n", err)
return ops.VolumeStatusExitInvalid
}
mode := "write_status"
if dryRun {
mode = "dry_run"
}
fmt.Fprintf(stdout, "failback_executor=%s namespace=%s targets=%d status_writes=%d invalid_targets=%d failback_attempts=%d status_mutation_allowed=%t authority_mutation_allowed=%t frontend_publication_allowed=%t mutation_allowed=%t storage_mutation_allowed=%t\n",
mode,
namespace,
result.TargetCount,
result.StatusWriteCount,
result.InvalidTargetCount,
result.FailbackAttempts,
!dryRun && result.StatusWriteCount > 0,
result.AuthorityMutationAllowed,
result.FrontendPublicationAllowed,
!dryRun && result.StatusWriteCount > 0,
result.StorageMutationAllowed)
return ops.VolumeStatusExitOK
}
if interval <= 0 {
return runOnce()
}
for {
code := runOnce()
if code != ops.VolumeStatusExitOK {
fmt.Fprintf(stderr, "sw-block ops failback-executor: iteration failed exit=%d; retrying in %s\n", code, interval)
}
time.Sleep(interval)
}
}
func runOpsFrontendPublicationTargetOwner(args []string, stdout, stderr io.Writer) int {
fs := flag.NewFlagSet("sw-block ops frontend-publication-target-owner", flag.ContinueOnError)
fs.SetOutput(stderr)
@@ -2007,6 +2075,7 @@ func usage(w io.Writer) {
fmt.Fprintln(w, " sw-block ops authority-executor [--namespace <ns>] [--allowed-mutation-class ack_eligibility|rebuild_traffic] [--interval 30s]")
fmt.Fprintln(w, " sw-block ops rebuild-target-owner [--dry-run] [--namespace <ns>] [--interval 30s]")
fmt.Fprintln(w, " sw-block ops failback-target-owner [--dry-run] [--namespace <ns>] [--interval 30s]")
fmt.Fprintln(w, " sw-block ops failback-executor [--dry-run] [--namespace <ns>] [--interval 30s]")
fmt.Fprintln(w, " sw-block ops frontend-publication-target-owner [--dry-run] [--namespace <ns>] [--interval 30s]")
fmt.Fprintln(w, " sw-block ops frontend-publication-executor [--dry-run] [--namespace <ns>] [--interval 30s]")
}
+116
View File
@@ -1134,6 +1134,90 @@ func TestOpsFailbackTargetOwnerDryRunDoesNotCreateTarget(t *testing.T) {
}
}
func TestOpsFailbackExecutorWritesDisabledStatus(t *testing.T) {
client := &lifecycleOwnerTestClient{
failbacks: []ops.SwBlockReplicaFailbackObject{cmdFailbackTarget()},
}
oldFactory := opsFailbackExecutorClientFactory
opsFailbackExecutorClientFactory = func() (ops.FailbackExecutorClient, error) {
return client, nil
}
t.Cleanup(func() { opsFailbackExecutorClientFactory = oldFactory })
var stdout, stderr bytes.Buffer
code := run([]string{"ops", "failback-executor", "--namespace", "kube-system"}, &stdout, &stderr)
if code != ops.VolumeStatusExitOK {
t.Fatalf("exit=%d stderr=%s stdout=%s", code, stderr.String(), stdout.String())
}
if len(client.failbackStatusWrites) != 1 {
t.Fatalf("failbackStatusWrites=%+v", client.failbackStatusWrites)
}
status := client.failbackStatusWrites[0].status
if status.State != ops.FailbackStateBlocked ||
status.ReasonCode != ops.AuthorityExecutorFailbackReasonDisabled ||
status.FailbackMutationAllowed ||
status.FailbackStarted ||
status.AuthorityEpochAdvanced ||
status.SinglePrimaryAfterFailback ||
status.PublishTargetSwappedAfterFailback {
t.Fatalf("status=%+v", status)
}
out := stdout.String()
for _, want := range []string{
"failback_executor=write_status",
"namespace=kube-system",
"targets=1",
"status_writes=1",
"invalid_targets=0",
"failback_attempts=0",
"status_mutation_allowed=true",
"authority_mutation_allowed=false",
"frontend_publication_allowed=false",
"mutation_allowed=true",
"storage_mutation_allowed=false",
} {
if !strings.Contains(out, want) {
t.Fatalf("stdout missing %q:\n%s", want, out)
}
}
}
func TestOpsFailbackExecutorDryRunDoesNotWriteStatus(t *testing.T) {
client := &lifecycleOwnerTestClient{
failbacks: []ops.SwBlockReplicaFailbackObject{cmdFailbackTarget()},
}
oldFactory := opsFailbackExecutorClientFactory
opsFailbackExecutorClientFactory = func() (ops.FailbackExecutorClient, error) {
return client, nil
}
t.Cleanup(func() { opsFailbackExecutorClientFactory = oldFactory })
var stdout, stderr bytes.Buffer
code := run([]string{"ops", "failback-executor", "--dry-run", "--namespace", "kube-system"}, &stdout, &stderr)
if code != ops.VolumeStatusExitOK {
t.Fatalf("exit=%d stderr=%s stdout=%s", code, stderr.String(), stdout.String())
}
if len(client.failbackStatusWrites) != 0 {
t.Fatalf("dry-run writes=%+v", client.failbackStatusWrites)
}
out := stdout.String()
for _, want := range []string{
"failback_executor=dry_run",
"targets=1",
"status_writes=0",
"failback_attempts=0",
"status_mutation_allowed=false",
"authority_mutation_allowed=false",
"frontend_publication_allowed=false",
"mutation_allowed=false",
"storage_mutation_allowed=false",
} {
if !strings.Contains(out, want) {
t.Fatalf("stdout missing %q:\n%s", want, out)
}
}
}
func TestOpsFrontendPublicationTargetOwnerCreatesTarget(t *testing.T) {
client := &lifecycleOwnerTestClient{
eligibilities: []ops.SwBlockReplicaEligibilityObject{cmdFrontendPublicationEligibility()},
@@ -1719,6 +1803,27 @@ func cmdFrontendPublicationTarget() ops.SwBlockFrontendPublicationObject {
}
}
func cmdFailbackTarget() ops.SwBlockReplicaFailbackObject {
return ops.SwBlockReplicaFailbackObject{
Ref: ops.OperatorObjectRef{
APIVersion: ops.SwBlockVolumeAPIVersion,
Kind: ops.SwBlockReplicaFailbackKind,
Namespace: "kube-system",
Name: "demo-pvc-r1-failback",
},
Spec: ops.SwBlockReplicaFailbackSpec{
VolumeName: "demo-pvc",
VolumeID: "pvc-demo",
PVCName: "demo-pvc",
ReplicaID: "r1",
AckEligible: true,
FrontendFencedBeforeFailback: true,
DurableFrontierCovered: true,
NoCrossVolumeIdentityChange: true,
},
}
}
func cmdFailbackTargetVolume() ops.SwBlockVolumeObject {
return ops.SwBlockVolumeObject{
Ref: ops.OperatorObjectRef{
@@ -1777,6 +1882,7 @@ type lifecycleOwnerTestClient struct {
rebuildWrites []lifecycleOwnerTestRebuildWrite
rebuildCreates []ops.SwBlockReplicaRebuildObject
failbackCreates []ops.SwBlockReplicaFailbackObject
failbackStatusWrites []lifecycleOwnerTestFailbackWrite
frontendPublicationCreates []ops.SwBlockFrontendPublicationObject
frontendPublicationStatusWrites []lifecycleOwnerTestFrontendPublicationWrite
}
@@ -1796,6 +1902,11 @@ type lifecycleOwnerTestRebuildWrite struct {
status ops.SwBlockReplicaRebuildCRDStatus
}
type lifecycleOwnerTestFailbackWrite struct {
ref ops.OperatorObjectRef
status ops.SwBlockReplicaFailbackCRDStatus
}
type lifecycleOwnerTestFrontendPublicationWrite struct {
ref ops.OperatorObjectRef
status ops.SwBlockFrontendPublicationCRDStatus
@@ -1831,6 +1942,11 @@ func (c *lifecycleOwnerTestClient) WriteReplicaRebuildStatus(_ context.Context,
return nil
}
func (c *lifecycleOwnerTestClient) WriteReplicaFailbackStatus(_ context.Context, ref ops.OperatorObjectRef, status ops.SwBlockReplicaFailbackCRDStatus) error {
c.failbackStatusWrites = append(c.failbackStatusWrites, lifecycleOwnerTestFailbackWrite{ref: ref, status: status})
return nil
}
func (c *lifecycleOwnerTestClient) WriteFrontendPublicationStatus(_ context.Context, ref ops.OperatorObjectRef, status ops.SwBlockFrontendPublicationCRDStatus) error {
c.frontendPublicationStatusWrites = append(c.frontendPublicationStatusWrites, lifecycleOwnerTestFrontendPublicationWrite{ref: ref, status: status})
return nil
@@ -0,0 +1,112 @@
package ops
import (
"context"
"fmt"
"time"
)
const (
FailbackStateBlocked = "blocked"
AuthorityExecutorFailbackReasonDisabled = "failback_policy_disabled"
AuthorityExecutorFailbackReasonMissingFacts = "missing_required_facts"
)
type FailbackExecutorClient interface {
ListSwBlockReplicaFailbacks(ctx context.Context, namespace string) ([]SwBlockReplicaFailbackObject, error)
WriteReplicaFailbackStatus(ctx context.Context, ref OperatorObjectRef, status SwBlockReplicaFailbackCRDStatus) error
}
type FailbackExecutorReconciler struct {
Namespace string
Client FailbackExecutorClient
DryRun bool
Now func() time.Time
}
type FailbackExecutorReconcileResult struct {
TargetCount int `json:"targetCount"`
StatusWriteCount int `json:"statusWriteCount"`
InvalidTargetCount int `json:"invalidTargetCount"`
FailbackAttempts int `json:"failbackAttempts"`
AuthorityMutationAllowed bool `json:"authorityMutationAllowed"`
FrontendPublicationAllowed bool `json:"frontendPublicationAllowed"`
StorageMutationAllowed bool `json:"storageMutationAllowed"`
}
func (r FailbackExecutorReconciler) Reconcile(ctx context.Context) (FailbackExecutorReconcileResult, error) {
if r.Client == nil {
return FailbackExecutorReconcileResult{}, fmt.Errorf("failback executor client is required")
}
namespace := defaultString(r.Namespace, "default")
targets, err := r.Client.ListSwBlockReplicaFailbacks(ctx, namespace)
if err != nil {
return FailbackExecutorReconcileResult{}, err
}
result := FailbackExecutorReconcileResult{TargetCount: len(targets)}
for _, target := range targets {
status := failbackExecutorDisabledStatus(r.now()(), target)
if !failbackExecutorTargetValid(target) {
result.InvalidTargetCount++
status.ReasonCode = AuthorityExecutorFailbackReasonMissingFacts
status.Conditions[0].Reason = AuthorityExecutorFailbackReasonMissingFacts
status.Conditions[0].Message = "failback target is missing required terminal evidence"
}
if r.DryRun {
continue
}
if err := r.Client.WriteReplicaFailbackStatus(ctx, target.Ref, status); err != nil {
return result, err
}
result.StatusWriteCount++
}
return result, nil
}
func failbackExecutorTargetValid(target SwBlockReplicaFailbackObject) bool {
spec := target.Spec
return spec.VolumeName != "" &&
spec.ReplicaID != "" &&
spec.AckEligible &&
spec.FrontendFencedBeforeFailback &&
spec.DurableFrontierCovered &&
spec.NoCrossVolumeIdentityChange
}
func failbackExecutorDisabledStatus(now time.Time, target SwBlockReplicaFailbackObject) SwBlockReplicaFailbackCRDStatus {
return SwBlockReplicaFailbackCRDStatus{
ObservedAt: now,
Executor: "failback-executor",
State: FailbackStateBlocked,
ReasonCode: AuthorityExecutorFailbackReasonDisabled,
FailbackMutationAllowed: false,
FailbackStarted: false,
AuthorityEpochAdvanced: false,
SinglePrimaryAfterFailback: false,
PublishTargetSwappedAfterFailback: false,
NoCrossVolumeIdentityChange: target.Spec.NoCrossVolumeIdentityChange,
Conditions: []ObservationCondition{{
Type: ConditionBlocked,
Status: "True",
Reason: AuthorityExecutorFailbackReasonDisabled,
Severity: "warning",
Message: "failback executor is disabled by product policy",
}},
NonClaims: []string{
"no_failback",
"no_authority_epoch_advance",
"no_primary_reassignment",
"no_publish_target_swap",
"no_frontend_publication",
"no_storage_mutation",
},
}
}
func (r FailbackExecutorReconciler) now() func() time.Time {
if r.Now != nil {
return r.Now
}
return time.Now
}
@@ -0,0 +1,156 @@
package ops
import (
"context"
"testing"
"time"
)
func TestFailbackExecutorWritesDisabledStatus(t *testing.T) {
client := &fakeFailbackExecutorClient{
targets: []SwBlockReplicaFailbackObject{failbackExecutorTestTarget()},
}
result, err := (FailbackExecutorReconciler{
Namespace: "kube-system",
Client: client,
Now: func() time.Time { return time.Date(2026, 6, 25, 13, 0, 0, 0, time.UTC) },
}).Reconcile(context.Background())
if err != nil {
t.Fatalf("reconcile: %v", err)
}
if result.TargetCount != 1 ||
result.StatusWriteCount != 1 ||
result.InvalidTargetCount != 0 ||
result.FailbackAttempts != 0 ||
result.AuthorityMutationAllowed ||
result.FrontendPublicationAllowed ||
result.StorageMutationAllowed {
t.Fatalf("result=%+v", result)
}
if len(client.writes) != 1 {
t.Fatalf("writes=%+v", client.writes)
}
status := client.writes[0].status
if status.State != FailbackStateBlocked ||
status.ReasonCode != AuthorityExecutorFailbackReasonDisabled ||
status.FailbackMutationAllowed ||
status.FailbackStarted ||
status.AuthorityEpochAdvanced ||
status.SinglePrimaryAfterFailback ||
status.PublishTargetSwappedAfterFailback ||
!status.NoCrossVolumeIdentityChange {
t.Fatalf("status=%+v", status)
}
if len(status.Conditions) != 1 ||
status.Conditions[0].Type != ConditionBlocked ||
status.Conditions[0].Status != "True" ||
status.Conditions[0].Reason != AuthorityExecutorFailbackReasonDisabled {
t.Fatalf("conditions=%+v", status.Conditions)
}
for _, want := range []string{
"no_failback",
"no_authority_epoch_advance",
"no_primary_reassignment",
"no_publish_target_swap",
"no_frontend_publication",
"no_storage_mutation",
} {
if !failbackExecutorStringSliceContains(status.NonClaims, want) {
t.Fatalf("nonClaims=%+v missing %s", status.NonClaims, want)
}
}
}
func TestFailbackExecutorDryRunDoesNotWriteStatus(t *testing.T) {
client := &fakeFailbackExecutorClient{
targets: []SwBlockReplicaFailbackObject{failbackExecutorTestTarget()},
}
result, err := (FailbackExecutorReconciler{
Namespace: "kube-system",
Client: client,
DryRun: true,
}).Reconcile(context.Background())
if err != nil {
t.Fatalf("reconcile: %v", err)
}
if result.TargetCount != 1 || result.StatusWriteCount != 0 {
t.Fatalf("result=%+v", result)
}
if len(client.writes) != 0 {
t.Fatalf("dry-run wrote status: %+v", client.writes)
}
}
func TestFailbackExecutorMarksInvalidTargets(t *testing.T) {
target := failbackExecutorTestTarget()
target.Spec.DurableFrontierCovered = false
client := &fakeFailbackExecutorClient{
targets: []SwBlockReplicaFailbackObject{target},
}
result, err := (FailbackExecutorReconciler{
Namespace: "kube-system",
Client: client,
}).Reconcile(context.Background())
if err != nil {
t.Fatalf("reconcile: %v", err)
}
if result.InvalidTargetCount != 1 || result.StatusWriteCount != 1 {
t.Fatalf("result=%+v", result)
}
status := client.writes[0].status
if status.State != FailbackStateBlocked ||
status.ReasonCode != AuthorityExecutorFailbackReasonMissingFacts ||
status.FailbackMutationAllowed ||
status.FailbackStarted {
t.Fatalf("status=%+v", status)
}
}
func failbackExecutorTestTarget() SwBlockReplicaFailbackObject {
return SwBlockReplicaFailbackObject{
Ref: OperatorObjectRef{
APIVersion: SwBlockVolumeAPIVersion,
Kind: SwBlockReplicaFailbackKind,
Namespace: "kube-system",
Name: "demo-pvc-r2-failback",
},
Spec: SwBlockReplicaFailbackSpec{
VolumeName: "demo-pvc",
VolumeID: "pvc-demo",
PVCName: "demo-pvc",
ReplicaID: "r2",
AckEligible: true,
FrontendFencedBeforeFailback: true,
DurableFrontierCovered: true,
NoCrossVolumeIdentityChange: true,
},
}
}
type fakeFailbackExecutorClient struct {
targets []SwBlockReplicaFailbackObject
writes []fakeFailbackStatusWrite
}
type fakeFailbackStatusWrite struct {
ref OperatorObjectRef
status SwBlockReplicaFailbackCRDStatus
}
func (f *fakeFailbackExecutorClient) ListSwBlockReplicaFailbacks(context.Context, string) ([]SwBlockReplicaFailbackObject, error) {
return append([]SwBlockReplicaFailbackObject(nil), f.targets...), nil
}
func (f *fakeFailbackExecutorClient) WriteReplicaFailbackStatus(_ context.Context, ref OperatorObjectRef, status SwBlockReplicaFailbackCRDStatus) error {
f.writes = append(f.writes, fakeFailbackStatusWrite{ref: ref, status: status})
return nil
}
func failbackExecutorStringSliceContains(values []string, want string) bool {
for _, value := range values {
if value == want {
return true
}
}
return false
}
@@ -898,6 +898,62 @@ func TestPhase75FailbackTargetOwnerPackagingIsNarrow(t *testing.T) {
}
}
func TestPhase76FailbackExecutorPackagingIsStatusOnly(t *testing.T) {
values := readYAMLMap(t, "charts/seaweed-block/values.yaml")
executor := yamlMap(t, values, "failbackExecutor")
assertYAMLBool(t, executor, "create", false)
assertYAMLBool(t, executor, "dryRun", true)
rbacValues := yamlMap(t, executor, "rbac")
assertYAMLBool(t, rbacValues, "create", true)
deploy := readRepoFile(t, "charts/seaweed-block/templates/failback-executor.yaml")
for _, want := range []string{
`kind: Deployment`,
`name: sw-block-failback-executor`,
`serviceAccountName: {{ include "seaweed-block.fullname" . }}-failback-executor`,
`command: ["/usr/local/bin/sw-block"]`,
`- "failback-executor"`,
`- "--namespace={{ .Release.Namespace }}"`,
`{{- if .Values.failbackExecutor.dryRun }}`,
`- "--dry-run"`,
`- "--interval={{ .Values.failbackExecutor.interval }}"`,
} {
if !strings.Contains(deploy, want) {
t.Fatalf("failback-executor deployment missing %q\n%s", want, deploy)
}
}
rbac := readRepoFile(t, "charts/seaweed-block/templates/failback-executor-rbac.yaml")
for _, want := range []string{
`resources: ["swblockreplicafailbacks"]`,
`verbs: ["get", "list", "watch"]`,
`resources: ["swblockreplicafailbacks/status"]`,
`verbs: ["get", "update", "patch"]`,
} {
if !strings.Contains(rbac, want) {
t.Fatalf("failback-executor RBAC missing %q\n%s", want, rbac)
}
}
for _, forbidden := range []string{
`resources: ["swblockvolumes"]`,
`resources: ["swblockreplicafailbacks/finalizers"]`,
`resources: ["swblockfrontendpublications"]`,
`resources: ["swblockreplicarebuilds"]`,
`resources: ["events"]`,
`resources: ["pods"]`,
`resources: ["persistentvolumes"]`,
`resources: ["persistentvolumeclaims"]`,
`resources: ["storageclasses"]`,
`resources: ["secrets"]`,
`"create"`,
`"delete"`,
} {
if strings.Contains(rbac, forbidden) {
t.Fatalf("failback-executor RBAC contains forbidden fragment %q\n%s", forbidden, rbac)
}
}
}
func TestPhase69FrontendPublicationTargetOwnerPackagingIsNarrow(t *testing.T) {
values := readYAMLMap(t, "charts/seaweed-block/values.yaml")
targetOwner := yamlMap(t, values, "frontendPublicationTargetOwner")
@@ -81,6 +81,10 @@ func (c *KubernetesStatusClient) WriteFrontendPublicationStatus(ctx context.Cont
return c.patchStatus(ctx, ref.Namespace, SwBlockFrontendPublicationPlural, ref.Name, status)
}
func (c *KubernetesStatusClient) WriteReplicaFailbackStatus(ctx context.Context, ref OperatorObjectRef, status SwBlockReplicaFailbackCRDStatus) error {
return c.patchStatus(ctx, ref.Namespace, SwBlockReplicaFailbackPlural, ref.Name, status)
}
func IsKubernetesStatusNotFound(err error) bool {
return err != nil && strings.Contains(err.Error(), "http 404")
}
@@ -198,9 +198,30 @@ func TestKubernetesStatusClientPatchesOnlyStatusSubresources(t *testing.T) {
}); err != nil {
t.Fatalf("write frontend publication status: %v", err)
}
if err := client.WriteReplicaFailbackStatus(context.Background(), OperatorObjectRef{
Namespace: "kube-system",
Name: "demo-pvc-r1-failback",
}, SwBlockReplicaFailbackCRDStatus{
ObservedAt: observedAt,
ObservedGeneration: 10,
Executor: "failback-executor",
State: FailbackStateBlocked,
ReasonCode: AuthorityExecutorFailbackReasonDisabled,
FailbackMutationAllowed: false,
FailbackStarted: false,
AuthorityEpochAdvanced: false,
SinglePrimaryAfterFailback: false,
PublishTargetSwappedAfterFailback: false,
NoCrossVolumeIdentityChange: true,
EvidenceGeneration: "executor-run-4",
EvidenceRefs: []string{"failback-summary.txt"},
NonClaims: []string{"no_failback", "no_frontend_publication", "no_storage_mutation"},
}); err != nil {
t.Fatalf("write replica failback status: %v", err)
}
if len(requests) != 5 {
t.Fatalf("requests=%d want 5: %+v", len(requests), requests)
if len(requests) != 6 {
t.Fatalf("requests=%d want 6: %+v", len(requests), requests)
}
wantPaths := []string{
"/apis/block.seaweedfs.com/v1alpha1/namespaces/kube-system/swblockclusters/sw-block/status",
@@ -208,6 +229,7 @@ func TestKubernetesStatusClientPatchesOnlyStatusSubresources(t *testing.T) {
"/apis/block.seaweedfs.com/v1alpha1/namespaces/kube-system/swblockreplicaeligibilities/demo-pvc-r1/status",
"/apis/block.seaweedfs.com/v1alpha1/namespaces/kube-system/swblockreplicarebuilds/demo-pvc-r1-rebuild/status",
"/apis/block.seaweedfs.com/v1alpha1/namespaces/kube-system/swblockfrontendpublications/demo-pvc-r1-frontend-publication/status",
"/apis/block.seaweedfs.com/v1alpha1/namespaces/kube-system/swblockreplicafailbacks/demo-pvc-r1-failback/status",
}
for i, req := range requests {
if req.Method != http.MethodPatch {
+10 -2
View File
@@ -290,7 +290,13 @@ Recommended order from here:
present. It can create the target object only; it cannot write status,
finalizers, Events, storage/workloads, authority state, frontend
publication, or failback execution.
33. Add backup/restore and NVMe ANA parity after they can reuse the same action
33. Phase 76: returned-replica failback executor boundary. **Closed 2026-06-25, local PASS**
(`internal/docs/finished-plans/phase76_finishedplan_failback_executor_boundary.md`).
The failback executor can read `SwBlockReplicaFailback` targets and write
disabled/blocked status through `swblockreplicafailbacks/status`. It remains
status-only: no failback, authority epoch advance, primary reassignment,
publish-target swap, frontend publication, or storage mutation is executed.
34. 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.
@@ -313,7 +319,9 @@ authority/failback owner is implemented and gated. Phase 74 names that missing
owner contract explicitly as `authority.failback_returned_replica` while
keeping execution disabled. Phase 75 adds the first target-owner seam for that
contract: `SwBlockReplicaFailback` can be planned as a handoff object, but no
failback, authority mutation, or frontend publication is executed.
failback, authority mutation, or frontend publication is executed. Phase 76 adds
the matching executor identity and status-only boundary for those failback
targets, still keeping all real failback side effects disabled.
The practical rule is:
+73 -101
View File
@@ -1,131 +1,109 @@
# Current Plan: Phase 75 Returned-Replica Failback Target Owner
# Current Plan: Phase 76 Returned-Replica Failback Executor Boundary
Status: complete.
## Goal
Phase 74 named the missing returned-replica failback owner as an explicit,
disabled contract:
Phase 75 created the failback handoff target:
```text
authority.failback_returned_replica
SwBlockReplicaFailback
```
Phase 75 adds the next narrow control-plane seam: a target-owner process can
materialize a `SwBlockReplicaFailback` handoff CR when the failback contract is
ready and terminal evidence is present.
Phase 76 adds the first executor boundary for that target. The executor can
read targets and write `SwBlockReplicaFailback.status`, but it still cannot
execute failback.
This phase does not execute failback. It does not advance authority, change the
primary, publish a frontend, or mutate storage/workloads.
This phase is intentionally status-only. It does not advance authority, change
the primary, swap publish targets, publish frontend paths, or mutate storage.
## Deliverables
### D1: Failback Target CRD
Added `SwBlockReplicaFailback`:
```text
kind=SwBlockReplicaFailback
plural=swblockreplicafailbacks
scope=Namespaced
status_subresource=true
```
The spec records only the target identity and precondition facts:
```text
volumeName
volumeID
pvcName
replicaID
ackEligible
frontendFencedBeforeFailback
durableFrontierCovered
noCrossVolumeIdentityChange
```
The status is reserved for a future executor:
```text
state=planned|blocked|failed_back
failbackMutationAllowed
failbackStarted
authorityEpochAdvanced
singlePrimaryAfterFailback
publishTargetSwappedAfterFailback
noCrossVolumeIdentityChange
```
### D2: Failback Target Owner
### D1: Status-Only Failback Executor
Added:
```text
sw-block ops failback-target-owner
sw-block ops failback-executor
```
The owner reads `SwBlockVolume` contracts and existing
`SwBlockReplicaFailback` targets. It creates a target only when:
For each target it writes:
```text
action=authority.failback_returned_replica
contract decision=disabled
executor policy=disabled
allowed_mutation=failback
ack_eligibility_known=true
ack_eligible=true
frontend_fenced=true
frontend_primary_ready=false
durable_frontier >= required_frontier
state=blocked
reasonCode=failback_policy_disabled
failbackMutationAllowed=false
failbackStarted=false
authorityEpochAdvanced=false
singlePrimaryAfterFailback=false
publishTargetSwappedAfterFailback=false
```
Dry-run is supported and is the Helm default.
Invalid targets are also blocked:
```text
reasonCode=missing_required_facts
```
### D2: Kubernetes Status Writer
Added:
```text
WriteReplicaFailbackStatus(...)
```
The writer patches only:
```text
swblockreplicafailbacks/status
```
It never patches spec, finalizers, Events, workloads, storage objects, or
frontend publication resources.
### D3: Helm Packaging + RBAC
Added disabled-by-default packaging:
```text
failbackTargetOwner.create=false
failbackTargetOwner.dryRun=true
failbackExecutor.create=false
failbackExecutor.dryRun=true
```
The target owner RBAC is intentionally narrow:
RBAC is status-only:
```text
swblockvolumes: get,list,watch
swblockreplicafailbacks: get,list,watch,create
swblockreplicafailbacks: get,list,watch
swblockreplicafailbacks/status: get,update,patch
```
It has no status, finalizer, Event, pod, PVC, PV, StorageClass, Secret, or
delete/update/patch permissions.
### D4: Gate
Added:
```text
scripts/run-phase75-failback-target-owner-gate.sh
testops/scenarios/failback-target-owner-chain.yaml
scripts/run-phase76-failback-executor-boundary-gate.sh
testops/scenarios/failback-executor-boundary-chain.yaml
```
The gate proves:
```text
target owner creates target when terminal evidence is present
dry-run creates no target
non-failback contracts are rejected
missing terminal evidence blocks target creation
target CRD schema is camelCase and bounded
Helm/RBAC packaging is disabled and narrow
failback executor writes disabled/blocked status
dry-run writes no status
invalid targets are blocked
status writer uses /status
RBAC is status-only
failback_attempts=0
storage_mutation_allowed=false
authority_mutation_allowed=false
frontend_publication_allowed=false
storage_mutation_allowed=false
```
## Non-Claims
Phase 75 does not implement:
Phase 76 does not implement:
```text
real failback execution
@@ -141,40 +119,34 @@ NVMe ANA behavior
## Verification
```text
go test ./core/ops -run "TestFailbackTargetOwner|TestPhase75|TestPhase57D1SwBlockReplicaRebuildTargetSchema|TestPhase69SwBlockFrontendPublicationTargetSchema" -count=1 -v
go test ./cmd/sw-block -run "TestOpsFailbackTargetOwner|TestOpsRebuildTargetOwner|TestOpsFrontendPublicationTargetOwner" -count=1 -v
go test ./core/ops -run "TestFailbackExecutor|TestPhase76|TestKubernetesStatusClientPatchesOnlyStatusSubresources" -count=1 -v
go test ./cmd/sw-block -run "TestOpsFailbackExecutor|TestOpsFailbackTargetOwner" -count=1 -v
go test ./core/ops ./cmd/sw-block
helm lint charts/seaweed-block
helm template sw-block charts/seaweed-block --set failbackTargetOwner.create=true
```
Additional gate/scenario validation:
```text
"C:\Program Files\Git\bin\bash.exe" scripts/run-phase75-failback-target-owner-gate.sh .
C:\work\swblock.exe validate testops\scenarios\failback-target-owner-chain.yaml
helm template sw-block charts/seaweed-block --set failbackExecutor.create=true
"C:\Program Files\Git\bin\bash.exe" scripts/run-phase76-failback-executor-boundary-gate.sh .
C:\work\swblock.exe validate testops\scenarios\failback-executor-boundary-chain.yaml
```
Terminal evidence:
```text
phase75_failback_target_owner_status=ok
core_ops_failback_target_owner_tests=pass
cmd_failback_target_owner_tests=pass
failback_target_owner_creates_target=true
failback_target_owner_dry_run_no_create=true
failback_target_owner_rejects_non_failback_contract=true
failback_target_owner_requires_terminal_evidence=true
failback_target_crd_schema=true
failback_target_owner_chart_boundary=true
phase76_failback_executor_boundary_status=ok
core_ops_failback_executor_tests=pass
cmd_failback_executor_tests=pass
failback_executor_writes_disabled_status=true
failback_executor_dry_run_no_status_write=true
kubernetes_writer_failback_status_subresource=true
failback_executor_rbac_status_only=true
failback_attempts=0
storage_mutation_allowed=false
authority_mutation_allowed=false
frontend_publication_allowed=false
storage_mutation_allowed=false
```
## Next
The next implementation step is a failback executor boundary. It should consume
`SwBlockReplicaFailback`, remain disabled until the real authority mutation can
prove terminal evidence, and must not reuse the ACK-eligibility, rebuild, or
generic frontend-publication paths as a shortcut.
The next step is a failback execution preflight/runtime contract. It must remain
disabled until it can prove the full terminal evidence: authority ownership,
epoch advance, single-primary state, publish-target swap, and cross-volume
identity isolation.
@@ -0,0 +1,128 @@
# Phase 76 Finished Plan: Returned-Replica Failback Executor Boundary
Status: complete.
## Problem
Phase 75 introduced `SwBlockReplicaFailback` as the handoff target for future
returned-replica failback. The target existed, but no executor identity owned
its status surface. Without that boundary, the next implementation would jump
straight from a target object to authority mutation.
## Implementation
Added:
```text
sw-block ops failback-executor
```
The executor reads `SwBlockReplicaFailback` targets and writes disabled status:
```text
state=blocked
reasonCode=failback_policy_disabled
failbackMutationAllowed=false
failbackStarted=false
authorityEpochAdvanced=false
singlePrimaryAfterFailback=false
publishTargetSwappedAfterFailback=false
```
Invalid targets are blocked with:
```text
reasonCode=missing_required_facts
```
Added Kubernetes status writer support:
```text
swblockreplicafailbacks/status
```
Added disabled-by-default Helm packaging:
```text
failbackExecutor.create=false
failbackExecutor.dryRun=true
```
RBAC is status-only:
```text
swblockreplicafailbacks: get,list,watch
swblockreplicafailbacks/status: get,update,patch
```
## Gate
Added:
```text
scripts/run-phase76-failback-executor-boundary-gate.sh
testops/scenarios/failback-executor-boundary-chain.yaml
```
The gate checks:
```text
disabled status write
dry-run no status write
invalid target blocked
Kubernetes writer uses status subresource
RBAC is status-only
failback attempts = 0
authority mutation allowed = false
frontend publication allowed = false
storage mutation allowed = false
```
## Verification
```text
go test ./core/ops -run "TestFailbackExecutor|TestPhase76|TestKubernetesStatusClientPatchesOnlyStatusSubresources" -count=1 -v
go test ./cmd/sw-block -run "TestOpsFailbackExecutor|TestOpsFailbackTargetOwner" -count=1 -v
go test ./core/ops ./cmd/sw-block
helm lint charts/seaweed-block
helm template sw-block charts/seaweed-block --set failbackExecutor.create=true
"C:\Program Files\Git\bin\bash.exe" scripts/run-phase76-failback-executor-boundary-gate.sh .
C:\work\swblock.exe validate testops\scenarios\failback-executor-boundary-chain.yaml
```
Terminal evidence:
```text
phase76_failback_executor_boundary_status=ok
core_ops_failback_executor_tests=pass
cmd_failback_executor_tests=pass
failback_executor_writes_disabled_status=true
failback_executor_dry_run_no_status_write=true
failback_executor_invalid_target_blocked=true
kubernetes_writer_failback_status_subresource=true
failback_executor_rbac_status_only=true
failback_attempts=0
authority_mutation_allowed=false
frontend_publication_allowed=false
storage_mutation_allowed=false
```
## Non-Claims
Phase 76 does not implement:
```text
failback execution
authority epoch mutation
primary reassignment
publish-target swap
frontend publication
blockvolume frontend switching
storage/workload mutation
```
## Next
The next phase should add an execution preflight/runtime contract for failback,
still disabled until it can prove authority ownership, epoch advance,
single-primary state, publish-target swap, and cross-volume isolation.
@@ -0,0 +1,79 @@
# Phase 76 Returned-Replica Failback Executor Boundary QA Sign-off
Verdict: PASS.
## Scope
Phase 76 validates the first executor boundary for:
```text
SwBlockReplicaFailback
```
This is a local/runner status-boundary gate. It does not install Kubernetes
resources and does not execute failback.
## Evidence
Local checks:
```text
go test ./core/ops -run "TestFailbackExecutor|TestPhase76|TestKubernetesStatusClientPatchesOnlyStatusSubresources" -count=1 -v
go test ./cmd/sw-block -run "TestOpsFailbackExecutor|TestOpsFailbackTargetOwner" -count=1 -v
go test ./core/ops ./cmd/sw-block
helm lint charts/seaweed-block
helm template sw-block charts/seaweed-block --set failbackExecutor.create=true
"C:\Program Files\Git\bin\bash.exe" scripts/run-phase76-failback-executor-boundary-gate.sh .
C:\work\swblock.exe validate testops\scenarios\failback-executor-boundary-chain.yaml
```
Gate summary:
```text
phase76_failback_executor_boundary_status=ok
phase76_scope=failback_executor_status_boundary
failback_attempts=0
authority_mutation_allowed=false
frontend_publication_allowed=false
storage_mutation_allowed=false
authority_epoch_advanced=false
single_primary_after_failback=false
publish_target_swapped_after_failback=false
core_ops_failback_executor_tests=pass
cmd_failback_executor_tests=pass
failback_target_schema_locked=true
failback_executor_rbac_status_only=true
kubernetes_writer_failback_status_subresource=true
failback_executor_writes_disabled_status=true
failback_executor_dry_run_no_status_write=true
failback_executor_invalid_target_blocked=true
cmd_failback_executor_writes_status=true
cmd_failback_executor_dry_run_no_status_write=true
failback_executor_status_writes=true
failback_executor_status=blocked
failback_executor_reason=failback_policy_disabled
failback_executor_status_mutation_allowed=true
failback_mutation_allowed=false
failback_started=false
phase76_failback_executor_boundary_status=ok
```
## Result
PASS:
- `sw-block ops failback-executor` writes disabled/blocked
`SwBlockReplicaFailback.status`.
- Dry-run writes no status.
- Invalid targets are blocked with `missing_required_facts`.
- Kubernetes writer patches only `swblockreplicafailbacks/status`.
- Helm packaging is disabled and dry-run by default.
- RBAC is status-only.
- No failback, authority mutation, frontend publication, storage mutation, or
publish-target swap is attempted.
## Non-Claims
Phase 76 does not claim real failback, authority epoch mutation, primary
reassignment, publish-target swap, blockvolume frontend switch, or NVMe ANA
parity.
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -euo pipefail
PRODUCT_ROOT="${1:-$(pwd)}"
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase76-failback-executor-boundary-gate}"
SUMMARY="${ARTIFACT_DIR}/phase76-failback-executor-boundary-summary.txt"
OPS_LOG="${ARTIFACT_DIR}/core-ops-go-test.log"
CMD_LOG="${ARTIFACT_DIR}/cmd-sw-block-go-test.log"
mkdir -p "${ARTIFACT_DIR}"
: >"${SUMMARY}"
write_summary() {
echo "$*" | tee -a "${SUMMARY}" >/dev/null
}
require_log() {
local name="$1"
local pattern="$2"
local file="$3"
local found="false"
if grep -Eq -- "${pattern}" "${file}"; then
found="true"
fi
write_summary "${name}=${found}"
if [ "${found}" != "true" ]; then
echo "missing evidence ${name}: pattern ${pattern}" >&2
return 1
fi
}
write_summary "phase76_failback_executor_boundary_status=running"
write_summary "phase76_scope=failback_executor_status_boundary"
write_summary "failback_attempts=0"
write_summary "authority_mutation_allowed=false"
write_summary "frontend_publication_allowed=false"
write_summary "storage_mutation_allowed=false"
write_summary "authority_epoch_advanced=false"
write_summary "single_primary_after_failback=false"
write_summary "publish_target_swapped_after_failback=false"
OPS_PATTERN="TestPhase75SwBlockReplicaFailbackTargetSchema|TestPhase76FailbackExecutorPackagingIsStatusOnly|TestKubernetesStatusClientPatchesOnlyStatusSubresources|TestFailbackExecutorWritesDisabledStatus|TestFailbackExecutorDryRunDoesNotWriteStatus|TestFailbackExecutorMarksInvalidTargets"
CMD_PATTERN="TestOpsFailbackExecutorWritesDisabledStatus|TestOpsFailbackExecutorDryRunDoesNotWriteStatus"
if (cd "${PRODUCT_ROOT}" && go test ./core/ops -run "${OPS_PATTERN}" -count=1 -v) >"${OPS_LOG}" 2>&1; then
write_summary "core_ops_failback_executor_tests=pass"
else
write_summary "core_ops_failback_executor_tests=fail"
cat "${OPS_LOG}" >&2 || true
exit 1
fi
if (cd "${PRODUCT_ROOT}" && go test ./cmd/sw-block -run "${CMD_PATTERN}" -count=1 -v) >"${CMD_LOG}" 2>&1; then
write_summary "cmd_failback_executor_tests=pass"
else
write_summary "cmd_failback_executor_tests=fail"
cat "${CMD_LOG}" >&2 || true
exit 1
fi
require_log "failback_target_schema_locked" "^--- PASS: TestPhase75SwBlockReplicaFailbackTargetSchema" "${OPS_LOG}"
require_log "failback_executor_rbac_status_only" "^--- PASS: TestPhase76FailbackExecutorPackagingIsStatusOnly" "${OPS_LOG}"
require_log "kubernetes_writer_failback_status_subresource" "^--- PASS: TestKubernetesStatusClientPatchesOnlyStatusSubresources" "${OPS_LOG}"
require_log "failback_executor_writes_disabled_status" "^--- PASS: TestFailbackExecutorWritesDisabledStatus" "${OPS_LOG}"
require_log "failback_executor_dry_run_no_status_write" "^--- PASS: TestFailbackExecutorDryRunDoesNotWriteStatus" "${OPS_LOG}"
require_log "failback_executor_invalid_target_blocked" "^--- PASS: TestFailbackExecutorMarksInvalidTargets" "${OPS_LOG}"
require_log "cmd_failback_executor_writes_status" "^--- PASS: TestOpsFailbackExecutorWritesDisabledStatus" "${CMD_LOG}"
require_log "cmd_failback_executor_dry_run_no_status_write" "^--- PASS: TestOpsFailbackExecutorDryRunDoesNotWriteStatus" "${CMD_LOG}"
write_summary "failback_executor_status_writes=true"
write_summary "failback_executor_status=blocked"
write_summary "failback_executor_reason=failback_policy_disabled"
write_summary "failback_executor_status_mutation_allowed=true"
write_summary "failback_mutation_allowed=false"
write_summary "failback_started=false"
write_summary "failback_executor_rbac_status_only=true"
write_summary "phase76_failback_executor_boundary_status=ok"
@@ -0,0 +1,115 @@
# Runner-native Phase 76 gate: SwBlockReplicaFailback executor writes
# disabled/blocked status only. It does not execute failback, advance authority,
# swap publish targets, publish frontend paths, or mutate storage.
name: failback-executor-boundary-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: failback_executor_boundary_gate
actions:
- action: exec
node: m02
timeout: 7m
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary && cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary bash scripts/run-phase76-failback-executor-boundary-gate.sh {{ product_root }}"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^phase76_failback_executor_boundary_status=ok$"
save_as: phase76_ok
- action: assert_greater
actual: "{{ phase76_ok }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^failback_executor_writes_disabled_status=true$"
save_as: writes_disabled
- action: assert_greater
actual: "{{ writes_disabled }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^failback_executor_dry_run_no_status_write=true$"
save_as: dry_run_no_write
- action: assert_greater
actual: "{{ dry_run_no_write }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^kubernetes_writer_failback_status_subresource=true$"
save_as: status_subresource
- action: assert_greater
actual: "{{ status_subresource }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^failback_executor_rbac_status_only=true$"
save_as: rbac_status_only
- action: assert_greater
actual: "{{ rbac_status_only }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^failback_attempts=0$"
save_as: no_failback_attempt
- action: assert_greater
actual: "{{ no_failback_attempt }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^authority_mutation_allowed=false$"
save_as: no_authority_mutation
- action: assert_greater
actual: "{{ no_authority_mutation }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^frontend_publication_allowed=false$"
save_as: no_frontend_publication
- action: assert_greater
actual: "{{ no_frontend_publication }}"
threshold: "0"
- action: grep_log
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary/phase76-failback-executor-boundary-summary.txt"
pattern: "^storage_mutation_allowed=false$"
save_as: no_storage_mutation
- action: assert_greater
actual: "{{ no_storage_mutation }}"
threshold: "0"
- name: collect
always: true
actions:
- action: collect_path
node: m02
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase76-failback-executor-boundary"
name: "remote-phases"
ignore_error: true