Check loopback and link-local multicast endpoints
Previously we just disallowed link-local (unicast). This disallows loopback and link-local multicast.
This commit is contained in:
@@ -3948,6 +3948,19 @@ func TestValidateEndpoints(t *testing.T) {
|
||||
},
|
||||
errorType: "FieldValueRequired",
|
||||
},
|
||||
"Address is loopback": {
|
||||
endpoints: api.Endpoints{
|
||||
ObjectMeta: api.ObjectMeta{Name: "mysvc", Namespace: "namespace"},
|
||||
Subsets: []api.EndpointSubset{
|
||||
{
|
||||
Addresses: []api.EndpointAddress{{IP: "127.0.0.1"}},
|
||||
Ports: []api.EndpointPort{{Name: "p", Port: 93, Protocol: "TCP"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
errorType: "FieldValueInvalid",
|
||||
errorDetail: "loopback",
|
||||
},
|
||||
"Address is link-local": {
|
||||
endpoints: api.Endpoints{
|
||||
ObjectMeta: api.ObjectMeta{Name: "mysvc", Namespace: "namespace"},
|
||||
@@ -3961,6 +3974,19 @@ func TestValidateEndpoints(t *testing.T) {
|
||||
errorType: "FieldValueInvalid",
|
||||
errorDetail: "link-local",
|
||||
},
|
||||
"Address is link-local multicast": {
|
||||
endpoints: api.Endpoints{
|
||||
ObjectMeta: api.ObjectMeta{Name: "mysvc", Namespace: "namespace"},
|
||||
Subsets: []api.EndpointSubset{
|
||||
{
|
||||
Addresses: []api.EndpointAddress{{IP: "224.0.0.1"}},
|
||||
Ports: []api.EndpointPort{{Name: "p", Port: 93, Protocol: "TCP"}},
|
||||
},
|
||||
},
|
||||
},
|
||||
errorType: "FieldValueInvalid",
|
||||
errorDetail: "link-local multicast",
|
||||
},
|
||||
}
|
||||
|
||||
for k, v := range errorCases {
|
||||
|
Reference in New Issue
Block a user