remove old ip checks

Signed-off-by: JaredTan95 <jian.tan@daocloud.io>
This commit is contained in:
JaredTan95 2021-05-04 08:57:15 +08:00
parent 31030820be
commit b6fbe5e622
2 changed files with 1 additions and 12 deletions

View File

@ -4085,11 +4085,7 @@ func ValidatePodStatusUpdate(newPod, oldPod *core.Pod, opts PodValidationOptions
allErrs = append(allErrs, ValidateContainerStateTransition(newPod.Status.InitContainerStatuses, oldPod.Status.InitContainerStatuses, fldPath.Child("initContainerStatuses"), oldPod.Spec.RestartPolicy)...)
if newIPErrs := validatePodIPs(newPod); len(newIPErrs) > 0 {
// Tolerate IP errors if IP errors already existed in the old pod. See http://issue.k8s.io/90625
// TODO(liggitt): Drop the check of oldPod in 1.20
if oldIPErrs := validatePodIPs(oldPod); len(oldIPErrs) == 0 {
allErrs = append(allErrs, newIPErrs...)
}
allErrs = append(allErrs, newIPErrs...)
}
return allErrs

View File

@ -16719,13 +16719,6 @@ func TestPodIPsValidation(t *testing.T) {
oldPod.Name = newPod.Name
errs := ValidatePodStatusUpdate(newPod, oldPod, PodValidationOptions{})
if oldTestCase.expectError {
// The old pod was invalid, tolerate invalid IPs in the new pod as well
if len(errs) > 0 {
t.Fatalf("expected success for update to pod with already-invalid IPs, got errors: %v", errs)
}
continue
}
if len(errs) == 0 && testCase.expectError {
t.Fatalf("expected failure for %s, but there were none", testCase.pod.Name)