mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 07:20:13 +00:00
Fix issue of pod spec mismatch if there is any non-restarble init container present
This commit is contained in:
parent
5d5e903e27
commit
591b0f547a
@ -5661,11 +5661,9 @@ func ValidatePodResize(newPod, oldPod *core.Pod, opts PodValidationOptions) fiel
|
||||
req := dropCPUMemoryUpdates(container.Resources.Requests, oldPod.Spec.InitContainers[ix].Resources.Requests)
|
||||
container.Resources = core.ResourceRequirements{Limits: lim, Requests: req}
|
||||
container.ResizePolicy = oldPod.Spec.InitContainers[ix].ResizePolicy // +k8s:verify-mutation:reason=clone
|
||||
newInitContainers = append(newInitContainers, container)
|
||||
}
|
||||
newInitContainers = append(newInitContainers, container)
|
||||
}
|
||||
}
|
||||
if len(newInitContainers) > 0 {
|
||||
originalCPUMemPodSpec.InitContainers = newInitContainers
|
||||
}
|
||||
|
||||
|
@ -319,11 +319,8 @@ func dropNonResizeUpdates(newPod, oldPod *api.Pod) *api.Pod {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
// Changes are only allowed for restartable init containers.
|
||||
if podutil.IsRestartableInitContainer(&ctr) {
|
||||
pod.Spec.InitContainers[idx].Resources = ctr.Resources
|
||||
pod.Spec.InitContainers[idx].ResizePolicy = ctr.ResizePolicy
|
||||
}
|
||||
pod.Spec.InitContainers[idx].Resources = ctr.Resources
|
||||
pod.Spec.InitContainers[idx].ResizePolicy = ctr.ResizePolicy
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user