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

VirtualService delegate doesn't work with defaultVirtualServiceExportTo: ["."] #42602

Closed
rajatsharma94 opened this issue Dec 29, 2022 · 0 comments · Fixed by #42604
Closed

VirtualService delegate doesn't work with defaultVirtualServiceExportTo: ["."] #42602

rajatsharma94 opened this issue Dec 29, 2022 · 0 comments · Fixed by #42604

Comments

@rajatsharma94
Copy link
Contributor

rajatsharma94 commented Dec 29, 2022

Bug Description

Merging of VirtualServices based on the delegate doesn't happen when VirtualServices are set to be exported to their own namespace (setting defaultVirtualServiceExportTo: ["."]) and the exportTo in VirtualService is not set.

Setup

VirtualService

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: dummy-svc-1
  namespace: ns-1
spec:
  hosts:
  - "dummy-svc-1.service"
  http:
  - match:
    - uri:
        prefix: "/"
    delegate:
       name: dummy-svc-1-dlg

Delegate VirtualService

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: dummy-svc-1-dlg
  namespace: ns-1
spec:
  http:
  - route:
    - destination:
        host: dummy-svc-1.ns-1.svc.cluster.local

In the Mesh config we have VirtualServices being exported to their own namespace.

defaultVirtualServiceExportTo: ["."]

Expected Behaviour

Since both VirtualServices are in the same namespace and are exported to their own namespace by default, the VirtualServices routes should be merged and the istio-proxy sidecar should receive a routing rule that matches dummy-svc-1.service and forwards it to dummy-svc-1.ns-1.svc.cluster.local

Actual Behaviour

The istio-proxy sidecar doesn't receive any routing logic for this VirtualService at all.

On further investigation, found the following error in Istiod logs

debug	model	delegate virtual ns-1/dummy-svc-1-dlg of ns-1/dummy-svc-1 is not exported to ns-1

Version

client version: 1.13.1
control plane version: 1.15.0
data plane version: 1.15.0 (9 proxies)

Additional Information

This issue doesn't show up if the VirtualServices are exported to all namespaces by default (defaultVirtualServiceExportTo:["*"]), or if we explicitly define exportTo:["."] in the delegate VirtualService.

rajatsharma94 added a commit to rajatsharma94/istio that referenced this issue Dec 30, 2022
For defaultVirtualServiceExportTo: ["."], defaultExportTo is a map containing a key visibility.Instance(".") which doesn't match the key visibility.Instance(root.Namespace).
This PR fixes that check by adding a new key visibility.Instance(vs.Namespace), similar to what is done while processing exportTo within VirtualServices.

Fixes istio#42602
istio-testing pushed a commit that referenced this issue Jan 3, 2023
For defaultVirtualServiceExportTo: ["."], defaultExportTo is a map containing a key visibility.Instance(".") which doesn't match the key visibility.Instance(root.Namespace).
This PR fixes that check by adding a new key visibility.Instance(vs.Namespace), similar to what is done while processing exportTo within VirtualServices.

Fixes #42602
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant