mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 11:07:31 +01:00
Merge pull request #59 from seaweedfs/phase108-nvme-tcp-multivolume-lifecycle-soak
phase108: harden NVMe/TCP multivolume lifecycle cleanup
This commit is contained in:
commit
fd281fc873
7 files changed
+409
-64
No files matched your search
@@ -591,6 +591,9 @@ func TestPhase107MultiVolumeScriptPinsProtocolAndNodeSelector(t *testing.T) {
|
||||
"protocol=$MULTI_VOLUME_PROTOCOL",
|
||||
"app_node_selector=${MULTI_VOLUME_NODE_SELECTOR:-none}",
|
||||
"kubernetes.io/hostname",
|
||||
"list_blockvolume_pods",
|
||||
"list_matching_pvs",
|
||||
"count_seaweed_nvme_subsystems",
|
||||
"SW_BLOCK_MULTI_VOLUME_PROTOCOL must be iscsi or nvme",
|
||||
} {
|
||||
if !strings.Contains(body, want) {
|
||||
@@ -599,6 +602,24 @@ func TestPhase107MultiVolumeScriptPinsProtocolAndNodeSelector(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase108NVMeLifecycleScenarioAssertsResidueFreeCycles(t *testing.T) {
|
||||
body := g15dReadFile(t, "testops", "scenarios", "nvme-tcp-cross-node-multivolume-lifecycle-soak-chain.yaml")
|
||||
for _, want := range []string{
|
||||
"phase108_nvme_tcp_multivolume_lifecycle_soak_status=ok",
|
||||
"cycle_count: \"2\"",
|
||||
"SW_BLOCK_MULTI_VOLUME_PROTOCOL=nvme",
|
||||
"SW_BLOCK_MULTI_VOLUME_CLEANUP=1",
|
||||
"cycle_{cycle}_cleanup_status=ok",
|
||||
"cycle_{cycle}_nvme_residue_count=0",
|
||||
"cycle_{cycle}_k8s_residue_count=0",
|
||||
"cleanup_status=ok",
|
||||
} {
|
||||
if !strings.Contains(body, want) {
|
||||
t.Fatalf("phase108 lifecycle scenario missing %q", want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestPhase20FirstVolumeScenarioPinsPublishedUserGate(t *testing.T) {
|
||||
body := g15dReadFile(t, "testops", "scenarios", "activation-day1-first-volume-chain.yaml")
|
||||
for _, want := range []string{
|
||||
|
||||
@@ -520,6 +520,16 @@ Recommended order from here:
|
||||
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.
|
||||
66. Phase 108: NVMe/TCP Multi-Volume Lifecycle Soak. **Closed 2026-06-29,
|
||||
live k3s PASS**
|
||||
Ran two consecutive two-PVC NVMe/TCP cross-node lifecycle cycles with app
|
||||
pods pinned to `m02`. Each cycle verified two writers and two readers, then
|
||||
helper cleanup waited for generated blockvolume pods, matching PVs, and
|
||||
SeaweedFS NVMe subsystems to drain before declaring `cleanup_status=ok`.
|
||||
Terminal evidence showed `cycle_1_nvme_residue_count=0`,
|
||||
`cycle_1_k8s_residue_count=0`, `cycle_2_nvme_residue_count=0`, and
|
||||
`cycle_2_k8s_residue_count=0`; final strict cleanup returned
|
||||
`cleanup_status=ok`.
|
||||
|
||||
The internal release-train contract is
|
||||
`internal/docs/ref/operation-layer-v0.5-release-train.md`. Phases 41-44 close
|
||||
|
||||
@@ -1,89 +1,88 @@
|
||||
# Current Plan: Phase 107 NVMe/TCP Multi-Volume Cross-Node Isolation
|
||||
# Current Plan: Phase 108 NVMe/TCP Multi-Volume Lifecycle Soak
|
||||
|
||||
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`.
|
||||
(`nvme-tcp-cross-node-multivolume-lifecycle-soak-chain`, run
|
||||
`20260629-143934-a9f5`, 19/19 PASS) with final strict cleanup returning
|
||||
`cleanup_status=ok`.
|
||||
|
||||
## Why This Is Next
|
||||
|
||||
Phase 106 proved the positive single-PVC cross-node NVMe/TCP path:
|
||||
Phase 106 proved one cross-node NVMe/TCP PVC can be mounted and verified.
|
||||
Phase 107 proved two cross-node NVMe/TCP PVCs keep distinct volume identities
|
||||
and distinct NVMe NQNs.
|
||||
|
||||
```text
|
||||
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.
|
||||
The next risk is lifecycle residue. A product can pass a single attach test but
|
||||
still leak NVMe sessions, stale PVC/PV objects, StorageClasses, or generated
|
||||
blockvolume Deployments after repeated create/delete cycles. That would make
|
||||
the feature unreliable for users even if the happy path is correct.
|
||||
|
||||
## Product Goal
|
||||
|
||||
Prove the supported-lab NVMe/TCP cross-node path handles multiple PVCs with
|
||||
independent identities.
|
||||
Prove the supported-lab NVMe/TCP cross-node multi-volume path can run repeated
|
||||
create/write/read/delete cycles without accumulating residue.
|
||||
|
||||
Required behavior:
|
||||
|
||||
- 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.
|
||||
- install the NVMe/TCP chart path with external NVMe/TCP enabled;
|
||||
- run two lifecycle cycles;
|
||||
- each cycle provisions two PVCs with `protocol=nvme`;
|
||||
- writer and reader pods are pinned to the application node and verify data;
|
||||
- helper cleanup deletes pods, PVCs, generated blockvolume Deployments, and the
|
||||
StorageClass;
|
||||
- each cycle leaves zero SeaweedFS NVMe subsystems and zero multi-volume
|
||||
Kubernetes residue before the next cycle starts;
|
||||
- final Helm uninstall plus strict cleanup returns `cleanup_status=ok`.
|
||||
|
||||
## D1: Multi-Volume Helper Protocol Selection
|
||||
|
||||
`scripts/run-multi-volume-example.sh` now accepts:
|
||||
|
||||
```text
|
||||
SW_BLOCK_MULTI_VOLUME_PROTOCOL=iscsi|nvme
|
||||
SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR=<kubernetes node name>
|
||||
```
|
||||
|
||||
For `nvme`, the helper renders both CSI protocol keys in the StorageClass:
|
||||
|
||||
```yaml
|
||||
sw-block.seaweedfs.com/protocol: "nvme"
|
||||
protocol: "nvme"
|
||||
```
|
||||
|
||||
The node selector pins all generated writer/reader pods to the selected
|
||||
application node.
|
||||
|
||||
## D2: Live Multi-Volume Cross-Node Gate
|
||||
## D1: Lifecycle Soak Scenario
|
||||
|
||||
Scenario:
|
||||
|
||||
```text
|
||||
testops/scenarios/nvme-tcp-cross-node-multivolume-isolation-chain.yaml
|
||||
testops/scenarios/nvme-tcp-cross-node-multivolume-lifecycle-soak-chain.yaml
|
||||
```
|
||||
|
||||
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
|
||||
phase108_nvme_tcp_multivolume_lifecycle_soak_status=ok
|
||||
cycle_count=2
|
||||
volume_count_per_cycle=2
|
||||
cycle_1_writer_verified_count=2
|
||||
cycle_1_reader_verified_count=2
|
||||
cycle_1_cleanup_status=ok
|
||||
cycle_1_nvme_residue_count=0
|
||||
cycle_1_k8s_residue_count=0
|
||||
cycle_2_writer_verified_count=2
|
||||
cycle_2_reader_verified_count=2
|
||||
cycle_2_cleanup_status=ok
|
||||
cycle_2_nvme_residue_count=0
|
||||
cycle_2_k8s_residue_count=0
|
||||
```
|
||||
|
||||
Strict cleanup audit:
|
||||
The first live run failed usefully: helper cleanup reported `cleanup_status=ok`
|
||||
while a SeaweedFS NVMe subsystem was still `deleting`, a matching PV was still
|
||||
`Released`, and generated blockvolume pods were still terminating/creating. The
|
||||
helper cleanup path now waits for generated blockvolume pods, matching PVs, and
|
||||
SeaweedFS NVMe subsystems to drain before declaring success.
|
||||
|
||||
## D2: Final Cleanup Gate
|
||||
|
||||
After the two lifecycle cycles, uninstall the Helm release and run the strict
|
||||
cleanup verifier.
|
||||
|
||||
Expected evidence:
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
Observed evidence:
|
||||
|
||||
```text
|
||||
cleanup_status=ok
|
||||
@@ -97,11 +96,11 @@ failure_count=0
|
||||
|
||||
## Non-Claims
|
||||
|
||||
Phase 107 still does not claim:
|
||||
Phase 108 still does not claim:
|
||||
|
||||
- RoCE/NVMe-RDMA;
|
||||
- performance or SLO;
|
||||
- broad distro/kernel compatibility;
|
||||
- production HA;
|
||||
- multi-path failover across real hosts;
|
||||
- more than the supported-lab two-PVC isolation gate.
|
||||
- more than the supported-lab two-PVC, two-cycle lifecycle gate.
|
||||
@@ -266,6 +266,11 @@ rebuild, delete safety, or cleanup must start as a separate gated phase.
|
||||
`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.
|
||||
- Phase 108 NVMe/TCP Multi-Volume Lifecycle Soak is closed for the supported
|
||||
lab path. Two consecutive two-PVC NVMe/TCP cross-node lifecycle cycles
|
||||
verified writer/reader data and then drained generated blockvolume pods,
|
||||
matching PVs, and SeaweedFS NVMe subsystems before each cycle could claim
|
||||
helper cleanup success. Final strict cleanup 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.
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
# Phase 108 NVMe/TCP Multi-Volume Lifecycle Soak QA Sign-off
|
||||
|
||||
Status: PASS.
|
||||
|
||||
Validated source branch:
|
||||
`phase108-nvme-tcp-multivolume-lifecycle-soak`.
|
||||
|
||||
Scenario:
|
||||
`testops/scenarios/nvme-tcp-cross-node-multivolume-lifecycle-soak-chain.yaml`
|
||||
|
||||
QA run: `20260629-143934-a9f5`
|
||||
|
||||
Result: 19/19 PASS.
|
||||
|
||||
## Scope
|
||||
|
||||
This gate validates lifecycle residue for the supported-lab NVMe/TCP
|
||||
multi-volume path. Phase 107 proved two cross-node NVMe/TCP PVCs can verify
|
||||
data with distinct identities. Phase 108 repeats that create/write/read/delete
|
||||
path twice and requires cleanup to drain before the next cycle can start.
|
||||
|
||||
The gate proves:
|
||||
|
||||
- two consecutive lifecycle cycles complete;
|
||||
- each cycle provisions two PVCs with `protocol=nvme`;
|
||||
- writer and reader pods pinned to the app node verify data for both PVCs;
|
||||
- helper cleanup waits for generated blockvolume pods, matching PVs, and
|
||||
SeaweedFS NVMe subsystems to drain;
|
||||
- each cycle leaves zero NVMe and Kubernetes multi-volume residue;
|
||||
- final Helm uninstall plus strict cleanup leaves zero residue.
|
||||
|
||||
## Useful First-Run Failure
|
||||
|
||||
The first live run (`20260629-143510-956b`) failed for a real reason:
|
||||
|
||||
```text
|
||||
cycle 1 residue nvme=1 pvc=0 pod=0 pv=1 sc=0
|
||||
```
|
||||
|
||||
Artifacts showed the helper had reported `cleanup_status=ok` while:
|
||||
|
||||
- one SeaweedFS NVMe subsystem was still in `deleting`;
|
||||
- one matching PV was still `Released`;
|
||||
- generated blockvolume pods were still terminating/creating.
|
||||
|
||||
The fix was not to relax the gate. The helper cleanup path now waits for
|
||||
generated blockvolume pods, matching PVs, and SeaweedFS NVMe subsystems before
|
||||
claiming cleanup success.
|
||||
|
||||
## Terminal Evidence
|
||||
|
||||
```text
|
||||
phase108_nvme_tcp_multivolume_lifecycle_soak_status=ok
|
||||
cycle_count=2
|
||||
volume_count_per_cycle=2
|
||||
cycle_1_status=ok
|
||||
cycle_1_writer_verified_count=2
|
||||
cycle_1_reader_verified_count=2
|
||||
cycle_1_cleanup_status=ok
|
||||
cycle_1_nvme_residue_count=0
|
||||
cycle_1_k8s_residue_count=0
|
||||
cycle_2_status=ok
|
||||
cycle_2_writer_verified_count=2
|
||||
cycle_2_reader_verified_count=2
|
||||
cycle_2_cleanup_status=ok
|
||||
cycle_2_nvme_residue_count=0
|
||||
cycle_2_k8s_residue_count=0
|
||||
```
|
||||
|
||||
Both cycle summaries reported:
|
||||
|
||||
```text
|
||||
multi_volume_status=ok
|
||||
protocol=nvme
|
||||
app_node_selector=m02
|
||||
requested_volume_count=2
|
||||
writer_verified_count=2
|
||||
reader_verified_count=2
|
||||
managed_volume_count=2
|
||||
cleanup_status=ok
|
||||
```
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
## Verdict
|
||||
|
||||
Phase 108 can close. The supported-lab NVMe/TCP path now has:
|
||||
|
||||
- Phase 106: single-PVC cross-node writer/reader attach;
|
||||
- Phase 107: two-PVC cross-node identity and NQN isolation;
|
||||
- Phase 108: repeated two-PVC lifecycle cleanup with zero per-cycle residue.
|
||||
|
||||
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.
|
||||
@@ -50,6 +50,21 @@ list_blockvolume_deployments() {
|
||||
| awk '/^deployment/ { print }'
|
||||
}
|
||||
|
||||
list_blockvolume_pods() {
|
||||
kubectl -n "$NAMESPACE" get pods -l app=sw-blockvolume -o name 2>/dev/null \
|
||||
| awk '/^pod/ { print }'
|
||||
}
|
||||
|
||||
list_matching_pvs() {
|
||||
kubectl get pv --no-headers 2>/dev/null \
|
||||
| awk -v prefix="$PVC_PREFIX" '$0 ~ prefix { print $1 }'
|
||||
}
|
||||
|
||||
count_seaweed_nvme_subsystems() {
|
||||
sudo -n nvme list-subsys 2>/dev/null \
|
||||
| grep -c 'nqn\.2026-05\.io\.seaweedfs' || true
|
||||
}
|
||||
|
||||
sw_block_cmd() {
|
||||
if [[ -n "${SW_BLOCK_CLI:-}" ]]; then
|
||||
"$SW_BLOCK_CLI" "$@"
|
||||
@@ -259,6 +274,9 @@ collect_status_evidence() {
|
||||
cleanup_multi_volume() {
|
||||
local rc=0
|
||||
local deployments_gone=false
|
||||
local pods_gone=false
|
||||
local pvs_gone=false
|
||||
local nvme_gone=true
|
||||
for idx in $(seq 1 "$VOLUME_COUNT"); do
|
||||
kubectl -n "$NAMESPACE" delete pod "${POD_PREFIX}-reader-${idx}" "${POD_PREFIX}-writer-${idx}" --ignore-not-found=true --wait=true --timeout=120s || rc=1
|
||||
done
|
||||
@@ -285,6 +303,64 @@ cleanup_multi_volume() {
|
||||
safe_capture "$ARTIFACT_DIR/logs/blockvolume-deployments.cleanup-timeout.txt" kubectl -n "$NAMESPACE" get deploy -l app=sw-blockvolume -o wide
|
||||
rc=1
|
||||
fi
|
||||
|
||||
deadline=$((SECONDS + 180))
|
||||
while (( SECONDS <= deadline )); do
|
||||
local remaining_pods
|
||||
remaining_pods="$(list_blockvolume_pods || true)"
|
||||
if [[ -z "$remaining_pods" ]]; then
|
||||
pods_gone=true
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
if [[ "$pods_gone" != "true" ]] && [[ -z "$(list_blockvolume_pods || true)" ]]; then
|
||||
pods_gone=true
|
||||
fi
|
||||
if [[ "$pods_gone" != "true" ]]; then
|
||||
safe_capture "$ARTIFACT_DIR/logs/blockvolume-pods.cleanup-timeout.txt" kubectl -n "$NAMESPACE" get pods -l app=sw-blockvolume -o wide
|
||||
rc=1
|
||||
fi
|
||||
|
||||
deadline=$((SECONDS + 180))
|
||||
while (( SECONDS <= deadline )); do
|
||||
local remaining_pvs
|
||||
remaining_pvs="$(list_matching_pvs || true)"
|
||||
if [[ -z "$remaining_pvs" ]]; then
|
||||
pvs_gone=true
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
if [[ "$pvs_gone" != "true" ]] && [[ -z "$(list_matching_pvs || true)" ]]; then
|
||||
pvs_gone=true
|
||||
fi
|
||||
if [[ "$pvs_gone" != "true" ]]; then
|
||||
safe_capture "$ARTIFACT_DIR/logs/pvs.cleanup-timeout.txt" kubectl get pv -o wide
|
||||
rc=1
|
||||
fi
|
||||
|
||||
if [[ "$MULTI_VOLUME_PROTOCOL" == "nvme" ]]; then
|
||||
nvme_gone=false
|
||||
deadline=$((SECONDS + 120))
|
||||
while (( SECONDS <= deadline )); do
|
||||
local nvme_count
|
||||
nvme_count="$(count_seaweed_nvme_subsystems)"
|
||||
if [[ "$nvme_count" == "0" ]]; then
|
||||
nvme_gone=true
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
if [[ "$nvme_gone" != "true" ]] && [[ "$(count_seaweed_nvme_subsystems)" == "0" ]]; then
|
||||
nvme_gone=true
|
||||
fi
|
||||
if [[ "$nvme_gone" != "true" ]]; then
|
||||
safe_capture "$ARTIFACT_DIR/logs/nvme-subsystems.cleanup-timeout.txt" sudo -n nvme list-subsys
|
||||
rc=1
|
||||
fi
|
||||
fi
|
||||
|
||||
kubectl delete storageclass "$STORAGECLASS_NAME" --ignore-not-found=true --wait=true --timeout=120s || rc=1
|
||||
return "$rc"
|
||||
}
|
||||
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
name: nvme-tcp-cross-node-multivolume-lifecycle-soak-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"
|
||||
cycle_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; 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; rm -rf /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle && mkdir -p /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/bin /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/build /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/values /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/install /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/asserts /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/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 }}-phase108-nvme-lifecycle/build"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/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 }}-phase108-nvme-lifecycle/bin/sw-block ./cmd/sw-block && /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/bin/sw-block ops generate-helm-values --kubeconfig /etc/rancher/k3s/k3s.yaml --out /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/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 }}-phase108-nvme-lifecycle/values/generate.stdout.txt && python3 - <<'PY'\nfrom pathlib import Path\nbase=Path('/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle')\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 }}-phase108-nvme-lifecycle/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 }}-phase108-nvme-lifecycle/values/values.nvme.yaml > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/install/helm-lint.txt && helm template {{ helm_release }} charts/seaweed-block --namespace {{ helm_namespace }} -f /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/values/values.nvme.yaml > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/install/helm-template.yaml && grep -q -- '--launcher-external-nvme' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/install/helm-template.yaml && ! grep -q -- '--launcher-external-iscsi' /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/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 }}-phase108-nvme-lifecycle/values/values.nvme.yaml --wait --timeout 10m > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/install/helm-install.txt && kubectl -n {{ helm_namespace }} get deploy,ds,pods,svc -o wide > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/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 }}-phase108-nvme-lifecycle/install/helm-install.txt"
|
||||
pattern: "STATUS: deployed"
|
||||
save_as: helm_deployed_count
|
||||
- action: assert_greater
|
||||
actual: "{{ helm_deployed_count }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: lifecycle_soak
|
||||
actions:
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 20m
|
||||
cmd: "set -e; BASE=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle; APP_NODE=$(cat \"$BASE/values/app-node.txt\"); cd {{ product_root }}; for cycle in $(seq 1 {{ cycle_count }}); do mkdir -p \"$BASE/cycle-$cycle\"; SW_BLOCK_ARTIFACT_DIR=\"$BASE/cycle-$cycle\" SW_BLOCK_MULTI_VOLUME_NODE_SELECTOR=\"$APP_NODE\" SW_BLOCK_MULTI_VOLUME_PROTOCOL=nvme SW_BLOCK_MULTI_VOLUME_COUNT={{ volume_count }} SW_BLOCK_MULTI_VOLUME_CLEANUP=1 SW_BLOCK_CLI=\"$BASE/bin/sw-block\" bash scripts/run-multi-volume-example.sh {{ product_root }}; sudo -n nvme list-subsys > \"$BASE/cycle-$cycle/nvme-list-subsys.after-cleanup.txt\" 2>&1 || true; kubectl -n default get pods,pvc -o wide > \"$BASE/cycle-$cycle/default.after-cleanup.txt\" 2>&1 || true; kubectl get pv -o wide > \"$BASE/cycle-$cycle/pv.after-cleanup.txt\" 2>&1 || true; kubectl get storageclass sw-block-multi > \"$BASE/cycle-$cycle/storageclass.after-cleanup.txt\" 2>&1 || true; done"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
- action: exec
|
||||
node: m02
|
||||
timeout: 3m
|
||||
cmd: "python3 - <<'PY'\nfrom pathlib import Path\nbase=Path('/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle')\ncycle_count={{ cycle_count }}\nvolume_count={{ volume_count }}\nlines=['phase108_nvme_tcp_multivolume_lifecycle_soak_status=ok', f'cycle_count={cycle_count}', f'volume_count_per_cycle={volume_count}']\nfor cycle in range(1, cycle_count+1):\n summary={}\n for raw in (base/f'cycle-{cycle}/multi-volume-summary.txt').read_text().splitlines():\n if '=' in raw:\n k,v=raw.split('=',1)\n summary[k]=v\n nvme_text=(base/f'cycle-{cycle}/nvme-list-subsys.after-cleanup.txt').read_text(errors='ignore')\n default_text=(base/f'cycle-{cycle}/default.after-cleanup.txt').read_text(errors='ignore')\n pv_text=(base/f'cycle-{cycle}/pv.after-cleanup.txt').read_text(errors='ignore')\n sc_text=(base/f'cycle-{cycle}/storageclass.after-cleanup.txt').read_text(errors='ignore')\n if summary.get('multi_volume_status') != 'ok':\n raise SystemExit(f'cycle {cycle} status={summary.get(\"multi_volume_status\")}')\n if summary.get('cleanup_status') != 'ok':\n raise SystemExit(f'cycle {cycle} cleanup={summary.get(\"cleanup_status\")}')\n if summary.get('writer_verified_count') != str(volume_count):\n raise SystemExit(f'cycle {cycle} writer_count={summary.get(\"writer_verified_count\")}')\n if summary.get('reader_verified_count') != str(volume_count):\n raise SystemExit(f'cycle {cycle} reader_count={summary.get(\"reader_verified_count\")}')\n nvme_residue=nvme_text.count('nqn.2026-05.io.seaweedfs')\n pvc_residue=default_text.count('sw-block-multi-pvc')\n pod_residue=default_text.count('sw-block-multi-reader') + default_text.count('sw-block-multi-writer')\n pv_residue=pv_text.count('sw-block-multi-pvc')\n sc_residue=0 if 'not found' in sc_text.lower() else sc_text.count('sw-block-multi')\n if any([nvme_residue, pvc_residue, pod_residue, pv_residue, sc_residue]):\n raise SystemExit(f'cycle {cycle} residue nvme={nvme_residue} pvc={pvc_residue} pod={pod_residue} pv={pv_residue} sc={sc_residue}')\n lines += [\n f'cycle_{cycle}_status=ok',\n f'cycle_{cycle}_writer_verified_count={summary.get(\"writer_verified_count\")}',\n f'cycle_{cycle}_reader_verified_count={summary.get(\"reader_verified_count\")}',\n f'cycle_{cycle}_cleanup_status=ok',\n f'cycle_{cycle}_nvme_residue_count=0',\n f'cycle_{cycle}_k8s_residue_count=0',\n ]\n(base/'asserts/phase108-lifecycle-soak-summary.txt').write_text('\\n'.join(lines)+'\\n')\nPY"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/asserts/phase108-lifecycle-soak-summary.txt"
|
||||
pattern: "^phase108_nvme_tcp_multivolume_lifecycle_soak_status=ok$"
|
||||
save_as: lifecycle_soak_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ lifecycle_soak_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 120s > /mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/cleanup/helm-uninstall.txt || 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; 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; cd {{ product_root }} && SW_BLOCK_ARTIFACT_DIR=/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/cleanup/verify bash scripts/verify-helm-cleanup.sh {{ product_root }}"
|
||||
env.KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
|
||||
- action: grep_log
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle/cleanup/verify/cleanup-summary.txt"
|
||||
pattern: "^cleanup_status=ok$"
|
||||
save_as: cleanup_ok
|
||||
- action: assert_greater
|
||||
actual: "{{ cleanup_ok }}"
|
||||
threshold: "0"
|
||||
|
||||
- name: collect
|
||||
always: true
|
||||
actions:
|
||||
- action: collect_path
|
||||
node: m02
|
||||
path: "/mnt/smb/work/share/g15d-k8s/{{ run_id }}-phase108-nvme-lifecycle"
|
||||
name: "remote-phases"
|
||||
ignore_error: true
|
||||
Reference in new issue
Block a user