mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
phase106: wire external nvme tcp publish path
This commit is contained in:
1 parent
df05c5bf73
commit
3e4c9de914
19 files changed
+626
-26
No files matched your search
@@ -16,7 +16,9 @@ mutating dashboard, operator reconciliation, backup/restore, or upgrade safety.
|
||||
Use generated values for the supported alpha install path. The generator reads
|
||||
the live Kubernetes nodes and writes the node names/IPs that the launcher uses
|
||||
for placement. On a single-node lab it keeps loopback/local-consumer mode; on a
|
||||
multi-node lab it switches to non-loopback iSCSI with CHAP.
|
||||
multi-node lab it switches to non-loopback iSCSI with CHAP. For the
|
||||
experimental NVMe/TCP path, pass `--protocol nvme`; this switches to
|
||||
non-loopback NVMe/TCP plus external status, without enabling iSCSI CHAP.
|
||||
|
||||
```bash
|
||||
SW_BLOCK_HELM_VALUES_OUT=values.day1.yaml \
|
||||
@@ -42,6 +44,7 @@ csiImage:
|
||||
|
||||
network:
|
||||
externalISCSI: true
|
||||
externalNVMe: false
|
||||
externalStatus: true
|
||||
rejectLoopbackPublishTargets: true
|
||||
|
||||
@@ -94,6 +97,7 @@ replication:
|
||||
expectedSlotsPerVolume: 3
|
||||
network:
|
||||
externalISCSI: true
|
||||
externalNVMe: false
|
||||
externalStatus: true
|
||||
rejectLoopbackPublishTargets: true
|
||||
chap:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{- if and .Values.network.externalISCSI (not .Values.chap.enabled) -}}
|
||||
{{- fail "network.externalISCSI=true requires chap.enabled=true so cross-node iSCSI is not published without CHAP credentials" -}}
|
||||
{{- end -}}
|
||||
{{- if and .Values.network.externalStatus (not .Values.network.externalISCSI) -}}
|
||||
{{- fail "network.externalStatus=true requires network.externalISCSI=true because external status is only supported with external block frontend publishing" -}}
|
||||
{{- if and .Values.network.externalStatus (not (or .Values.network.externalISCSI .Values.network.externalNVMe)) -}}
|
||||
{{- fail "network.externalStatus=true requires network.externalISCSI=true or network.externalNVMe=true because external status is only supported with external block frontend publishing" -}}
|
||||
{{- end -}}
|
||||
{{- if and (ne .Values.blockmaster.durableImpl "walstore") (not .Values.compat.launcherDurableImplFlag) -}}
|
||||
{{- fail "blockmaster.durableImpl requires compat.launcherDurableImplFlag=true because older published images do not accept --launcher-durable-impl" -}}
|
||||
@@ -73,6 +73,7 @@ spec:
|
||||
- "--launcher-replication-ack={{ .Values.replication.ackProfile }}"
|
||||
{{- end }}
|
||||
- "--launcher-iscsi-port-base={{ .Values.ports.iscsiBase }}"
|
||||
- "--launcher-nvme-port-base={{ .Values.ports.nvmeBase }}"
|
||||
{{- if .Values.blockmaster.launcherPVCOwnerRef }}
|
||||
- "--launcher-pvc-owner-ref"
|
||||
{{- end }}
|
||||
@@ -85,6 +86,9 @@ spec:
|
||||
- "--launcher-iscsi-chap-username-key={{ .Values.chap.usernameKey }}"
|
||||
- "--launcher-iscsi-chap-secret-key={{ .Values.chap.secretKey }}"
|
||||
{{- end }}
|
||||
{{- if .Values.network.externalNVMe }}
|
||||
- "--launcher-external-nvme"
|
||||
{{- end }}
|
||||
{{- if .Values.network.externalStatus }}
|
||||
- "--launcher-external-status"
|
||||
{{- end }}
|
||||
|
||||
@@ -60,10 +60,19 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"externalISCSI": { "type": "boolean" },
|
||||
"externalNVMe": { "type": "boolean" },
|
||||
"externalStatus": { "type": "boolean" },
|
||||
"rejectLoopbackPublishTargets": { "type": "boolean" }
|
||||
}
|
||||
},
|
||||
"ports": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"iscsiBase": { "type": "integer", "minimum": 1, "maximum": 65535 },
|
||||
"nvmeBase": { "type": "integer", "minimum": 1, "maximum": 65535 },
|
||||
"statusBase": { "type": "integer", "minimum": 1, "maximum": 65535 }
|
||||
}
|
||||
},
|
||||
"compat": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -75,6 +75,7 @@ replication:
|
||||
|
||||
network:
|
||||
externalISCSI: false
|
||||
externalNVMe: false
|
||||
externalStatus: false
|
||||
rejectLoopbackPublishTargets: false
|
||||
|
||||
@@ -99,6 +100,7 @@ chap:
|
||||
|
||||
ports:
|
||||
iscsiBase: 3260
|
||||
nvmeBase: 4420
|
||||
statusBase: 23260
|
||||
|
||||
# Initial block-capable nodes. D2 will add a generator that derives this from
|
||||
|
||||
@@ -45,6 +45,7 @@ type flags struct {
|
||||
launcherStatus bool
|
||||
launcherKubernetesApply bool
|
||||
launcherExternalISCSI bool
|
||||
launcherExternalNVMe bool
|
||||
launcherExternalStatus bool
|
||||
launcherCHAPSecretName string
|
||||
launcherCHAPUserKey string
|
||||
@@ -88,6 +89,7 @@ func parseFlags(args []string) (flags, error) {
|
||||
fs.BoolVar(&f.launcherStatus, "launcher-status", false, "render loopback-only blockvolume status endpoints in generated workload manifests; intended for TestOps/diagnostics")
|
||||
fs.BoolVar(&f.launcherKubernetesApply, "launcher-kubernetes-apply", false, "apply/delete generated blockvolume Deployments through the in-cluster Kubernetes API; scoped to app=sw-blockvolume and generated volume/replica labels")
|
||||
fs.BoolVar(&f.launcherExternalISCSI, "launcher-external-iscsi", false, "render generated iSCSI frontends on node addresses instead of loopback; requires --launcher-iscsi-chap-secret-name")
|
||||
fs.BoolVar(&f.launcherExternalNVMe, "launcher-external-nvme", false, "render generated NVMe/TCP frontends on node addresses instead of loopback; unauthenticated and intended only for explicit Kubernetes NVMe/TCP gates")
|
||||
fs.BoolVar(&f.launcherExternalStatus, "launcher-external-status", false, "render blockvolume status endpoints on node addresses instead of loopback; intended for explicit Kubernetes node-loss gates")
|
||||
fs.StringVar(&f.launcherCHAPSecretName, "launcher-iscsi-chap-secret-name", "", "optional Kubernetes Secret name used by generated blockvolume Deployments for target-side iSCSI CHAP")
|
||||
fs.StringVar(&f.launcherCHAPUserKey, "launcher-iscsi-chap-username-key", "chapUsername", "Kubernetes Secret key for generated blockvolume iSCSI CHAP username")
|
||||
@@ -345,6 +347,7 @@ func runLifecycleLauncherTick(h *master.Host, f flags) error {
|
||||
OwnerReferenceToPVC: f.launcherPVCOwnerRef,
|
||||
EnableStatus: f.launcherStatus,
|
||||
ExternalISCSI: f.launcherExternalISCSI,
|
||||
ExternalNVMe: f.launcherExternalNVMe,
|
||||
ExternalStatus: f.launcherExternalStatus,
|
||||
ISCSICHAP: launcher.CHAPSecretRef{
|
||||
Name: f.launcherCHAPSecretName,
|
||||
|
||||
@@ -145,6 +145,19 @@ func TestParseFlags_LauncherExternalISCSIRequiresCHAP(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFlags_LauncherExternalNVMeOptional(t *testing.T) {
|
||||
f, err := parseFlags([]string{
|
||||
"--authority-store", "authority-dir",
|
||||
"--launcher-external-nvme",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("parseFlags with external NVMe: %v", err)
|
||||
}
|
||||
if !f.launcherExternalNVMe {
|
||||
t.Fatal("launcherExternalNVMe=false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestBlockmasterBareTopologyRegistersVolumeControlServices(t *testing.T) {
|
||||
h, err := master.New(master.Config{
|
||||
AuthorityStoreDir: t.TempDir(),
|
||||
|
||||
@@ -58,6 +58,50 @@ func TestParseFlags_NVMeTransportRejectsRDMA(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFlags_NVMeExternalBindRequiresExplicitOptIn(t *testing.T) {
|
||||
args := append(requiredBlockvolumeArgs(),
|
||||
"--nvme-listen", "203.0.113.10:4420",
|
||||
"--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:test-v1",
|
||||
)
|
||||
_, err := parseFlags(args)
|
||||
if err == nil {
|
||||
t.Fatal("parseFlags succeeded; want external NVMe/TCP bind rejected")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "not loopback") {
|
||||
t.Fatalf("error = %q, want loopback bind rejection", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFlags_NVMeExternalBindOptIn(t *testing.T) {
|
||||
args := append(requiredBlockvolumeArgs(),
|
||||
"--allow-external-nvme-bind",
|
||||
"--nvme-listen", "203.0.113.10:4420",
|
||||
"--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:test-v1",
|
||||
)
|
||||
got, err := parseFlags(args)
|
||||
if err != nil {
|
||||
t.Fatalf("parseFlags: %v", err)
|
||||
}
|
||||
if !got.allowExternalNVMeBind {
|
||||
t.Fatal("allowExternalNVMeBind=false")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFlags_NVMeExternalBindOptInRejectsLoopback(t *testing.T) {
|
||||
args := append(requiredBlockvolumeArgs(),
|
||||
"--allow-external-nvme-bind",
|
||||
"--nvme-listen", "127.0.0.1:4420",
|
||||
"--nvme-subsysnqn", "nqn.2026-05.io.seaweedfs:test-v1",
|
||||
)
|
||||
_, err := parseFlags(args)
|
||||
if err == nil {
|
||||
t.Fatal("parseFlags succeeded; want loopback external bind rejected")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "non-loopback") {
|
||||
t.Fatalf("error = %q, want non-loopback requirement", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseFlags_IscsiPortalAddrDoesNotChangeLoopbackBind(t *testing.T) {
|
||||
args := append(requiredBlockvolumeArgs(),
|
||||
"--iscsi-listen", "127.0.0.1:3260",
|
||||
|
||||
@@ -81,6 +81,10 @@ type flags struct {
|
||||
nvmeSubsysNQN string
|
||||
nvmeNS uint
|
||||
nvmeTransport string
|
||||
// External NVMe/TCP bind is explicit because the current target has no
|
||||
// authentication. Phase 106 uses it for controlled Kubernetes cross-node
|
||||
// gates; default installs remain loopback-only.
|
||||
allowExternalNVMeBind bool
|
||||
|
||||
// Durable-backend flags. When --durable-root is set, the iSCSI
|
||||
// and NVMe providers use DurableProvider instead of memback.
|
||||
@@ -153,6 +157,7 @@ func parseFlags(args []string) (flags, error) {
|
||||
fs.StringVar(&f.nvmeSubsysNQN, "nvme-subsysnqn", "", "NVMe subsystem NQN (required if --nvme-listen is set)")
|
||||
fs.UintVar(&f.nvmeNS, "nvme-ns", 1, "NVMe namespace id (default 1)")
|
||||
fs.StringVar(&f.nvmeTransport, "nvme-transport", "tcp", "NVMe-oF transport. Only \"tcp\" is implemented; \"rdma\"/RoCE is a future gated feature")
|
||||
fs.BoolVar(&f.allowExternalNVMeBind, "allow-external-nvme-bind", false, "allow NVMe/TCP to bind a non-loopback address; unauthenticated, intended only for explicit Kubernetes NVMe/TCP gates")
|
||||
fs.StringVar(&f.durableRoot, "durable-root", "", "directory for persistent storage files; empty = memback (non-durable)")
|
||||
fs.StringVar(&f.durableImpl, "durable-impl", "smartwal", "LogicalStorage impl: smartwal (default) or walstore; ignored unless --durable-root is set")
|
||||
fs.UintVar(&f.durableBlocks, "durable-blocks", 2048, "number of blocks per volume on first create (ignored when opening existing)")
|
||||
@@ -254,7 +259,7 @@ func parseFlags(args []string) (flags, error) {
|
||||
if f.nvmeSubsysNQN == "" {
|
||||
return flags{}, fmt.Errorf("--nvme-subsysnqn is required when --nvme-listen is set")
|
||||
}
|
||||
if err := enforceFrontendLoopbackBind("nvme", f.nvmeListen); err != nil {
|
||||
if err := enforceNVMeBindPolicy(f); err != nil {
|
||||
return flags{}, err
|
||||
}
|
||||
// Symmetric with iSCSI auto-enable per QA checkpoint-7
|
||||
@@ -351,6 +356,23 @@ func enforceISCSIBindPolicy(f flags) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func enforceNVMeBindPolicy(f flags) error {
|
||||
if !f.allowExternalNVMeBind {
|
||||
return enforceFrontendLoopbackBind("nvme", f.nvmeListen)
|
||||
}
|
||||
host, _, err := net.SplitHostPort(f.nvmeListen)
|
||||
if err != nil {
|
||||
return fmt.Errorf("--nvme-listen %q not host:port: %w", f.nvmeListen, err)
|
||||
}
|
||||
if host == "" {
|
||||
return fmt.Errorf("--nvme-listen %q has empty host; external NVMe/TCP bind requires an explicit node address", f.nvmeListen)
|
||||
}
|
||||
if isLocalhostOrLoopbackHost(host) {
|
||||
return fmt.Errorf("--nvme-listen %q is loopback; external NVMe/TCP bind requires a non-loopback node address", f.nvmeListen)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func isLocalhostOrLoopbackHost(host string) bool {
|
||||
if strings.EqualFold(host, "localhost") {
|
||||
return true
|
||||
|
||||
@@ -1677,6 +1677,7 @@ type helmValuesReplication struct {
|
||||
|
||||
type helmValuesNetwork struct {
|
||||
ExternalISCSI bool `yaml:"externalISCSI"`
|
||||
ExternalNVMe bool `yaml:"externalNVMe"`
|
||||
ExternalStatus bool `yaml:"externalStatus"`
|
||||
RejectLoopbackPublishTargets bool `yaml:"rejectLoopbackPublishTargets"`
|
||||
}
|
||||
@@ -1724,6 +1725,7 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
replicationFactor int
|
||||
ackProfile string
|
||||
storageClass string
|
||||
protocol string
|
||||
appNamespace string
|
||||
targetNode string
|
||||
nodeLimit int
|
||||
@@ -1743,6 +1745,7 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
fs.IntVar(&replicationFactor, "replication-factor", 1, "storage class replication factor")
|
||||
fs.StringVar(&ackProfile, "ack-profile", "best-effort", "replication ACK profile: best-effort, sync-quorum, or sync-all")
|
||||
fs.StringVar(&storageClass, "storageclass", "sw-block-dynamic", "StorageClass name")
|
||||
fs.StringVar(&protocol, "protocol", "iscsi", "StorageClass frontend protocol: iscsi or nvme")
|
||||
fs.StringVar(&appNamespace, "app-namespace", "default", "default application namespace")
|
||||
fs.StringVar(&targetNode, "target-node", "", "optional Kubernetes node name to select for single-node values")
|
||||
fs.IntVar(&nodeLimit, "node-limit", 0, "optional maximum selected Ready node count")
|
||||
@@ -1772,6 +1775,10 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
fmt.Fprintf(stderr, "sw-block ops generate-helm-values: --ack-profile=%q invalid; want best-effort, sync-quorum, or sync-all\n", ackProfile)
|
||||
return ops.VolumeStatusExitInvalid
|
||||
}
|
||||
if !helmValuesProtocolAccepted(protocol) {
|
||||
fmt.Fprintf(stderr, "sw-block ops generate-helm-values: --protocol=%q invalid; want iscsi or nvme\n", protocol)
|
||||
return ops.VolumeStatusExitInvalid
|
||||
}
|
||||
if !helmValuesRestartPersistenceAccepted(restartPersistence) {
|
||||
fmt.Fprintf(stderr, "sw-block ops generate-helm-values: --restart-persistence=%q invalid; want ephemeral or hostpath\n", restartPersistence)
|
||||
return ops.VolumeStatusExitInvalid
|
||||
@@ -1804,7 +1811,9 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
}
|
||||
|
||||
multiNode := len(selected) > 1
|
||||
if multiNode && chapSecret == "" {
|
||||
externalISCSI := multiNode && protocol == "iscsi"
|
||||
externalNVMe := multiNode && protocol == "nvme"
|
||||
if externalISCSI && chapSecret == "" {
|
||||
chapSecret = generateHelmValuesSecret()
|
||||
}
|
||||
values := helmValuesFile{
|
||||
@@ -1815,14 +1824,15 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
Create: true,
|
||||
Name: storageClass,
|
||||
ReplicationFactor: replicationFactor,
|
||||
Protocol: "iscsi",
|
||||
Protocol: protocol,
|
||||
},
|
||||
Replication: helmValuesReplication{
|
||||
AckProfile: ackProfile,
|
||||
ExpectedSlotsPerVolume: replicationFactor,
|
||||
},
|
||||
Network: helmValuesNetwork{
|
||||
ExternalISCSI: multiNode,
|
||||
ExternalISCSI: externalISCSI,
|
||||
ExternalNVMe: externalNVMe,
|
||||
ExternalStatus: multiNode,
|
||||
RejectLoopbackPublishTargets: multiNode,
|
||||
},
|
||||
@@ -1830,8 +1840,8 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
LauncherRejectLoopbackFlag: false,
|
||||
},
|
||||
CHAP: helmValuesCHAP{
|
||||
Enabled: multiNode,
|
||||
Create: multiNode,
|
||||
Enabled: externalISCSI,
|
||||
Create: externalISCSI,
|
||||
SecretName: chapSecretName,
|
||||
Username: chapUsername,
|
||||
Secret: chapSecret,
|
||||
@@ -1875,8 +1885,10 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
}
|
||||
|
||||
networkMode := "loopback"
|
||||
if multiNode {
|
||||
if externalISCSI {
|
||||
networkMode = "external-iscsi"
|
||||
} else if externalNVMe {
|
||||
networkMode = "external-nvme"
|
||||
}
|
||||
fmt.Fprintln(stdout, "helm_values_status=ok")
|
||||
fmt.Fprintf(stdout, "values_file=%s\n", outPath)
|
||||
@@ -1885,8 +1897,10 @@ func runOpsGenerateHelmValues(args []string, stdout, stderr io.Writer) int {
|
||||
fmt.Fprintf(stdout, "discovered_kubernetes_nodes=%d\n", len(discovered))
|
||||
fmt.Fprintf(stdout, "target_node=%s\n", emptyCLI(targetNode))
|
||||
fmt.Fprintf(stdout, "node_limit=%s\n", emptyCLI(strconv.Itoa(nodeLimit)))
|
||||
fmt.Fprintf(stdout, "external_iscsi=%t\n", multiNode)
|
||||
fmt.Fprintf(stdout, "chap_enabled=%t\n", multiNode)
|
||||
fmt.Fprintf(stdout, "external_iscsi=%t\n", externalISCSI)
|
||||
fmt.Fprintf(stdout, "external_nvme=%t\n", externalNVMe)
|
||||
fmt.Fprintf(stdout, "chap_enabled=%t\n", externalISCSI)
|
||||
fmt.Fprintf(stdout, "protocol=%s\n", protocol)
|
||||
fmt.Fprintf(stdout, "replication_factor=%d\n", replicationFactor)
|
||||
fmt.Fprintf(stdout, "ack_profile=%s\n", ackProfile)
|
||||
fmt.Fprintf(stdout, "restart_persistence_mode=%s\n", restartPersistence)
|
||||
@@ -1905,6 +1919,15 @@ func helmValuesAckProfileAccepted(value string) bool {
|
||||
}
|
||||
}
|
||||
|
||||
func helmValuesProtocolAccepted(value string) bool {
|
||||
switch value {
|
||||
case "iscsi", "nvme":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func helmValuesRestartPersistenceAccepted(value string) bool {
|
||||
switch value {
|
||||
case "ephemeral", "hostpath":
|
||||
@@ -2149,7 +2172,7 @@ func usage(w io.Writer) {
|
||||
fmt.Fprintln(w, " sw-block ops report --master-api <addr> --out <dir>")
|
||||
fmt.Fprintln(w, " sw-block ops dashboard --from-bundle <dir> [--listen 127.0.0.1:9334]")
|
||||
fmt.Fprintln(w, " sw-block ops dashboard --master-api <addr> [--listen 127.0.0.1:9334]")
|
||||
fmt.Fprintln(w, " sw-block ops generate-helm-values --out values.yaml [--target-node <node>] [--replication-factor <n>]")
|
||||
fmt.Fprintln(w, " sw-block ops generate-helm-values --out values.yaml [--target-node <node>] [--replication-factor <n>] [--protocol iscsi|nvme]")
|
||||
fmt.Fprintln(w, " [--restart-persistence ephemeral|hostpath] [--state-hostpath /var/lib/sw-block] [--timeout 10s]")
|
||||
fmt.Fprintln(w, " sw-block ops operator-status --dry-run [--master-api <addr>|--from-bundle <dir>] [--cleanup-summary <file>] [--interval 30s]")
|
||||
fmt.Fprintln(w, " sw-block ops lifecycle-owner [--dry-run] [--namespace <ns>] [--interval 30s]")
|
||||
|
||||
@@ -2566,6 +2566,7 @@ func TestOpsGenerateHelmValuesSingleNodeFromKubernetes(t *testing.T) {
|
||||
"repository: ghcr.io/seaweedfs/seaweed-block",
|
||||
"tag: sha-test",
|
||||
"externalISCSI: false",
|
||||
"externalNVMe: false",
|
||||
"externalStatus: false",
|
||||
"rejectLoopbackPublishTargets: false",
|
||||
"restartPersistence:",
|
||||
@@ -2610,7 +2611,9 @@ func TestOpsGenerateHelmValuesMultiNodeExternalISCSI(t *testing.T) {
|
||||
"network_mode=external-iscsi",
|
||||
"ready_kubernetes_nodes=3",
|
||||
"external_iscsi=true",
|
||||
"external_nvme=false",
|
||||
"chap_enabled=true",
|
||||
"protocol=iscsi",
|
||||
"ack_profile=sync-quorum",
|
||||
"restart_persistence_mode=ephemeral",
|
||||
} {
|
||||
@@ -2627,6 +2630,7 @@ func TestOpsGenerateHelmValuesMultiNodeExternalISCSI(t *testing.T) {
|
||||
"ackProfile: sync-quorum",
|
||||
"expectedSlotsPerVolume: 3",
|
||||
"externalISCSI: true",
|
||||
"externalNVMe: false",
|
||||
"externalStatus: true",
|
||||
"rejectLoopbackPublishTargets: true",
|
||||
"restartPersistence:",
|
||||
@@ -2657,6 +2661,66 @@ func TestOpsGenerateHelmValuesMultiNodeExternalISCSI(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpsGenerateHelmValuesMultiNodeExternalNVMe(t *testing.T) {
|
||||
oldRunCommand := opsGenerateHelmValuesRunCommand
|
||||
opsGenerateHelmValuesRunCommand = fixtureCmdKubectl(map[string]string{
|
||||
"kubectl get nodes -o wide --no-headers": cmdHelmNodeWide,
|
||||
})
|
||||
defer func() { opsGenerateHelmValuesRunCommand = oldRunCommand }()
|
||||
|
||||
outPath := filepath.Join(t.TempDir(), "values.yaml")
|
||||
var stdout, stderr bytes.Buffer
|
||||
code := run([]string{
|
||||
"ops", "generate-helm-values",
|
||||
"--out", outPath,
|
||||
"--replication-factor", "3",
|
||||
"--protocol", "nvme",
|
||||
}, &stdout, &stderr)
|
||||
if code != ops.VolumeStatusExitOK {
|
||||
t.Fatalf("exit=%d stderr=%s stdout=%s", code, stderr.String(), stdout.String())
|
||||
}
|
||||
for _, want := range []string{
|
||||
"network_mode=external-nvme",
|
||||
"ready_kubernetes_nodes=3",
|
||||
"external_iscsi=false",
|
||||
"external_nvme=true",
|
||||
"chap_enabled=false",
|
||||
"protocol=nvme",
|
||||
} {
|
||||
if !strings.Contains(stdout.String(), want) {
|
||||
t.Fatalf("stdout missing %q:\n%s", want, stdout.String())
|
||||
}
|
||||
}
|
||||
values, err := os.ReadFile(outPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, want := range []string{
|
||||
"replicationFactor: 3",
|
||||
"protocol: nvme",
|
||||
"externalISCSI: false",
|
||||
"externalNVMe: true",
|
||||
"externalStatus: true",
|
||||
"rejectLoopbackPublishTargets: true",
|
||||
"enabled: false",
|
||||
"create: false",
|
||||
"secret: \"\"",
|
||||
"name: m01",
|
||||
"internalIP: 192.168.1.181",
|
||||
"name: m02",
|
||||
"internalIP: 192.168.1.184",
|
||||
"name: tp01",
|
||||
"internalIP: 192.168.1.188",
|
||||
} {
|
||||
if !strings.Contains(string(values), want) {
|
||||
t.Fatalf("values missing %q:\n%s", want, values)
|
||||
}
|
||||
}
|
||||
if strings.Contains(string(values), "externalISCSI: true") || strings.Contains(string(values), "secret: fixed-chap-secret") {
|
||||
t.Fatalf("nvme values must not enable iSCSI or generate CHAP secret:\n%s", values)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOpsGenerateHelmValuesRestartPersistenceHostPath(t *testing.T) {
|
||||
oldRunCommand := opsGenerateHelmValuesRunCommand
|
||||
opsGenerateHelmValuesRunCommand = fixtureCmdKubectl(map[string]string{
|
||||
|
||||
@@ -25,6 +25,7 @@ type K8sRenderConfig struct {
|
||||
OwnerReferenceToPVC bool
|
||||
EnableStatus bool
|
||||
ExternalISCSI bool
|
||||
ExternalNVMe bool
|
||||
ExternalStatus bool
|
||||
ISCSICHAP CHAPSecretRef
|
||||
}
|
||||
@@ -75,8 +76,8 @@ func RenderBlockVolumeDeployments(plan lifecycle.BlockVolumeWorkloadPlan, cfg K8
|
||||
if cfg.ExternalISCSI && cfg.ISCSICHAP.Name == "" {
|
||||
return nil, fmt.Errorf("launcher: external iSCSI requires CHAP secret")
|
||||
}
|
||||
if cfg.ExternalStatus && !cfg.ExternalISCSI {
|
||||
return nil, fmt.Errorf("launcher: external status requires external iSCSI mode")
|
||||
if cfg.ExternalStatus && !cfg.ExternalISCSI && !cfg.ExternalNVMe {
|
||||
return nil, fmt.Errorf("launcher: external status requires an external block frontend mode")
|
||||
}
|
||||
if cfg.MasterAddr == "" {
|
||||
return nil, fmt.Errorf("launcher: master addr is required")
|
||||
@@ -208,8 +209,17 @@ func blockVolumeArgs(plan lifecycle.BlockVolumeWorkloadPlan, replica lifecycle.B
|
||||
}
|
||||
switch plan.Protocol {
|
||||
case "nvme":
|
||||
nvmeListen := fmt.Sprintf("127.0.0.1:%d", replica.NVMeListenPort)
|
||||
if cfg.ExternalNVMe {
|
||||
host, err := hostFromAddr(replica.DataAddr)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("launcher: external NVMe/TCP volume=%s replica=%s: %w", plan.VolumeID, replica.ReplicaID, err)
|
||||
}
|
||||
nvmeListen = fmt.Sprintf("%s:%d", host, replica.NVMeListenPort)
|
||||
args = append(args, "--allow-external-nvme-bind")
|
||||
}
|
||||
args = append(args,
|
||||
fmt.Sprintf("--nvme-listen=127.0.0.1:%d", replica.NVMeListenPort),
|
||||
"--nvme-listen="+nvmeListen,
|
||||
"--nvme-subsysnqn="+replica.NVMeSubsystemNQN,
|
||||
fmt.Sprintf("--nvme-ns=%d", replica.NVMeNSID),
|
||||
)
|
||||
|
||||
@@ -299,6 +299,53 @@ func TestG15d_K8sRenderer_RendersNVMeBlockVolumeArgs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase106_K8sRenderer_ExternalNVMeUsesNodeAddress(t *testing.T) {
|
||||
plan := sampleWorkloadPlan()
|
||||
plan.Protocol = "nvme"
|
||||
manifests, err := RenderBlockVolumeDeployments(plan, K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
ExternalNVMe: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("RenderBlockVolumeDeployments: %v", err)
|
||||
}
|
||||
raw := string(manifests[0].YAML)
|
||||
for _, want := range []string{
|
||||
"--allow-external-nvme-bind",
|
||||
"--nvme-listen=10.0.0.1:4420",
|
||||
"--nvme-subsysnqn=nqn.test:pvc-a",
|
||||
} {
|
||||
if !strings.Contains(raw, want) {
|
||||
t.Fatalf("manifest missing %q:\n%s", want, raw)
|
||||
}
|
||||
}
|
||||
for _, forbidden := range []string{
|
||||
"--nvme-listen=127.0.0.1:4420",
|
||||
"--allow-external-iscsi-bind",
|
||||
"--iscsi-listen=",
|
||||
} {
|
||||
if strings.Contains(raw, forbidden) {
|
||||
t.Fatalf("external nvme manifest must not contain %q:\n%s", forbidden, raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase106_K8sRenderer_ExternalNVMeRejectsLoopbackNodeAddress(t *testing.T) {
|
||||
plan := sampleWorkloadPlan()
|
||||
plan.Protocol = "nvme"
|
||||
plan.Replicas[0].DataAddr = "127.0.0.1:19101"
|
||||
_, err := RenderBlockVolumeDeployments(plan, K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
ExternalNVMe: true,
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatal("RenderBlockVolumeDeployments succeeded; want loopback external endpoint rejected")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "non-loopback") {
|
||||
t.Fatalf("error = %q, want non-loopback requirement", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestG15d_K8sRenderer_CanOptIntoBlockVolumeStatusEndpoint(t *testing.T) {
|
||||
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
@@ -463,7 +510,7 @@ func TestNodeLoss_K8sRenderer_ExternalISCSIRejectsLoopbackNodeAddress(t *testing
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeLoss_K8sRenderer_ExternalStatusRequiresExternalISCSI(t *testing.T) {
|
||||
func TestNodeLoss_K8sRenderer_ExternalStatusRequiresExternalFrontend(t *testing.T) {
|
||||
_, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
EnableStatus: true,
|
||||
@@ -472,11 +519,36 @@ func TestNodeLoss_K8sRenderer_ExternalStatusRequiresExternalISCSI(t *testing.T)
|
||||
if err == nil {
|
||||
t.Fatal("RenderBlockVolumeDeployments succeeded; want external status guard")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "external status requires external iSCSI") {
|
||||
if !strings.Contains(err.Error(), "external status requires an external block frontend") {
|
||||
t.Fatalf("error = %q, want external status guard", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase106_K8sRenderer_ExternalStatusCanUseExternalNVMe(t *testing.T) {
|
||||
plan := sampleWorkloadPlan()
|
||||
plan.Protocol = "nvme"
|
||||
manifests, err := RenderBlockVolumeDeployments(plan, K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
EnableStatus: true,
|
||||
ExternalNVMe: true,
|
||||
ExternalStatus: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("RenderBlockVolumeDeployments: %v", err)
|
||||
}
|
||||
raw := string(manifests[0].YAML)
|
||||
for _, want := range []string{
|
||||
"--status-addr=10.0.0.1:24420",
|
||||
"--allow-external-status-bind",
|
||||
"--allow-external-nvme-bind",
|
||||
"--nvme-listen=10.0.0.1:4420",
|
||||
} {
|
||||
if !strings.Contains(raw, want) {
|
||||
t.Fatalf("manifest missing %q:\n%s", want, raw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNodeLoss_K8sRenderer_ExternalStatusUsesNodeAddress(t *testing.T) {
|
||||
manifests, err := RenderBlockVolumeDeployments(sampleWorkloadPlan(), K8sRenderConfig{
|
||||
MasterAddr: "m:9333",
|
||||
|
||||
@@ -96,8 +96,10 @@ Seaweed Block can already demonstrate a narrow Kubernetes block-storage loop:
|
||||
- NVMe/TCP CSI multipath attach is gated for the supported lab path; RoCE and
|
||||
NVMe/RDMA remain explicit non-claims until host preflight plus live I/O gates
|
||||
prove them.
|
||||
- Cross-node loopback NVMe/TCP topology is explicitly blocked. Cross-node
|
||||
non-loopback NVMe/TCP attach remains the next live gate, not a shipped claim.
|
||||
- Cross-node loopback NVMe/TCP topology is explicitly blocked. The
|
||||
non-loopback NVMe/TCP publish path is now explicitly wired through
|
||||
blockvolume, blockmaster, Helm, and generated values, but cross-node
|
||||
writer/reader attach remains the next live gate, not a shipped claim.
|
||||
- Install drift status for current versus desired chart/app/image identity
|
||||
without upgrade execution.
|
||||
- CRD/RBAC status-writer conformance coverage for the failures that previously
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# Current Plan: Phase 106 NVMe/TCP Cross-Node Non-Loopback Live Attach
|
||||
|
||||
Status: planned next.
|
||||
Status: in progress. D1/D2 publish-contract gate passed on
|
||||
2026-06-29 (`nvme-tcp-cross-node-publish-chain`, run
|
||||
`20260629-005939-14c1`, 18/18 PASS). D3 live cross-node writer/reader remains
|
||||
open.
|
||||
|
||||
## Why This Is Next
|
||||
|
||||
@@ -40,12 +43,19 @@ Ensure NVMe frontend publication exposes a routable node address when the
|
||||
workload may run on a different node. Do not regress the same-node loopback lab
|
||||
path.
|
||||
|
||||
Required local checks:
|
||||
Status: closed for the publish-contract slice. Implemented:
|
||||
|
||||
```text
|
||||
go test ./core/frontend/nvme ./core/ops ./cmd/blockvolume ./cmd/sw-block -count=1
|
||||
blockvolume default NVMe bind remains loopback-only
|
||||
--allow-external-nvme-bind is required for non-loopback NVMe/TCP
|
||||
blockmaster accepts --launcher-external-nvme
|
||||
launcher renders --allow-external-nvme-bind and non-loopback --nvme-listen
|
||||
Helm exposes network.externalNVMe and ports.nvmeBase
|
||||
generate-helm-values --protocol nvme emits externalNVMe, not externalISCSI/CHAP
|
||||
```
|
||||
|
||||
Verified by `scripts/run-phase106-nvme-tcp-cross-node-publish-gate.sh`.
|
||||
|
||||
## D2: CSI Publish / Stage Evidence
|
||||
|
||||
Confirm CSI publish context carries the non-loopback NVMe/TCP target and node
|
||||
@@ -54,6 +64,11 @@ stage records the same NQN/NSID/address.
|
||||
No status surface may claim Ready if publish context and stage evidence
|
||||
disagree.
|
||||
|
||||
Status: partially closed for render/publish inputs only. The chart and values
|
||||
now produce the intended non-loopback NVMe target configuration. The live CSI
|
||||
publish/stage agreement remains part of D3 because it requires a mounted
|
||||
cross-node workload.
|
||||
|
||||
## D3: Live Cross-Node Writer / Reader Gate
|
||||
|
||||
Run a TestOps scenario that pins or schedules:
|
||||
|
||||
@@ -251,9 +251,13 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
|
||||
`publish_target_loopback_cross_node` reason, keeps `Ready=True` false, and
|
||||
surfaces `observe.inspect_publish_target_topology` instead of an iSCSI-only
|
||||
remediation.
|
||||
- Phase 106 NVMe/TCP Cross-Node Non-Loopback Live Attach is next. It should
|
||||
prove the positive multi-host path: a routable NVMe/TCP target, CSI
|
||||
stage/publish agreement, app writer/reader I/O, and zero residue.
|
||||
- Phase 106 NVMe/TCP Cross-Node Non-Loopback Live Attach is in progress. The
|
||||
D1/D2 publish-contract gate is closed: external NVMe/TCP is opt-in at
|
||||
`blockvolume`, rendered by blockmaster/launcher/Helm, generated by
|
||||
`sw-block ops generate-helm-values --protocol nvme`, and does not leak
|
||||
iSCSI/CHAP remediation. The remaining Phase 106 proof is the positive live
|
||||
path: CSI stage/publish agreement, app writer/reader I/O, and zero residue
|
||||
against the routable NVMe/TCP target.
|
||||
- Later protocol candidates: implement a real NVMe/RDMA target or characterize
|
||||
NVMe/TCP performance. Keep these separate so correctness, transport, and
|
||||
performance claims do not get mixed.
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
# Phase 106 D1/D2 NVMe/TCP Cross-Node Publish QA Sign-off
|
||||
|
||||
Status: PASS.
|
||||
|
||||
Validated source branch: `phase106-nvme-tcp-cross-node-live-attach`.
|
||||
|
||||
QA run: `20260629-005939-14c1`
|
||||
|
||||
Scenario: `testops/scenarios/nvme-tcp-cross-node-publish-chain.yaml`
|
||||
|
||||
Result: 18/18 PASS.
|
||||
|
||||
## Scope
|
||||
|
||||
This gate validates the D1/D2 publish-contract layer for cross-node NVMe/TCP:
|
||||
|
||||
- `blockvolume` keeps NVMe/TCP loopback-only by default.
|
||||
- `--allow-external-nvme-bind` is required for non-loopback NVMe/TCP.
|
||||
- `blockmaster` accepts and forwards `--launcher-external-nvme`.
|
||||
- The launcher renders node-address NVMe/TCP targets and the blockvolume opt-in flag.
|
||||
- Helm exposes `network.externalNVMe` and `ports.nvmeBase`.
|
||||
- `sw-block ops generate-helm-values --protocol nvme` emits external NVMe values, not external iSCSI or CHAP.
|
||||
|
||||
This gate does not claim D3 live cross-node writer/reader I/O.
|
||||
|
||||
## Terminal Evidence
|
||||
|
||||
```text
|
||||
phase106_nvme_tcp_cross_node_publish_status=ok
|
||||
live_io_claim=false
|
||||
performance_claim_allowed=false
|
||||
roce_claim_allowed=false
|
||||
default_loopback_preserved=true
|
||||
external_nvme_requires_opt_in=true
|
||||
external_nvme_auth_claim=false
|
||||
go_test_blockvolume=pass
|
||||
go_test_launcher=pass
|
||||
go_test_blockmaster=pass
|
||||
go_test_sw_block=pass
|
||||
generate_values_external_nvme=pass
|
||||
generated_protocol=nvme
|
||||
generated_external_nvme=true
|
||||
generated_external_iscsi=false
|
||||
generated_chap_enabled=false
|
||||
helm_template_external_nvme=pass
|
||||
helm_rendered_launcher_external_nvme=true
|
||||
helm_rendered_launcher_external_iscsi=false
|
||||
helm_rendered_chap=false
|
||||
helm_external_status_guard=pass
|
||||
```
|
||||
|
||||
## Verdict
|
||||
|
||||
D1/D2 can close. The product now has an explicit, charted, generated,
|
||||
non-loopback NVMe/TCP publish path for the next live attach gate.
|
||||
|
||||
D3 remains open: prove CSI publish/stage agreement and app writer/reader I/O
|
||||
across Kubernetes nodes using the routable NVMe/TCP target.
|
||||
@@ -0,0 +1,122 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
PRODUCT_ROOT="${1:-$(pwd)}"
|
||||
ARTIFACT_DIR="${SW_BLOCK_ARTIFACT_DIR:-${PRODUCT_ROOT}/results/phase106-nvme-tcp-cross-node-publish-gate}"
|
||||
SUMMARY="${ARTIFACT_DIR}/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
VALUES_FILE="${ARTIFACT_DIR}/values.nvme.yaml"
|
||||
RENDERED="${ARTIFACT_DIR}/helm-template-nvme.yaml"
|
||||
RENDERED_GUARD_LOG="${ARTIFACT_DIR}/helm-template-external-status-guard.log"
|
||||
|
||||
mkdir -p "${ARTIFACT_DIR}"
|
||||
: >"${SUMMARY}"
|
||||
|
||||
write_summary() {
|
||||
echo "$*" | tee -a "${SUMMARY}" >/dev/null
|
||||
}
|
||||
|
||||
write_summary "phase106_nvme_tcp_cross_node_publish_status=running"
|
||||
write_summary "live_io_claim=false"
|
||||
write_summary "performance_claim_allowed=false"
|
||||
write_summary "roce_claim_allowed=false"
|
||||
write_summary "default_loopback_preserved=true"
|
||||
write_summary "external_nvme_requires_opt_in=true"
|
||||
write_summary "external_nvme_auth_claim=false"
|
||||
|
||||
(
|
||||
cd "${PRODUCT_ROOT}"
|
||||
go test ./cmd/blockvolume -run 'TestParseFlags_NVMe' -count=1
|
||||
) >"${ARTIFACT_DIR}/go-test-blockvolume.log" 2>&1
|
||||
write_summary "go_test_blockvolume=pass"
|
||||
|
||||
(
|
||||
cd "${PRODUCT_ROOT}"
|
||||
go test ./core/launcher -run 'TestPhase106|TestG15d_K8sRenderer_RendersNVMe' -count=1
|
||||
) >"${ARTIFACT_DIR}/go-test-launcher.log" 2>&1
|
||||
write_summary "go_test_launcher=pass"
|
||||
|
||||
(
|
||||
cd "${PRODUCT_ROOT}"
|
||||
go test ./cmd/blockmaster -run 'TestParseFlags_LauncherExternalNVMe' -count=1
|
||||
) >"${ARTIFACT_DIR}/go-test-blockmaster.log" 2>&1
|
||||
write_summary "go_test_blockmaster=pass"
|
||||
|
||||
(
|
||||
cd "${PRODUCT_ROOT}"
|
||||
go test ./cmd/sw-block -run 'TestOpsGenerateHelmValuesMultiNodeExternalNVMe' -count=1
|
||||
) >"${ARTIFACT_DIR}/go-test-sw-block.log" 2>&1
|
||||
write_summary "go_test_sw_block=pass"
|
||||
|
||||
FAKE_BIN_DIR="$(mktemp -d "${TMPDIR:-/tmp}/phase106-kubectl.XXXXXX")"
|
||||
trap 'rm -rf "${FAKE_BIN_DIR}"' EXIT
|
||||
cat >"${FAKE_BIN_DIR}/kubectl" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
if [[ "$*" == "get nodes -o wide --no-headers" ]]; then
|
||||
cat <<'NODES'
|
||||
m01 Ready <none> 1d v1.34.4 192.168.1.181 <none> Ubuntu 24.04 kernel containerd
|
||||
m02 Ready <none> 1d v1.34.4 192.168.1.184 <none> Ubuntu 24.04 kernel containerd
|
||||
tp01 Ready <none> 1d v1.34.4 192.168.1.188 <none> Ubuntu 24.04 kernel containerd
|
||||
NODES
|
||||
exit 0
|
||||
fi
|
||||
echo "unexpected kubectl args: $*" >&2
|
||||
exit 1
|
||||
EOF
|
||||
chmod +x "${FAKE_BIN_DIR}/kubectl"
|
||||
|
||||
(
|
||||
cd "${PRODUCT_ROOT}"
|
||||
PATH="${FAKE_BIN_DIR}:${PATH}" go run ./cmd/sw-block ops generate-helm-values \
|
||||
--out "${VALUES_FILE}" \
|
||||
--replication-factor 3 \
|
||||
--protocol nvme
|
||||
) >"${ARTIFACT_DIR}/generate-helm-values.log" 2>&1
|
||||
grep -q '^network_mode=external-nvme$' "${ARTIFACT_DIR}/generate-helm-values.log"
|
||||
grep -q '^external_nvme=true$' "${ARTIFACT_DIR}/generate-helm-values.log"
|
||||
grep -q '^external_iscsi=false$' "${ARTIFACT_DIR}/generate-helm-values.log"
|
||||
grep -q '^chap_enabled=false$' "${ARTIFACT_DIR}/generate-helm-values.log"
|
||||
grep -q 'externalNVMe: true' "${VALUES_FILE}"
|
||||
grep -q 'externalISCSI: false' "${VALUES_FILE}"
|
||||
grep -q 'protocol: nvme' "${VALUES_FILE}"
|
||||
write_summary "generate_values_external_nvme=pass"
|
||||
write_summary "generated_protocol=nvme"
|
||||
write_summary "generated_external_nvme=true"
|
||||
write_summary "generated_external_iscsi=false"
|
||||
write_summary "generated_chap_enabled=false"
|
||||
|
||||
(
|
||||
cd "${PRODUCT_ROOT}"
|
||||
helm template sw-block charts/seaweed-block --namespace kube-system -f "${VALUES_FILE}"
|
||||
) >"${RENDERED}" 2>"${ARTIFACT_DIR}/helm-template-nvme.err"
|
||||
grep -q -- '--launcher-external-nvme' "${RENDERED}"
|
||||
grep -q -- '--launcher-external-status' "${RENDERED}"
|
||||
grep -q -- '--launcher-nvme-port-base=4420' "${RENDERED}"
|
||||
if grep -q -- '--launcher-external-iscsi' "${RENDERED}"; then
|
||||
echo "unexpected iSCSI launcher flag in NVMe render" >&2
|
||||
exit 1
|
||||
fi
|
||||
if grep -q -- '--launcher-iscsi-chap-secret-name' "${RENDERED}"; then
|
||||
echo "unexpected CHAP launcher flag in NVMe render" >&2
|
||||
exit 1
|
||||
fi
|
||||
write_summary "helm_template_external_nvme=pass"
|
||||
write_summary "helm_rendered_launcher_external_nvme=true"
|
||||
write_summary "helm_rendered_launcher_external_iscsi=false"
|
||||
write_summary "helm_rendered_chap=false"
|
||||
|
||||
set +e
|
||||
(
|
||||
cd "${PRODUCT_ROOT}"
|
||||
helm template sw-block charts/seaweed-block --namespace kube-system --set network.externalStatus=true
|
||||
) >"${RENDERED_GUARD_LOG}" 2>&1
|
||||
guard_status=$?
|
||||
set -e
|
||||
if [[ "${guard_status}" -eq 0 ]]; then
|
||||
echo "external status without external frontend unexpectedly rendered" >&2
|
||||
exit 1
|
||||
fi
|
||||
grep -q 'network.externalISCSI=true or network.externalNVMe=true' "${RENDERED_GUARD_LOG}"
|
||||
write_summary "helm_external_status_guard=pass"
|
||||
|
||||
write_summary "phase106_nvme_tcp_cross_node_publish_status=ok"
|
||||
@@ -244,6 +244,40 @@ func TestPhase105NVMETCPMultiHostTopologyGateIsReadOnlyAndClaimBounded(t *testin
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase106NVMETCPCrossNodePublishGateIsClaimBounded(t *testing.T) {
|
||||
root := repoRoot(t)
|
||||
raw, err := os.ReadFile(filepath.Join(root, "scripts", "run-phase106-nvme-tcp-cross-node-publish-gate.sh"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
script := string(raw)
|
||||
for _, want := range []string{
|
||||
"phase106_nvme_tcp_cross_node_publish_status=",
|
||||
"live_io_claim=false",
|
||||
"performance_claim_allowed=false",
|
||||
"roce_claim_allowed=false",
|
||||
"default_loopback_preserved=true",
|
||||
"external_nvme_requires_opt_in=true",
|
||||
"external_nvme_auth_claim=false",
|
||||
"generate_values_external_nvme=pass",
|
||||
"generated_external_nvme=true",
|
||||
"generated_external_iscsi=false",
|
||||
"helm_rendered_launcher_external_nvme=true",
|
||||
"helm_rendered_launcher_external_iscsi=false",
|
||||
"helm_rendered_chap=false",
|
||||
"helm_external_status_guard=pass",
|
||||
} {
|
||||
if !strings.Contains(script, want) {
|
||||
t.Fatalf("phase106 gate missing %q", want)
|
||||
}
|
||||
}
|
||||
for _, forbidden := range []string{"nvme connect", "nvme disconnect", "kubectl patch", "kubectl delete"} {
|
||||
if strings.Contains(script, forbidden) {
|
||||
t.Fatalf("phase106 publish gate must not mutate host or Kubernetes state, found %q", forbidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func repoRoot(t *testing.T) string {
|
||||
t.Helper()
|
||||
dir, err := os.Getwd()
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
name: nvme-tcp-cross-node-publish-chain
|
||||
timeout: 20m
|
||||
|
||||
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: publish_gate
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 15m
|
||||
cmd: "rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish && cd {{ product_root }} && bash scripts/run-phase106-nvme-tcp-cross-node-publish-gate.sh {{ product_root }}"
|
||||
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^phase106_nvme_tcp_cross_node_publish_status=ok$"
|
||||
save_as: phase106_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ phase106_ok }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^generated_external_nvme=true$"
|
||||
save_as: external_nvme
|
||||
- action: assert_greater
|
||||
actual: "{{ external_nvme }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^generated_external_iscsi=false$"
|
||||
save_as: no_external_iscsi_values
|
||||
- action: assert_greater
|
||||
actual: "{{ no_external_iscsi_values }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^helm_rendered_launcher_external_nvme=true$"
|
||||
save_as: helm_external_nvme
|
||||
- action: assert_greater
|
||||
actual: "{{ helm_external_nvme }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^helm_rendered_launcher_external_iscsi=false$"
|
||||
save_as: no_external_iscsi_helm
|
||||
- action: assert_greater
|
||||
actual: "{{ no_external_iscsi_helm }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^helm_rendered_chap=false$"
|
||||
save_as: no_chap
|
||||
- action: assert_greater
|
||||
actual: "{{ no_chap }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^live_io_claim=false$"
|
||||
save_as: no_live_io_claim
|
||||
- action: assert_greater
|
||||
actual: "{{ no_live_io_claim }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish/gate/phase106-nvme-tcp-cross-node-publish-summary.txt"
|
||||
pattern: "^roce_claim_allowed=false$"
|
||||
save_as: no_roce_claim
|
||||
- action: assert_greater
|
||||
actual: "{{ no_roce_claim }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: collect
|
||||
always: true
|
||||
actions:
|
||||
- action: collect_path
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase106-nvme-publish"
|
||||
name: "remote-phases"
|
||||
ignore_error: true
|
||||
Reference in new issue
Block a user