Skip to content

Commit 6b7e38f

Browse files
committed
Fix nits from PR 130355
1 parent 803e9d6 commit 6b7e38f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pkg/apis/core/validation/validation.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6266,7 +6266,7 @@ func ValidateReplicationControllerSpec(spec, oldSpec *core.ReplicationController
62666266
allErrs := field.ErrorList{}
62676267
allErrs = append(allErrs, ValidateNonnegativeField(int64(spec.MinReadySeconds), fldPath.Child("minReadySeconds"))...)
62686268
allErrs = append(allErrs, ValidateNonEmptySelector(spec.Selector, fldPath.Child("selector"))...)
6269-
allErrs = append(allErrs, ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas")).WithOrigin("minimum")...)
6269+
allErrs = append(allErrs, ValidateNonnegativeField(int64(spec.Replicas), fldPath.Child("replicas"))...)
62706270
allErrs = append(allErrs, ValidatePodTemplateSpecForRC(spec.Template, spec.Selector, spec.Replicas, fldPath.Child("template"), opts)...)
62716271
return allErrs
62726272
}
@@ -7489,18 +7489,18 @@ func ValidateNonSpecialIP(ipAddress string, fldPath *field.Path) field.ErrorList
74897489
return allErrs
74907490
}
74917491
if ip.IsUnspecified() {
7492-
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, fmt.Sprintf("may not be unspecified (%v)", ipAddress)).WithOrigin("format=non-special-ip"))
7492+
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, fmt.Sprintf("may not be unspecified (%v)", ipAddress)))
74937493
}
74947494
if ip.IsLoopback() {
7495-
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the loopback range (127.0.0.0/8, ::1/128)").WithOrigin("format=non-special-ip"))
7495+
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the loopback range (127.0.0.0/8, ::1/128)"))
74967496
}
74977497
if ip.IsLinkLocalUnicast() {
7498-
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the link-local range (169.254.0.0/16, fe80::/10)").WithOrigin("format=non-special-ip"))
7498+
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the link-local range (169.254.0.0/16, fe80::/10)"))
74997499
}
75007500
if ip.IsLinkLocalMulticast() {
7501-
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the link-local multicast range (224.0.0.0/24, ff02::/10)").WithOrigin("format=non-special-ip"))
7501+
allErrs = append(allErrs, field.Invalid(fldPath, ipAddress, "may not be in the link-local multicast range (224.0.0.0/24, ff02::/10)"))
75027502
}
7503-
return allErrs
7503+
return allErrs.WithOrigin("format=non-special-ip")
75047504
}
75057505

75067506
func validateEndpointPort(port *core.EndpointPort, requireName bool, fldPath *field.Path) field.ErrorList {

staging/src/k8s.io/apimachinery/pkg/api/validation/generic.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func maskTrailingDash(name string) string {
8282
func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList {
8383
allErrs := field.ErrorList{}
8484
if value < 0 {
85-
allErrs = append(allErrs, field.Invalid(fldPath, value, IsNegativeErrorMsg))
85+
allErrs = append(allErrs, field.Invalid(fldPath, value, IsNegativeErrorMsg).WithOrigin("minimum"))
8686
}
8787
return allErrs
8888
}

0 commit comments

Comments
 (0)