diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 017192fceca..85102a949f9 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 97b1ed931ba..89f9ee71bee 100644 --- a/pkg/controller/v1beta1/inferenceservice/controller_test.go +++ b/pkg/controller/v1beta1/inferenceservice/controller_test.go @@ -316,6 +316,7 @@ var _ = Describe("v1beta1 inference service controller", func() { Spec: istiov1beta1.VirtualService{ Gateways: []string{ constants.KnativeLocalGateway, + constants.IstioMeshGateway, constants.KnativeIngressGateway, }, Hosts: []string{ @@ -326,7 +327,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 9a1e9121f93..1c8a8aec660 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 a9a701ae28c..fc8a38b9e0b 100644 --- a/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler_test.go +++ b/pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/ingress_reconciler_test.go @@ -54,7 +54,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{ @@ -128,7 +128,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, @@ -183,7 +183,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{ @@ -193,7 +193,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{ @@ -291,7 +291,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, @@ -363,7 +363,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, @@ -462,7 +462,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{ @@ -477,7 +477,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{ @@ -563,7 +563,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{ @@ -573,7 +573,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{ @@ -678,7 +678,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, @@ -749,7 +749,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, @@ -947,7 +947,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{ @@ -957,7 +957,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{