mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
Update function name and remove feature gate check
This commit is contained in:
@@ -5515,7 +5515,7 @@ func ValidatePodResize(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel
|
||||
allErrs = append(allErrs, field.Invalid(specPath, newPod.Status.QOSClass, "Pod QOS Class may not change as a result of resizing"))
|
||||
}
|
||||
|
||||
isPodResizeRequestValid := isPodResizeRequestValid(*oldPod)
|
||||
isPodResizeRequestValid := isPodResizeRequestSupported(*oldPod)
|
||||
|
||||
if !isPodResizeRequestValid {
|
||||
allErrs = append(allErrs, field.Forbidden(specPath, "Pod running on node without InPlacePodVerticalScaling feature gate enabled may not be updated"))
|
||||
@@ -5561,22 +5561,20 @@ func ValidatePodResize(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func isPodResizeRequestValid(pod core.Pod) bool {
|
||||
// isPodResizeRequestSupported checks whether the pod is running on a node with InPlacePodVerticalScaling enabled.
|
||||
func isPodResizeRequestSupported(pod core.Pod) bool {
|
||||
// TODO: Remove this after GA+3 releases of InPlacePodVerticalScaling
|
||||
// This code handles the version skew as described in the KEP.
|
||||
// For handling version skew we're only allowing to update the Pod's Resources
|
||||
// if the Pod already has Pod.Status.ContainerStatuses[i].Resources. This means
|
||||
// that the apiserver would only allow updates to Pods running on Nodes with
|
||||
// the InPlacePodVerticalScaling feature gate enabled.
|
||||
if !utilfeature.DefaultFeatureGate.Enabled(features.InPlacePodVerticalScaling) {
|
||||
return false
|
||||
}
|
||||
for _, c := range pod.Status.ContainerStatuses {
|
||||
if c.State.Running != nil {
|
||||
return c.Resources != nil
|
||||
}
|
||||
}
|
||||
// No running containers
|
||||
// No running containers. We cannot tell whether the node supports resize at this point, so we assume it does.
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user