let ISCSITargetPOD to prepare empty filesystem volume
@@ -2242,6 +2242,7 @@ const (
ContainerDiskAlpine ContainerDisk = "alpine"
ContainerDiskFedora ContainerDisk = "fedora-cloud"
ContainerDiskVirtio ContainerDisk = "virtio-container-disk"
+ ContainerDiskEmpty ContainerDisk = "empty"
)
// ContainerDiskFor takes the name of an image and returns the full
@@ -2831,7 +2832,20 @@ func CreateISCSITargetPOD(containerDiskName ContainerDisk) (iscsiTargetIP string
Name: "test-iscsi-target",
Image: image,
Resources: resources,
- Env: []k8sv1.EnvVar{
+ },
+ },
+ },
+ }
+ if containerDiskName == ContainerDiskEmpty {
+ asEmpty := []k8sv1.EnvVar{
+ {
+ Name: "AS_EMPTY",
+ Value: "true",
+ },
+ }
+ pod.Spec.Containers[0].Env = asEmpty
+ } else {
+ imageEnv := []k8sv1.EnvVar{
{
Name: "AS_ISCSI",
Value: "true",
@@ -2840,11 +2854,10 @@ func CreateISCSITargetPOD(containerDiskName ContainerDisk) (iscsiTargetIP string
Name: "IMAGE_NAME",
Value: fmt.Sprintf("%s", containerDiskName),
},
- },
- },
- },
- },
}
+ pod.Spec.Containers[0].Env = imageEnv
+ }
+
pod, err = virtClient.CoreV1().Pods(NamespaceTestDefault).Create(pod)
PanicOnError(err)
