| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: reviews |
| namespace: default |
| spec: |
| ports: |
| - port: 42 |
| name: tcp-test |
| protocol: TCP |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: reviews-2port |
| namespace: default |
| spec: |
| ports: |
| - port: 80 |
| name: http-test |
| protocol: HTTP |
| - port: 443 |
| name: https-test |
| protocol: HTTPS |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: ServiceEntry |
| metadata: |
| name: external-reviews |
| namespace: default |
| spec: |
| hosts: |
| - external-reviews.org |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: ServiceEntry |
| metadata: |
| name: eu-wildcard |
| namespace: default |
| spec: |
| hosts: |
| - "*.eu.bookinfo.com" |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: ServiceEntry |
| metadata: |
| name: service-entry-ignore |
| namespace: default-ignore |
| spec: |
| exportTo: |
| - "." |
| hosts: |
| - "*" # This ServiceEntry should not match any instance as it isn't exported to other namespaces |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: ServiceEntry |
| metadata: |
| name: service-entry-other |
| namespace: other |
| spec: |
| exportTo: |
| - "." |
| hosts: |
| - "other.bookinfo.com" # This ServiceEntry should not match any instance as it isn't exported to other namespaces |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: # This virtualservice has no validation errors (base case) |
| host: reviews |
| subset: v1 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-bogushost |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: reviews-bogus # This host does not exist, should result in a validation error |
| subset: v1 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-fqdn |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: reviews.default.svc.cluster.local # FQDN representation is valid and should not generate an error |
| subset: v1 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-external |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: external-reviews.org # Referring to a ServiceEntry host is valid and should not generate an error |
| # Since this is an "external" service, subset is omitted |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-bookinfo-eu |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: reviews.eu.bookinfo.com # This should match the eu-wildcard service entry and not generate an error |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-bookinfo-eu-wildcard |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: "*.eu.bookinfo.com" # Should match *.eu.bookinfo.com |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-bookinfo-other |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: other.bookinfo.com # Should generate validation error, the SE is in another namespace |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-mirror |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: reviews |
| subset: v1 |
| mirror: # Includes mirroring, but should not generate any errors |
| host: reviews |
| subset: v1 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-mirror-bogushost |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: reviews |
| subset: v1 |
| mirror: |
| host: reviews-bogus # This host does not exist, should result in a validation error |
| subset: v1 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-bogusport |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: reviews |
| subset: v1 |
| port: |
| number: 999 # No match for this port number, should generate an error |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-2port-missing |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: # Since reviews-2port exposes multiple ports, not including a port in the destination is an error |
| host: reviews-2port |
| subset: v1 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: reviews-2port-present |
| namespace: default |
| spec: |
| http: |
| - route: |
| - destination: |
| host: reviews-2port |
| subset: v1 |
| port: |
| number: 80 # Should not generate an error since we specify a valid port, as required in this case |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| # This VirtualService is in 'dubbo-system' and uses a FQDN destination |
| name: cross-namespace |
| namespace: dubbo-system |
| spec: |
| hosts: [reviews] |
| http: |
| - route: |
| - destination: |
| # Should not generate error because the this host exists, just not in our namespace |
| host: reviews.default.svc.cluster.local |
| --- |
| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: details |
| namespace: default |
| annotations: |
| networking.istio.io/exportTo: banana |
| labels: |
| app: details |
| service: details |
| spec: |
| ports: |
| - port: 9080 |
| name: http |
| selector: |
| app: details |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| # This VirtualService is in 'dubbo-system' and uses a FQDN destination, but this ns doesn't see that Service |
| name: cross-namespace-details |
| namespace: dubbo-system |
| spec: |
| hosts: [details] |
| http: |
| - route: |
| - destination: |
| # Should generate error, because details is only exported to "banana" ns |
| host: details.default.svc.cluster.local |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| # This is cross-namespace, but not a problem, details has explicit networking.istio.io/exportTo=banana |
| name: banana-details |
| namespace: banana |
| spec: |
| hosts: [details] |
| http: |
| - route: |
| - destination: |
| host: details.default.svc.cluster.local |