mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-13 11:25:19 +00:00
Merge pull request #23317 from aanm/removing-ipv4-enforcement
Automatic merge from submit-queue Remove requirement that Endpoints IPs be IPv4 Signed-off-by: André Martins <aanm90@gmail.com> Release Note: The `Endpoints` API object now allows IPv6 addresses to be stored. Other components of the system are not ready for IPv6 yet, and many cloud providers are not IPv6 compatible, but installations that use their own controller logic can now store v6 endpoints.
This commit is contained in:
@@ -2599,8 +2599,8 @@ func validateEndpointSubsets(subsets []api.EndpointSubset, fldPath *field.Path)
|
||||
|
||||
func validateEndpointAddress(address *api.EndpointAddress, fldPath *field.Path) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if !validation.IsValidIPv4(address.IP) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("ip"), address.IP, "must be a valid IPv4 address"))
|
||||
if !validation.IsValidIP(address.IP) {
|
||||
allErrs = append(allErrs, field.Invalid(fldPath.Child("ip"), address.IP, "must be a valid IP address"))
|
||||
return allErrs
|
||||
}
|
||||
return validateIpIsNotLinkLocalOrLoopback(address.IP, fldPath.Child("ip"))
|
||||
|
||||
@@ -4909,13 +4909,13 @@ func TestValidateEndpoints(t *testing.T) {
|
||||
ObjectMeta: api.ObjectMeta{Name: "mysvc", Namespace: "namespace"},
|
||||
Subsets: []api.EndpointSubset{
|
||||
{
|
||||
Addresses: []api.EndpointAddress{{IP: "2001:0db8:85a3:0042:1000:8a2e:0370:7334"}},
|
||||
Addresses: []api.EndpointAddress{{IP: "[2001:0db8:85a3:0042:1000:8a2e:0370:7334]"}},
|
||||
Ports: []api.EndpointPort{{Name: "a", Port: 93, Protocol: "TCP"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
errorType: "FieldValueInvalid",
|
||||
errorDetail: "must be a valid IPv4 address",
|
||||
errorDetail: "must be a valid IP address",
|
||||
},
|
||||
"Multiple ports, one without name": {
|
||||
endpoints: api.Endpoints{
|
||||
@@ -4965,7 +4965,7 @@ func TestValidateEndpoints(t *testing.T) {
|
||||
},
|
||||
},
|
||||
errorType: "FieldValueInvalid",
|
||||
errorDetail: "must be a valid IPv4 address",
|
||||
errorDetail: "must be a valid IP address",
|
||||
},
|
||||
"Port missing number": {
|
||||
endpoints: api.Endpoints{
|
||||
|
||||
Reference in New Issue
Block a user