pod-overhead: drop from PodSpec based on feature-gate

Signed-off-by: Eric Ernst <eric.ernst@intel.com>
This commit is contained in:
Eric Ernst 2019-04-26 12:24:11 -07:00
parent d0b0c0ae45
commit 33713087f4

View File

@ -375,6 +375,11 @@ func dropDisabledFields(
podSpec.RuntimeClassName = nil
}
if !utilfeature.DefaultFeatureGate.Enabled(features.PodOverhead) && !overheadInUse(oldPodSpec) {
// Set Overhead to nil only if the feature is disabled and it is not used
podSpec.Overhead = nil
}
dropDisabledProcMountField(podSpec, oldPodSpec)
dropDisabledCSIVolumeSourceAlphaFields(podSpec, oldPodSpec)
@ -524,6 +529,18 @@ func runtimeClassInUse(podSpec *api.PodSpec) bool {
return false
}
// overheadInUse returns true if the pod spec is non-nil and has Overhead set
func overheadInUse(podSpec *api.PodSpec) bool {
if podSpec == nil {
return false
}
if podSpec.Overhead != nil {
return true
}
return false
}
// procMountInUse returns true if the pod spec is non-nil and has a SecurityContext's ProcMount field set to a non-default value
func procMountInUse(podSpec *api.PodSpec) bool {
if podSpec == nil {