mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 02:27:26 +01:00
Merge pull request #58 from seaweedfs/phase107-nvme-tcp-multivolume-cross-node-isolation
phase107: prove NVMe/TCP multivolume isolation
This commit is contained in:
commit
06bb00de6a
7 files changed
+403
-94
No files matched your search
@@ -582,6 +582,23 @@ func TestPhase20FirstVolumeScriptPinsUserLoop(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase107MultiVolumeScriptPinsProtocolAndNodeSelector(t *testing.T) {
|
||||
body := g15dReadFile(t, "scripts", "run-multi-volume-example.sh")
|
||||
for _, want := range []string{
|
||||
"SW_BLOCK_MULTI_VOLUME_PROTOCOL",
|
||||
"SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR",
|
||||
"sw-block.seaweedfs.com/protocol: \\\"nvme\\\"",
|
||||
"protocol=$MULTI_VOLUME_PROTOCOL",
|
||||
"app_node_selector=${MULTI_VOLUME_NODE_SELECTOR:-none}",
|
||||
"kubernetes.io/hostname",
|
||||
"SW_BLOCK_MULTI_VOLUME_PROTOCOL must be iscsi or nvme",
|
||||
} {
|
||||
if !strings.Contains(body, want) {
|
||||
t.Fatalf("multi-volume wrapper missing %q", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase20FirstVolumeScenarioPinsPublishedUserGate(t *testing.T) {
|
||||
body := g15dReadFile(t, "testops", "scenarios", "activation-day1-first-volume-chain.yaml")
|
||||
for _, want := range []string{
|
||||
|
||||
@@ -511,6 +511,15 @@ Recommended order from here:
|
||||
`ready/first_volume_verified`, writer/reader verified, and strict cleanup
|
||||
audit `cleanup_status=ok`. This still excludes RoCE, performance/SLO,
|
||||
broad compatibility, and production HA.
|
||||
65. Phase 107: NVMe/TCP Multi-Volume Cross-Node Isolation. **Closed
|
||||
2026-06-29, live k3s PASS**
|
||||
Proved the new routable NVMe/TCP path with two PVCs in the supported lab:
|
||||
`protocol=nvme`, app pods pinned to `m02`, `writer_verified_count=2`,
|
||||
`reader_verified_count=2`, managed volumes
|
||||
`ready/first_volume_verified`, two distinct volume IDs, two distinct NVMe
|
||||
NQNs, no loopback publish target, no cross-volume identity mix-up, and
|
||||
strict cleanup audit `cleanup_status=ok`. This still excludes RoCE,
|
||||
performance/SLO, broad compatibility, production HA, and broader scale.
|
||||
|
||||
The internal release-train contract is
|
||||
`internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close
|
||||
|
||||
@@ -1,139 +1,107 @@
|
||||
# Current Plan: Phase 106 NVMe/TCP Cross-Node Non-Loopback Live Attach
|
||||
# Current Plan: Phase 107 NVMe/TCP Multi-Volume Cross-Node Isolation
|
||||
|
||||
Status: closed. 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 passed
|
||||
on 2026-06-29 (`nvme-tcp-cross-node-live-attach-chain`, run
|
||||
`20260629-021338-5089`, 31/31 PASS) with a separate strict cleanup audit
|
||||
Status: closed. Live gate passed on 2026-06-29
|
||||
(`nvme-tcp-cross-node-multivolume-isolation-chain`, run
|
||||
`20260629-142400-2032`, 30/30 PASS) with a separate strict cleanup audit
|
||||
returning `cleanup_status=ok`.
|
||||
|
||||
## Why This Is Next
|
||||
|
||||
Phase 103 proved the host can support NVMe/TCP preflight. Phase 104 proved the
|
||||
product must not claim RoCE/NVMe-RDMA. Phase 105 proved the topology boundary:
|
||||
cross-node loopback NVMe/TCP evidence is blocked with
|
||||
`publish_target_loopback_cross_node`, no false `Ready=True`, and no iSCSI-only
|
||||
remediation.
|
||||
|
||||
The next useful NVMe feature is therefore the positive live path that Phase 105
|
||||
explicitly did not claim:
|
||||
Phase 106 proved the positive single-PVC cross-node NVMe/TCP path:
|
||||
|
||||
```text
|
||||
blockvolume publishes a non-loopback NVMe/TCP target on node B
|
||||
CSI stages it for a workload on node A
|
||||
writer/reader I/O succeeds
|
||||
status surfaces Ready only after live evidence
|
||||
blockvolume on m01
|
||||
workload on m02
|
||||
publish_target=192.168.1.181:4420
|
||||
protocol=nvme
|
||||
writer/reader verified
|
||||
managed_volume=ready reason=first_volume_verified
|
||||
```
|
||||
|
||||
The next risk is not another transport claim. It is isolation: when more than
|
||||
one PVC uses the new routable NVMe/TCP path, the product must not collapse
|
||||
volume identity, reuse the wrong NQN, or surface one volume's target as another
|
||||
volume's authority.
|
||||
|
||||
## Product Goal
|
||||
|
||||
Make cross-node NVMe/TCP attach a real gated capability for the lab path, not a
|
||||
model-only promise.
|
||||
Prove the supported-lab NVMe/TCP cross-node path handles multiple PVCs with
|
||||
independent identities.
|
||||
|
||||
Required behavior:
|
||||
|
||||
- loopback target across nodes stays blocked by Phase 105;
|
||||
- non-loopback target across nodes can be staged by CSI;
|
||||
- the published NQN/NSID/address in master status, CSI publish context, node
|
||||
stage evidence, report, dashboard, and CRD status agree;
|
||||
- app writer/reader verifies data through the mounted volume;
|
||||
- cleanup leaves zero Kubernetes, NVMe, process, and host residue.
|
||||
- two PVCs can be provisioned with `protocol=nvme`;
|
||||
- workload pods are pinned to a different Kubernetes node from the primary
|
||||
blockvolume node;
|
||||
- every writer and reader verifies data through its own PVC;
|
||||
- each managed volume reports `ready/first_volume_verified`;
|
||||
- NVMe NQNs remain distinct per volume;
|
||||
- no loopback target is used for cross-node attach;
|
||||
- cleanup leaves zero residue in the strict verifier.
|
||||
|
||||
## D1: Publish Target Selection
|
||||
## D1: Multi-Volume Helper Protocol Selection
|
||||
|
||||
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.
|
||||
|
||||
Status: closed for the publish-contract slice. Implemented:
|
||||
`scripts/run-multi-volume-example.sh` now accepts:
|
||||
|
||||
```text
|
||||
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
|
||||
SW_BLOCK_MULTI_VOLUME_PROTOCOL=iscsi|nvme
|
||||
SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR=<kubernetes node name>
|
||||
```
|
||||
|
||||
Verified by `scripts/run-phase106-nvme-tcp-cross-node-publish-gate.sh`.
|
||||
For `nvme`, the helper renders both CSI protocol keys in the StorageClass:
|
||||
|
||||
## D2: CSI Publish / Stage Evidence
|
||||
|
||||
Confirm CSI publish context carries the non-loopback NVMe/TCP target and node
|
||||
stage records the same NQN/NSID/address.
|
||||
|
||||
No status surface may claim Ready if publish context and stage evidence
|
||||
disagree.
|
||||
|
||||
Status: closed. The chart and values produce the intended non-loopback NVMe
|
||||
target configuration, and D3 proved the mounted cross-node workload sees the
|
||||
same routable NVMe target through the managed-volume report.
|
||||
|
||||
## D3: Live Cross-Node Writer / Reader Gate
|
||||
|
||||
Run a TestOps scenario that pins or schedules:
|
||||
|
||||
```text
|
||||
blockvolume_node=m02
|
||||
workload_node=m01
|
||||
publish_target=<m02 routable IP>:4420
|
||||
protocol=nvme
|
||||
```yaml
|
||||
sw-block.seaweedfs.com/protocol: "nvme"
|
||||
protocol: "nvme"
|
||||
```
|
||||
|
||||
Expected evidence:
|
||||
The node selector pins all generated writer/reader pods to the selected
|
||||
application node.
|
||||
|
||||
## D2: Live Multi-Volume Cross-Node Gate
|
||||
|
||||
Scenario:
|
||||
|
||||
```text
|
||||
writer_verified=true
|
||||
reader_verified=true
|
||||
status=ready
|
||||
reason=first_volume_verified
|
||||
nvme_target_loopback=false
|
||||
ready_true_allowed_only_after_reader=true
|
||||
testops/scenarios/nvme-tcp-cross-node-multivolume-isolation-chain.yaml
|
||||
```
|
||||
|
||||
Status: closed. Run `20260629-021338-5089` proved:
|
||||
Terminal evidence:
|
||||
|
||||
```text
|
||||
phase106_nvme_tcp_cross_node_live_status=ok
|
||||
blockvolume_node=m01
|
||||
phase107_nvme_tcp_multivolume_isolation_status=ok
|
||||
app_node=m02
|
||||
publish_target=192.168.1.181:4420
|
||||
publish_target_loopback=false
|
||||
protocol=nvme
|
||||
managed_volume_count=2
|
||||
writer_verified_count=2
|
||||
reader_verified_count=2
|
||||
managed_volume_status=ready
|
||||
managed_volume_reason=first_volume_verified
|
||||
writer_verified=true
|
||||
reader_verified=true
|
||||
distinct_volume_ids=2
|
||||
distinct_nvme_nqns=2
|
||||
publish_target_loopback=false
|
||||
cross_volume_identity_mixup=false
|
||||
```
|
||||
|
||||
The live scenario uses already-built local images when present to stay within
|
||||
the TestOps runner wall-clock budget. A strict cleanup audit was then run
|
||||
outside the scenario against the same lab teardown artifacts and returned all
|
||||
residue counts zero.
|
||||
|
||||
## D4: Negative Regression
|
||||
|
||||
Keep the Phase 105 negative topology scenario in the suite:
|
||||
Strict cleanup audit:
|
||||
|
||||
```text
|
||||
publish_target=127.0.0.1:4420
|
||||
blockvolume_node=m02
|
||||
workload_node=m01
|
||||
status=blocked
|
||||
reason=publish_target_loopback_cross_node
|
||||
ready_true_count=0
|
||||
cleanup_status=ok
|
||||
k8s_residue_count=0
|
||||
iscsi_residue_count=0
|
||||
process_residue_count=0
|
||||
multipath_residue_count=0
|
||||
hostpath_residue_count=0
|
||||
failure_count=0
|
||||
```
|
||||
|
||||
Status: covered by Phase 105 and retained as the negative counterpart. Phase
|
||||
106 did not weaken the loopback-cross-node block.
|
||||
|
||||
## Non-Claims
|
||||
|
||||
Phase 106 still does not claim:
|
||||
Phase 107 still does not claim:
|
||||
|
||||
- RoCE/NVMe-RDMA;
|
||||
- multi-path failover across real hosts;
|
||||
- performance or SLO;
|
||||
- broad distro/kernel compatibility;
|
||||
- production HA.
|
||||
- production HA;
|
||||
- multi-path failover across real hosts;
|
||||
- more than the supported-lab two-PVC isolation gate.
|
||||
@@ -260,6 +260,12 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
|
||||
(`192.168.1.181:4420`) with managed-volume status
|
||||
`ready/first_volume_verified`; a separate strict cleanup audit returned zero
|
||||
residue.
|
||||
- Phase 107 NVMe/TCP Multi-Volume Cross-Node Isolation is closed for the
|
||||
supported lab path. Two PVCs using `protocol=nvme` can be mounted by
|
||||
writer/reader pods pinned to another Kubernetes node; both volumes report
|
||||
`ready/first_volume_verified`, expose distinct volume IDs and distinct NVMe
|
||||
NQNs, avoid loopback publish targets, and avoid cross-volume identity mix-up.
|
||||
A separate strict cleanup audit returned zero residue.
|
||||
- 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.
|
||||
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
# Phase 107 NVMe/TCP Multi-Volume Isolation QA Sign-off
|
||||
|
||||
Status: PASS.
|
||||
|
||||
Validated source branch:
|
||||
`phase107-nvme-tcp-multivolume-cross-node-isolation`.
|
||||
|
||||
Scenario:
|
||||
`testops/scenarios/nvme-tcp-cross-node-multivolume-isolation-chain.yaml`
|
||||
|
||||
QA run: `20260629-142400-2032`
|
||||
|
||||
Result: 30/30 PASS.
|
||||
|
||||
## Scope
|
||||
|
||||
This gate validates the next NVMe/TCP risk after the Phase 106 single-PVC
|
||||
cross-node attach path: two PVCs must use the routable NVMe/TCP path without
|
||||
collapsing volume identity or reusing the wrong NVMe NQN.
|
||||
|
||||
The gate proves:
|
||||
|
||||
- the multi-volume helper can render `protocol=nvme` StorageClass parameters;
|
||||
- writer and reader pods can be pinned to the application node;
|
||||
- two PVCs provision and verify data through their own mounted volumes;
|
||||
- both managed volumes report `ready/first_volume_verified`;
|
||||
- each volume has a distinct `volume_id` and distinct NVMe NQN;
|
||||
- cross-node publish targets are not loopback addresses;
|
||||
- strict cleanup leaves no residue.
|
||||
|
||||
The TestOps runner has a short wall-clock cap for a single scenario, so the
|
||||
strict cleanup verifier was run immediately after the passing product scenario
|
||||
as a separate QA command against the same lab teardown.
|
||||
|
||||
## Terminal Evidence
|
||||
|
||||
```text
|
||||
phase107_nvme_tcp_multivolume_isolation_status=ok
|
||||
app_node=m02
|
||||
protocol=nvme
|
||||
managed_volume_count=2
|
||||
writer_verified_count=2
|
||||
reader_verified_count=2
|
||||
managed_volume_status=ready
|
||||
managed_volume_reason=first_volume_verified
|
||||
distinct_volume_ids=2
|
||||
distinct_nvme_nqns=2
|
||||
publish_target_loopback=false
|
||||
cross_volume_identity_mixup=false
|
||||
```
|
||||
|
||||
The multi-volume helper summary also reported:
|
||||
|
||||
```text
|
||||
multi_volume_status=ok
|
||||
namespace=default
|
||||
storageclass=sw-block-multi
|
||||
protocol=nvme
|
||||
app_node_selector=m02
|
||||
requested_volume_count=2
|
||||
replication_factor=1
|
||||
writer_verified_count=2
|
||||
reader_verified_count=2
|
||||
managed_volume_count=2
|
||||
cleanup_status=external_to_script
|
||||
```
|
||||
|
||||
Strict cleanup audit:
|
||||
|
||||
```text
|
||||
cleanup_status=ok
|
||||
k8s_residue_count=0
|
||||
iscsi_residue_count=0
|
||||
process_residue_count=0
|
||||
multipath_residue_count=0
|
||||
hostpath_residue_count=0
|
||||
failure_count=0
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
The live scenario reuses already-built local images when present so repeated
|
||||
runner executions stay under the runner wall-clock cap. The final PASS run used
|
||||
the cached images and collected the authoritative live multi-volume isolation
|
||||
evidence above.
|
||||
|
||||
## Verdict
|
||||
|
||||
Phase 107 can close. The supported-lab NVMe/TCP path now has both:
|
||||
|
||||
- Phase 106: single-PVC cross-node writer/reader attach;
|
||||
- Phase 107: two-PVC cross-node multi-volume identity and NQN isolation.
|
||||
|
||||
Non-claims remain: no RoCE/NVMe-RDMA, no performance/SLO, no broad
|
||||
distro/kernel compatibility, no production HA, and no multi-path failover
|
||||
claim across real hosts.
|
||||
@@ -12,6 +12,8 @@ POD_PREFIX="${SW_BLOCK_MULTI_VOLUME_POD_PREFIX:-sw-block-multi}"
|
||||
CHAP_SECRET_NAME="${SW_BLOCK_ISCSI_CHAP_SECRET_NAME:-sw-block-iscsi-chap}"
|
||||
MASTER_PORT="${SW_BLOCK_MASTER_PORT_FORWARD_PORT:-}"
|
||||
CLEANUP_REQUESTED="${SW_BLOCK_MULTI_VOLUME_CLEANUP:-1}"
|
||||
MULTI_VOLUME_PROTOCOL="${SW_BLOCK_MULTI_VOLUME_PROTOCOL:-iscsi}"
|
||||
MULTI_VOLUME_NODE_SELECTOR="${SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR:-}"
|
||||
|
||||
MULTI_VOLUME_STATUS="ok"
|
||||
FAILED_PHASE=""
|
||||
@@ -108,6 +110,10 @@ render_storageclass() {
|
||||
echo "allowVolumeExpansion: false"
|
||||
echo "parameters:"
|
||||
echo " replicationFactor: \"$REPLICATION_FACTOR\""
|
||||
if [[ "$MULTI_VOLUME_PROTOCOL" == "nvme" ]]; then
|
||||
echo " sw-block.seaweedfs.com/protocol: \"nvme\""
|
||||
echo " protocol: \"nvme\""
|
||||
fi
|
||||
if kubectl -n "$NAMESPACE" get secret "$CHAP_SECRET_NAME" >/dev/null 2>&1; then
|
||||
echo " csi.storage.k8s.io/node-stage-secret-name: \"$CHAP_SECRET_NAME\""
|
||||
echo " csi.storage.k8s.io/node-stage-secret-namespace: \"$NAMESPACE\""
|
||||
@@ -136,6 +142,21 @@ YAML
|
||||
echo "$out"
|
||||
}
|
||||
|
||||
inject_pod_node_selector() {
|
||||
local path="$1"
|
||||
[[ -n "$MULTI_VOLUME_NODE_SELECTOR" ]] || return 0
|
||||
awk -v node="$MULTI_VOLUME_NODE_SELECTOR" '
|
||||
/^spec:[[:space:]]*$/ {
|
||||
print
|
||||
print " nodeSelector:"
|
||||
print " kubernetes.io/hostname: \"" node "\""
|
||||
next
|
||||
}
|
||||
{ print }
|
||||
' "$path" >"$path.tmp"
|
||||
mv "$path.tmp" "$path"
|
||||
}
|
||||
|
||||
render_writer() {
|
||||
local idx="$1"
|
||||
local out="$ARTIFACT_DIR/manifests/writer-$idx.yaml"
|
||||
@@ -169,6 +190,7 @@ spec:
|
||||
persistentVolumeClaim:
|
||||
claimName: ${PVC_PREFIX}-${idx}
|
||||
YAML
|
||||
inject_pod_node_selector "$out"
|
||||
echo "$out"
|
||||
}
|
||||
|
||||
@@ -204,6 +226,7 @@ spec:
|
||||
persistentVolumeClaim:
|
||||
claimName: ${PVC_PREFIX}-${idx}
|
||||
YAML
|
||||
inject_pod_node_selector "$out"
|
||||
echo "$out"
|
||||
}
|
||||
|
||||
@@ -309,6 +332,8 @@ write_summary() {
|
||||
fi
|
||||
echo "namespace=$NAMESPACE"
|
||||
echo "storageclass=$STORAGECLASS_NAME"
|
||||
echo "protocol=$MULTI_VOLUME_PROTOCOL"
|
||||
echo "app_node_selector=${MULTI_VOLUME_NODE_SELECTOR:-none}"
|
||||
echo "requested_volume_count=$VOLUME_COUNT"
|
||||
echo "replication_factor=$REPLICATION_FACTOR"
|
||||
echo "writer_verified_count=$writer_count"
|
||||
@@ -325,6 +350,10 @@ if [[ "$NAMESPACE" != "default" ]]; then
|
||||
echo "SW_BLOCK_APP_NAMESPACE=$NAMESPACE is not supported by this helper; use default" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [[ "$MULTI_VOLUME_PROTOCOL" != "iscsi" && "$MULTI_VOLUME_PROTOCOL" != "nvme" ]]; then
|
||||
echo "SW_BLOCK_MULTI_VOLUME_PROTOCOL must be iscsi or nvme" >&2
|
||||
exit 2
|
||||
fi
|
||||
case "$VOLUME_COUNT" in
|
||||
''|*[!0-9]*|0)
|
||||
echo "SW_BLOCK_MULTI_VOLUME_COUNT must be a positive integer; got: $VOLUME_COUNT" >&2
|
||||
@@ -338,6 +367,8 @@ fi
|
||||
log "artifact_dir=$ARTIFACT_DIR"
|
||||
log "namespace=$NAMESPACE"
|
||||
log "volume_count=$VOLUME_COUNT"
|
||||
log "protocol=$MULTI_VOLUME_PROTOCOL"
|
||||
log "app_node_selector=${MULTI_VOLUME_NODE_SELECTOR:-none}"
|
||||
log "master_port=$MASTER_PORT"
|
||||
|
||||
kubectl apply -f "$(render_storageclass)" | tee "$ARTIFACT_DIR/apply-storageclass.log"
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
name: nvme-tcp-cross-node-multivolume-isolation-chain
|
||||
timeout: 45m
|
||||
|
||||
env:
|
||||
product_root: "/tmp/seaweed_block"
|
||||
ssh_key: "C:\\work\\dev_server\\testdev_key"
|
||||
helm_release: "sw-block"
|
||||
helm_namespace: "kube-system"
|
||||
volume_count: "2"
|
||||
|
||||
topology:
|
||||
nodes:
|
||||
m02:
|
||||
host: 192.168.1.184
|
||||
user: testdev
|
||||
key: "{{ ssh_key }}"
|
||||
|
||||
phases:
|
||||
- name: pre_clean
|
||||
actions:
|
||||
- action: pre_run_cleanup
|
||||
node: m02
|
||||
kill_patterns: "blockmaster,blockvolume,blockcsi,iscsi-target"
|
||||
nvme_disconnect: "true"
|
||||
iscsi_logout_prefix: "iqn.2026-05.io.seaweedfs"
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 5m
|
||||
cmd: "helm status {{ helm_release }} --namespace {{ helm_namespace }} >/dev/null 2>&1 && helm uninstall {{ helm_release }} --namespace {{ helm_namespace }} --wait --timeout 240s || true; kubectl -n default delete pod -l sw-block-test=multi-volume --ignore-not-found=true --wait=true --timeout=45s || true; for i in 1 2 3; do kubectl -n default delete pod sw-block-multi-writer-$i sw-block-multi-reader-$i --ignore-not-found=true --wait=true --timeout=45s || true; kubectl -n default delete pvc sw-block-multi-pvc-$i --ignore-not-found=true --wait=true --timeout=45s || true; done; kubectl delete storageclass sw-block-multi --ignore-not-found=true --wait=true --timeout=45s || true; sudo -n nvme disconnect-all >/dev/null 2>&1 || true; rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/bin /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/build /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/multi-volume /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/asserts /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/cleanup"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
|
||||
- name: build_and_import_images
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 10m
|
||||
cmd: "cd {{ product_root }} && if docker image inspect sw-block:local sw-block-csi:local >/dev/null 2>&1; then mkdir -p \"$SW_BLOCK_ARTIFACT_DIR\"; echo \"SW_BLOCK_IMAGE_ID=$(docker image inspect sw-block:local --format '{{.Id}}')\" > \"$SW_BLOCK_ARTIFACT_DIR/alpha-images.env\"; echo \"SW_BLOCK_CSI_IMAGE_ID=$(docker image inspect sw-block-csi:local --format '{{.Id}}')\" >> \"$SW_BLOCK_ARTIFACT_DIR/alpha-images.env\"; echo cached_images=true >> \"$SW_BLOCK_ARTIFACT_DIR/alpha-images.env\"; else bash scripts/build-alpha-images.sh {{ product_root }}; fi"
|
||||
env.SW_BLOCK_IMPORT_K3S: "1"
|
||||
env.SW_BLOCK_IMPORT_K3S_NODES: "192.168.1.181"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_USER: "testdev"
|
||||
env.SW_BLOCK_IMPORT_K3S_SSH_KEY: "{{ ssh_key }}"
|
||||
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/build"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/build/alpha-images.env"
|
||||
pattern: "SW_BLOCK_IMAGE_ID="
|
||||
save_as: image_id_count
|
||||
- action: assert_greater
|
||||
actual: "{{ image_id_count }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: generate_values
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 4m
|
||||
cmd: "cd {{ product_root }} && go build -o /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/bin/sw-block ./cmd/sw-block && /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/bin/sw-block ops generate-helm-values --kubeconfig /etc/rancher/k3s/k3s.yaml --out /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values/values.nvme.yaml --image sw-block:local --csi-image sw-block-csi:local --protocol nvme --node-limit 2 > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values/generate.stdout.txt && python3 - <<'PY'\nfrom pathlib import Path\nbase=Path('/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume')\nnodes=[]\ncur=None\nfor raw in (base/'values/values.nvme.yaml').read_text().splitlines():\n line=raw.strip()\n if line.startswith('- name:'):\n if cur:\n nodes.append(cur)\n cur={}\n if cur is None:\n continue\n if line.startswith('kubernetesNode:'):\n cur['kubernetesNode']=line.split(':',1)[1].strip().strip('\"')\nif cur:\n nodes.append(cur)\nif len(nodes) < 2:\n raise SystemExit('need at least two generated nodes')\n(base/'values/blockvolume-node.txt').write_text(nodes[0]['kubernetesNode']+'\\n')\n(base/'values/app-node.txt').write_text(nodes[1]['kubernetesNode']+'\\n')\nPY"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values/generate.stdout.txt"
|
||||
pattern: "^network_mode=external-nvme$"
|
||||
save_as: external_nvme_count
|
||||
- action: assert_greater
|
||||
actual: "{{ external_nvme_count }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: helm_install_stack
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 12m
|
||||
cmd: "cd {{ product_root }} && helm lint charts/seaweed-block -f /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values/values.nvme.yaml > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install/helm-lint.txt && helm template {{ helm_release }} charts/seaweed-block --namespace {{ helm_namespace }} -f /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values/values.nvme.yaml > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install/helm-template.yaml && grep -q -- '--launcher-external-nvme' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install/helm-template.yaml && ! grep -q -- '--launcher-external-iscsi' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install/helm-template.yaml && helm install {{ helm_release }} charts/seaweed-block --namespace {{ helm_namespace }} --create-namespace -f /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values/values.nvme.yaml --wait --timeout 10m > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install/helm-install.txt && kubectl -n {{ helm_namespace }} get deploy,ds,pods,svc -o wide > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install/kube-system.after-install.txt"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/install/helm-install.txt"
|
||||
pattern: "STATUS: deployed"
|
||||
save_as: helm_deployed_count
|
||||
- action: assert_greater
|
||||
actual: "{{ helm_deployed_count }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: multi_volume_user_loop
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 10m
|
||||
cmd: "set -e; APP_NODE=$(cat /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/values/app-node.txt); cd {{ product_root }} && SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR=\"$APP_NODE\" SW_BLOCK_MULTI_VOLUME_PROTOCOL=nvme bash scripts/run-multi-volume-example.sh {{ product_root }}"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
env.SW_BLOCK_ARTIFACT_DIR: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/multi-volume"
|
||||
env.SW_BLOCK_MULTI_VOLUME_COUNT: "{{ volume_count }}"
|
||||
env.SW_BLOCK_MULTI_VOLUME_CLEANUP: "0"
|
||||
env.SW_BLOCK_CLI: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/bin/sw-block"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/multi-volume/multi-volume-summary.txt"
|
||||
pattern: "^multi_volume_status=ok$"
|
||||
save_as: multi_volume_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ multi_volume_ok }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: isolation_asserts
|
||||
actions:
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/multi-volume/multi-volume-summary.txt"
|
||||
pattern: "^protocol=nvme$"
|
||||
save_as: protocol_nvme
|
||||
- action: assert_greater
|
||||
actual: "{{ protocol_nvme }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/multi-volume/multi-volume-summary.txt"
|
||||
pattern: "^writer_verified_count=2$"
|
||||
save_as: writer_count_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ writer_count_ok }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/multi-volume/multi-volume-summary.txt"
|
||||
pattern: "^reader_verified_count=2$"
|
||||
save_as: reader_count_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ reader_count_ok }}"
|
||||
threshold: "0"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/multi-volume/multi-volume-summary.txt"
|
||||
pattern: "^managed_volume_count=2$"
|
||||
save_as: managed_volume_count_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ managed_volume_count_ok }}"
|
||||
threshold: "0"
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 2m
|
||||
cmd: "python3 - <<'PY'\nfrom pathlib import Path\nimport re\nbase=Path('/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume')\napp_node=(base/'values/app-node.txt').read_text().strip()\nsummary=(base/'multi-volume/status/report/summary.txt').read_text().splitlines()\nmanaged=[line for line in summary if line.startswith('managed_volume=')]\nnvme=[line for line in summary if line.startswith('managed_volume_nvme=')]\nif len(managed) != 2:\n raise SystemExit(f'managed_volume_count={len(managed)}')\nif len(nvme) != 2:\n raise SystemExit(f'nvme_line_count={len(nvme)}')\nready=[line for line in managed if ' status=ready ' in line and ' reason=first_volume_verified' in line]\nif len(ready) != 2:\n raise SystemExit('not all managed volumes are ready/first_volume_verified')\nids=[]\nnqns=[]\naddrs=[]\nfor line in managed:\n m=re.match(r'managed_volume=([^ ]+)', line)\n if m:\n ids.append(m.group(1))\nfor line in nvme:\n for key, sink in [('nqn', nqns), ('addr', addrs)]:\n m=re.search(rf' {key}=([^ ]+)', line)\n if m:\n sink.append(m.group(1))\nif len(set(ids)) != 2:\n raise SystemExit(f'volume identity collapsed: {ids}')\nif len(set(nqns)) != 2:\n raise SystemExit(f'nqn identity collapsed: {nqns}')\nif any(a.startswith('127.') or a.startswith('localhost') for a in addrs):\n raise SystemExit(f'loopback nvme addr observed: {addrs}')\nif not all(':4420' in a or ':442' in a for a in addrs):\n raise SystemExit(f'unexpected nvme addrs: {addrs}')\ntext='\\n'.join([\n 'phase107_nvme_tcp_multivolume_isolation_status=ok',\n f'app_node={app_node}',\n 'protocol=nvme',\n 'managed_volume_count=2',\n 'writer_verified_count=2',\n 'reader_verified_count=2',\n 'managed_volume_status=ready',\n 'managed_volume_reason=first_volume_verified',\n f'distinct_volume_ids={len(set(ids))}',\n f'distinct_nvme_nqns={len(set(nqns))}',\n 'publish_target_loopback=false',\n 'cross_volume_identity_mixup=false',\n])+'\\n'\n(base/'asserts/phase107-isolation-summary.txt').write_text(text)\nPY"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/asserts/phase107-isolation-summary.txt"
|
||||
pattern: "^phase107_nvme_tcp_multivolume_isolation_status=ok$"
|
||||
save_as: isolation_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ isolation_ok }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: helm_uninstall_cleanup
|
||||
always: true
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 3m
|
||||
cmd: "helm status {{ helm_release }} --namespace {{ helm_namespace }} >/dev/null 2>&1 && helm uninstall {{ helm_release }} --namespace {{ helm_namespace }} --wait --timeout 45s > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume/cleanup/helm-uninstall.txt || true"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 3m
|
||||
cmd: "for i in 1 2 3; do kubectl -n default delete pod sw-block-multi-writer-$i sw-block-multi-reader-$i --ignore-not-found=true --wait=true --timeout=45s || true; kubectl -n default delete pvc sw-block-multi-pvc-$i --ignore-not-found=true --wait=true --timeout=45s || true; done; kubectl delete storageclass sw-block-multi --ignore-not-found=true --wait=true --timeout=45s || true"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 1m
|
||||
cmd: "kubectl get pv --no-headers | awk '/sw-block-multi/ {print $1}' | xargs -r -n1 kubectl patch pv --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl get pv --no-headers | awk '/sw-block-multi/ {print $1}' | xargs -r kubectl delete pv --wait=false >/dev/null 2>&1 || true; sudo -n nvme disconnect-all >/dev/null 2>&1 || true"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 1m
|
||||
cmd: "sleep 5; kubectl get pv --no-headers | awk '/sw-block-multi/ {print $1}' | xargs -r -n1 kubectl patch pv --type=merge -p '{\"metadata\":{\"finalizers\":[]}}' >/dev/null 2>&1 || true; kubectl get pv --no-headers | awk '/sw-block-multi/ {print $1}' | xargs -r kubectl delete pv --wait=false >/dev/null 2>&1 || true; sudo -n nvme disconnect-all >/dev/null 2>&1 || true"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
|
||||
- name: collect
|
||||
always: true
|
||||
actions:
|
||||
- action: collect_path
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase107-nvme-multivolume"
|
||||
name: "remote-phases"
|
||||
ignore_error: true
|
||||
Reference in new issue
Block a user