mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-02 17:34:18 +00:00
csi-kata-directvolume: Support CoCo ephemeral disk
This enables support to pass confidential=true and ephemeral=true to the shim via a feature flag. Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
This commit is contained in:
@@ -62,6 +62,8 @@ func (dv *directVolume) CreateVolume(ctx context.Context, req *csi.CreateVolumeR
|
|||||||
volumeCtx[utils.KataContainersDirectFsType] = value
|
volumeCtx[utils.KataContainersDirectFsType] = value
|
||||||
case utils.KataContainersDirectLoop:
|
case utils.KataContainersDirectLoop:
|
||||||
volumeCtx[utils.KataContainersDirectLoop] = value
|
volumeCtx[utils.KataContainersDirectLoop] = value
|
||||||
|
case utils.KataContainersDirectCoCoEphemeral:
|
||||||
|
volumeCtx[utils.KataContainersDirectCoCoEphemeral] = value
|
||||||
default:
|
default:
|
||||||
klog.Warningf("unknown parameter: %s", key)
|
klog.Warningf("unknown parameter: %s", key)
|
||||||
}
|
}
|
||||||
|
@@ -106,6 +106,11 @@ func (dv *directVolume) NodePublishVolume(ctx context.Context, req *csi.NodePubl
|
|||||||
guestOptions = options
|
guestOptions = options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isCoCoEphemeralVolume(attrib) {
|
||||||
|
attrib["confidential"] = "true"
|
||||||
|
attrib["ephemeral"] = "true"
|
||||||
|
}
|
||||||
|
|
||||||
// kata-containers DirectVolume add
|
// kata-containers DirectVolume add
|
||||||
mountInfo := utils.MountInfo{
|
mountInfo := utils.MountInfo{
|
||||||
VolumeType: volType,
|
VolumeType: volType,
|
||||||
@@ -225,6 +230,10 @@ func isLoopDevice(VolumeCtx map[string]string) bool {
|
|||||||
return parseBool(VolumeCtx[utils.KataContainersDirectLoop])
|
return parseBool(VolumeCtx[utils.KataContainersDirectLoop])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isCoCoEphemeralVolume(VolumeCtx map[string]string) bool {
|
||||||
|
return parseBool(VolumeCtx[utils.KataContainersDirectCoCoEphemeral])
|
||||||
|
}
|
||||||
|
|
||||||
// getDeviceSymlinkPath returns the path of the symlink that is used to
|
// getDeviceSymlinkPath returns the path of the symlink that is used to
|
||||||
// point to the loop device from inside the specified stagingTargetPath
|
// point to the loop device from inside the specified stagingTargetPath
|
||||||
// directory.
|
// directory.
|
||||||
|
@@ -24,11 +24,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
KataContainersDirectVolumeType = "katacontainers.direct.volume/volumetype"
|
KataContainersDirectVolumeType = "katacontainers.direct.volume/volumetype"
|
||||||
KataContainersDirectFsType = "katacontainers.direct.volume/fstype"
|
KataContainersDirectFsType = "katacontainers.direct.volume/fstype"
|
||||||
KataContainersDirectLoop = "katacontainers.direct.volume/loop"
|
KataContainersDirectLoop = "katacontainers.direct.volume/loop"
|
||||||
DirectVolumeTypeName = "directvol"
|
KataContainersDirectCoCoEphemeral = "katacontainers.direct.volume/cocoephemeral"
|
||||||
IsDirectVolume = "is_directvolume"
|
DirectVolumeTypeName = "directvol"
|
||||||
|
IsDirectVolume = "is_directvolume"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
Reference in New Issue
Block a user