Remove Sysctls feature gate from validation

This commit is contained in:
Rajath Agasthya
2019-01-09 14:17:50 -08:00
parent c9e1ffb0e7
commit 5de2d7694d
7 changed files with 220 additions and 14 deletions

View File

@@ -310,6 +310,12 @@ func dropDisabledFields(
podSpec.ReadinessGates = nil
}
if !utilfeature.DefaultFeatureGate.Enabled(features.Sysctls) && !sysctlsInUse(oldPodSpec) {
if podSpec.SecurityContext != nil {
podSpec.SecurityContext.Sysctls = nil
}
}
if !utilfeature.DefaultFeatureGate.Enabled(features.LocalStorageCapacityIsolation) && !emptyDirSizeLimitInUse(oldPodSpec) {
for i := range podSpec.Volumes {
if podSpec.Volumes[i].EmptyDir != nil {
@@ -496,6 +502,16 @@ func podReadinessGatesInUse(podSpec *api.PodSpec) bool {
return false
}
func sysctlsInUse(podSpec *api.PodSpec) bool {
if podSpec == nil {
return false
}
if podSpec.SecurityContext != nil && podSpec.SecurityContext.Sysctls != nil {
return true
}
return false
}
// emptyDirSizeLimitInUse returns true if any pod's EptyDir volumes use SizeLimit.
func emptyDirSizeLimitInUse(podSpec *api.PodSpec) bool {
if podSpec == nil {