File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 389389}
390390
391391@test " ephemeral encrypted raw LV is LUKS-formatted" {
392- # Ephemeral volume ID: csi-<pod-uid>-<volume-handle>
393- POD_UID=$( kubectl get pod volume-test-inline-encrypted -o jsonpath=' {.metadata.uid}' )
394392 NODE=$( kubectl get pod volume-test-inline-encrypted -o jsonpath=' {.spec.nodeName}' )
395393 PLUGIN_POD=$( kubectl get pods -n csi-driver-lvm -l app=csi-driver-lvm --field-selector " spec.nodeName=$NODE " -o jsonpath=' {.items[0].metadata.name}' )
396394
397- # Find the ephemeral LV name (starts with csi- and contains the pod UID)
398- LV_NAME=$( kubectl exec -n csi-driver-lvm " $PLUGIN_POD " -c csi-driver-lvm -- lvs csi-lvm --noheadings -o lv_name | tr -d ' ' | grep " $POD_UID " )
395+ # Ephemeral LV names start with " csi-" — find the one currently active
396+ LV_NAME=$( kubectl exec -n csi-driver-lvm " $PLUGIN_POD " -c csi-driver-lvm -- lvs csi-lvm --noheadings -o lv_name | tr -d ' ' | grep ' ^csi- ' )
399397 [ -n " $LV_NAME " ]
400398
401399 run kubectl exec -n csi-driver-lvm " $PLUGIN_POD " -c csi-driver-lvm -- cryptsetup isLuks " /dev/csi-lvm/$LV_NAME "
402400 [ " $status " -eq 0 ]
403401}
404402
405403@test " ephemeral encrypted plaintext data not readable on raw LV" {
406- POD_UID=$( kubectl get pod volume-test-inline-encrypted -o jsonpath=' {.metadata.uid}' )
407404 NODE=$( kubectl get pod volume-test-inline-encrypted -o jsonpath=' {.spec.nodeName}' )
408405 PLUGIN_POD=$( kubectl get pods -n csi-driver-lvm -l app=csi-driver-lvm --field-selector " spec.nodeName=$NODE " -o jsonpath=' {.items[0].metadata.name}' )
409406
410- LV_NAME=$( kubectl exec -n csi-driver-lvm " $PLUGIN_POD " -c csi-driver-lvm -- lvs csi-lvm --noheadings -o lv_name | tr -d ' ' | grep " $POD_UID " )
407+ LV_NAME=$( kubectl exec -n csi-driver-lvm " $PLUGIN_POD " -c csi-driver-lvm -- lvs csi-lvm --noheadings -o lv_name | tr -d ' ' | grep ' ^csi- ' )
411408 [ -n " $LV_NAME " ]
412409
413410 run kubectl exec -n csi-driver-lvm " $PLUGIN_POD " -c csi-driver-lvm -- strings " /dev/csi-lvm/$LV_NAME "
You can’t perform that action at this time.
0 commit comments