startupProbe: API changes

This commit is contained in:
Matthias Bertschy
2019-08-07 10:21:48 +02:00
parent 4495d09282
commit e4d26f845e
6 changed files with 76 additions and 6 deletions

View File

@@ -383,6 +383,14 @@ func dropDisabledFields(
})
}
if !utilfeature.DefaultFeatureGate.Enabled(features.StartupProbe) && !startupProbeInUse(oldPodSpec) {
// drop startupProbe from all containers if the feature is disabled
VisitContainers(podSpec, func(c *api.Container) bool {
c.StartupProbe = nil
return true
})
}
dropDisabledVolumeDevicesFields(podSpec, oldPodSpec)
dropDisabledRunAsGroupField(podSpec, oldPodSpec)
@@ -819,6 +827,24 @@ func subpathExprInUse(podSpec *api.PodSpec) bool {
return inUse
}
// startupProbeInUse returns true if the pod spec is non-nil and has a container that has a startupProbe defined
func startupProbeInUse(podSpec *api.PodSpec) bool {
if podSpec == nil {
return false
}
var inUse bool
VisitContainers(podSpec, func(c *api.Container) bool {
if c.StartupProbe != nil {
inUse = true
return false
}
return true
})
return inUse
}
// csiInUse returns true if any pod's spec include inline CSI volumes.
func csiInUse(podSpec *api.PodSpec) bool {
if podSpec == nil {