1apiVersion: v1
2kind: Service
3metadata:
4  name: reviews
5  namespace: default
6spec:
7  ports:
8  - port: 42
9    name: tcp-test
10    protocol: TCP
11---
12apiVersion: v1
13kind: Service
14metadata:
15  name: reviews-2port
16  namespace: default
17spec:
18  ports:
19  - port: 80
20    name: http-test
21    protocol: HTTP
22  - port: 443
23    name: https-test
24    protocol: HTTPS
25---
26apiVersion: networking.istio.io/v1alpha3
27kind: ServiceEntry
28metadata:
29  name: external-reviews
30  namespace: default
31spec:
32  hosts:
33  - external-reviews.org
34---
35apiVersion: networking.istio.io/v1alpha3
36kind: ServiceEntry
37metadata:
38  name: eu-wildcard
39  namespace: default
40spec:
41  hosts:
42  - "*.eu.bookinfo.com"
43---
44apiVersion: networking.istio.io/v1alpha3
45kind: ServiceEntry
46metadata:
47  name: service-entry-ignore
48  namespace: default-ignore
49spec:
50  exportTo:
51    - "."
52  hosts:
53  - "*" # This ServiceEntry should not match any instance as it isn't exported to other namespaces
54---
55apiVersion: networking.istio.io/v1alpha3
56kind: ServiceEntry
57metadata:
58  name: service-entry-other
59  namespace: other
60spec:
61  exportTo:
62    - "."
63  hosts:
64  - "other.bookinfo.com" # This ServiceEntry should not match any instance as it isn't exported to other namespaces
65---
66apiVersion: networking.istio.io/v1alpha3
67kind: VirtualService
68metadata:
69  name: reviews
70  namespace: default
71spec:
72  http:
73  - route:
74    - destination:  # This virtualservice has no validation errors (base case)
75        host: reviews
76        subset: v1
77---
78apiVersion: networking.istio.io/v1alpha3
79kind: VirtualService
80metadata:
81  name: reviews-bogushost
82  namespace: default
83spec:
84  http:
85  - route:
86    - destination:
87        host: reviews-bogus # This host does not exist, should result in a validation error
88        subset: v1
89---
90apiVersion: networking.istio.io/v1alpha3
91kind: VirtualService
92metadata:
93  name: reviews-fqdn
94  namespace: default
95spec:
96  http:
97  - route:
98    - destination:
99        host: reviews.default.svc.cluster.local # FQDN representation is valid and should not generate an error
100        subset: v1
101---
102apiVersion: networking.istio.io/v1alpha3
103kind: VirtualService
104metadata:
105  name: reviews-external
106  namespace: default
107spec:
108  http:
109  - route:
110    - destination:
111        host: external-reviews.org  # Referring to a ServiceEntry host is valid and should not generate an error
112                                    # Since this is an "external" service, subset is omitted
113---
114apiVersion: networking.istio.io/v1alpha3
115kind: VirtualService
116metadata:
117  name: reviews-bookinfo-eu
118  namespace: default
119spec:
120  http:
121  - route:
122    - destination:
123        host: reviews.eu.bookinfo.com # This should match the eu-wildcard service entry and not generate an error
124---
125apiVersion: networking.istio.io/v1alpha3
126kind: VirtualService
127metadata:
128  name: reviews-bookinfo-eu-wildcard
129  namespace: default
130spec:
131  http:
132  - route:
133    - destination:
134        host: "*.eu.bookinfo.com" # Should match *.eu.bookinfo.com
135---
136apiVersion: networking.istio.io/v1alpha3
137kind: VirtualService
138metadata:
139  name: reviews-bookinfo-other
140  namespace: default
141spec:
142  http:
143  - route:
144    - destination:
145        host: other.bookinfo.com # Should generate validation error, the SE is in another namespace
146---
147apiVersion: networking.istio.io/v1alpha3
148kind: VirtualService
149metadata:
150  name: reviews-mirror
151  namespace: default
152spec:
153  http:
154  - route:
155    - destination:
156        host: reviews
157        subset: v1
158    mirror: # Includes mirroring, but should not generate any errors
159      host: reviews
160      subset: v1
161---
162apiVersion: networking.istio.io/v1alpha3
163kind: VirtualService
164metadata:
165  name: reviews-mirror-bogushost
166  namespace: default
167spec:
168  http:
169  - route:
170    - destination:
171        host: reviews
172        subset: v1
173    mirror:
174      host: reviews-bogus # This host does not exist, should result in a validation error
175      subset: v1
176---
177apiVersion: networking.istio.io/v1alpha3
178kind: VirtualService
179metadata:
180  name: reviews-bogusport
181  namespace: default
182spec:
183  http:
184  - route:
185    - destination:
186        host: reviews
187        subset: v1
188        port:
189          number: 999 # No match for this port number, should generate an error
190---
191apiVersion: networking.istio.io/v1alpha3
192kind: VirtualService
193metadata:
194  name: reviews-2port-missing
195  namespace: default
196spec:
197  http:
198  - route:
199    - destination:  # Since reviews-2port exposes multiple ports, not including a port in the destination is an error
200        host: reviews-2port
201        subset: v1
202---
203apiVersion: networking.istio.io/v1alpha3
204kind: VirtualService
205metadata:
206  name: reviews-2port-present
207  namespace: default
208spec:
209  http:
210  - route:
211    - destination:
212        host: reviews-2port
213        subset: v1
214        port:
215          number: 80 # Should not generate an error since we specify a valid port, as required in this case
216