@@ -138,6 +138,10 @@ func validateVolume(ctx context.Context, volume corev1.Volume) *apis.FieldError
138138 errs = errs .Also (& apis.FieldError {Message : fmt .Sprintf ("CSI volume support is disabled, " +
139139 "but found CSI volume %s" , volume .Name )})
140140 }
141+ if volume .Ephemeral != nil && features .PodSpecVolumesEphemeral != config .Enabled {
142+ errs = errs .Also (& apis.FieldError {Message : fmt .Sprintf ("Ephemeral volume support is disabled, " +
143+ "but found Ephemeral volume %s" , volume .Name )})
144+ }
141145 errs = errs .Also (apis .CheckDisallowedFields (volume , * VolumeMask (ctx , & volume )))
142146 if volume .Name == "" {
143147 errs = apis .ErrMissingField ("name" )
@@ -182,6 +186,10 @@ func validateVolume(ctx context.Context, volume corev1.Volume) *apis.FieldError
182186 specified = append (specified , "csi" )
183187 }
184188
189+ if vs .Ephemeral != nil {
190+ specified = append (specified , "ephemeral" )
191+ }
192+
185193 if vs .Image != nil {
186194 specified = append (specified , "image" )
187195 errs = errs .Also (validateImageVolumeSource (vs .Image ).ViaField ("image" ))
@@ -202,6 +210,9 @@ func validateVolume(ctx context.Context, volume corev1.Volume) *apis.FieldError
202210 if cfg .Features .PodSpecVolumesCSI == config .Enabled {
203211 fieldPaths = append (fieldPaths , "csi" )
204212 }
213+ if cfg .Features .PodSpecVolumesEphemeral == config .Enabled {
214+ fieldPaths = append (fieldPaths , "ephemeral" )
215+ }
205216 if cfg .Features .PodSpecVolumesImage == config .Enabled {
206217 fieldPaths = append (fieldPaths , "image" )
207218 }
@@ -545,11 +556,17 @@ func validateSidecarContainer(ctx context.Context, container corev1.Container, v
545556 errs = errs .Also (apis .CheckDisallowedFields (* container .ReadinessProbe ,
546557 * ProbeMask (& corev1.Probe {})).ViaField ("readinessProbe" ))
547558 }
559+ if container .StartupProbe != nil {
560+ errs = errs .Also (apis .CheckDisallowedFields (* container .StartupProbe ,
561+ * ProbeMask (& corev1.Probe {})).ViaField ("startupProbe" ))
562+ }
548563 } else if cfg .Features .MultiContainerProbing == config .Enabled {
549564 // Liveness Probes
550565 errs = errs .Also (validateProbe (container .LivenessProbe , nil , false ).ViaField ("livenessProbe" ))
551566 // Readiness Probes
552567 errs = errs .Also (validateReadinessProbe (container .ReadinessProbe , nil , false ).ViaField ("readinessProbe" ))
568+ // Startup Probes
569+ errs = errs .Also (validateProbe (container .StartupProbe , nil , false ).ViaField ("startupProbe" ))
553570 }
554571
555572 return errs .Also (validate (ctx , container , volumes ))
@@ -591,6 +608,8 @@ func ValidateUserContainer(ctx context.Context, container corev1.Container, volu
591608 errs = errs .Also (validateProbe (container .LivenessProbe , & port , true ).ViaField ("livenessProbe" ))
592609 // Readiness Probes
593610 errs = errs .Also (validateReadinessProbe (container .ReadinessProbe , & port , true ).ViaField ("readinessProbe" ))
611+ // Startup Probes
612+ errs = errs .Also (validateProbe (container .StartupProbe , & port , true ).ViaField ("startupProbe" ))
594613 return errs .Also (validate (ctx , container , volumes ))
595614}
596615
@@ -717,7 +736,7 @@ func validateVolumeMounts(ctx context.Context, mounts []corev1.VolumeMount, volu
717736 }
718737 seenMountPath .Insert (path .Clean (vm .MountPath ))
719738
720- shouldCheckReadOnlyVolume := volumes [vm .Name ].EmptyDir == nil && volumes [vm .Name ].PersistentVolumeClaim == nil
739+ shouldCheckReadOnlyVolume := volumes [vm .Name ].EmptyDir == nil && volumes [vm .Name ].PersistentVolumeClaim == nil && volumes [ vm . Name ]. Ephemeral == nil
721740 if shouldCheckReadOnlyVolume && ! vm .ReadOnly {
722741 errs = errs .Also ((& apis.FieldError {
723742 Message : "volume mount should be readOnly for this type of volume" ,
0 commit comments