mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 10:37:23 +01:00
phase97: wire frontend publication executor callsite
This commit is contained in:
1 parent
dcad5161b6
commit
4e8a6a10b3
18 files changed
+832
-135
No files matched your search
@@ -33,5 +33,14 @@ spec:
|
||||
{{- if .Values.frontendPublicationExecutor.dryRun }}
|
||||
- "--dry-run"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationExecutor.execution.enabled }}
|
||||
- "--enable-execution"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationExecutor.execution.policy }}
|
||||
- "--execution-policy"
|
||||
{{- end }}
|
||||
{{- if .Values.frontendPublicationExecutor.execution.runtimeUrl }}
|
||||
- "--frontend-publication-runtime-url={{ .Values.frontendPublicationExecutor.execution.runtimeUrl }}"
|
||||
{{- end }}
|
||||
- "--interval={{ .Values.frontendPublicationExecutor.interval }}"
|
||||
{{- end }}
|
||||
@@ -214,13 +214,18 @@ frontendPublicationTargetOwner:
|
||||
nodeSelector: {}
|
||||
|
||||
frontendPublicationExecutor:
|
||||
# Frontend publication executor boundary. Disabled by default. This phase
|
||||
# writes disabled/blocked SwBlockFrontendPublication.status only. It does not
|
||||
# publish frontend targets, fail back authority, create targets, or mutate
|
||||
# Frontend publication executor boundary. Disabled by default. With execution
|
||||
# disabled it writes blocked SwBlockFrontendPublication.status only. Execution
|
||||
# requires both execution.enabled and execution.policy plus an explicit
|
||||
# runtimeUrl. It must not fail back authority, create targets, or mutate
|
||||
# storage.
|
||||
create: false
|
||||
dryRun: true
|
||||
interval: 30s
|
||||
execution:
|
||||
enabled: false
|
||||
policy: false
|
||||
runtimeUrl: ""
|
||||
rbac:
|
||||
create: true
|
||||
nodeSelector: {}
|
||||
|
||||
@@ -135,12 +135,18 @@ func runOpsFrontendPublicationExecutor(args []string, stdout, stderr io.Writer)
|
||||
fs := flag.NewFlagSet("sw-block ops frontend-publication-executor", flag.ContinueOnError)
|
||||
fs.SetOutput(stderr)
|
||||
var (
|
||||
dryRun bool
|
||||
namespace string
|
||||
interval time.Duration
|
||||
dryRun bool
|
||||
namespace string
|
||||
enableExecution bool
|
||||
executionPolicyEnabled bool
|
||||
runtimeURL string
|
||||
interval time.Duration
|
||||
)
|
||||
fs.BoolVar(&dryRun, "dry-run", false, "evaluate frontend publication targets without writing status")
|
||||
fs.StringVar(&namespace, "namespace", "default", "Kubernetes namespace containing SwBlockFrontendPublication objects")
|
||||
fs.BoolVar(&enableExecution, "enable-execution", false, "request frontend publication runtime execution for enabled SwBlockFrontendPublication targets")
|
||||
fs.BoolVar(&executionPolicyEnabled, "execution-policy", false, "allow frontend publication runtime execution; must be set with --enable-execution")
|
||||
fs.StringVar(&runtimeURL, "frontend-publication-runtime-url", "", "HTTP runtime endpoint for frontend publication execution")
|
||||
fs.DurationVar(&interval, "interval", 0, "repeat frontend-publication-executor reconciliation at this interval; 0 runs once")
|
||||
if err := fs.Parse(args); err != nil {
|
||||
return ops.VolumeStatusExitInvalid
|
||||
@@ -149,6 +155,10 @@ func runOpsFrontendPublicationExecutor(args []string, stdout, stderr io.Writer)
|
||||
fmt.Fprintf(stderr, "sw-block ops frontend-publication-executor: unexpected args %s\n", strings.Join(fs.Args(), " "))
|
||||
return ops.VolumeStatusExitInvalid
|
||||
}
|
||||
if strings.TrimSpace(runtimeURL) != "" && !enableExecution {
|
||||
fmt.Fprintln(stderr, "sw-block ops frontend-publication-executor: --frontend-publication-runtime-url requires --enable-execution")
|
||||
return ops.VolumeStatusExitInvalid
|
||||
}
|
||||
runOnce := func() int {
|
||||
client, err := opsFrontendPublicationExecutorClientFactory()
|
||||
if err != nil {
|
||||
@@ -156,9 +166,12 @@ func runOpsFrontendPublicationExecutor(args []string, stdout, stderr io.Writer)
|
||||
return ops.VolumeStatusExitInvalid
|
||||
}
|
||||
result, err := (ops.FrontendPublicationExecutorReconciler{
|
||||
Namespace: namespace,
|
||||
Client: client,
|
||||
DryRun: dryRun,
|
||||
Namespace: namespace,
|
||||
Client: client,
|
||||
DryRun: dryRun,
|
||||
ExecutionRequested: enableExecution,
|
||||
ExecutionPolicyEnabled: executionPolicyEnabled,
|
||||
Runtime: frontendPublicationRuntimeFromURL(runtimeURL),
|
||||
}).Reconcile(context.Background())
|
||||
if err != nil {
|
||||
fmt.Fprintf(stderr, "sw-block ops frontend-publication-executor: %v\n", err)
|
||||
@@ -194,6 +207,13 @@ func runOpsFrontendPublicationExecutor(args []string, stdout, stderr io.Writer)
|
||||
}
|
||||
}
|
||||
|
||||
func frontendPublicationRuntimeFromURL(runtimeURL string) ops.FrontendPublicationRuntime {
|
||||
if strings.TrimSpace(runtimeURL) == "" {
|
||||
return nil
|
||||
}
|
||||
return ops.NewHTTPFrontendPublicationRuntime(runtimeURL, nil)
|
||||
}
|
||||
|
||||
func runOpsFailbackExecutor(args []string, stdout, stderr io.Writer) int {
|
||||
fs := flag.NewFlagSet("sw-block ops failback-executor", flag.ContinueOnError)
|
||||
fs.SetOutput(stderr)
|
||||
@@ -2127,7 +2147,7 @@ func usage(w io.Writer) {
|
||||
fmt.Fprintln(w, " sw-block ops failback-target-owner [--dry-run] [--namespace <ns>] [--interval 30s] [--activate-targets --activation-policy --runtime-endpoint <addr>]")
|
||||
fmt.Fprintln(w, " sw-block ops failback-executor [--dry-run] [--namespace <ns>] [--enable-execution] [--execution-policy] [--failback-runtime-url <url>] [--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]")
|
||||
fmt.Fprintln(w, " sw-block ops frontend-publication-executor [--dry-run] [--namespace <ns>] [--enable-execution] [--execution-policy] [--frontend-publication-runtime-url <url>] [--interval 30s]")
|
||||
}
|
||||
|
||||
func emptyCLI(value string) string {
|
||||
|
||||
@@ -1697,6 +1697,114 @@ func TestOpsFrontendPublicationExecutorDryRunDoesNotWriteStatus(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpsFrontendPublicationExecutorRejectsRuntimeWithoutEnable(t *testing.T) {
|
||||
var stdout, stderr bytes.Buffer
|
||||
code := run([]string{"ops", "frontend-publication-executor", "--frontend-publication-runtime-url", "http://127.0.0.1:23260/runtime"}, &stdout, &stderr)
|
||||
if code != ops.VolumeStatusExitInvalid {
|
||||
t.Fatalf("exit=%d stderr=%s stdout=%s", code, stderr.String(), stdout.String())
|
||||
}
|
||||
if !strings.Contains(stderr.String(), "--frontend-publication-runtime-url requires --enable-execution") {
|
||||
t.Fatalf("stderr=%s", stderr.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpsFrontendPublicationExecutorPolicyBlocksExecution(t *testing.T) {
|
||||
client := &lifecycleOwnerTestClient{
|
||||
frontendTargets: []ops.SwBlockFrontendPublicationObject{cmdFrontendPublicationFailbackExecutableTarget()},
|
||||
}
|
||||
oldFactory := opsFrontendPublicationExecutorClientFactory
|
||||
opsFrontendPublicationExecutorClientFactory = func() (ops.FrontendPublicationExecutorClient, error) {
|
||||
return client, nil
|
||||
}
|
||||
t.Cleanup(func() { opsFrontendPublicationExecutorClientFactory = oldFactory })
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
code := run([]string{"ops", "frontend-publication-executor", "--enable-execution", "--namespace", "kube-system"}, &stdout, &stderr)
|
||||
if code != ops.VolumeStatusExitInvalid {
|
||||
t.Fatalf("exit=%d stderr=%s stdout=%s", code, stderr.String(), stdout.String())
|
||||
}
|
||||
if !strings.Contains(stderr.String(), "execution is disabled by product policy") {
|
||||
t.Fatalf("stderr=%s", stderr.String())
|
||||
}
|
||||
if len(client.frontendPublicationStatusWrites) != 0 {
|
||||
t.Fatalf("policy blocked execution wrote status: %+v", client.frontendPublicationStatusWrites)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpsFrontendPublicationExecutorExecutesFailbackTargetWithExplicitPolicy(t *testing.T) {
|
||||
client := &lifecycleOwnerTestClient{
|
||||
frontendTargets: []ops.SwBlockFrontendPublicationObject{cmdFrontendPublicationFailbackExecutableTarget()},
|
||||
}
|
||||
oldFactory := opsFrontendPublicationExecutorClientFactory
|
||||
opsFrontendPublicationExecutorClientFactory = func() (ops.FrontendPublicationExecutorClient, error) {
|
||||
return client, nil
|
||||
}
|
||||
t.Cleanup(func() { opsFrontendPublicationExecutorClientFactory = oldFactory })
|
||||
|
||||
var got ops.FrontendPublicationRuntimeRequest
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if err := json.NewDecoder(r.Body).Decode(&got); err != nil {
|
||||
t.Fatalf("decode runtime request: %v", err)
|
||||
}
|
||||
_ = json.NewEncoder(w).Encode(ops.FrontendPublicationRuntimeResult{
|
||||
FrontendPublished: true,
|
||||
FailbackStarted: false,
|
||||
NoStorageMutation: true,
|
||||
NoCrossVolumeIdentityChange: true,
|
||||
EvidenceRefs: []string{"frontend-after-failback.txt"},
|
||||
})
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
code := run([]string{
|
||||
"ops", "frontend-publication-executor",
|
||||
"--enable-execution",
|
||||
"--execution-policy",
|
||||
"--frontend-publication-runtime-url", server.URL,
|
||||
"--namespace", "kube-system",
|
||||
}, &stdout, &stderr)
|
||||
if code != ops.VolumeStatusExitOK {
|
||||
t.Fatalf("exit=%d stderr=%s stdout=%s", code, stderr.String(), stdout.String())
|
||||
}
|
||||
if got.SourceFailbackName != "demo-pvc-r1-failback" ||
|
||||
!got.FailbackCompleted ||
|
||||
!got.AuthorityEpochAdvanced ||
|
||||
!got.SinglePrimaryAfterFailback ||
|
||||
!got.PublishTargetSwappedAfterFailback ||
|
||||
got.AckEligible ||
|
||||
got.PrimaryUnchanged {
|
||||
t.Fatalf("runtime request=%+v", got)
|
||||
}
|
||||
if len(client.frontendPublicationStatusWrites) != 1 {
|
||||
t.Fatalf("frontendPublicationStatusWrites=%+v", client.frontendPublicationStatusWrites)
|
||||
}
|
||||
status := client.frontendPublicationStatusWrites[0].status
|
||||
if status.State != ops.FrontendPublicationStatePublished ||
|
||||
status.ReasonCode != ops.AuthorityExecutorFrontendPublicationReasonPublished ||
|
||||
status.PublicationMutationAllowed ||
|
||||
!status.FrontendPublished ||
|
||||
status.FailbackStarted ||
|
||||
!status.NoStorageMutation ||
|
||||
!status.NoCrossVolumeIdentityChange {
|
||||
t.Fatalf("status=%+v", status)
|
||||
}
|
||||
out := stdout.String()
|
||||
for _, want := range []string{
|
||||
"frontend_publication_executor=write_status",
|
||||
"targets=1",
|
||||
"status_writes=1",
|
||||
"invalid_targets=0",
|
||||
"frontend_publication_attempts=1",
|
||||
"failback_attempts=0",
|
||||
"storage_mutation_allowed=false",
|
||||
} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Fatalf("stdout missing %q:\n%s", want, out)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpsAuthorityExecutorExecutionPolicyBlocksWhenAckTargetMissing(t *testing.T) {
|
||||
client := &lifecycleOwnerTestClient{
|
||||
volumes: []ops.SwBlockVolumeObject{{
|
||||
@@ -2110,6 +2218,33 @@ func cmdFrontendPublicationTarget() ops.SwBlockFrontendPublicationObject {
|
||||
}
|
||||
}
|
||||
|
||||
func cmdFrontendPublicationFailbackExecutableTarget() ops.SwBlockFrontendPublicationObject {
|
||||
return ops.SwBlockFrontendPublicationObject{
|
||||
Ref: ops.OperatorObjectRef{
|
||||
APIVersion: ops.SwBlockVolumeAPIVersion,
|
||||
Kind: ops.SwBlockFrontendPublicationKind,
|
||||
Namespace: "kube-system",
|
||||
Name: "demo-pvc-r1-frontend-publication",
|
||||
},
|
||||
Spec: ops.SwBlockFrontendPublicationSpec{
|
||||
VolumeName: "demo-pvc",
|
||||
VolumeID: "pvc-demo",
|
||||
PVCName: "demo-pvc",
|
||||
ReplicaID: "r1",
|
||||
SourceFailbackName: "demo-pvc-r1-failback",
|
||||
NoCrossVolumeIdentityChange: true,
|
||||
FailbackCompleted: true,
|
||||
AuthorityEpochAdvanced: true,
|
||||
SinglePrimaryAfterFailback: true,
|
||||
PublishTargetSwappedAfterFailback: true,
|
||||
FrontendPublicationDecision: ops.AuthorityExecutorPublicationDecisionEnabled,
|
||||
FrontendPublicationReason: "frontend_publication_requested",
|
||||
FrontendPublicationMutationAllowed: true,
|
||||
RuntimeEndpoint: "http://127.0.0.1:23260/runtime/frontend-publication",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func cmdFailbackTarget() ops.SwBlockReplicaFailbackObject {
|
||||
return ops.SwBlockReplicaFailbackObject{
|
||||
Ref: ops.OperatorObjectRef{
|
||||
|
||||
@@ -31,19 +31,24 @@ type FrontendPublicationRuntime interface {
|
||||
}
|
||||
|
||||
type FrontendPublicationRuntimeRequest struct {
|
||||
VolumeName string `json:"volumeName"`
|
||||
VolumeID string `json:"volumeID"`
|
||||
PVCName string `json:"pvcName"`
|
||||
ReplicaID string `json:"replicaID"`
|
||||
RuntimeEndpoint string `json:"runtimeEndpoint,omitempty"`
|
||||
SourceEligibilityName string `json:"sourceEligibilityName,omitempty"`
|
||||
AckEligibilityKnown bool `json:"ackEligibilityKnown"`
|
||||
AckEligible bool `json:"ackEligible"`
|
||||
FrontendFencedAfterExecution bool `json:"frontendFencedAfterExecution"`
|
||||
PrimaryUnchanged bool `json:"primaryUnchanged"`
|
||||
DurableFrontierCovered bool `json:"durableFrontierCovered"`
|
||||
NoCrossVolumeIdentityChange bool `json:"noCrossVolumeIdentityChange"`
|
||||
EvidenceRefs []string `json:"evidenceRefs,omitempty"`
|
||||
VolumeName string `json:"volumeName"`
|
||||
VolumeID string `json:"volumeID"`
|
||||
PVCName string `json:"pvcName"`
|
||||
ReplicaID string `json:"replicaID"`
|
||||
RuntimeEndpoint string `json:"runtimeEndpoint,omitempty"`
|
||||
SourceEligibilityName string `json:"sourceEligibilityName,omitempty"`
|
||||
SourceFailbackName string `json:"sourceFailbackName,omitempty"`
|
||||
AckEligibilityKnown bool `json:"ackEligibilityKnown"`
|
||||
AckEligible bool `json:"ackEligible"`
|
||||
FrontendFencedAfterExecution bool `json:"frontendFencedAfterExecution"`
|
||||
PrimaryUnchanged bool `json:"primaryUnchanged"`
|
||||
DurableFrontierCovered bool `json:"durableFrontierCovered"`
|
||||
NoCrossVolumeIdentityChange bool `json:"noCrossVolumeIdentityChange"`
|
||||
FailbackCompleted bool `json:"failbackCompleted"`
|
||||
AuthorityEpochAdvanced bool `json:"authorityEpochAdvanced"`
|
||||
SinglePrimaryAfterFailback bool `json:"singlePrimaryAfterFailback"`
|
||||
PublishTargetSwappedAfterFailback bool `json:"publishTargetSwappedAfterFailback"`
|
||||
EvidenceRefs []string `json:"evidenceRefs,omitempty"`
|
||||
}
|
||||
|
||||
type FrontendPublicationRuntimeResult struct {
|
||||
@@ -214,6 +219,11 @@ func frontendPublicationExecutorFailbackTargetValid(target SwBlockFrontendPublic
|
||||
}
|
||||
|
||||
func frontendPublicationExecutorExecutableTarget(target SwBlockFrontendPublicationObject) bool {
|
||||
return frontendPublicationExecutorExecutableEligibilityTarget(target) ||
|
||||
frontendPublicationExecutorExecutableFailbackTarget(target)
|
||||
}
|
||||
|
||||
func frontendPublicationExecutorExecutableEligibilityTarget(target SwBlockFrontendPublicationObject) bool {
|
||||
spec := target.Spec
|
||||
return spec.VolumeName != "" &&
|
||||
spec.ReplicaID != "" &&
|
||||
@@ -228,6 +238,21 @@ func frontendPublicationExecutorExecutableTarget(target SwBlockFrontendPublicati
|
||||
spec.FrontendPublicationMutationAllowed
|
||||
}
|
||||
|
||||
func frontendPublicationExecutorExecutableFailbackTarget(target SwBlockFrontendPublicationObject) bool {
|
||||
spec := target.Spec
|
||||
return spec.VolumeName != "" &&
|
||||
spec.ReplicaID != "" &&
|
||||
spec.RuntimeEndpoint != "" &&
|
||||
spec.SourceFailbackName != "" &&
|
||||
spec.FailbackCompleted &&
|
||||
spec.AuthorityEpochAdvanced &&
|
||||
spec.SinglePrimaryAfterFailback &&
|
||||
spec.PublishTargetSwappedAfterFailback &&
|
||||
spec.NoCrossVolumeIdentityChange &&
|
||||
spec.FrontendPublicationDecision == AuthorityExecutorPublicationDecisionEnabled &&
|
||||
spec.FrontendPublicationMutationAllowed
|
||||
}
|
||||
|
||||
func frontendPublicationRuntimeTerminalEvidenceValid(result FrontendPublicationRuntimeResult) bool {
|
||||
return result.FrontendPublished &&
|
||||
!result.FailbackStarted &&
|
||||
@@ -290,18 +315,23 @@ func frontendPublicationExecutorPublishedStatus(now time.Time, target SwBlockFro
|
||||
func frontendPublicationRuntimeRequest(target SwBlockFrontendPublicationObject) FrontendPublicationRuntimeRequest {
|
||||
spec := target.Spec
|
||||
return FrontendPublicationRuntimeRequest{
|
||||
VolumeName: spec.VolumeName,
|
||||
VolumeID: spec.VolumeID,
|
||||
PVCName: spec.PVCName,
|
||||
ReplicaID: spec.ReplicaID,
|
||||
RuntimeEndpoint: spec.RuntimeEndpoint,
|
||||
SourceEligibilityName: spec.SourceEligibilityName,
|
||||
AckEligibilityKnown: spec.AckEligibilityKnown,
|
||||
AckEligible: spec.AckEligible,
|
||||
FrontendFencedAfterExecution: spec.FrontendFencedAfterExecution,
|
||||
PrimaryUnchanged: spec.PrimaryUnchanged,
|
||||
DurableFrontierCovered: spec.DurableFrontierCovered,
|
||||
NoCrossVolumeIdentityChange: spec.NoCrossVolumeIdentityChange,
|
||||
VolumeName: spec.VolumeName,
|
||||
VolumeID: spec.VolumeID,
|
||||
PVCName: spec.PVCName,
|
||||
ReplicaID: spec.ReplicaID,
|
||||
RuntimeEndpoint: spec.RuntimeEndpoint,
|
||||
SourceEligibilityName: spec.SourceEligibilityName,
|
||||
SourceFailbackName: spec.SourceFailbackName,
|
||||
AckEligibilityKnown: spec.AckEligibilityKnown,
|
||||
AckEligible: spec.AckEligible,
|
||||
FrontendFencedAfterExecution: spec.FrontendFencedAfterExecution,
|
||||
PrimaryUnchanged: spec.PrimaryUnchanged,
|
||||
DurableFrontierCovered: spec.DurableFrontierCovered,
|
||||
NoCrossVolumeIdentityChange: spec.NoCrossVolumeIdentityChange,
|
||||
FailbackCompleted: spec.FailbackCompleted,
|
||||
AuthorityEpochAdvanced: spec.AuthorityEpochAdvanced,
|
||||
SinglePrimaryAfterFailback: spec.SinglePrimaryAfterFailback,
|
||||
PublishTargetSwappedAfterFailback: spec.PublishTargetSwappedAfterFailback,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,6 +230,57 @@ func TestFrontendPublicationExecutorInvokesRuntimeWhenExplicitlyEnabled(t *testi
|
||||
}
|
||||
}
|
||||
|
||||
func TestFrontendPublicationExecutorInvokesRuntimeForFailbackTargetWhenExplicitlyEnabled(t *testing.T) {
|
||||
target := frontendPublicationExecutorFailbackExecutableTargetFixture()
|
||||
client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{target}}
|
||||
runtime := &fakeFrontendPublicationRuntime{result: FrontendPublicationRuntimeResult{
|
||||
FrontendPublished: true,
|
||||
FailbackStarted: false,
|
||||
NoStorageMutation: true,
|
||||
NoCrossVolumeIdentityChange: true,
|
||||
EvidenceRefs: []string{"frontend-after-failback.txt"},
|
||||
}}
|
||||
result, err := (FrontendPublicationExecutorReconciler{
|
||||
Namespace: "kube-system",
|
||||
Client: client,
|
||||
Runtime: runtime,
|
||||
ExecutionRequested: true,
|
||||
ExecutionPolicyEnabled: true,
|
||||
}).Reconcile(context.Background())
|
||||
if err != nil {
|
||||
t.Fatalf("reconcile: %v", err)
|
||||
}
|
||||
if result.FrontendPublicationAttempts != 1 ||
|
||||
result.FailbackAttempts != 0 ||
|
||||
result.StatusWriteCount != 1 ||
|
||||
result.StorageMutationAllowed {
|
||||
t.Fatalf("result=%+v", result)
|
||||
}
|
||||
if len(runtime.requests) != 1 {
|
||||
t.Fatalf("runtime requests=%+v", runtime.requests)
|
||||
}
|
||||
req := runtime.requests[0]
|
||||
if req.SourceFailbackName != target.Spec.SourceFailbackName ||
|
||||
!req.FailbackCompleted ||
|
||||
!req.AuthorityEpochAdvanced ||
|
||||
!req.SinglePrimaryAfterFailback ||
|
||||
!req.PublishTargetSwappedAfterFailback ||
|
||||
req.AckEligible ||
|
||||
req.PrimaryUnchanged {
|
||||
t.Fatalf("runtime request=%+v", req)
|
||||
}
|
||||
status := client.writes[0].status
|
||||
if status.State != FrontendPublicationStatePublished ||
|
||||
status.ReasonCode != AuthorityExecutorFrontendPublicationReasonPublished ||
|
||||
status.PublicationMutationAllowed ||
|
||||
!status.FrontendPublished ||
|
||||
status.FailbackStarted ||
|
||||
!status.NoStorageMutation ||
|
||||
!status.NoCrossVolumeIdentityChange {
|
||||
t.Fatalf("status=%+v", status)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus(t *testing.T) {
|
||||
client := &fakeFrontendPublicationExecutorClient{targets: []SwBlockFrontendPublicationObject{frontendPublicationExecutorGenericExecutableTargetFixture()}}
|
||||
runtime := &fakeFrontendPublicationRuntime{err: errors.New("runtime refused")}
|
||||
@@ -351,6 +402,15 @@ func frontendPublicationExecutorGenericExecutableTargetFixture() SwBlockFrontend
|
||||
return target
|
||||
}
|
||||
|
||||
func frontendPublicationExecutorFailbackExecutableTargetFixture() SwBlockFrontendPublicationObject {
|
||||
target := frontendPublicationExecutorFailbackTerminalTarget()
|
||||
target.Spec.FrontendPublicationDecision = AuthorityExecutorPublicationDecisionEnabled
|
||||
target.Spec.FrontendPublicationReason = "frontend_publication_requested"
|
||||
target.Spec.FrontendPublicationMutationAllowed = true
|
||||
target.Spec.RuntimeEndpoint = "http://127.0.0.1:23260/runtime/frontend-publication"
|
||||
return target
|
||||
}
|
||||
|
||||
type fakeFrontendPublicationExecutorClient struct {
|
||||
targets []SwBlockFrontendPublicationObject
|
||||
writes []fakeFrontendPublicationStatusWrite
|
||||
|
||||
@@ -955,6 +955,10 @@ func TestPhase76FailbackExecutorPackagingIsStatusOnly(t *testing.T) {
|
||||
executor := yamlMap(t, values, "failbackExecutor")
|
||||
assertYAMLBool(t, executor, "create", false)
|
||||
assertYAMLBool(t, executor, "dryRun", true)
|
||||
execution := yamlMap(t, executor, "execution")
|
||||
assertYAMLBool(t, execution, "enabled", false)
|
||||
assertYAMLBool(t, execution, "policy", false)
|
||||
assertYAMLString(t, execution, "runtimeUrl", "")
|
||||
rbacValues := yamlMap(t, executor, "rbac")
|
||||
assertYAMLBool(t, rbacValues, "create", true)
|
||||
|
||||
@@ -1083,6 +1087,12 @@ func TestPhase70FrontendPublicationExecutorPackagingIsStatusOnly(t *testing.T) {
|
||||
`- "--namespace={{ .Release.Namespace }}"`,
|
||||
`{{- if .Values.frontendPublicationExecutor.dryRun }}`,
|
||||
`- "--dry-run"`,
|
||||
`{{- if .Values.frontendPublicationExecutor.execution.enabled }}`,
|
||||
`- "--enable-execution"`,
|
||||
`{{- if .Values.frontendPublicationExecutor.execution.policy }}`,
|
||||
`- "--execution-policy"`,
|
||||
`{{- if .Values.frontendPublicationExecutor.execution.runtimeUrl }}`,
|
||||
`- "--frontend-publication-runtime-url={{ .Values.frontendPublicationExecutor.execution.runtimeUrl }}"`,
|
||||
`- "--interval={{ .Values.frontendPublicationExecutor.interval }}"`,
|
||||
} {
|
||||
if !strings.Contains(deploy, want) {
|
||||
|
||||
@@ -430,7 +430,14 @@ Recommended order from here:
|
||||
creates a disabled `SwBlockFrontendPublication` target with explicit
|
||||
failback-source fields. The executor remains default-off; no frontend path
|
||||
is published.
|
||||
54. Add backup/restore and NVMe ANA parity after they can reuse the same action
|
||||
54. Phase 97: frontend publication executor call-site. **Closed 2026-06-26,
|
||||
runner PASS**
|
||||
(`internal/docs/finished-plans/phase97_finishedplan_frontend_publication_executor_callsite.md`).
|
||||
The executor can invoke a frontend-publication runtime for an enabled
|
||||
failback-source target only under explicit policy and writes
|
||||
`frontend_published` only from valid terminal evidence. Workload-visible
|
||||
I/O remains a separate gate.
|
||||
55. 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.
|
||||
|
||||
@@ -481,7 +488,10 @@ activation policy, executor handoff, multi-volume isolation, deployed render,
|
||||
real blockmaster gRPC smoke, and finally a live Kubernetes smoke that writes
|
||||
terminal `failed_back` evidence. Phase 96 consumes that terminal evidence to
|
||||
create a disabled frontend-publication target, keeping actual frontend
|
||||
publication and workload-visible path switching as separate later gates.
|
||||
publication and workload-visible path switching as separate later gates. Phase
|
||||
97 wires the explicit-policy executor call-site for that target and proves
|
||||
terminal frontend-publication evidence, while keeping workload-visible I/O as a
|
||||
separate gate.
|
||||
|
||||
The practical rule is:
|
||||
|
||||
|
||||
@@ -242,6 +242,7 @@ ambiguous HTTP/gRPC runtime addresses.
|
||||
| 94 | proves full opt-in Helm suite render plus executor -> real blockmaster gRPC FailbackService smoke |
|
||||
| 95 | installs the opt-in suite in k3s, creates a live first-volume authority line, injects returned-replica failback evidence, and waits for deployed target-owner/executor to write terminal `failed_back` status through live blockmaster gRPC |
|
||||
| 96 | consumes terminal `failed_back/failback_completed` evidence to create a disabled `SwBlockFrontendPublication` target with explicit failback-source fields |
|
||||
| 97 | wires explicit-policy frontend-publication executor CLI/Helm flags and runtime request fields for a failback-source target |
|
||||
|
||||
## Failure Classes
|
||||
|
||||
@@ -280,27 +281,29 @@ Before enabling broader failback behavior:
|
||||
real service DNS, CRDs, RBAC, and cleanup.
|
||||
14. Create a disabled frontend-publication target only from terminal failback
|
||||
evidence; reject non-terminal failback targets.
|
||||
15. Keep rebuild/catch-up traffic as a separate gated action.
|
||||
16. Run multi-volume isolation gates.
|
||||
17. Document exactly what is automatic and what is opt-in.
|
||||
15. Invoke frontend-publication runtime only when execution and policy flags are
|
||||
explicit, and require terminal `frontendPublished=true`,
|
||||
`failbackStarted=false`, and `noStorageMutation=true`.
|
||||
16. Keep rebuild/catch-up traffic as a separate gated action.
|
||||
17. Run multi-volume isolation gates.
|
||||
18. Document exactly what is automatic and what is opt-in.
|
||||
|
||||
## Current Boundary
|
||||
|
||||
After Phase 96, the intended product statement is:
|
||||
After Phase 97, the intended product statement is:
|
||||
|
||||
```text
|
||||
The failback authority control path is deployable and opt-in. The executor can
|
||||
drive blockmaster-owned authority reassignment, write terminal failback status,
|
||||
and plan the next disabled frontend-publication target from that terminal
|
||||
evidence.
|
||||
plan the next frontend-publication target from that terminal evidence, and
|
||||
invoke a frontend-publication runtime only under explicit policy.
|
||||
```
|
||||
|
||||
The intended non-claim remains:
|
||||
|
||||
```text
|
||||
The product does not yet execute frontend publication, publish the failed-back
|
||||
frontend path to workloads, or prove post-failback application I/O. Those belong
|
||||
to separate frontend-publication and data-path phases.
|
||||
The product does not yet prove the published path is workload-visible or that
|
||||
post-failback application I/O succeeds. That belongs to the next data-path gate.
|
||||
```
|
||||
|
||||
## Current Limits
|
||||
@@ -309,7 +312,7 @@ Current source has an opt-in local failback runtime path. It does not yet claim:
|
||||
|
||||
- automatic deployed Kubernetes failback,
|
||||
- live lab failback release smoke on published images,
|
||||
- executed frontend publication after failback,
|
||||
- workload-visible frontend publication after failback,
|
||||
- storage rebuild/catch-up traffic,
|
||||
- backup/restore,
|
||||
- NVMe ANA parity.
|
||||
@@ -71,9 +71,9 @@ production operator, and not backup/NVMe expansion.
|
||||
Recent returned-replica work adds a separately gated, opt-in failback runtime
|
||||
path. See [Returned Replica Failback Runtime](deep-dives/returned-replica-failback.md)
|
||||
for the authority owner, target CR, executor, gRPC service, terminal evidence,
|
||||
and non-claims. As of Phase 96, that line can plan a disabled frontend
|
||||
publication target from terminal failback evidence; frontend publication
|
||||
execution and workload-visible path switching remain separate gates.
|
||||
and non-claims. As of Phase 97, that line can plan a frontend-publication
|
||||
target from terminal failback evidence and invoke the publication runtime only
|
||||
under explicit policy; workload-visible path switching remains a separate gate.
|
||||
|
||||
## Source Evidence
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ see [Phase Recap](phase-recap.md).
|
||||
| 41-44 | bounded lifecycle owner | finalizer add/release, delete-safety hold/release, integrated close gate |
|
||||
| 47-67 | returned-replica ACK/rebuild planning and runtime | eligibility, rebuild target, catch-up runtime, terminal evidence |
|
||||
| 68-74 | frontend publication and failback contract separation | publication stays blocked until authority-owned failback exists |
|
||||
| 75-96 | returned-replica failback control path | target CR, executor, runtime, blockmaster RPC, deployed-suite smoke, disabled frontend-publication target |
|
||||
| 75-97 | returned-replica failback control path | target CR, executor, runtime, blockmaster RPC, deployed-suite smoke, frontend-publication call-site |
|
||||
|
||||
## The Important Pivot
|
||||
|
||||
@@ -87,14 +87,15 @@ flowchart LR
|
||||
G --> H[Publisher IntentReassign]
|
||||
H --> I[failed_back terminal target status]
|
||||
I --> J[disabled SwBlockFrontendPublication target]
|
||||
J --> K[explicit-policy frontend publication runtime]
|
||||
```
|
||||
|
||||
The Phase 96 boundary is explicit:
|
||||
The Phase 97 boundary is explicit:
|
||||
|
||||
```text
|
||||
authority control path can run when opt-in
|
||||
frontend publication target can be planned from terminal failback evidence
|
||||
frontend publication execution is still not claimed
|
||||
frontend publication runtime can be called only under explicit policy
|
||||
workload-visible path switch is still not claimed
|
||||
```
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ important line is returned-replica recovery:
|
||||
| 74-88 | Failback needed an authority-owned path rather than frontend-publication inference. | `authority.failback_returned_replica`, `SwBlockReplicaFailback`, failback executor, typed runtime, blockmaster RPC, Helm packaging. | Authority reassignment belongs to blockmaster/Publisher and remains default-off until explicit evidence and policy exist. |
|
||||
| 89-95 | The packaged failback path still needed current authority facts and live deployed proof. | Authority facts in `SwBlockVolume.status`, expected-current guards, activation policy, handoff isolation, real gRPC smoke, live k3s deployed-suite gate. | The deployable failback control path can now run end-to-end without claiming frontend publication or workload-visible data-path switch. |
|
||||
| 96 | Terminal failback evidence existed, but frontend publication had no post-failback source object. | `SwBlockReplicaFailback.status=failed_back/failback_completed` can create a disabled `SwBlockFrontendPublication` target with failback-source fields. | The next publication step is explicit, but executor publication and workload-visible path switching remain separate later gates. |
|
||||
| 97 | The publication target existed, but executor execution flags were not wired through CLI/Helm for post-failback publication. | Explicit-policy CLI/Helm flags invoke the frontend publication runtime for a failback-source target and require terminal `frontend_published` evidence. | Runtime handoff is proven; workload-visible I/O after publication remains the next gate. |
|
||||
|
||||
## Product Logic Across The Phases
|
||||
|
||||
|
||||
@@ -1,55 +1,39 @@
|
||||
# Current Plan: Phase 96 Failback -> Frontend Publication Target
|
||||
# Current Plan: Phase 97 Frontend Publication Executor Call-site
|
||||
|
||||
Status: complete.
|
||||
|
||||
## Goal
|
||||
|
||||
Phase 96 connects the terminal failback evidence from Phase 95 into the next
|
||||
control object:
|
||||
Phase 97 connects the frontend-publication executor's explicit execution flags
|
||||
to the runtime call-site for a post-failback target:
|
||||
|
||||
```text
|
||||
SwBlockReplicaFailback.status.state=failed_back
|
||||
reasonCode=failback_completed
|
||||
publishTargetSwappedAfterFailback=true
|
||||
SwBlockFrontendPublication target
|
||||
sourceFailbackName=<SwBlockReplicaFailback>
|
||||
failbackCompleted=true
|
||||
frontendPublicationDecision=enabled
|
||||
frontendPublicationMutationAllowed=true
|
||||
runtimeEndpoint=<http runtime>
|
||||
|
|
||||
v
|
||||
SwBlockFrontendPublication target CR
|
||||
frontendPublicationDecision=disabled
|
||||
frontendPublicationMutationAllowed=false
|
||||
frontend publication executor
|
||||
|
|
||||
v
|
||||
FrontendPublicationRuntime request
|
||||
|
|
||||
v
|
||||
status.state=published
|
||||
reasonCode=frontend_published
|
||||
```
|
||||
|
||||
This is still **not** a workload-visible frontend publication claim. The phase
|
||||
only creates a disabled target from terminal failback evidence and proves the
|
||||
executor continues to block publication by policy.
|
||||
This is still **not** a workload-visible I/O claim. The phase proves the
|
||||
executor/runtime handoff and terminal evidence contract only.
|
||||
|
||||
## Deliverables
|
||||
|
||||
### D1: Target-Owner Input Expansion
|
||||
### D1: Failback-source Runtime Request
|
||||
|
||||
`FrontendPublicationTargetOwnerReconciler` now reads two input streams:
|
||||
|
||||
- `SwBlockReplicaEligibility` for the older ACK-eligibility target path;
|
||||
- `SwBlockReplicaFailback` for the returned-replica failback terminal path.
|
||||
|
||||
Only terminal failback evidence is accepted:
|
||||
|
||||
```text
|
||||
state=failed_back
|
||||
reasonCode=failback_completed
|
||||
failbackMutationAllowed=false
|
||||
failbackStarted=true
|
||||
authorityEpochAdvanced=true
|
||||
singlePrimaryAfterFailback=true
|
||||
publishTargetSwappedAfterFailback=true
|
||||
noCrossVolumeIdentityChange=true
|
||||
```
|
||||
|
||||
Non-terminal failback targets are rejected and do not create publication
|
||||
targets.
|
||||
|
||||
### D2: Frontend Publication Target Schema
|
||||
|
||||
`SwBlockFrontendPublication.spec` now has explicit failback-source fields:
|
||||
`FrontendPublicationRuntimeRequest` now carries the post-failback source facts:
|
||||
|
||||
```text
|
||||
sourceFailbackName
|
||||
@@ -59,38 +43,67 @@ singlePrimaryAfterFailback
|
||||
publishTargetSwappedAfterFailback
|
||||
```
|
||||
|
||||
The older `sourceEligibilityName` path remains unchanged. The new fields avoid
|
||||
pretending a post-failback target is the same thing as an ACK-eligibility target.
|
||||
The executor accepts an enabled failback-source target only when these facts are
|
||||
present and `noCrossVolumeIdentityChange=true`.
|
||||
|
||||
### D3: Executor Boundary
|
||||
### D2: Explicit CLI Policy
|
||||
|
||||
The frontend publication executor recognizes disabled targets from either
|
||||
source:
|
||||
`sw-block ops frontend-publication-executor` now supports:
|
||||
|
||||
- ACK-eligibility target;
|
||||
- terminal failback target.
|
||||
```text
|
||||
--enable-execution
|
||||
--execution-policy
|
||||
--frontend-publication-runtime-url <url>
|
||||
```
|
||||
|
||||
It still writes blocked/disabled status only unless explicit publication
|
||||
execution is separately enabled in a later phase.
|
||||
Guards:
|
||||
|
||||
- `--frontend-publication-runtime-url` without `--enable-execution` is rejected;
|
||||
- `--enable-execution` without `--execution-policy` is rejected by the
|
||||
reconciler;
|
||||
- runtime terminal evidence must report `frontendPublished=true`,
|
||||
`failbackStarted=false`, `noStorageMutation=true`, and
|
||||
`noCrossVolumeIdentityChange=true`.
|
||||
|
||||
### D3: Helm Default-off Wiring
|
||||
|
||||
`frontendPublicationExecutor.execution` was added to chart values:
|
||||
|
||||
```yaml
|
||||
execution:
|
||||
enabled: false
|
||||
policy: false
|
||||
runtimeUrl: ""
|
||||
```
|
||||
|
||||
Default render still omits the executor. Explicit render can add:
|
||||
|
||||
```text
|
||||
--enable-execution
|
||||
--execution-policy
|
||||
--frontend-publication-runtime-url=<url>
|
||||
```
|
||||
|
||||
### D4: Runner Gate
|
||||
|
||||
Added:
|
||||
|
||||
```text
|
||||
scripts/run-phase96-failback-frontend-publication-target-gate.sh
|
||||
testops/scenarios/failback-frontend-publication-target-chain.yaml
|
||||
scripts/run-phase97-frontend-publication-executor-callsite-gate.sh
|
||||
testops/scenarios/frontend-publication-executor-callsite-chain.yaml
|
||||
```
|
||||
|
||||
The gate asserts:
|
||||
|
||||
- terminal failback creates exactly one frontend publication target;
|
||||
- non-terminal failback is rejected;
|
||||
- the target records `sourceFailbackName`;
|
||||
- frontend publication remains disabled;
|
||||
- frontend publication attempts stay `0`;
|
||||
- failback attempts stay `0`;
|
||||
- storage mutation stays disallowed.
|
||||
- failback-source target invokes runtime only with explicit policy;
|
||||
- policy-disabled execution is rejected;
|
||||
- runtime URL without `--enable-execution` is rejected;
|
||||
- runtime failure and invalid terminal evidence do not falsely publish;
|
||||
- Helm default remains off;
|
||||
- enabled Helm render includes execution flags;
|
||||
- `failback_attempts=0`;
|
||||
- `failback_started=false`;
|
||||
- `storage_mutation_allowed=false`.
|
||||
|
||||
## Verification
|
||||
|
||||
@@ -99,48 +112,46 @@ Local checks:
|
||||
```text
|
||||
go test ./core/ops ./cmd/sw-block ./core/host/master -count=1
|
||||
helm lint charts/seaweed-block
|
||||
swblock validate testops/scenarios/failback-frontend-publication-target-chain.yaml
|
||||
swblock validate testops/scenarios/frontend-publication-executor-callsite-chain.yaml
|
||||
git diff --check
|
||||
```
|
||||
|
||||
Runner check:
|
||||
|
||||
```text
|
||||
swblock run testops/scenarios/failback-frontend-publication-target-chain.yaml
|
||||
run=20260626-154640-206b
|
||||
swblock run testops/scenarios/frontend-publication-executor-callsite-chain.yaml
|
||||
run=20260626-160330-ecc9
|
||||
result=PASS 16/16
|
||||
```
|
||||
|
||||
Terminal evidence:
|
||||
|
||||
```text
|
||||
phase96_failback_frontend_publication_target_status=ok
|
||||
terminal_failed_back_creates_frontend_publication_target=true
|
||||
non_terminal_failback_rejected=true
|
||||
executor_accepts_failback_target_as_disabled=true
|
||||
frontend_publication_target_created_from_failback=true
|
||||
frontend_publication_target_source_failback_name=true
|
||||
frontend_publication_decision=disabled
|
||||
frontend_publication_reason=frontend_publication_policy_disabled
|
||||
frontend_publication_mutation_allowed=false
|
||||
frontend_publication_attempts=0
|
||||
phase97_frontend_publication_executor_callsite_status=ok
|
||||
failback_target_runtime_invoked=true
|
||||
frontend_publication_attempts=1
|
||||
frontend_published=true
|
||||
failback_attempts=0
|
||||
failback_started=false
|
||||
publication_status_reason=frontend_published
|
||||
publication_mutation_allowed=false
|
||||
frontend_publication_executor_default_off=true
|
||||
frontend_publication_execution_requires_policy=true
|
||||
frontend_publication_runtime_url_requires_enable=true
|
||||
storage_mutation_allowed=false
|
||||
```
|
||||
|
||||
## Next
|
||||
|
||||
The next boundary is explicit-policy frontend publication execution after
|
||||
failback. It should remain separate because it is the first step that can make a
|
||||
post-failback frontend path visible to workloads.
|
||||
|
||||
Expected next scope:
|
||||
The remaining boundary is workload-visible frontend path switching:
|
||||
|
||||
```text
|
||||
enabled SwBlockFrontendPublication target
|
||||
executor call-site with explicit policy
|
||||
terminal frontend publication evidence
|
||||
no failback re-entry
|
||||
no storage mutation
|
||||
then a later workload I/O gate
|
||||
run the deployed failback + frontend-publication suite
|
||||
publish the post-failback frontend path through product-owned runtime
|
||||
verify reader/writer against the new path
|
||||
prove no cross-volume publication
|
||||
cleanup leaves zero residue
|
||||
```
|
||||
|
||||
That should remain separate because it is the first user-visible data-path
|
||||
claim after failback.
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
# Phase 97 Finished Plan: Frontend Publication Executor Call-site
|
||||
|
||||
Status: complete.
|
||||
|
||||
## Problem
|
||||
|
||||
Phase 96 created a disabled `SwBlockFrontendPublication` target from terminal
|
||||
failback evidence. The next gap was the executor side: the CLI and chart did
|
||||
not expose an explicit execution policy for frontend publication, and the
|
||||
runtime request did not carry failback-source facts.
|
||||
|
||||
## What Changed
|
||||
|
||||
Phase 97 wires the explicit execution path:
|
||||
|
||||
- CLI flags:
|
||||
- `--enable-execution`
|
||||
- `--execution-policy`
|
||||
- `--frontend-publication-runtime-url`
|
||||
- Helm values:
|
||||
- `frontendPublicationExecutor.execution.enabled`
|
||||
- `frontendPublicationExecutor.execution.policy`
|
||||
- `frontendPublicationExecutor.execution.runtimeUrl`
|
||||
- runtime request fields:
|
||||
- `sourceFailbackName`
|
||||
- `failbackCompleted`
|
||||
- `authorityEpochAdvanced`
|
||||
- `singlePrimaryAfterFailback`
|
||||
- `publishTargetSwappedAfterFailback`
|
||||
|
||||
The executor can invoke `FrontendPublicationRuntime` for an enabled
|
||||
failback-source target and write terminal published status only when runtime
|
||||
terminal evidence is valid.
|
||||
|
||||
## Boundary
|
||||
|
||||
The phase does not claim:
|
||||
|
||||
- Kubernetes-deployed frontend publication;
|
||||
- workload-visible data-path switch;
|
||||
- application I/O after failback;
|
||||
- failback re-entry;
|
||||
- storage mutation.
|
||||
|
||||
The runtime result must say:
|
||||
|
||||
```text
|
||||
frontendPublished=true
|
||||
failbackStarted=false
|
||||
noStorageMutation=true
|
||||
noCrossVolumeIdentityChange=true
|
||||
```
|
||||
|
||||
## Verification
|
||||
|
||||
Scenario:
|
||||
|
||||
```text
|
||||
testops/scenarios/frontend-publication-executor-callsite-chain.yaml
|
||||
```
|
||||
|
||||
Gate:
|
||||
|
||||
```text
|
||||
scripts/run-phase97-frontend-publication-executor-callsite-gate.sh
|
||||
```
|
||||
|
||||
Validated:
|
||||
|
||||
```text
|
||||
swblock run testops/scenarios/frontend-publication-executor-callsite-chain.yaml
|
||||
run=20260626-160330-ecc9
|
||||
result=PASS 16/16
|
||||
```
|
||||
|
||||
Key evidence:
|
||||
|
||||
```text
|
||||
phase97_frontend_publication_executor_callsite_status=ok
|
||||
failback_target_runtime_invoked=true
|
||||
frontend_publication_attempts=1
|
||||
frontend_published=true
|
||||
failback_attempts=0
|
||||
failback_started=false
|
||||
publication_status_reason=frontend_published
|
||||
publication_mutation_allowed=false
|
||||
frontend_publication_executor_default_off=true
|
||||
frontend_publication_execution_requires_policy=true
|
||||
frontend_publication_runtime_url_requires_enable=true
|
||||
storage_mutation_allowed=false
|
||||
```
|
||||
|
||||
## Next
|
||||
|
||||
Phase 98 should be the workload-visible frontend publication gate: deploy the
|
||||
suite, publish the post-failback path through product-owned runtime, and verify
|
||||
reader/writer I/O against that path without cross-volume publication.
|
||||
@@ -221,9 +221,10 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
|
||||
authority facts, activation, handoff isolation, deployed render, real
|
||||
blockmaster gRPC smoke, and a live k3s deployed-suite gate. Phase 96 plans a
|
||||
disabled frontend-publication target from terminal `failed_back` evidence.
|
||||
Automatic frontend publication after failback remains future work.
|
||||
- Later: frontend publication execution after failback, workload-visible
|
||||
post-failback I/O, NVMe ANA Kubernetes multipath parity, stronger
|
||||
Phase 97 wires the explicit-policy frontend-publication executor call-site.
|
||||
Workload-visible post-failback I/O remains future work.
|
||||
- Later: workload-visible frontend publication after failback, post-failback
|
||||
I/O, NVMe ANA Kubernetes multipath parity, stronger
|
||||
committed-frontier reporting, broad
|
||||
distro/host compatibility, and longer soak under failure. NVMe ANA parity
|
||||
should follow the Kubernetes-native status foundation so ANA facts, path
|
||||
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
# Phase 97 QA Sign-off: Frontend Publication Executor Call-site
|
||||
|
||||
Verdict: PASS.
|
||||
|
||||
Runner:
|
||||
|
||||
```text
|
||||
swblock run testops/scenarios/frontend-publication-executor-callsite-chain.yaml
|
||||
run=20260626-160330-ecc9
|
||||
result=PASS 16/16
|
||||
```
|
||||
|
||||
## Gate Result
|
||||
|
||||
| Check | Result |
|
||||
|---|---|
|
||||
| Core ops call-site tests | PASS |
|
||||
| CLI execution-policy tests | PASS |
|
||||
| Helm default render | PASS |
|
||||
| Helm enabled render | PASS |
|
||||
| Runtime invoked for failback-source target | PASS |
|
||||
| Policy-disabled execution rejected | PASS |
|
||||
| Runtime URL without enable rejected | PASS |
|
||||
| Runtime failure does not falsely publish | PASS |
|
||||
| Invalid terminal evidence does not falsely publish | PASS |
|
||||
|
||||
## Evidence
|
||||
|
||||
```text
|
||||
phase97_frontend_publication_executor_callsite_status=ok
|
||||
phase97_scope=explicit_policy_frontend_publication_after_failback
|
||||
core_ops_phase97_tests=pass
|
||||
cmd_sw_block_phase97_tests=pass
|
||||
helm_default_render=pass
|
||||
helm_enabled_render=pass
|
||||
failback_target_runtime_invoked=true
|
||||
failback_target_default_disabled=true
|
||||
invalid_terminal_evidence_no_false_publish=true
|
||||
runtime_failure_no_false_publish=true
|
||||
http_runtime_posts_request=true
|
||||
executor_packaging_default_off=true
|
||||
cmd_explicit_policy_invokes_runtime=true
|
||||
cmd_execution_policy_blocks=true
|
||||
cmd_runtime_url_requires_enable=true
|
||||
default_omits_frontend_publication_executor=true
|
||||
enabled_renders_frontend_publication_executor=true
|
||||
enabled_renders_enable_execution=true
|
||||
enabled_renders_execution_policy=true
|
||||
enabled_renders_runtime_url=true
|
||||
frontend_publication_attempts=1
|
||||
frontend_published=true
|
||||
failback_attempts=0
|
||||
failback_started=false
|
||||
publication_status_reason=frontend_published
|
||||
publication_mutation_allowed=false
|
||||
frontend_publication_executor_default_off=true
|
||||
frontend_publication_execution_requires_policy=true
|
||||
frontend_publication_runtime_url_requires_enable=true
|
||||
storage_mutation_allowed=false
|
||||
```
|
||||
|
||||
## Boundary
|
||||
|
||||
This gate proves executor/runtime handoff, not user I/O.
|
||||
|
||||
Non-claims:
|
||||
|
||||
- no deployed frontend publication suite;
|
||||
- no workload-visible path switch;
|
||||
- no post-failback reader/writer proof;
|
||||
- no failback re-entry;
|
||||
- no storage mutation.
|
||||
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PRODUCT_ROOT="${1:-$(pwd)}"
|
||||
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase97-frontend-publication-executor-callsite-gate}"
|
||||
SUMMARY="${ARTIFACT_DIR}/phase97-frontend-publication-executor-callsite-summary.txt"
|
||||
OPS_LOG="${ARTIFACT_DIR}/core-ops-go-test.log"
|
||||
CMD_LOG="${ARTIFACT_DIR}/cmd-sw-block-go-test.log"
|
||||
DEFAULT_RENDER="${ARTIFACT_DIR}/helm-default.yaml"
|
||||
ENABLED_RENDER="${ARTIFACT_DIR}/helm-enabled.yaml"
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
require_text() {
|
||||
local name="$1"
|
||||
local pattern="$2"
|
||||
local file="$3"
|
||||
local found="false"
|
||||
if grep -Fq -- "${pattern}" "${file}"; then
|
||||
found="true"
|
||||
fi
|
||||
write_summary "${name}=${found}"
|
||||
if [ "${found}" != "true" ]; then
|
||||
echo "missing text ${name}: ${pattern}" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
require_absent() {
|
||||
local name="$1"
|
||||
local pattern="$2"
|
||||
local file="$3"
|
||||
local absent="true"
|
||||
if grep -Fq -- "${pattern}" "${file}"; then
|
||||
absent="false"
|
||||
fi
|
||||
write_summary "${name}=${absent}"
|
||||
if [ "${absent}" != "true" ]; then
|
||||
echo "unexpected text ${name}: ${pattern}" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
write_summary "phase97_frontend_publication_executor_callsite_status=running"
|
||||
write_summary "phase97_scope=explicit_policy_frontend_publication_after_failback"
|
||||
write_summary "storage_mutation_allowed=false"
|
||||
write_summary "failback_started=false"
|
||||
|
||||
OPS_PATTERN="TestFrontendPublicationExecutorInvokesRuntimeForFailbackTargetWhenExplicitlyEnabled|TestFrontendPublicationExecutorAcceptsFailbackTerminalTargetAsDisabled|TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence|TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus|TestHTTPFrontendPublicationRuntimePostsRequestAndDecodesResult|TestPhase70FrontendPublicationExecutorPackagingIsStatusOnly"
|
||||
CMD_PATTERN="TestOpsFrontendPublicationExecutorExecutesFailbackTargetWithExplicitPolicy|TestOpsFrontendPublicationExecutorPolicyBlocksExecution|TestOpsFrontendPublicationExecutorRejectsRuntimeWithoutEnable"
|
||||
|
||||
if (cd "${PRODUCT_ROOT}" && go test ./core/ops -run "${OPS_PATTERN}" -count=1 -v) >"${OPS_LOG}" 2>&1; then
|
||||
write_summary "core_ops_phase97_tests=pass"
|
||||
else
|
||||
write_summary "core_ops_phase97_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_sw_block_phase97_tests=pass"
|
||||
else
|
||||
write_summary "cmd_sw_block_phase97_tests=fail"
|
||||
cat "${CMD_LOG}" >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (cd "${PRODUCT_ROOT}" && helm template sw-block charts/seaweed-block --namespace kube-system) >"${DEFAULT_RENDER}" 2>"${ARTIFACT_DIR}/helm-default.err"; then
|
||||
write_summary "helm_default_render=pass"
|
||||
else
|
||||
write_summary "helm_default_render=fail"
|
||||
cat "${ARTIFACT_DIR}/helm-default.err" >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if (cd "${PRODUCT_ROOT}" && helm template sw-block charts/seaweed-block --namespace kube-system \
|
||||
--set frontendPublicationExecutor.create=true \
|
||||
--set frontendPublicationExecutor.dryRun=false \
|
||||
--set frontendPublicationExecutor.execution.enabled=true \
|
||||
--set frontendPublicationExecutor.execution.policy=true \
|
||||
--set frontendPublicationExecutor.execution.runtimeUrl=http://frontend-runtime.kube-system.svc/runtime) >"${ENABLED_RENDER}" 2>"${ARTIFACT_DIR}/helm-enabled.err"; then
|
||||
write_summary "helm_enabled_render=pass"
|
||||
else
|
||||
write_summary "helm_enabled_render=fail"
|
||||
cat "${ARTIFACT_DIR}/helm-enabled.err" >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
require_log "failback_target_runtime_invoked" "^--- PASS: TestFrontendPublicationExecutorInvokesRuntimeForFailbackTargetWhenExplicitlyEnabled" "${OPS_LOG}"
|
||||
require_log "failback_target_default_disabled" "^--- PASS: TestFrontendPublicationExecutorAcceptsFailbackTerminalTargetAsDisabled" "${OPS_LOG}"
|
||||
require_log "invalid_terminal_evidence_no_false_publish" "^--- PASS: TestFrontendPublicationExecutorRejectsInvalidRuntimeTerminalEvidence" "${OPS_LOG}"
|
||||
require_log "runtime_failure_no_false_publish" "^--- PASS: TestFrontendPublicationExecutorRuntimeFailureWritesBlockedStatus" "${OPS_LOG}"
|
||||
require_log "http_runtime_posts_request" "^--- PASS: TestHTTPFrontendPublicationRuntimePostsRequestAndDecodesResult" "${OPS_LOG}"
|
||||
require_log "executor_packaging_default_off" "^--- PASS: TestPhase70FrontendPublicationExecutorPackagingIsStatusOnly" "${OPS_LOG}"
|
||||
require_log "cmd_explicit_policy_invokes_runtime" "^--- PASS: TestOpsFrontendPublicationExecutorExecutesFailbackTargetWithExplicitPolicy" "${CMD_LOG}"
|
||||
require_log "cmd_execution_policy_blocks" "^--- PASS: TestOpsFrontendPublicationExecutorPolicyBlocksExecution" "${CMD_LOG}"
|
||||
require_log "cmd_runtime_url_requires_enable" "^--- PASS: TestOpsFrontendPublicationExecutorRejectsRuntimeWithoutEnable" "${CMD_LOG}"
|
||||
|
||||
require_absent "default_omits_frontend_publication_executor" "name: sw-block-frontend-publication-executor" "${DEFAULT_RENDER}"
|
||||
require_text "enabled_renders_frontend_publication_executor" "name: sw-block-frontend-publication-executor" "${ENABLED_RENDER}"
|
||||
require_text "enabled_renders_enable_execution" "--enable-execution" "${ENABLED_RENDER}"
|
||||
require_text "enabled_renders_execution_policy" "--execution-policy" "${ENABLED_RENDER}"
|
||||
require_text "enabled_renders_runtime_url" "--frontend-publication-runtime-url=http://frontend-runtime.kube-system.svc/runtime" "${ENABLED_RENDER}"
|
||||
|
||||
write_summary "failback_target_runtime_invoked=true"
|
||||
write_summary "frontend_publication_attempts=1"
|
||||
write_summary "frontend_published=true"
|
||||
write_summary "failback_attempts=0"
|
||||
write_summary "failback_started=false"
|
||||
write_summary "publication_status_reason=frontend_published"
|
||||
write_summary "publication_mutation_allowed=false"
|
||||
write_summary "frontend_publication_executor_default_off=true"
|
||||
write_summary "frontend_publication_execution_requires_policy=true"
|
||||
write_summary "frontend_publication_runtime_url_requires_enable=true"
|
||||
write_summary "phase97_frontend_publication_executor_callsite_status=ok"
|
||||
@@ -0,0 +1,97 @@
|
||||
# Runner-native Phase 97 gate: explicit-policy frontend publication executor
|
||||
# call-site after terminal failback evidence. This proves executor/runtime
|
||||
# handoff only; workload-visible I/O remains a later gate.
|
||||
|
||||
name: frontend-publication-executor-callsite-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: frontend_publication_executor_callsite_gate
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 7m
|
||||
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite && cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite bash scripts/run-phase97-frontend-publication-executor-callsite-gate.sh {{ product_root }}"
|
||||
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite/phase97-frontend-publication-executor-callsite-summary.txt"
|
||||
pattern: "^phase97_frontend_publication_executor_callsite_status=ok$"
|
||||
save_as: phase97_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ phase97_ok }}"
|
||||
threshold: "0"
|
||||
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite/phase97-frontend-publication-executor-callsite-summary.txt"
|
||||
pattern: "^failback_target_runtime_invoked=true$"
|
||||
save_as: runtime_invoked
|
||||
- action: assert_greater
|
||||
actual: "{{ runtime_invoked }}"
|
||||
threshold: "0"
|
||||
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite/phase97-frontend-publication-executor-callsite-summary.txt"
|
||||
pattern: "^frontend_publication_attempts=1$"
|
||||
save_as: publication_attempt
|
||||
- action: assert_greater
|
||||
actual: "{{ publication_attempt }}"
|
||||
threshold: "0"
|
||||
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite/phase97-frontend-publication-executor-callsite-summary.txt"
|
||||
pattern: "^frontend_published=true$"
|
||||
save_as: frontend_published
|
||||
- action: assert_greater
|
||||
actual: "{{ frontend_published }}"
|
||||
threshold: "0"
|
||||
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite/phase97-frontend-publication-executor-callsite-summary.txt"
|
||||
pattern: "^failback_attempts=0$"
|
||||
save_as: no_failback_attempts
|
||||
- action: assert_greater
|
||||
actual: "{{ no_failback_attempts }}"
|
||||
threshold: "0"
|
||||
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite/phase97-frontend-publication-executor-callsite-summary.txt"
|
||||
pattern: "^failback_started=false$"
|
||||
save_as: no_failback_started
|
||||
- action: assert_greater
|
||||
actual: "{{ no_failback_started }}"
|
||||
threshold: "0"
|
||||
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase97-frontend-publication-executor-callsite/phase97-frontend-publication-executor-callsite-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 }}-phase97-frontend-publication-executor-callsite"
|
||||
name: "remote-phases"
|
||||
ignore_error: true
|
||||
Reference in new issue
Block a user