Skip to content

[DRAFT-NOT-FOR-REVIEW] Draft changes to debug conformance test issues. #132073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pkg/proxy/winkernel/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,12 @@ func (proxier *Proxier) syncProxyRules() {
klog.V(4).InfoS("Skipped terminating status check for all endpoints", "svcClusterIP", svcInfo.ClusterIP(), "ingressLBCount", len(svcInfo.loadBalancerIngressIPs))
}

epsMap := proxier.endpointsMap[svcName]
klog.V(4).InfoS("TEST: Endpoints map for service", "svcName", svcName, "endpointsCount", len(epsMap))
for svcName := range proxier.endpointsMap {
klog.V(4).InfoS("TEST: Available services in endpointmap", "svcName", svcName, "endpointsCount", len(proxier.endpointsMap[svcName]))
}

for _, epInfo := range proxier.endpointsMap[svcName] {
ep, ok := epInfo.(*endpointInfo)
if !ok {
Expand Down Expand Up @@ -1356,9 +1362,11 @@ func (proxier *Proxier) syncProxyRules() {
// targetPort is zero if it is specified as a name in port.TargetPort, so the real port should be got from endpoints.
// Note that hnslib.AddLoadBalancer() doesn't support endpoints with different ports, so only port from first endpoint is used.
// TODO(feiskyer): add support of different endpoint ports after hnslib.AddLoadBalancer() add that.
if svcInfo.targetPort == 0 {
if svcInfo.targetPort != int(ep.port) {
klog.V(3).InfoS("Prince: svcInfo.targetPort == 0 ", "EpIP", ep.ip, " EpPort", ep.port)
svcInfo.targetPort = int(ep.port)
}
klog.V(3).InfoS("Prince: After svcInfo.targetPort == 0 ", "EpIP", ep.ip, " EpPort", ep.port)
// There is a bug in Windows Server 2019 that can cause two endpoints to be created with the same IP address, so we need to check using endpoint ID first.
// TODO: Remove lookup by endpoint ID, and use the IP address only, so we don't need to maintain multiple keys for lookup.
if len(ep.hnsID) > 0 {
Expand Down Expand Up @@ -1522,7 +1530,7 @@ func (proxier *Proxier) syncProxyRules() {
if !proxier.requiresUpdateLoadbalancer(svcInfo.hnsID, len(clusterIPEndpoints)) {
proxier.deleteExistingLoadBalancer(hns, svcInfo.winProxyOptimization, &svcInfo.hnsID, svcInfo.ClusterIP().String(), Enum(svcInfo.Protocol()), uint16(svcInfo.targetPort), uint16(svcInfo.Port()), hnsEndpoints, queriedLoadBalancers)
if len(clusterIPEndpoints) > 0 {

klog.V(3).InfoS("Prince: Creating clusterip lb ", "svcInfo.targetPort", svcInfo.targetPort)
// If all endpoints are terminating, then no need to create Cluster IP LoadBalancer
// Cluster IP LoadBalancer creation
hnsLoadBalancer, err := hns.getLoadBalancer(
Expand Down
16 changes: 16 additions & 0 deletions test/conformance/testdata/conformance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1727,6 +1727,22 @@
MUST have Endpoints and EndpointSlices pointing to each API server instance.
release: v1.21
file: test/e2e/network/endpointslice.go
- testname: EndpointSlice, multiple IPs, multiple ports
codename: '[sig-network] EndpointSlice should support a Service with multiple endpoint
IPs specified in multiple EndpointSlices [Conformance]'
description: Given a selector-less Service with multiple manually-created EndpointSlices
(and no Endpoints) where the endpoints have different IPs and different Ports,
the service proxy MUST allow connections to both ports.
release: v1.34
file: test/e2e/network/endpointslice.go
- testname: EndpointSlice, single IP, multiple ports
codename: '[sig-network] EndpointSlice should support a Service with multiple ports
specified in multiple EndpointSlices [Conformance]'
description: Given a selector-less Service with multiple manually-created EndpointSlices
(and no Endpoints) where the endpoints have the same IP but different Ports, the
service proxy MUST allow connections to both ports.
release: v1.34
file: test/e2e/network/endpointslice.go
- testname: EndpointSlice API
codename: '[sig-network] EndpointSlice should support creating EndpointSlice API
operations [Conformance]'
Expand Down
38 changes: 29 additions & 9 deletions test/e2e/network/endpointslice.go
Original file line number Diff line number Diff line change
Expand Up @@ -528,28 +528,38 @@ var _ = common.SIGDescribe("EndpointSlice", func() {
gomega.Expect(epsList.Items).To(gomega.BeEmpty(), "filtered list should have 0 items")
})

ginkgo.It("should support a Service with multiple ports specified in multiple EndpointSlices", func(ctx context.Context) {
/*
Release: v1.34
Testname: EndpointSlice, single IP, multiple ports
Description: Given a selector-less Service with multiple manually-created
EndpointSlices (and no Endpoints) where the endpoints have the same IP
but different Ports, the service proxy MUST allow connections to both ports.
*/
framework.ConformanceIt("should support a Service with multiple ports specified in multiple EndpointSlices", func(ctx context.Context) {
ns := f.Namespace.Name
svc := createServiceReportErr(ctx, cs, f.Namespace.Name, &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "example-custom-endpoints",
Name: "example-custom-endpoints",
Namespace: ns,
},
Spec: v1.ServiceSpec{
Ports: []v1.ServicePort{
{
Name: "port80",
Name: "port80prince",
Port: 80,
Protocol: v1.ProtocolTCP,
},
{
Name: "port81",
Name: "port81prince",
Port: 81,
Protocol: v1.ProtocolTCP,
},
},
},
})

framework.Logf("Prince new Svc created: %v ", svc)

// Add a backend pod to the service in the other node
port8090 := []v1.ContainerPort{
{
Expand Down Expand Up @@ -585,7 +595,9 @@ var _ = common.SIGDescribe("EndpointSlice", func() {
tcpProtocol := v1.ProtocolTCP
readyCondTrue := true
epsTemplate := &discoveryv1.EndpointSlice{
ObjectMeta: metav1.ObjectMeta{GenerateName: "e2e-custom-slice",
ObjectMeta: metav1.ObjectMeta{
GenerateName: "e2e-custom-slice",
Namespace: ns,
Labels: map[string]string{
discoveryv1.LabelServiceName: svc.Name,
discoveryv1.LabelManagedBy: "e2e-test" + ns,
Expand All @@ -602,7 +614,7 @@ var _ = common.SIGDescribe("EndpointSlice", func() {
ginkgo.By("creating")
eps1 := epsTemplate.DeepCopy()
eps1.Ports = []discoveryv1.EndpointPort{{
Name: pointer.String("port80"),
Name: pointer.String("port80prince"),
Port: pointer.Int32(8090),
Protocol: &tcpProtocol,
}}
Expand All @@ -611,7 +623,7 @@ var _ = common.SIGDescribe("EndpointSlice", func() {
framework.ExpectNoError(err)
eps2 := epsTemplate.DeepCopy()
eps2.Ports = []discoveryv1.EndpointPort{{
Name: pointer.String("port81"),
Name: pointer.String("port81prince"),
Port: pointer.Int32(9090),
Protocol: &tcpProtocol,
}}
Expand All @@ -631,11 +643,19 @@ var _ = common.SIGDescribe("EndpointSlice", func() {

})

ginkgo.It("should support a Service with multiple endpoint IPs specified in multiple EndpointSlices", func(ctx context.Context) {
/*
Release: v1.34
Testname: EndpointSlice, multiple IPs, multiple ports
Description: Given a selector-less Service with multiple manually-created
EndpointSlices (and no Endpoints) where the endpoints have different IPs
and different Ports, the service proxy MUST allow connections to both ports.
*/
framework.ConformanceIt("should support a Service with multiple endpoint IPs specified in multiple EndpointSlices", func(ctx context.Context) {
ns := f.Namespace.Name
svc := createServiceReportErr(ctx, cs, f.Namespace.Name, &v1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: "example-custom-endpoints",
Name: "example-custom-endpoints",
Namespace: ns,
},
Spec: v1.ServiceSpec{
Ports: []v1.ServicePort{
Expand Down