Skip to content

Commit cc36dda

Browse files
authored
Merge pull request kubernetes#88288 from sbezverk/endpointslice_v1beta1
Switch EndpointSlice e2e test to use discovery v1beta1 api
2 parents 3a24c32 + 5b7ae34 commit cc36dda

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

test/e2e/network/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ go_library(
3939
"//pkg/master/ports:go_default_library",
4040
"//staging/src/k8s.io/api/apps/v1:go_default_library",
4141
"//staging/src/k8s.io/api/core/v1:go_default_library",
42-
"//staging/src/k8s.io/api/discovery/v1alpha1:go_default_library",
42+
"//staging/src/k8s.io/api/discovery/v1beta1:go_default_library",
4343
"//staging/src/k8s.io/api/networking/v1:go_default_library",
4444
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
4545
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",

test/e2e/network/endpointslice.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"time"
2323

2424
v1 "k8s.io/api/core/v1"
25-
discoveryv1alpha1 "k8s.io/api/discovery/v1alpha1"
25+
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
2626
apierrors "k8s.io/apimachinery/pkg/api/errors"
2727
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2828
"k8s.io/apimachinery/pkg/util/intstr"
@@ -192,7 +192,7 @@ var _ = SIGDescribe("EndpointSlice [Feature:EndpointSlice]", func() {
192192
// and takes some shortcuts with the assumption that those test cases will be
193193
// the only caller of this function.
194194
func expectEndpointsAndSlices(cs clientset.Interface, ns string, svc *v1.Service, pods []*v1.Pod, numSubsets, numSlices int, namedPort bool) {
195-
endpointSlices := []discoveryv1alpha1.EndpointSlice{}
195+
endpointSlices := []discoveryv1beta1.EndpointSlice{}
196196
endpoints := &v1.Endpoints{}
197197

198198
err := wait.Poll(5*time.Second, 1*time.Minute, func() (bool, error) {
@@ -353,18 +353,18 @@ func expectEndpointsAndSlices(cs clientset.Interface, ns string, svc *v1.Service
353353
// hasMatchingEndpointSlices returns any EndpointSlices that match the
354354
// conditions along with a boolean indicating if all the conditions have been
355355
// met.
356-
func hasMatchingEndpointSlices(cs clientset.Interface, ns, svcName string, numEndpoints, numSlices int) ([]discoveryv1alpha1.EndpointSlice, bool) {
357-
listOptions := metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s", discoveryv1alpha1.LabelServiceName, svcName)}
358-
esList, err := cs.DiscoveryV1alpha1().EndpointSlices(ns).List(context.TODO(), listOptions)
356+
func hasMatchingEndpointSlices(cs clientset.Interface, ns, svcName string, numEndpoints, numSlices int) ([]discoveryv1beta1.EndpointSlice, bool) {
357+
listOptions := metav1.ListOptions{LabelSelector: fmt.Sprintf("%s=%s", discoveryv1beta1.LabelServiceName, svcName)}
358+
esList, err := cs.DiscoveryV1beta1().EndpointSlices(ns).List(context.TODO(), listOptions)
359359
framework.ExpectNoError(err, "Error fetching EndpointSlice for %s/%s Service", ns, svcName)
360360

361361
if len(esList.Items) == 0 {
362362
framework.Logf("EndpointSlice for %s/%s Service not found", ns, svcName)
363-
return []discoveryv1alpha1.EndpointSlice{}, false
363+
return []discoveryv1beta1.EndpointSlice{}, false
364364
}
365365
if len(esList.Items) != numSlices {
366366
framework.Logf("Expected %d EndpointSlices for %s/%s Service, got %d", numSlices, ns, svcName, len(esList.Items))
367-
return []discoveryv1alpha1.EndpointSlice{}, false
367+
return []discoveryv1beta1.EndpointSlice{}, false
368368
}
369369

370370
actualNumEndpoints := 0
@@ -373,7 +373,7 @@ func hasMatchingEndpointSlices(cs clientset.Interface, ns, svcName string, numEn
373373
}
374374
if actualNumEndpoints != numEndpoints {
375375
framework.Logf("EndpointSlices for %s/%s Service have %d/%d endpoints", ns, svcName, actualNumEndpoints, numEndpoints)
376-
return []discoveryv1alpha1.EndpointSlice{}, false
376+
return []discoveryv1beta1.EndpointSlice{}, false
377377
}
378378

379379
return esList.Items, true

0 commit comments

Comments
 (0)