|
383 | 383 | # the 5m pod-Succeeded budget when containerd's CreateContainer stalls. |
384 | 384 | kubectl wait hr -n tenant-test "kubernetes-${test_name}-csi" --timeout=10m --for=condition=ready |
385 | 385 |
|
| 386 | + # ---------------------------------------------------------------------- |
| 387 | + # StorageClass propagation (issue #2094). Remote-accessible LINSTOR infra |
| 388 | + # classes propagate to the tenant under the same name; node-local classes |
| 389 | + # ("local", allowRemoteVolumeAccess=false) are filtered out; the legacy |
| 390 | + # "kubevirt" alias is retained for backward compatibility. The e2e infra |
| 391 | + # cluster ships both "replicated" (remote) and "local" (node-local). |
| 392 | + # ---------------------------------------------------------------------- |
| 393 | + echo "Verifying StorageClass propagation to tenant..." |
| 394 | + timeout 2m bash -c ' |
| 395 | + until kubectl --kubeconfig tenantkubeconfig-'"${test_name}"' get sc replicated >/dev/null 2>&1; do |
| 396 | + sleep 5 |
| 397 | + done |
| 398 | + ' |
| 399 | + |
| 400 | + rep_prov=$(kubectl --kubeconfig "tenantkubeconfig-${test_name}" get sc replicated -o jsonpath='{.provisioner}') |
| 401 | + rep_infra=$(kubectl --kubeconfig "tenantkubeconfig-${test_name}" get sc replicated -o jsonpath='{.parameters.infraStorageClassName}') |
| 402 | + if [ "$rep_prov" != "csi.kubevirt.io" ] || [ "$rep_infra" != "replicated" ]; then |
| 403 | + echo "replicated SC misconfigured: provisioner=$rep_prov infraStorageClassName=$rep_infra" >&2 |
| 404 | + kubectl --kubeconfig "tenantkubeconfig-${test_name}" get sc >&2 |
| 405 | + exit 1 |
| 406 | + fi |
| 407 | + |
| 408 | + # Legacy kubevirt alias must still exist (existing PVCs depend on it). |
| 409 | + if ! kubectl --kubeconfig "tenantkubeconfig-${test_name}" get sc kubevirt >/dev/null 2>&1; then |
| 410 | + echo "legacy kubevirt StorageClass alias is missing" >&2 |
| 411 | + exit 1 |
| 412 | + fi |
| 413 | + |
| 414 | + # Node-local "local" class must NOT be propagated (allowRemoteVolumeAccess=false). |
| 415 | + if kubectl --kubeconfig "tenantkubeconfig-${test_name}" get sc local >/dev/null 2>&1; then |
| 416 | + echo "node-local StorageClass 'local' should not be propagated to the tenant" >&2 |
| 417 | + exit 1 |
| 418 | + fi |
| 419 | + |
| 420 | + # Exactly one default StorageClass, and it must be "replicated". |
| 421 | + default_scs=$(kubectl --kubeconfig "tenantkubeconfig-${test_name}" get sc \ |
| 422 | + -o jsonpath='{range .items[?(@.metadata.annotations.storageclass\.kubernetes\.io/is-default-class=="true")]}{.metadata.name}{"\n"}{end}') |
| 423 | + default_count=$(printf '%s' "$default_scs" | grep -c .) |
| 424 | + if [ "$default_count" -ne 1 ] || [ "$default_scs" != "replicated" ]; then |
| 425 | + echo "expected exactly one default StorageClass 'replicated', got: ${default_scs:-<none>} (count=$default_count)" >&2 |
| 426 | + exit 1 |
| 427 | + fi |
| 428 | + echo "StorageClass propagation OK (replicated default, kubevirt alias present, local filtered)" |
| 429 | + |
386 | 430 | # Clean up NFS test resources from any previous failed attempt |
387 | 431 | kubectl --kubeconfig "tenantkubeconfig-${test_name}" delete pod nfs-test-pod \ |
388 | 432 | -n tenant-test --ignore-not-found --timeout=60s || true |
|
0 commit comments