diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 017192fcec..85102a949f 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -231,6 +231,7 @@ const ( var ( LocalGatewayHost = "knative-local-gateway.istio-system.svc." + network.GetClusterDomainName() + IstioMeshGateway = "mesh" ) // InferenceService Component enums diff --git a/pkg/controller/v1beta1/inferenceservice/controller_test.go b/pkg/controller/v1beta1/inferenceservice/controller_test.go index c01f227a71..e83c05e87b 100644 --- a/pkg/controller/v1beta1/inferenceservice/controller_test.go +++ b/pkg/controller/v1beta1/inferenceservice/controller_test.go @@ -315,6 +315,7 @@ var _ = Describe("v1beta1 inference service controller", func() { Spec: istiov1beta1.VirtualService{ Gateways: []string{ constants.KnativeLocalGateway, + constants.IstioMeshGateway, constants.KnativeIngressGateway, }, Hosts: []string{ @@ -325,7 +326,7 @@ var _ = Describe("v1beta1 inference service controller", func() { { Match: []*istiov1beta1.HTTPMatchRequest{ { - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, Authority: &istiov1beta1.StringMatch{ MatchType: &istiov1beta1.StringMatch_Regex{ Regex: constants.HostRegExp(network.GetServiceHostname(serviceKey.Name, serviceKey.Namespace)), diff --git a/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler.go b/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler.go index 335b9222c8..39acfbad2b 100644 --- a/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler.go +++ b/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler.go @@ -254,7 +254,7 @@ func createHTTPMatchRequest(prefix, targetHost, internalHost string, isInternal Regex: constants.HostRegExp(internalHost), }, }, - Gateways: []string{config.LocalGateway}, + Gateways: []string{config.LocalGateway, constants.IstioMeshGateway}, }, } if !isInternal { @@ -373,6 +373,7 @@ func createIngress(isvc *v1beta1.InferenceService, useDefault bool, config *v1be } gateways := []string{ config.LocalGateway, + constants.IstioMeshGateway, } if !isInternal { hosts = append(hosts, serviceHost) diff --git a/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler_test.go b/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler_test.go index d0be97175e..7a83679dbf 100644 --- a/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler_test.go +++ b/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler_test.go @@ -55,7 +55,7 @@ func TestCreateVirtualService(t *testing.T) { Regex: constants.HostRegExp(network.GetServiceHostname(serviceName, namespace)), }, }, - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, }, { Authority: &istiov1beta1.StringMatch{ @@ -129,7 +129,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName, serviceHostName}, - Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: predictorRouteMatch, @@ -184,7 +184,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName}, - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: []*istiov1beta1.HTTPMatchRequest{ @@ -194,7 +194,7 @@ func TestCreateVirtualService(t *testing.T) { Regex: constants.HostRegExp(network.GetServiceHostname(serviceName, namespace)), }, }, - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, }, }, Route: []*istiov1beta1.HTTPRouteDestination{ @@ -292,7 +292,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName, serviceHostName}, - Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: predictorRouteMatch, @@ -364,7 +364,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName, serviceHostName}, - Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: predictorRouteMatch, @@ -463,7 +463,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName, serviceHostName}, - Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: []*istiov1beta1.HTTPMatchRequest{ @@ -478,7 +478,7 @@ func TestCreateVirtualService(t *testing.T) { Regex: constants.HostRegExp(network.GetServiceHostname(serviceName, namespace)), }, }, - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, }, { Uri: &istiov1beta1.StringMatch{ @@ -564,7 +564,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName, serviceHostName, "my-domain.com"}, - Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: []*istiov1beta1.HTTPMatchRequest{ @@ -574,7 +574,7 @@ func TestCreateVirtualService(t *testing.T) { Regex: constants.HostRegExp(network.GetServiceHostname(serviceName, namespace)), }, }, - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, }, { Authority: &istiov1beta1.StringMatch{ @@ -679,7 +679,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName, serviceHostName}, - Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: predictorRouteMatch, @@ -750,7 +750,7 @@ func TestCreateVirtualService(t *testing.T) { ObjectMeta: metav1.ObjectMeta{Name: serviceName, Namespace: namespace, Annotations: annotations, Labels: labels}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName, serviceHostName}, - Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: predictorRouteMatch, @@ -948,7 +948,7 @@ func TestCreateVirtualService(t *testing.T) { }}, Spec: istiov1beta1.VirtualService{ Hosts: []string{serviceInternalHostName}, - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, Http: []*istiov1beta1.HTTPRoute{ { Match: []*istiov1beta1.HTTPMatchRequest{ @@ -958,7 +958,7 @@ func TestCreateVirtualService(t *testing.T) { Regex: constants.HostRegExp(network.GetServiceHostname(serviceName, namespace)), }, }, - Gateways: []string{constants.KnativeLocalGateway}, + Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway}, }, }, Route: []*istiov1beta1.HTTPRouteDestination{