Skip to content

Commit f4c5562

Browse files
upgrade to latest dependencies (#1311)
bumping knative.dev/networking a40d058...979f637: > 979f637 [release-1.14] Update test dialer to use ip when available (# 971) Signed-off-by: Knative Automation <automation@knative.team>
1 parent 2971532 commit f4c5562

File tree

4 files changed

+61
-48
lines changed

4 files changed

+61
-48
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
k8s.io/apimachinery v0.29.2
1414
k8s.io/client-go v0.29.2
1515
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7
16-
knative.dev/networking v0.0.0-20240416165409-a40d058f6aef
16+
knative.dev/networking v0.0.0-20240418213116-979f63728302
1717
knative.dev/pkg v0.0.0-20240416145024-0f34a8815650
1818
sigs.k8s.io/yaml v1.4.0
1919
)

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,8 @@ k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCf
685685
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
686686
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7 h1:fkWYWvdHm1mVHevKW2vVJnZtxH0NzOlux8imesweKwE=
687687
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7/go.mod h1:yk2OjGDsbEnQjfxdm0/HJKS2WqTLEFg/N6nUs6Rqx3Q=
688-
knative.dev/networking v0.0.0-20240416165409-a40d058f6aef h1:bA7FC8IGcXFO95LqbUqVMngp0bEXgQ/D2vXDJj8QbfI=
689-
knative.dev/networking v0.0.0-20240416165409-a40d058f6aef/go.mod h1:bb3B1eNMNO827kErNDGKYYiBgtlaR6T1DEDnfEad3q4=
688+
knative.dev/networking v0.0.0-20240418213116-979f63728302 h1:TQwoh8K7RgPXU+5Z5SX385vYjgvQ0OzdFLHRRCeF5K4=
689+
knative.dev/networking v0.0.0-20240418213116-979f63728302/go.mod h1:bb3B1eNMNO827kErNDGKYYiBgtlaR6T1DEDnfEad3q4=
690690
knative.dev/pkg v0.0.0-20240416145024-0f34a8815650 h1:m2ahFUO0L2VrgGDYdyOUFdE6xBd3pLXAJozLJwqLRQM=
691691
knative.dev/pkg v0.0.0-20240416145024-0f34a8815650/go.mod h1:soFw5ss08G4PU3JiFDKqiZRd2U7xoqcfNpJP1coIXkY=
692692
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

vendor/knative.dev/networking/test/conformance/ingress/util.go

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,61 +1046,74 @@ func CreateDialContext(ctx context.Context, t *testing.T, ing *v1alpha1.Ingress,
10461046
// TODO(mattmoor): I'm open to tricks that would let us cleanly test multiple
10471047
// public load balancers or LBs with multiple ingresses (below), but want to
10481048
// keep our simple tests simple, thus the [0]s...
1049-
// We expect an ingress LB with the form foo.bar.svc.cluster.local (though
1050-
// we aren't strictly sensitive to the suffix, this is just illustrative.
10511049
internalDomain := ing.Status.PublicLoadBalancer.Ingress[0].DomainInternal
1052-
parts := strings.SplitN(internalDomain, ".", 3)
1053-
if len(parts) < 3 {
1054-
t.Fatal("Too few parts in internal domain:", internalDomain)
1055-
}
1056-
name, namespace := parts[0], parts[1]
1050+
if internalDomain != "" {
1051+
parts := strings.SplitN(internalDomain, ".", 3)
1052+
if len(parts) < 3 {
1053+
t.Fatal("Too few parts in internal domain:", internalDomain)
1054+
}
1055+
name, namespace := parts[0], parts[1]
10571056

1058-
var svc *corev1.Service
1059-
err := reconciler.RetryTestErrors(func(attempts int) (err error) {
1060-
svc, err = clients.KubeClient.CoreV1().Services(namespace).Get(ctx, name, metav1.GetOptions{})
1061-
return err
1062-
})
1063-
if err != nil {
1064-
t.Fatalf("Unable to retrieve Kubernetes service %s/%s: %v", namespace, name, err)
1065-
}
1057+
var svc *corev1.Service
1058+
err := reconciler.RetryTestErrors(func(attempts int) (err error) {
1059+
svc, err = clients.KubeClient.CoreV1().Services(namespace).Get(ctx, name, metav1.GetOptions{})
1060+
return err
1061+
})
1062+
if err != nil {
1063+
t.Fatalf("Unable to retrieve Kubernetes service %s/%s: %v", namespace, name, err)
1064+
}
10661065

1067-
dial := network.NewBackoffDialer(dialBackoff)
1068-
if pkgTest.Flags.IngressEndpoint != "" {
1069-
t.Logf("ingressendpoint: %q", pkgTest.Flags.IngressEndpoint)
1066+
dial := network.NewBackoffDialer(dialBackoff)
1067+
if pkgTest.Flags.IngressEndpoint != "" {
1068+
t.Logf("ingressendpoint: %q", pkgTest.Flags.IngressEndpoint)
10701069

1071-
// If we're using a manual --ingressendpoint then don't require
1072-
// "type: LoadBalancer", which may not play nice with KinD
1073-
return func(ctx context.Context, _ string, address string) (net.Conn, error) {
1074-
_, port, err := net.SplitHostPort(address)
1075-
if err != nil {
1076-
return nil, err
1070+
// If we're using a manual --ingressendpoint then don't require
1071+
// "type: LoadBalancer", which may not play nice with KinD
1072+
return func(ctx context.Context, _ string, address string) (net.Conn, error) {
1073+
_, port, err := net.SplitHostPort(address)
1074+
if err != nil {
1075+
return nil, err
1076+
}
1077+
for _, sp := range svc.Spec.Ports {
1078+
if fmt.Sprint(sp.Port) == port {
1079+
return dial(ctx, "tcp", fmt.Sprintf("%s:%d", pkgTest.Flags.IngressEndpoint, sp.NodePort))
1080+
}
1081+
}
1082+
return nil, fmt.Errorf("service doesn't contain a matching port: %s", port)
10771083
}
1078-
for _, sp := range svc.Spec.Ports {
1079-
if fmt.Sprint(sp.Port) == port {
1080-
return dial(ctx, "tcp", fmt.Sprintf("%s:%d", pkgTest.Flags.IngressEndpoint, sp.NodePort))
1084+
} else if len(svc.Status.LoadBalancer.Ingress) >= 1 {
1085+
ingress := svc.Status.LoadBalancer.Ingress[0]
1086+
return func(ctx context.Context, _ string, address string) (net.Conn, error) {
1087+
_, port, err := net.SplitHostPort(address)
1088+
if err != nil {
1089+
return nil, err
1090+
}
1091+
if ingress.IP != "" {
1092+
return dial(ctx, "tcp", ingress.IP+":"+port)
10811093
}
1094+
if ingress.Hostname != "" {
1095+
return dial(ctx, "tcp", ingress.Hostname+":"+port)
1096+
}
1097+
return nil, errors.New("service ingress does not contain dialing information")
10821098
}
1083-
return nil, fmt.Errorf("service doesn't contain a matching port: %s", port)
10841099
}
1085-
} else if len(svc.Status.LoadBalancer.Ingress) >= 1 {
1086-
ingress := svc.Status.LoadBalancer.Ingress[0]
1087-
return func(ctx context.Context, _ string, address string) (net.Conn, error) {
1088-
_, port, err := net.SplitHostPort(address)
1089-
if err != nil {
1090-
return nil, err
1091-
}
1092-
if ingress.IP != "" {
1093-
return dial(ctx, "tcp", ingress.IP+":"+port)
1094-
}
1095-
if ingress.Hostname != "" {
1096-
return dial(ctx, "tcp", ingress.Hostname+":"+port)
1097-
}
1098-
return nil, errors.New("service ingress does not contain dialing information")
1100+
t.Fatal("Service does not have a supported shape (not type LoadBalancer? missing --ingressendpoint?).")
1101+
} else if ing.Status.PublicLoadBalancer.Ingress[0].IP != "" {
1102+
dial := network.NewBackoffDialer(dialBackoff)
1103+
ingressIP := ing.Status.PublicLoadBalancer.Ingress[0].IP
1104+
1105+
port := 80
1106+
if ing.Spec.Rules[0].Visibility == v1alpha1.IngressVisibilityExternalIP && ing.Spec.HTTPOption == v1alpha1.HTTPOptionRedirected {
1107+
port = 443
1108+
}
1109+
1110+
return func(ctx context.Context, _ string, _ string) (net.Conn, error) {
1111+
return dial(ctx, "tcp", fmt.Sprintf("%s:%d", ingressIP, port))
10991112
}
11001113
} else {
1101-
t.Fatal("Service does not have a supported shape (not type LoadBalancer? missing --ingressendpoint?).")
1102-
return nil // Unreachable
1114+
t.Fatal("No IP or domain found on ingress.")
11031115
}
1116+
return nil // Unreachable
11041117
}
11051118

11061119
type RequestOption func(*http.Request)

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ k8s.io/utils/trace
910910
# knative.dev/hack v0.0.0-20240404013450-1133b37da8d7
911911
## explicit; go 1.18
912912
knative.dev/hack
913-
# knative.dev/networking v0.0.0-20240416165409-a40d058f6aef
913+
# knative.dev/networking v0.0.0-20240418213116-979f63728302
914914
## explicit; go 1.21
915915
knative.dev/networking/config
916916
knative.dev/networking/pkg

0 commit comments

Comments
 (0)