/
virtual_service.pb.go
1798 lines (1667 loc) · 65.4 KB
/
virtual_service.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/costinm/dmesh/dm/istio/virtual_service.proto
package istio
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// A `VirtualService` defines a set of traffic routing rules to apply when a host is
// addressed. Each routing rule defines matching criteria for traffic of a specific
// protocol. If the traffic is matched, then it is sent to a named destination service
// (or subset/version of it) defined in the registry.
//
// The source of traffic can also be matched in a routing rule. This allows routing
// to be customized for specific client contexts.
//
// The following example on Kubernetes, routes all HTTP traffic by default to
// pods of the reviews service with label "version: v1". In addition,
// HTTP requests containing /wpcatalog/, /consumercatalog/ url prefixes will
// be rewritten to /newcatalog and sent to pods with label "version: v2".
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: reviews-route
// spec:
// hosts:
// - reviews.prod.svc.cluster.local
// http:
// - match:
// - uri:
// prefix: "/wpcatalog"
// - uri:
// prefix: "/consumercatalog"
// rewrite:
// uri: "/newcatalog"
// route:
// - destination:
// host: reviews.prod.svc.cluster.local
// subset: v2
// - route:
// - destination:
// host: reviews.prod.svc.cluster.local
// subset: v1
//
// A subset/version of a route destination is identified with a reference
// to a named service subset which must be declared in a corresponding
// `DestinationRule`.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: reviews-destination
// spec:
// host: reviews.prod.svc.cluster.local
// subsets:
// - name: v1
// labels:
// version: v1
// - name: v2
// labels:
// version: v2
//
type VirtualService struct {
// REQUIRED. The destination hosts to which traffic is being sent. Could
// be a DNS name with wildcard prefix or an IP address. Depending on the
// platform, short-names can also be used instead of a FQDN (i.e. has no
// dots in the name). In such a scenario, the FQDN of the host would be
// derived based on the underlying platform.
//
// **A host name can be defined by only one VirtualService**. A single
// VirtualService can be used to describe traffic properties for multiple
// HTTP and TCP ports.
//
// *Note for Kubernetes users*: When short names are used (e.g. "reviews"
// instead of "reviews.default.svc.cluster.local"), Istio will interpret
// the short name based on the namespace of the rule, not the service. A
// rule in the "default" namespace containing a host "reviews will be
// interpreted as "reviews.default.svc.cluster.local", irrespective of
// the actual namespace associated with the reviews service. _To avoid
// potential misconfigurations, it is recommended to always use fully
// qualified domain names over short names._
//
// The hosts field applies to both HTTP and TCP services. Service inside
// the mesh, i.e., those found in the service registry, must always be
// referred to using their alphanumeric names. IP addresses are allowed
// only for services defined via the Gateway.
Hosts []string `protobuf:"bytes,1,rep,name=hosts" json:"hosts,omitempty"`
// The names of gateways and sidecars that should apply these routes. A
// single VirtualService is used for sidecars inside the mesh as well
// as for one or more gateways. The selection condition imposed by this field
// can be overridden using the source field in the match conditions of HTTP/TCP
// routes. The reserved word `mesh` is used to imply all the sidecars in
// the mesh. When this field is omitted, the default gateway (`mesh`)
// will be used, which would apply the rule to all sidecars in the
// mesh. If a list of gateway names is provided, the rules will apply
// only to the gateways. To apply the rules to both gateways and sidecars,
// specify `mesh` as one of the gateway names.
Gateways []string `protobuf:"bytes,2,rep,name=gateways" json:"gateways,omitempty"`
// An ordered list of route rules for HTTP traffic.
// The first rule matching an incoming request is used.
Http []*HTTPRoute `protobuf:"bytes,3,rep,name=http" json:"http,omitempty"`
// An ordered list of route rules for TCP traffic.
// The first rule matching an incoming request is used.
Tcp []*TCPRoute `protobuf:"bytes,4,rep,name=tcp" json:"tcp,omitempty"`
}
func (m *VirtualService) Reset() { *m = VirtualService{} }
func (m *VirtualService) String() string { return proto.CompactTextString(m) }
func (*VirtualService) ProtoMessage() {}
func (*VirtualService) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{0} }
func (m *VirtualService) GetHosts() []string {
if m != nil {
return m.Hosts
}
return nil
}
func (m *VirtualService) GetGateways() []string {
if m != nil {
return m.Gateways
}
return nil
}
func (m *VirtualService) GetHttp() []*HTTPRoute {
if m != nil {
return m.Http
}
return nil
}
func (m *VirtualService) GetTcp() []*TCPRoute {
if m != nil {
return m.Tcp
}
return nil
}
// Destination indicates the network addressable service to which the
// request/connection will be sent after processing a routing rule. The
// destination.host should unambiguously refer to a service in the service
// registry. Istio's service registry is composed of all the services found
// in the platform's service registry (e.g., Kubernetes services, Consul
// services), as well as services declared through the
// [ServiceEntry](#ServiceEntry) resource.
//
// *Note for Kubernetes users*: When short names are used (e.g. "reviews"
// instead of "reviews.default.svc.cluster.local"), Istio will interpret
// the short name based on the namespace of the rule, not the service. A
// rule in the "default" namespace containing a host "reviews will be
// interpreted as "reviews.default.svc.cluster.local", irrespective of the
// actual namespace associated with the reviews service. _To avoid potential
// misconfigurations, it is recommended to always use fully qualified
// domain names over short names._
//
// The following Kubernetes example routes all traffic by default to pods
// of the reviews service with label "version: v1" (i.e., subset v1), and
// some to subset v2, in a kubernetes environment.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: reviews-route
// namespace: foo
// spec:
// hosts:
// - reviews # interpreted as reviews.foo.svc.cluster.local
// http:
// - match:
// - uri:
// prefix: "/wpcatalog"
// - uri:
// prefix: "/consumercatalog"
// rewrite:
// uri: "/newcatalog"
// route:
// - destination:
// host: reviews # interpreted as reviews.foo.svc.cluster.local
// subset: v2
// - route:
// - destination:
// host: reviews # interpreted as reviews.foo.svc.cluster.local
// subset: v1
//
// And the associated DestinationRule
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: reviews-destination
// namespace: foo
// spec:
// host: reviews # interpreted as reviews.foo.svc.cluster.local
// subsets:
// - name: v1
// labels:
// version: v1
// - name: v2
// labels:
// version: v2
//
// The following VirtualService sets a timeout of 5s for all calls to
// productpage.prod.svc.cluster.local service in Kubernetes. Notice that
// there are no subsets defined in this rule. Istio will fetch all
// instances of productpage.prod.svc.cluster.local service from the service
// registry and populate the sidecar's load balancing pool. Also, notice
// that this rule is set in the dmesh namespace but uses the fully
// qualified domain name of the productpage service,
// productpage.prod.svc.cluster.local. Therefore the rule's namespace does
// not have an impact in resolving the name of the productpage service.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: my-productpage-rule
// namespace: dmesh
// spec:
// hosts:
// - productpage.prod.svc.cluster.local # ignores rule namespace
// http:
// - timeout: 5s
// route:
// - destination:
// host: productpage.prod.svc.cluster.local
//
// To control routing for traffic bound to services outside the mesh, external
// services must first be added to Istio's internal service registry using the
// ServiceEntry resource. VirtualServices can then be defined to control traffic
// bound to these external services. For example, the following rules define a
// Service for wikipedia.org and set a timeout of 5s for http requests.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: ServiceEntry
// metadata:
// name: external-svc-wikipedia
// spec:
// hosts:
// - wikipedia.org
// location: MESH_EXTERNAL
// ports:
// - number: 80
// name: example-http
// protocol: HTTP
// resolution: DNS
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: my-wiki-rule
// spec:
// hosts:
// - wikipedia.org
// http:
// - timeout: 5s
// route:
// - destination:
// host: wikipedia.org
//
type Destination struct {
// REQUIRED. The name of a service from the service registry. Service
// names are looked up from the platform's service registry (e.g.,
// Kubernetes services, Consul services, etc.) and from the hosts
// declared by [ServiceEntry](#ServiceEntry). Traffic forwarded to
// destinations that are not found in either of the two, will be dropped.
//
// *Note for Kubernetes users*: When short names are used (e.g. "reviews"
// instead of "reviews.default.svc.cluster.local"), Istio will interpret
// the short name based on the namespace of the rule, not the service. A
// rule in the "default" namespace containing a host "reviews will be
// interpreted as "reviews.default.svc.cluster.local", irrespective of
// the actual namespace associated with the reviews service. _To avoid
// potential misconfigurations, it is recommended to always use fully
// qualified domain names over short names._
Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
// The name of a subset within the service. Applicable only to services
// within the mesh. The subset must be defined in a corresponding
// DestinationRule.
Subset string `protobuf:"bytes,2,opt,name=subset,proto3" json:"subset,omitempty"`
// Specifies the port on the host that is being addressed. Many services
// only expose a single port or label ports with the protocols they support,
// in these cases it is not required to explicitly select the port. Note that
// selection priority is to first match by name and then match by number.
//
// Names must comply with DNS label syntax (rfc1035) and therefore cannot
// collide with numbers. If there are multiple ports on a service with
// the same protocol the names should be of the form <protocol-name>-<DNS
// label>.
Port *PortSelector `protobuf:"bytes,3,opt,name=port" json:"port,omitempty"`
}
func (m *Destination) Reset() { *m = Destination{} }
func (m *Destination) String() string { return proto.CompactTextString(m) }
func (*Destination) ProtoMessage() {}
func (*Destination) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{1} }
func (m *Destination) GetHost() string {
if m != nil {
return m.Host
}
return ""
}
func (m *Destination) GetSubset() string {
if m != nil {
return m.Subset
}
return ""
}
func (m *Destination) GetPort() *PortSelector {
if m != nil {
return m.Port
}
return nil
}
// Describes match conditions and actions for routing HTTP/1.1, HTTP2, and
// gRPC traffic. See VirtualService for usage examples.
type HTTPRoute struct {
// Match conditions to be satisfied for the rule to be
// activated. All conditions inside a single match block have AND
// semantics, while the list of match blocks have OR semantics. The rule
// is matched if any one of the match blocks succeed.
Match []*HTTPMatchRequest `protobuf:"bytes,1,rep,name=match" json:"match,omitempty"`
// A http rule can either redirect or forward (default) traffic. The
// forwarding target can be one of several versions of a service (see
// glossary in beginning of document). Weights associated with the
// service version determine the proportion of traffic it receives.
Route []*DestinationWeight `protobuf:"bytes,2,rep,name=route" json:"route,omitempty"`
// A http rule can either redirect or forward (default) traffic. If
// traffic passthrough option is specified in the rule,
// route/redirect will be ignored. The redirect primitive can be used to
// send a HTTP 302 redirect to a different URI or Authority.
Redirect *HTTPRedirect `protobuf:"bytes,3,opt,name=redirect" json:"redirect,omitempty"`
// Rewrite HTTP URIs and Authority headers. Rewrite cannot be used with
// Redirect primitive. Rewrite will be performed before forwarding.
Rewrite *HTTPRewrite `protobuf:"bytes,4,opt,name=rewrite" json:"rewrite,omitempty"`
// Indicates that a HTTP/1.1 client connection to this particular route
// should be allowed (and expected) to upgrade to a WebSocket connection.
// The default is false. Istio's reference sidecar implementation (Envoy)
// expects the first request to this route to contain the WebSocket
// upgrade headers. Otherwise, the request will be rejected. Note that
// Websocket allows secondary protocol negotiation which may then be
// subject to further routing rules based on the protocol selected.
WebsocketUpgrade bool `protobuf:"varint,5,opt,name=websocket_upgrade,proto3" json:"websocket_upgrade,omitempty"`
// Timeout for HTTP requests.
Timeout *Duration `protobuf:"bytes,6,opt,name=timeout" json:"timeout,omitempty"`
// Retry policy for HTTP requests.
Retries *HTTPRetry `protobuf:"bytes,7,opt,name=retries" json:"retries,omitempty"`
// Fault injection policy to apply on HTTP traffic.
Fault *HTTPFaultInjection `protobuf:"bytes,8,opt,name=fault" json:"fault,omitempty"`
// Mirror HTTP traffic to a another destination in addition to forwarding
// the requests to the intended destination. Mirrored traffic is on a
// best effort basis where the sidecar/gateway will not wait for the
// mirrored cluster to respond before returning the response from the
// original destination. Statistics will be generated for the mirrored
// destination.
Mirror *Destination `protobuf:"bytes,9,opt,name=mirror" json:"mirror,omitempty"`
// Cross-Origin Resource Sharing policy (CORS). Refer to
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
// for further details about cross origin resource sharing.
CorsPolicy *CorsPolicy `protobuf:"bytes,10,opt,name=cors_policy" json:"cors_policy,omitempty"`
// Additional HTTP headers to add before forwarding a request to the
// destination service.
AppendHeaders map[string]string `protobuf:"bytes,11,rep,name=append_headers" json:"append_headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (m *HTTPRoute) Reset() { *m = HTTPRoute{} }
func (m *HTTPRoute) String() string { return proto.CompactTextString(m) }
func (*HTTPRoute) ProtoMessage() {}
func (*HTTPRoute) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{2} }
func (m *HTTPRoute) GetMatch() []*HTTPMatchRequest {
if m != nil {
return m.Match
}
return nil
}
func (m *HTTPRoute) GetRoute() []*DestinationWeight {
if m != nil {
return m.Route
}
return nil
}
func (m *HTTPRoute) GetRedirect() *HTTPRedirect {
if m != nil {
return m.Redirect
}
return nil
}
func (m *HTTPRoute) GetRewrite() *HTTPRewrite {
if m != nil {
return m.Rewrite
}
return nil
}
func (m *HTTPRoute) GetWebsocketUpgrade() bool {
if m != nil {
return m.WebsocketUpgrade
}
return false
}
func (m *HTTPRoute) GetTimeout() *Duration {
if m != nil {
return m.Timeout
}
return nil
}
func (m *HTTPRoute) GetRetries() *HTTPRetry {
if m != nil {
return m.Retries
}
return nil
}
func (m *HTTPRoute) GetFault() *HTTPFaultInjection {
if m != nil {
return m.Fault
}
return nil
}
func (m *HTTPRoute) GetMirror() *Destination {
if m != nil {
return m.Mirror
}
return nil
}
func (m *HTTPRoute) GetCorsPolicy() *CorsPolicy {
if m != nil {
return m.CorsPolicy
}
return nil
}
func (m *HTTPRoute) GetAppendHeaders() map[string]string {
if m != nil {
return m.AppendHeaders
}
return nil
}
// Describes match conditions and actions for routing TCP traffic. The
// following routing rule forwards traffic arriving at port 27017 for
// mongo.prod.svc.cluster.local from 172.17.16.* subnet to another Mongo
// server on port 5555.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: bookinfo-Mongo
// spec:
// hosts:
// - mongo.prod.svc.cluster.local
// tcp:
// - match:
// - port: 27017
// sourceSubnet: "172.17.16.0/24"
// route:
// - destination:
// host: mongo.backup.svc.cluster.local
// port:
// number: 5555
type TCPRoute struct {
// Match conditions to be satisfied for the rule to be
// activated. All conditions inside a single match block have AND
// semantics, while the list of match blocks have OR semantics. The rule
// is matched if any one of the match blocks succeed.
Match []*L4MatchAttributes `protobuf:"bytes,1,rep,name=match" json:"match,omitempty"`
// The destination to which the connection should be forwarded to.
// Currently, only one destination is allowed for TCP services. When TCP
// weighted routing support is introduced in Envoy, multiple destinations
// with weights can be specified.
Route []*DestinationWeight `protobuf:"bytes,2,rep,name=route" json:"route,omitempty"`
}
func (m *TCPRoute) Reset() { *m = TCPRoute{} }
func (m *TCPRoute) String() string { return proto.CompactTextString(m) }
func (*TCPRoute) ProtoMessage() {}
func (*TCPRoute) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{3} }
func (m *TCPRoute) GetMatch() []*L4MatchAttributes {
if m != nil {
return m.Match
}
return nil
}
func (m *TCPRoute) GetRoute() []*DestinationWeight {
if m != nil {
return m.Route
}
return nil
}
// HttpMatchRequest specifies a set of criterion to be met in order for the
// rule to be applied to the HTTP request. For example, the following
// restricts the rule to match only requests where the URL path
// starts with /ratings/v2/ and the request contains a `cookie` with value
// `user=jason`.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: ratings-route
// spec:
// hosts:
// - ratings.prod.svc.cluster.local
// http:
// - match:
// - headers:
// cookie:
// regex: "^(.*?;)?(user=jason)(;.*)?"
// uri:
// prefix: "/ratings/v2/"
// route:
// - destination:
// host: ratings.prod.svc.cluster.local
//
// HTTPMatchRequest CANNOT be empty.
type HTTPMatchRequest struct {
// URI to match
// values are case-sensitive and formatted as follows:
//
// - `exact: "value"` for exact string match
//
// - `prefix: "value"` for prefix-based match
//
// - `regex: "value"` for ECMAscript style regex-based match
//
Uri *StringMatch `protobuf:"bytes,1,opt,name=uri" json:"uri,omitempty"`
// URI Scheme
// values are case-sensitive and formatted as follows:
//
// - `exact: "value"` for exact string match
//
// - `prefix: "value"` for prefix-based match
//
// - `regex: "value"` for ECMAscript style regex-based match
//
Scheme *StringMatch `protobuf:"bytes,2,opt,name=scheme" json:"scheme,omitempty"`
// HTTP Method
// values are case-sensitive and formatted as follows:
//
// - `exact: "value"` for exact string match
//
// - `prefix: "value"` for prefix-based match
//
// - `regex: "value"` for ECMAscript style regex-based match
//
Method *StringMatch `protobuf:"bytes,3,opt,name=method" json:"method,omitempty"`
// HTTP Authority
// values are case-sensitive and formatted as follows:
//
// - `exact: "value"` for exact string match
//
// - `prefix: "value"` for prefix-based match
//
// - `regex: "value"` for ECMAscript style regex-based match
//
Authority *StringMatch `protobuf:"bytes,4,opt,name=authority" json:"authority,omitempty"`
// The header keys must be lowercase and use hyphen as the separator,
// e.g. _x-request-id_.
//
// Header values are case-sensitive and formatted as follows:
//
// - `exact: "value"` for exact string match
//
// - `prefix: "value"` for prefix-based match
//
// - `regex: "value"` for ECMAscript style regex-based match
//
// **Note:** The keys `uri`, `scheme`, `method`, and `authority` will be ignored.
Headers map[string]*StringMatch `protobuf:"bytes,5,rep,name=headers" json:"headers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value"`
// Specifies the ports on the host that is being addressed. Many services
// only expose a single port or label ports with the protocols they support,
// in these cases it is not required to explicitly select the port.
Port uint32 `protobuf:"varint,6,opt,name=port,proto3" json:"port,omitempty"`
// One or more labels that constrain the applicability of a rule to
// workloads with the given labels. If the VirtualService has a list of
// gateways specified at the top, it should include the reserved gateway
// `mesh` in order for this field to be applicable.
SourceLabels map[string]string `protobuf:"bytes,7,rep,name=source_labels" json:"source_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Names of gateways where the rule should be applied to. Gateway names
// at the top of the VirtualService (if any) are overridden. The gateway match is
// independent of sourceLabels.
Gateways []string `protobuf:"bytes,8,rep,name=gateways" json:"gateways,omitempty"`
}
func (m *HTTPMatchRequest) Reset() { *m = HTTPMatchRequest{} }
func (m *HTTPMatchRequest) String() string { return proto.CompactTextString(m) }
func (*HTTPMatchRequest) ProtoMessage() {}
func (*HTTPMatchRequest) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{4} }
func (m *HTTPMatchRequest) GetUri() *StringMatch {
if m != nil {
return m.Uri
}
return nil
}
func (m *HTTPMatchRequest) GetScheme() *StringMatch {
if m != nil {
return m.Scheme
}
return nil
}
func (m *HTTPMatchRequest) GetMethod() *StringMatch {
if m != nil {
return m.Method
}
return nil
}
func (m *HTTPMatchRequest) GetAuthority() *StringMatch {
if m != nil {
return m.Authority
}
return nil
}
func (m *HTTPMatchRequest) GetHeaders() map[string]*StringMatch {
if m != nil {
return m.Headers
}
return nil
}
func (m *HTTPMatchRequest) GetPort() uint32 {
if m != nil {
return m.Port
}
return 0
}
func (m *HTTPMatchRequest) GetSourceLabels() map[string]string {
if m != nil {
return m.SourceLabels
}
return nil
}
func (m *HTTPMatchRequest) GetGateways() []string {
if m != nil {
return m.Gateways
}
return nil
}
// Each routing rule is associated with one or more service versions (see
// glossary in beginning of document). Weights associated with the version
// determine the proportion of traffic it receives. For example, the
// following rule will route 25% of traffic for the "reviews" service to
// instances with the "v2" tag and the remaining traffic (i.e., 75%) to
// "v1".
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: reviews-route
// spec:
// hosts:
// - reviews.prod.svc.cluster.local
// http:
// - route:
// - destination:
// host: reviews.prod.svc.cluster.local
// subset: v2
// weight: 25
// - destination:
// host: reviews.prod.svc.cluster.local
// subset: v1
// weight: 75
//
// And the associated DestinationRule
//
// apiVersion: networking.istio.io/v1alpha3
// kind: DestinationRule
// metadata:
// name: reviews-destination
// spec:
// host: reviews.prod.svc.cluster.local
// subsets:
// - name: v1
// labels:
// version: v1
// - name: v2
// labels:
// version: v2
//
// Traffic can also be split across two entirely different services without
// having to define new subsets. For example, the following rule forwards 25% of
// traffic to reviews.com to dev.reviews.com
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: reviews-route-two-domains
// spec:
// hosts:
// - reviews.com
// http:
// - route:
// - destination:
// host: dev.reviews.com
// weight: 25
// - destination:
// host: reviews.com
// weight: 75
//
type DestinationWeight struct {
// REQUIRED. Destination uniquely identifies the instances of a service
// to which the request/connection should be forwarded to.
Destination *Destination `protobuf:"bytes,1,opt,name=destination" json:"destination,omitempty"`
// REQUIRED. The proportion of traffic to be forwarded to the service
// version. (0-100). Sum of weights across destinations SHOULD BE == 100.
// If there is only destination in a rule, the weight value is assumed to
// be 100.
Weight int32 `protobuf:"varint,2,opt,name=weight,proto3" json:"weight,omitempty"`
}
func (m *DestinationWeight) Reset() { *m = DestinationWeight{} }
func (m *DestinationWeight) String() string { return proto.CompactTextString(m) }
func (*DestinationWeight) ProtoMessage() {}
func (*DestinationWeight) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{5} }
func (m *DestinationWeight) GetDestination() *Destination {
if m != nil {
return m.Destination
}
return nil
}
func (m *DestinationWeight) GetWeight() int32 {
if m != nil {
return m.Weight
}
return 0
}
// L4 connection match attributes. Note that L4 connection matching support
// is incomplete.
type L4MatchAttributes struct {
// IPv4 or IPv6 ip address of destination with optional subnet. E.g.,
// a.b.c.d/xx form or just a.b.c.d. This is only valid when the
// destination service has several IPs and the application explicitly
// specifies a particular IP.
DestinationSubnet string `protobuf:"bytes,1,opt,name=destination_subnet,proto3" json:"destination_subnet,omitempty"`
// Specifies the port on the host that is being addressed. Many services
// only expose a single port or label ports with the protocols they support,
// in these cases it is not required to explicitly select the port.
Port uint32 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"`
// IPv4 or IPv6 ip address of source with optional subnet. E.g., a.b.c.d/xx
// form or just a.b.c.d
SourceSubnet string `protobuf:"bytes,3,opt,name=source_subnet,proto3" json:"source_subnet,omitempty"`
// One or more labels that constrain the applicability of a rule to
// workloads with the given labels. If the VirtualService has a list of
// gateways specified at the top, it should include the reserved gateway
// `mesh` in order for this field to be applicable.
SourceLabels map[string]string `protobuf:"bytes,4,rep,name=source_labels" json:"source_labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
// Names of gateways where the rule should be applied to. Gateway names
// at the top of the VirtualService (if any) are overridden. The gateway match is
// independent of sourceLabels.
Gateways []string `protobuf:"bytes,5,rep,name=gateways" json:"gateways,omitempty"`
}
func (m *L4MatchAttributes) Reset() { *m = L4MatchAttributes{} }
func (m *L4MatchAttributes) String() string { return proto.CompactTextString(m) }
func (*L4MatchAttributes) ProtoMessage() {}
func (*L4MatchAttributes) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{6} }
func (m *L4MatchAttributes) GetDestinationSubnet() string {
if m != nil {
return m.DestinationSubnet
}
return ""
}
func (m *L4MatchAttributes) GetPort() uint32 {
if m != nil {
return m.Port
}
return 0
}
func (m *L4MatchAttributes) GetSourceSubnet() string {
if m != nil {
return m.SourceSubnet
}
return ""
}
func (m *L4MatchAttributes) GetSourceLabels() map[string]string {
if m != nil {
return m.SourceLabels
}
return nil
}
func (m *L4MatchAttributes) GetGateways() []string {
if m != nil {
return m.Gateways
}
return nil
}
// HTTPRedirect can be used to send a 302 redirect response to the caller,
// where the Authority/Host and the URI in the response can be swapped with
// the specified values. For example, the following rule redirects
// requests for /v1/getProductRatings API on the ratings service to
// /v1/bookRatings provided by the bookratings service.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: ratings-route
// spec:
// hosts:
// - ratings.prod.svc.cluster.local
// http:
// - match:
// - uri:
// exact: /v1/getProductRatings
// redirect:
// uri: /v1/bookRatings
// authority: newratings.default.svc.cluster.local
// ...
//
type HTTPRedirect struct {
// On a redirect, overwrite the Path portion of the URL with this
// value. Note that the entire path will be replaced, irrespective of the
// request URI being matched as an exact path or prefix.
Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"`
// On a redirect, overwrite the Authority/Host portion of the URL with
// this value.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (m *HTTPRedirect) Reset() { *m = HTTPRedirect{} }
func (m *HTTPRedirect) String() string { return proto.CompactTextString(m) }
func (*HTTPRedirect) ProtoMessage() {}
func (*HTTPRedirect) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{7} }
func (m *HTTPRedirect) GetUri() string {
if m != nil {
return m.Uri
}
return ""
}
func (m *HTTPRedirect) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
// HTTPRewrite can be used to rewrite specific parts of a HTTP request
// before forwarding the request to the destination. Rewrite primitive can
// be used only with the DestinationWeights. The following example
// demonstrates how to rewrite the URL prefix for api call (/ratings) to
// ratings service before making the actual API call.
//
// apiVersion: networking.istio.io/v1alpha3
// kind: VirtualService
// metadata:
// name: ratings-route
// spec:
// hosts:
// - ratings.prod.svc.cluster.local
// http:
// - match:
// - uri:
// prefix: /ratings
// rewrite:
// uri: /v1/bookRatings
// route:
// - destination:
// host: ratings.prod.svc.cluster.local
// subset: v1
//
type HTTPRewrite struct {
// rewrite the path (or the prefix) portion of the URI with this
// value. If the original URI was matched based on prefix, the value
// provided in this field will replace the corresponding matched prefix.
Uri string `protobuf:"bytes,1,opt,name=uri,proto3" json:"uri,omitempty"`
// rewrite the Authority/Host header with this value.
Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"`
}
func (m *HTTPRewrite) Reset() { *m = HTTPRewrite{} }
func (m *HTTPRewrite) String() string { return proto.CompactTextString(m) }
func (*HTTPRewrite) ProtoMessage() {}
func (*HTTPRewrite) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{8} }
func (m *HTTPRewrite) GetUri() string {
if m != nil {
return m.Uri
}
return ""
}
func (m *HTTPRewrite) GetAuthority() string {
if m != nil {
return m.Authority
}
return ""
}
// Describes how to match a given string in HTTP headers. Match is
// case-sensitive.
type StringMatch struct {
// Types that are valid to be assigned to MatchType:
// *StringMatch_Exact
// *StringMatch_Prefix
// *StringMatch_Regex
MatchType isStringMatch_MatchType `protobuf_oneof:"match_type"`
}
func (m *StringMatch) Reset() { *m = StringMatch{} }
func (m *StringMatch) String() string { return proto.CompactTextString(m) }
func (*StringMatch) ProtoMessage() {}
func (*StringMatch) Descriptor() ([]byte, []int) { return fileDescriptorVirtualService, []int{9} }
type isStringMatch_MatchType interface {
isStringMatch_MatchType()
}
type StringMatch_Exact struct {
Exact string `protobuf:"bytes,1,opt,name=exact,proto3,oneof"`
}
type StringMatch_Prefix struct {
Prefix string `protobuf:"bytes,2,opt,name=prefix,proto3,oneof"`
}
type StringMatch_Regex struct {
Regex string `protobuf:"bytes,3,opt,name=regex,proto3,oneof"`
}
func (*StringMatch_Exact) isStringMatch_MatchType() {}
func (*StringMatch_Prefix) isStringMatch_MatchType() {}
func (*StringMatch_Regex) isStringMatch_MatchType() {}
func (m *StringMatch) GetMatchType() isStringMatch_MatchType {
if m != nil {
return m.MatchType
}
return nil
}
func (m *StringMatch) GetExact() string {
if x, ok := m.GetMatchType().(*StringMatch_Exact); ok {
return x.Exact
}
return ""
}
func (m *StringMatch) GetPrefix() string {
if x, ok := m.GetMatchType().(*StringMatch_Prefix); ok {
return x.Prefix
}
return ""
}
func (m *StringMatch) GetRegex() string {
if x, ok := m.GetMatchType().(*StringMatch_Regex); ok {
return x.Regex
}
return ""
}
// XXX_OneofFuncs is for the internal use of the proto package.
func (*StringMatch) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
return _StringMatch_OneofMarshaler, _StringMatch_OneofUnmarshaler, _StringMatch_OneofSizer, []interface{}{
(*StringMatch_Exact)(nil),
(*StringMatch_Prefix)(nil),
(*StringMatch_Regex)(nil),
}
}
func _StringMatch_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
m := msg.(*StringMatch)
// match_type
switch x := m.MatchType.(type) {
case *StringMatch_Exact: