Skip to content

Commit 9a9faf8

Browse files
committed
Limit redirect route generation to external traffic
1 parent e5dac81 commit 9a9faf8

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

config/config-gateway.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ data:
5353
class: istio
5454
gateway: istio-system/knative-local-gateway
5555
service: istio-system/knative-local-gateway
56-
httpListenerName: http2
56+
httpListenerName: default

pkg/reconciler/ingress/config/gateway.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const (
3939
defaultGatewayClass = "istio"
4040

4141
// defaultClusterLocalHTTPListener is the name of the listener for HTTP traffic
42-
defaultClusterLocalHTTPListener = "http2"
42+
defaultClusterLocalHTTPListener = "default"
4343

4444
// defaultExternalIPHTTPListener
4545
defaultExternalIPHTTPListener = "default"

pkg/reconciler/ingress/ingress.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ func (c *Reconciler) reconcileIngress(ctx context.Context, ing *v1alpha1.Ingress
103103
return err
104104
}
105105

106+
// For now, we only generate the redirected HTTPRoute for external visibility,
107+
// because there's no way to provide TLS for internal listeners.
106108
var redirectHTTPRoute *gatewayapi.HTTPRoute
107-
if ing.Spec.HTTPOption == v1alpha1.HTTPOptionRedirected {
109+
if ing.Spec.HTTPOption == v1alpha1.HTTPOptionRedirected && rule.Visibility == v1alpha1.IngressVisibilityExternalIP {
108110
redirectHTTPRoute, err = c.reconcileRedirectHTTPRoute(ctx, ing, &rule)
109111
if err != nil {
110112
return err

pkg/reconciler/ingress/reconcile_resources.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ func (c *Reconciler) reconcileWorkloadRoute(
5050
Name: gatewayapi.ObjectName(gatewayConfig.Gateway.Name),
5151
}
5252

53-
// if http > https redirect is enabled, this route must only be bound to the TLS listener on the gateway
54-
if ing.Spec.HTTPOption == netv1alpha1.HTTPOptionRedirected {
53+
// If http > https redirect is enabled, this route must only be bound to the TLS listener on the gateway.
54+
// For now, we only generate the TLS Listener on the external traffic gateway
55+
// because there's no way to provide TLS for internal listeners.
56+
if ing.Spec.HTTPOption == netv1alpha1.HTTPOptionRedirected && rule.Visibility == netv1alpha1.IngressVisibilityExternalIP {
5557
sectionName := gatewayapi.SectionName(listenerPrefix + ing.GetUID())
5658
gatewayRef.SectionName = &sectionName
5759
}

0 commit comments

Comments
 (0)