Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cherry-pick] Prevent the PassthroughCluster for clients in the service mesh #369

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ const (

var (
LocalGatewayHost = "knative-local-gateway.istio-system.svc." + network.GetClusterDomainName()
IstioMeshGateway = "mesh"
)

// InferenceService Component enums
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/v1beta1/inferenceservice/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ var _ = Describe("v1beta1 inference service controller", func() {
Spec: istiov1beta1.VirtualService{
Gateways: []string{
constants.KnativeLocalGateway,
constants.IstioMeshGateway,
constants.KnativeIngressGateway,
},
Hosts: []string{
Expand All @@ -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)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func createHTTPMatchRequest(prefix, targetHost, internalHost string, additionalH
Regex: constants.HostRegExp(internalHost),
},
},
Gateways: []string{config.LocalGateway},
Gateways: []string{config.LocalGateway, constants.IstioMeshGateway},
},
}
if !isInternal {
Expand Down Expand Up @@ -431,6 +431,7 @@ func createIngress(isvc *v1beta1.InferenceService, useDefault bool, config *v1be

gateways := []string{
config.LocalGateway,
constants.IstioMeshGateway,
}
if !isInternal {
hosts = append(hosts, serviceHost)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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{
Expand Down Expand Up @@ -132,7 +132,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,
Expand Down Expand Up @@ -187,7 +187,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{
Expand All @@ -197,7 +197,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{
Expand Down Expand Up @@ -295,7 +295,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,
Expand Down Expand Up @@ -367,7 +367,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,
Expand Down Expand Up @@ -466,7 +466,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{
Expand All @@ -481,7 +481,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{
Expand Down Expand Up @@ -567,7 +567,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{
Expand All @@ -577,7 +577,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{
Expand Down Expand Up @@ -689,7 +689,7 @@ func TestCreateVirtualService(t *testing.T) {
Spec: istiov1beta1.VirtualService{
Hosts: []string{serviceInternalHostName, serviceHostName, "my-domain.com",
"my-model.test.my-additional-domain.com", "my-model.test.my-second-additional-domain.com"},
Gateways: []string{constants.KnativeLocalGateway, constants.KnativeIngressGateway},
Gateways: []string{constants.KnativeLocalGateway, constants.IstioMeshGateway, constants.KnativeIngressGateway},
Http: []*istiov1beta1.HTTPRoute{
{
Match: []*istiov1beta1.HTTPMatchRequest{
Expand All @@ -699,7 +699,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{
Expand Down Expand Up @@ -820,7 +820,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,
Expand Down Expand Up @@ -891,7 +891,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,
Expand Down Expand Up @@ -1089,7 +1089,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{
Expand All @@ -1099,7 +1099,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{
Expand Down
Loading