mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
Allow volumeDevices in ephemeral containers
This commit is contained in:
parent
d874cf8ffd
commit
d33bbb8940
@ -84,6 +84,7 @@ var allowedEphemeralContainerFields = map[string]bool{
|
||||
"Env": true,
|
||||
"Resources": false,
|
||||
"VolumeMounts": true,
|
||||
"VolumeDevices": true,
|
||||
"LivenessProbe": false,
|
||||
"ReadinessProbe": false,
|
||||
"StartupProbe": false,
|
||||
|
@ -6143,7 +6143,10 @@ func getResourceLimits(cpu, memory string) core.ResourceList {
|
||||
func TestValidateEphemeralContainers(t *testing.T) {
|
||||
containers := []core.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}}
|
||||
initContainers := []core.Container{{Name: "ictr", Image: "iimage", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}}
|
||||
vols := map[string]core.VolumeSource{"vol": {EmptyDir: &core.EmptyDirVolumeSource{}}}
|
||||
vols := map[string]core.VolumeSource{
|
||||
"blk": {PersistentVolumeClaim: &core.PersistentVolumeClaimVolumeSource{ClaimName: "pvc"}},
|
||||
"vol": {EmptyDir: &core.EmptyDirVolumeSource{}},
|
||||
}
|
||||
|
||||
// Success Cases
|
||||
for title, ephemeralContainers := range map[string][]core.EphemeralContainer{
|
||||
@ -6161,7 +6164,7 @@ func TestValidateEphemeralContainers(t *testing.T) {
|
||||
TargetContainerName: "ctr",
|
||||
},
|
||||
},
|
||||
"All allowed Fields": {
|
||||
"All allowed fields": {
|
||||
{
|
||||
EphemeralContainerCommon: core.EphemeralContainerCommon{
|
||||
|
||||
@ -6184,6 +6187,9 @@ func TestValidateEphemeralContainers(t *testing.T) {
|
||||
VolumeMounts: []core.VolumeMount{
|
||||
{Name: "vol", MountPath: "/vol"},
|
||||
},
|
||||
VolumeDevices: []core.VolumeDevice{
|
||||
{Name: "blk", DevicePath: "/dev/block"},
|
||||
},
|
||||
TerminationMessagePath: "/dev/termination-log",
|
||||
TerminationMessagePolicy: "File",
|
||||
ImagePullPolicy: "IfNotPresent",
|
||||
|
Loading…
Reference in New Issue
Block a user