mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 10:48:15 +00:00
Graduate EndpointSlice API to GA
* Removes discovery v1alpha1 API * Replaces per Endpoint Topology with a read only DeprecatedTopology in GA API * Adds per Endpoint Zone field in GA API
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api "k8s.io/kubernetes/pkg/apis/core"
|
||||
"k8s.io/kubernetes/pkg/apis/discovery"
|
||||
@@ -197,8 +198,8 @@ func TestValidateEndpointSlice(t *testing.T) {
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
}},
|
||||
Endpoints: []discovery.Endpoint{{
|
||||
Addresses: generateIPAddresses(1),
|
||||
Topology: generateTopology(maxTopologyLabels),
|
||||
Addresses: generateIPAddresses(1),
|
||||
DeprecatedTopology: generateTopology(maxTopologyLabels),
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -321,8 +322,8 @@ func TestValidateEndpointSlice(t *testing.T) {
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
}},
|
||||
Endpoints: []discovery.Endpoint{{
|
||||
Addresses: generateIPAddresses(1),
|
||||
Topology: map[string]string{"--INVALID": "example"},
|
||||
Addresses: generateIPAddresses(1),
|
||||
DeprecatedTopology: map[string]string{"--INVALID": "example"},
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -336,8 +337,8 @@ func TestValidateEndpointSlice(t *testing.T) {
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
}},
|
||||
Endpoints: []discovery.Endpoint{{
|
||||
Addresses: generateIPAddresses(1),
|
||||
Topology: generateTopology(maxTopologyLabels + 1),
|
||||
Addresses: generateIPAddresses(1),
|
||||
DeprecatedTopology: generateTopology(maxTopologyLabels + 1),
|
||||
}},
|
||||
},
|
||||
},
|
||||
@@ -454,6 +455,21 @@ func TestValidateEndpointSlice(t *testing.T) {
|
||||
expectedErrors: 3,
|
||||
endpointSlice: &discovery.EndpointSlice{},
|
||||
},
|
||||
"zone-key-topology": {
|
||||
expectedErrors: 1,
|
||||
endpointSlice: &discovery.EndpointSlice{
|
||||
ObjectMeta: standardMeta,
|
||||
AddressType: discovery.AddressTypeIPv4,
|
||||
Ports: []discovery.EndpointPort{{
|
||||
Name: utilpointer.StringPtr("http"),
|
||||
Protocol: protocolPtr(api.ProtocolTCP),
|
||||
}},
|
||||
Endpoints: []discovery.Endpoint{{
|
||||
Addresses: generateIPAddresses(1),
|
||||
DeprecatedTopology: map[string]string{corev1.LabelTopologyZone: "zone1"},
|
||||
}},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, testCase := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user