mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +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,
|
"Env": true,
|
||||||
"Resources": false,
|
"Resources": false,
|
||||||
"VolumeMounts": true,
|
"VolumeMounts": true,
|
||||||
|
"VolumeDevices": true,
|
||||||
"LivenessProbe": false,
|
"LivenessProbe": false,
|
||||||
"ReadinessProbe": false,
|
"ReadinessProbe": false,
|
||||||
"StartupProbe": false,
|
"StartupProbe": false,
|
||||||
|
@ -6143,7 +6143,10 @@ func getResourceLimits(cpu, memory string) core.ResourceList {
|
|||||||
func TestValidateEphemeralContainers(t *testing.T) {
|
func TestValidateEphemeralContainers(t *testing.T) {
|
||||||
containers := []core.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}}
|
containers := []core.Container{{Name: "ctr", Image: "image", ImagePullPolicy: "IfNotPresent", TerminationMessagePolicy: "File"}}
|
||||||
initContainers := []core.Container{{Name: "ictr", Image: "iimage", 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
|
// Success Cases
|
||||||
for title, ephemeralContainers := range map[string][]core.EphemeralContainer{
|
for title, ephemeralContainers := range map[string][]core.EphemeralContainer{
|
||||||
@ -6161,7 +6164,7 @@ func TestValidateEphemeralContainers(t *testing.T) {
|
|||||||
TargetContainerName: "ctr",
|
TargetContainerName: "ctr",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"All allowed Fields": {
|
"All allowed fields": {
|
||||||
{
|
{
|
||||||
EphemeralContainerCommon: core.EphemeralContainerCommon{
|
EphemeralContainerCommon: core.EphemeralContainerCommon{
|
||||||
|
|
||||||
@ -6184,6 +6187,9 @@ func TestValidateEphemeralContainers(t *testing.T) {
|
|||||||
VolumeMounts: []core.VolumeMount{
|
VolumeMounts: []core.VolumeMount{
|
||||||
{Name: "vol", MountPath: "/vol"},
|
{Name: "vol", MountPath: "/vol"},
|
||||||
},
|
},
|
||||||
|
VolumeDevices: []core.VolumeDevice{
|
||||||
|
{Name: "blk", DevicePath: "/dev/block"},
|
||||||
|
},
|
||||||
TerminationMessagePath: "/dev/termination-log",
|
TerminationMessagePath: "/dev/termination-log",
|
||||||
TerminationMessagePolicy: "File",
|
TerminationMessagePolicy: "File",
|
||||||
ImagePullPolicy: "IfNotPresent",
|
ImagePullPolicy: "IfNotPresent",
|
||||||
|
Loading…
Reference in New Issue
Block a user