Skip to content

Commit

Permalink
Filter IngressTLS for visibility IngressVisibilityExternalIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ReToCode committed Nov 24, 2023
1 parent f9e2ce4 commit 80d262c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pkg/reconciler/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ func (c *Reconciler) reconcileIngress(ctx context.Context, ing *v1alpha1.Ingress
}
}

listeners := make([]*gatewayapi.Listener, 0, len(ing.Spec.TLS))
for _, tls := range ing.Spec.TLS {
externalIngressTLS := ing.GetIngressTLSForVisibility(v1alpha1.IngressVisibilityExternalIP)
listeners := make([]*gatewayapi.Listener, 0, len(externalIngressTLS))
for _, tls := range externalIngressTLS {
tls := tls

l, err := c.reconcileTLS(ctx, &tls, ing)
Expand Down
6 changes: 3 additions & 3 deletions pkg/reconciler/ingress/ingress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ func TestReconcileTLS(t *testing.T) {
rp(secret(secretName, nsName)),
},
WantUpdates: []clientgotesting.UpdateActionImpl{{
Object: gw(defaultListener, tlsListener("secure.example.com", nsName, secretName)),
Object: gw(defaultListener, tlsListener("example.com", nsName, secretName)),
}},
WantPatches: []clientgotesting.PatchActionImpl{{
ActionImpl: clientgotesting.ActionImpl{
Expand Down Expand Up @@ -315,7 +315,7 @@ func TestReconcileTLS(t *testing.T) {
Objects: []runtime.Object{
ing(withBasicSpec, withFinalizer, withGatewayAPIClass, withTLS()),
secret(secretName, nsName),
gw(defaultListener, tlsListener("secure.example.com", nsName, secretName)),
gw(defaultListener, tlsListener("example.com", nsName, secretName)),
httpRoute(t, ing(withBasicSpec, withGatewayAPIClass, withTLS())),
rp(secret(secretName, nsName)),
},
Expand Down Expand Up @@ -602,7 +602,7 @@ var withFinalizer = func(i *v1alpha1.Ingress) {
func withTLS() IngressOption {
return func(i *v1alpha1.Ingress) {
i.Spec.TLS = append(i.Spec.TLS, v1alpha1.IngressTLS{
Hosts: []string{"secure.example.com"},
Hosts: []string{"example.com"},
SecretName: "name-WE-STICK-A-LONG-UID-HERE",
SecretNamespace: "ns",
})
Expand Down

0 comments on commit 80d262c

Please sign in to comment.