Documentation ¶
Overview ¶
proto: https://github.com/istio/api/blob/master/networking/v1alpha3/destination_rule.pb.go
+k8s:deepcopy-gen=package +groupName=networking.istio.io
proto: https://github.com/istio/api/blob/master/networking/v1alpha3/virtual_service.proto
Index ¶
- Variables
- func Kind(kind string) schema.GroupKind
- func Resource(resource string) schema.GroupResource
- type ConnectionPoolSettings
- type ConsistentHashLB
- type CorsPolicy
- type Destination
- type DestinationRule
- type DestinationRuleList
- type DestinationRuleSpec
- type Distribute
- type Failover
- type HTTPCookie
- type HTTPFaultInjection
- type HTTPMatchRequest
- type HTTPRedirect
- type HTTPRetry
- type HTTPRewrite
- type HTTPRoute
- type HTTPRouteDestination
- type HTTPSettings
- type HeaderOperations
- type Headers
- type InjectAbort
- type InjectDelay
- type L4MatchAttributes
- type LoadBalancerSettings
- type LocalityLbSetting
- type OutlierDetection
- type Percent
- type PortSelector
- type PortTrafficPolicy
- type SimpleLB
- type Subset
- type TCPRoute
- type TCPSettings
- type TLSSettings
- type TLSmode
- type TrafficPolicy
- type VirtualService
- type VirtualServiceList
- type VirtualServiceSpec
Constants ¶
This section is empty.
Variables ¶
var ( SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) AddToScheme = SchemeBuilder.AddToScheme )
var SchemeGroupVersion = schema.GroupVersion{Group: istio.GroupName, Version: "v1alpha3"}
SchemeGroupVersion is group version used to register these objects
Functions ¶
func Resource ¶
func Resource(resource string) schema.GroupResource
Resource takes an unqualified resource and returns a Group qualified GroupResource
Types ¶
type ConnectionPoolSettings ¶
type ConnectionPoolSettings struct { // Settings common to both HTTP and TCP upstream connections. TCP *TCPSettings `json:"tcp,omitempty"` // HTTP connection pool settings. HTTP *HTTPSettings `json:"http,omitempty"` }
Connection pool settings for an upstream host. The settings apply to each individual host in the upstream service. See Envoy's [circuit breaker](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/circuit_breaking) for more details. Connection pool settings can be applied at the TCP level as well as at HTTP level.
For example, the following rule sets a limit of 100 connections to redis service called myredissrv with a connect timeout of 30ms
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: bookinfo-redis
spec:
host: myredissrv.prod.svc.cluster.local trafficPolicy: connectionPool: tcp: maxConnections: 100 connectTimeout: 30ms
func (*ConnectionPoolSettings) DeepCopy ¶
func (in *ConnectionPoolSettings) DeepCopy() *ConnectionPoolSettings
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectionPoolSettings.
func (*ConnectionPoolSettings) DeepCopyInto ¶
func (in *ConnectionPoolSettings) DeepCopyInto(out *ConnectionPoolSettings)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ConsistentHashLB ¶
type ConsistentHashLB struct { // It is required to specify exactly one of the fields as hash key: // HTTPHeaderName, HTTPCookie, or UseSourceIP. // Hash based on a specific HTTP header. HTTPHeaderName string `json:"httpHeaderName,omitempty"` // Hash based on HTTP cookie. HTTPCookie *HTTPCookie `json:"httpCookie,omitempty"` // Hash based on the source IP address. UseSourceIP bool `json:"useSourceIp,omitempty"` // The minimum number of virtual nodes to use for the hash // ring. Defaults to 1024. Larger ring sizes result in more granular // load distributions. If the number of hosts in the load balancing // pool is larger than the ring size, each host will be assigned a // single virtual node. MinimumRingSize uint64 `json:"minimumRingSize,omitempty"` }
Consistent Hash-based load balancing can be used to provide soft session affinity based on HTTP headers, cookies or other properties. This load balancing policy is applicable only for HTTP connections. The affinity to a particular destination host will be lost when one or more hosts are added/removed from the destination service.
func (*ConsistentHashLB) DeepCopy ¶
func (in *ConsistentHashLB) DeepCopy() *ConsistentHashLB
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConsistentHashLB.
func (*ConsistentHashLB) DeepCopyInto ¶
func (in *ConsistentHashLB) DeepCopyInto(out *ConsistentHashLB)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type CorsPolicy ¶
type CorsPolicy struct { // The list of origins that are allowed to perform CORS requests. The // content will be serialized into the Access-Control-Allow-Origin // header. Wildcard * will allow all origins. AllowOrigin []string `json:"allowOrigin,omitempty"` // String patterns that match allowed origins. An origin is allowed if // any of the string matchers match. If a match is found, then the // outgoing Access-Control-Allow-Origin would be set to the origin as // provided by the client. AllowOrigins []*v1alpha1.StringMatch `json:"allowOrigins,omitempty"` // List of HTTP methods allowed to access the resource. The content will // be serialized into the Access-Control-Allow-Methods header. AllowMethods []string `json:"allowMethods,omitempty"` // List of HTTP headers that can be used when requesting the // resource. Serialized to Access-Control-Allow-Methods header. AllowHeaders []string `json:"allowHeaders,omitempty"` // A white list of HTTP headers that the browsers are allowed to // access. Serialized into Access-Control-Expose-Headers header. ExposeHeaders []string `json:"exposeHeaders,omitempty"` // Specifies how long the the results of a preflight request can be // cached. Translates to the Access-Control-Max-Age header. MaxAge string `json:"maxAge,omitempty"` // Indicates whether the caller is allowed to send the actual request // (not the preflight) using credentials. Translates to // Access-Control-Allow-Credentials header. AllowCredentials bool `json:"allowCredentials,omitempty"` }
Describes the Cross-Origin Resource Sharing (CORS) policy, for a given service. Refer to https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS for further details about cross origin resource sharing. For example, the following rule restricts cross origin requests to those originating from example.com domain using HTTP POST/GET, and sets the Access-Control-Allow-Credentials header to false. In addition, it only exposes X-Foo-bar header and sets an expiry period of 1 day.
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: ratings-route spec: hosts: - ratings http: - route: - destination: host: ratings subset: v1 corsPolicy: allowOrigin: - example.com allowMethods: - POST - GET allowCredentials: false allowHeaders: - X-Foo-Bar maxAge: "1d"
func (*CorsPolicy) DeepCopy ¶
func (in *CorsPolicy) DeepCopy() *CorsPolicy
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CorsPolicy.
func (*CorsPolicy) DeepCopyInto ¶
func (in *CorsPolicy) DeepCopyInto(out *CorsPolicy)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Destination ¶
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 `json:"host"` // 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 `json:"subset,omitempty"` // Specifies the port on the host that is being addressed. If a service // exposes only a single port it is not required to explicitly select the // port. Port *PortSelector `json:"port,omitempty"` }
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.
```yaml 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 ¶
```yaml 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 istio-system 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.
```yaml apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata:
name: my-productpage-rule namespace: istio-system
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.
```yaml 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
```
func (*Destination) DeepCopy ¶
func (in *Destination) DeepCopy() *Destination
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Destination.
func (*Destination) DeepCopyInto ¶
func (in *Destination) DeepCopyInto(out *Destination)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type DestinationRule ¶
type DestinationRule struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec DestinationRuleSpec `json:"spec"` }
+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object DestinationRule
func (*DestinationRule) DeepCopy ¶
func (in *DestinationRule) DeepCopy() *DestinationRule
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestinationRule.
func (*DestinationRule) DeepCopyInto ¶
func (in *DestinationRule) DeepCopyInto(out *DestinationRule)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*DestinationRule) DeepCopyObject ¶
func (in *DestinationRule) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type DestinationRuleList ¶
type DestinationRuleList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []DestinationRule `json:"items"` }
+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object DestinationRuleList is a list of DestinationRule resources
func (*DestinationRuleList) DeepCopy ¶
func (in *DestinationRuleList) DeepCopy() *DestinationRuleList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestinationRuleList.
func (*DestinationRuleList) DeepCopyInto ¶
func (in *DestinationRuleList) DeepCopyInto(out *DestinationRuleList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*DestinationRuleList) DeepCopyObject ¶
func (in *DestinationRuleList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type DestinationRuleSpec ¶
type DestinationRuleSpec 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 [ServiceEntries](#ServiceEntry). Rules defined for // services that do not exist in the service registry will be ignored. // // *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._ // // Note that the host field applies to both HTTP and TCP services. Host string `json:"host"` // Traffic policies to apply (load balancing policy, connection pool // sizes, outlier detection). TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty"` // One or more named sets that represent individual versions of a // service. Traffic policies can be overridden at subset level. Subsets []Subset `json:"subsets,omitempty"` }
DestinationRule defines policies that apply to traffic intended for a service after routing has occurred. These rules specify configuration for load balancing, connection pool size from the sidecar, and outlier detection settings to detect and evict unhealthy hosts from the load balancing pool. For example, a simple load balancing policy for the ratings service would look as follows:
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: bookinfo-ratings
spec:
host: ratings.prod.svc.cluster.local trafficPolicy: loadBalancer: simple: LEAST_CONN
Version specific policies can be specified by defining a named subset and overriding the settings specified at the service level. The following rule uses a round robin load balancing policy for all traffic going to a subset named testversion that is composed of endpoints (e.g., pods) with labels (version:v3).
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: bookinfo-ratings
spec:
host: ratings.prod.svc.cluster.local trafficPolicy: loadBalancer: simple: LEAST_CONN subsets: - name: testversion labels: version: v3 trafficPolicy: loadBalancer: simple: ROUND_ROBIN
**Note:** Policies specified for subsets will not take effect until a route rule explicitly sends traffic to this subset.
Traffic policies can be customized to specific ports as well. The following rule uses the least connection load balancing policy for all traffic to port 80, while uses a round robin load balancing setting for traffic to the port 9080.
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: bookinfo-ratings-port
spec:
host: ratings.prod.svc.cluster.local trafficPolicy: # Apply to all ports portLevelSettings: - port: number: 80 loadBalancer: simple: LEAST_CONN - port: number: 9080 loadBalancer: simple: ROUND_ROBIN
func (*DestinationRuleSpec) DeepCopy ¶
func (in *DestinationRuleSpec) DeepCopy() *DestinationRuleSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DestinationRuleSpec.
func (*DestinationRuleSpec) DeepCopyInto ¶
func (in *DestinationRuleSpec) DeepCopyInto(out *DestinationRuleSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Distribute ¶ added in v1.14.0
type Distribute struct { // Originating locality, '/' separated, e.g. 'region/zone/sub_zone'. From string `json:"from,omitempty"` // Map of upstream localities to traffic distribution weights. The sum of // all weights should be 100. Any locality not present will // receive no traffic. To map[string]uint32 `json:"to,omitempty"` }
Describes how traffic originating in the 'from' zone or sub-zone is distributed over a set of 'to' zones. Syntax for specifying a zone is {region}/{zone}/{sub-zone} and terminal wildcards are allowed on any segment of the specification. Examples:
`*` - matches all localities
`us-west/*` - all zones and sub-zones within the us-west region
`us-west/zone-1/*` - all sub-zones within us-west/zone-1
func (*Distribute) DeepCopy ¶ added in v1.14.0
func (in *Distribute) DeepCopy() *Distribute
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Distribute.
func (*Distribute) DeepCopyInto ¶ added in v1.14.0
func (in *Distribute) DeepCopyInto(out *Distribute)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Failover ¶ added in v1.14.0
type Failover struct { // Originating region. From string `json:"from,omitempty"` // Destination region the traffic will fail over to when endpoints in // the 'from' region becomes unhealthy. To string `json:"to,omitempty"` }
Specify the traffic failover policy across regions. Since zone and sub-zone failover is supported by default this only needs to be specified for regions when the operator needs to constrain traffic failover so that the default behavior of failing over to any endpoint globally does not apply. This is useful when failing over traffic across regions would not improve service health or may need to be restricted for other reasons like regulatory controls.
func (*Failover) DeepCopy ¶ added in v1.14.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Failover.
func (*Failover) DeepCopyInto ¶ added in v1.14.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPCookie ¶
type HTTPCookie struct { // REQUIRED. Name of the cookie. Name string `json:"name"` // Path to set for the cookie. Path string `json:"path,omitempty"` // REQUIRED. Lifetime of the cookie. TTL string `json:"ttl"` }
Describes a HTTP cookie that will be used as the hash key for the Consistent Hash load balancer. If the cookie is not present, it will be generated.
func (*HTTPCookie) DeepCopy ¶
func (in *HTTPCookie) DeepCopy() *HTTPCookie
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPCookie.
func (*HTTPCookie) DeepCopyInto ¶
func (in *HTTPCookie) DeepCopyInto(out *HTTPCookie)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPFaultInjection ¶
type HTTPFaultInjection struct { // Delay requests before forwarding, emulating various failures such as // network issues, overloaded upstream service, etc. Delay *InjectDelay `json:"delay,omitempty"` // Abort Http request attempts and return error codes back to downstream // service, giving the impression that the upstream service is faulty. Abort *InjectAbort `json:"abort,omitempty"` }
HTTPFaultInjection can be used to specify one or more faults to inject while forwarding http requests to the destination specified in a route. Fault specification is part of a VirtualService rule. Faults include aborting the Http request from downstream service, and/or delaying proxying of requests. A fault rule MUST HAVE delay or abort or both.
*Note:* Delay and abort faults are independent of one another, even if both are specified simultaneously.
func (*HTTPFaultInjection) DeepCopy ¶
func (in *HTTPFaultInjection) DeepCopy() *HTTPFaultInjection
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPFaultInjection.
func (*HTTPFaultInjection) DeepCopyInto ¶
func (in *HTTPFaultInjection) DeepCopyInto(out *HTTPFaultInjection)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPMatchRequest ¶
type HTTPMatchRequest struct { // The name assigned to a match. The match's name will be // concatenated with the parent route's name and will be logged in // the access logs for requests matching this route. Name string `json:"name,omitempty"` // 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 *v1alpha1.StringMatch `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 *v1alpha1.StringMatch `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 *v1alpha1.StringMatch `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 *v1alpha1.StringMatch `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]v1alpha1.StringMatch `json:"headers,omitempty"` // 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 `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 `json:"sourceLabels,omitempty"` // 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 `json:"gateways,omitempty"` // Query parameters for matching. // // Ex: // - For a query parameter like "?key=true", the map key would be "key" and // the string match could be defined as `exact: "true"`. // - For a query parameter like "?key", the map key would be "key" and the // string match could be defined as `exact: ""`. // - For a query parameter like "?key=123", the map key would be "key" and the // string match could be defined as `regex: "\d+$"`. Note that this // configuration will only match values like "123" but not "a123" or "123a". // // **Note:** `prefix` matching is currently not supported. QueryParams map[string]v1alpha1.StringMatch `json:"queryParams,omitempty"` // Flag to specify whether the URI matching should be case-insensitive. // // **Note:** The case will be ignored only in the case of `exact` and `prefix` // URI matches. IgnoreUriCase bool `json:"ignoreUriCase,omitempty"` // withoutHeader has the same syntax with the header, but has opposite meaning. // If a header is matched with a matching rule among withoutHeader, the traffic becomes not matched one. WithoutHeaders map[string]v1alpha1.StringMatch `json:"withoutHeaders,omitempty"` // Source namespace constraining the applicability of a rule to workloads in that namespace. // If the VirtualService has a list of gateways specified in the top-level `gateways` field, // it must include the reserved gateway `mesh` for this field to be applicable. SourceNamespace string `json:"sourceNamespace,omitempty"` }
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 http: - match: - headers: cookie: regex: "^(.*?;)?(user=jason)(;.*)?" uri: prefix: "/ratings/v2/" route: - destination: host: ratings
HTTPMatchRequest CANNOT be empty.
func (*HTTPMatchRequest) DeepCopy ¶
func (in *HTTPMatchRequest) DeepCopy() *HTTPMatchRequest
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPMatchRequest.
func (*HTTPMatchRequest) DeepCopyInto ¶
func (in *HTTPMatchRequest) DeepCopyInto(out *HTTPMatchRequest)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPRedirect ¶
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 `json:"uri,omitempty"` // On a redirect, overwrite the Authority/Host portion of the URL with // this value. Authority string `json:"authority,omitempty"` }
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 http: - match: - uri: exact: /v1/getProductRatings redirect: uri: /v1/bookRatings authority: bookratings.default.svc.cluster.local ...
func (*HTTPRedirect) DeepCopy ¶
func (in *HTTPRedirect) DeepCopy() *HTTPRedirect
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRedirect.
func (*HTTPRedirect) DeepCopyInto ¶
func (in *HTTPRedirect) DeepCopyInto(out *HTTPRedirect)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPRetry ¶
type HTTPRetry struct { // REQUIRED. Number of retries for a given request. The interval // between retries will be determined automatically (25ms+). Actual // number of retries attempted depends on the httpReqTimeout. Attempts int `json:"attempts"` // Timeout per retry attempt for a given request. format: 1h/1m/1s/1ms. MUST BE >=1ms. PerTryTimeout string `json:"perTryTimeout,omitempty"` // Specifies the conditions under which retry takes place. // One or more policies can be specified using a ‘,’ delimited list. // The supported policies can be found in // <https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/router_filter#x-envoy-retry-on> // and <https://www.envoyproxy.io/docs/envoy/latest/configuration/http_filters/router_filter#x-envoy-retry-grpc-on> RetryOn string `json:"retryOn,omitempty"` }
Describes the retry policy to use when a HTTP request fails. For example, the following rule sets the maximum number of retries to 3 when calling ratings:v1 service, with a 2s timeout per retry attempt.
```yaml apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata:
name: ratings-route
spec:
hosts: - ratings.prod.svc.cluster.local http: - route: - destination: host: ratings.prod.svc.cluster.local subset: v1 retries: attempts: 3 perTryTimeout: 2s retryOn: gateway-error,connect-failure,refused-stream
```
func (*HTTPRetry) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRetry.
func (*HTTPRetry) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPRewrite ¶
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 `json:"uri,omitempty"` // rewrite the Authority/Host header with this value. Authority string `json:"authority,omitempty"` }
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 http: - match: - uri: prefix: /ratings rewrite: uri: /v1/bookRatings route: - destination: host: ratings subset: v1
func (*HTTPRewrite) DeepCopy ¶
func (in *HTTPRewrite) DeepCopy() *HTTPRewrite
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRewrite.
func (*HTTPRewrite) DeepCopyInto ¶
func (in *HTTPRewrite) DeepCopyInto(out *HTTPRewrite)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPRoute ¶
type HTTPRoute struct { // The name assigned to the route for debugging purposes. The route’s name will // be concatenated with the match’s name and will be logged in the access logs // for requests matching this route/match. Name string `json:"name,omitempty"` // 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 `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 []HTTPRouteDestination `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 `json:"redirect,omitempty"` // Rewrite HTTP URIs and Authority headers. Rewrite cannot be used with // Redirect primitive. Rewrite will be performed before forwarding. Rewrite *HTTPRewrite `json:"rewrite,omitempty"` // Timeout for HTTP requests. Timeout string `json:"timeout,omitempty"` // Retry policy for HTTP requests. Retries *HTTPRetry `json:"retries,omitempty"` // Fault injection policy to apply on HTTP traffic. Fault *HTTPFaultInjection `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 `json:"mirror,omitempty"` // Percentage of the traffic to be mirrored by the `mirror` field. // If this field is absent, all the traffic (100%) will be mirrored. // Max value is 100. MirrorPercentage *Percent `json:"mirrorPercentage,omitempty"` // Cross-Origin Resource Sharing policy (CORS). Refer to // https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS // for further details about cross origin resource sharing. CorsPolicy *CorsPolicy `json:"corsPolicy,omitempty"` // Header manipulation rules Headers *Headers `json:"headers,omitempty"` }
Describes match conditions and actions for routing HTTP/1.1, HTTP2, and gRPC traffic. See VirtualService for usage examples.
func (*HTTPRoute) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRoute.
func (*HTTPRoute) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPRouteDestination ¶ added in v1.25.0
type HTTPRouteDestination struct { // REQUIRED. Destination uniquely identifies the instances of a service // to which the request/connection should be forwarded to. Destination Destination `json:"destination"` // 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 int `json:"weight"` // Header manipulation rules Headers *Headers `json:"headers,omitempty"` }
func (*HTTPRouteDestination) DeepCopy ¶ added in v1.25.0
func (in *HTTPRouteDestination) DeepCopy() *HTTPRouteDestination
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPRouteDestination.
func (*HTTPRouteDestination) DeepCopyInto ¶ added in v1.25.0
func (in *HTTPRouteDestination) DeepCopyInto(out *HTTPRouteDestination)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HTTPSettings ¶
type HTTPSettings struct { // Specify if http1.1 connection should be upgraded to http2 for the associated destination. // DEFAULT - Use the global default. // DO_NOT_UPGRADE - Do not upgrade the connection to http2. // UPGRADE - Upgrade the connection to http2. H2UpgradePolicy string `json:"h2UpgradePolicy,omitempty"` // Maximum number of pending HTTP requests to a destination. Default 2^32-1. HTTP1MaxPendingRequests int32 `json:"http1MaxPendingRequests,omitempty"` // Maximum number of requests to a backend. Default 2^32-1. HTTP2MaxRequests int32 `json:"http2MaxRequests,omitempty"` // Maximum number of requests per connection to a backend. Setting this // parameter to 1 disables keep alive. Default 0, meaning "unlimited", // up to 2^29. MaxRequestsPerConnection int32 `json:"maxRequestsPerConnection,omitempty"` // Maximum number of retries that can be outstanding to all hosts in a // cluster at a given time. Defaults to 2^32-1. MaxRetries int32 `json:"maxRetries,omitempty"` // The idle timeout for upstream connection pool connections. The idle timeout is defined as the period in which there are no active requests. // If not set, the default is 1 hour. When the idle timeout is reached the connection will be closed. // Note that request based timeouts mean that HTTP/2 PINGs will not keep the connection alive. Applies to both HTTP1.1 and HTTP2 connections. IdleTimeout string `json:"idleTimeout,omitempty"` }
Settings applicable to HTTP1.1/HTTP2/GRPC connections.
func (*HTTPSettings) DeepCopy ¶
func (in *HTTPSettings) DeepCopy() *HTTPSettings
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPSettings.
func (*HTTPSettings) DeepCopyInto ¶
func (in *HTTPSettings) DeepCopyInto(out *HTTPSettings)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type HeaderOperations ¶
type HeaderOperations struct { // Overwrite the headers specified by key with the given values Set map[string]string `json:"set,omitempty"` // Append the given values to the headers specified by keys // (will create a comma-separated list of values) Add map[string]string `json:"add,omitempty"` // Remove the specified headers Remove []string `json:"remove,omitempty"` }
HeaderOperations Describes the header manipulations to apply
func (*HeaderOperations) DeepCopy ¶
func (in *HeaderOperations) DeepCopy() *HeaderOperations
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HeaderOperations.
func (*HeaderOperations) DeepCopyInto ¶
func (in *HeaderOperations) DeepCopyInto(out *HeaderOperations)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Headers ¶
type Headers struct { // Header manipulation rules to apply before forwarding a request // to the destination service Request *HeaderOperations `json:"request,omitempty"` // Header manipulation rules to apply before returning a response // to the caller Response *HeaderOperations `json:"response,omitempty"` }
Header manipulation rules
func (*Headers) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Headers.
func (*Headers) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type InjectAbort ¶
type InjectAbort struct { // Percentage of requests to be aborted with the error code provided (0-100). Perecent int `json:"percent,omitempty"` // REQUIRED. HTTP status code to use to abort the Http request. HttpStatus int `json:"httpStatus"` }
Abort specification is used to prematurely abort a request with a pre-specified error code. The following example will return an HTTP 400 error code for 10% of the requests to the "ratings" service "v1".
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: ratings-route spec: hosts: - ratings http: - route: - destination: host: ratings subset: v1 fault: abort: percent: 10 httpStatus: 400
The _httpStatus_ field is used to indicate the HTTP status code to return to the caller. The optional _percent_ field, a value between 0 and 100, is used to only abort a certain percentage of requests. If not specified, all requests are aborted.
func (*InjectAbort) DeepCopy ¶
func (in *InjectAbort) DeepCopy() *InjectAbort
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InjectAbort.
func (*InjectAbort) DeepCopyInto ¶
func (in *InjectAbort) DeepCopyInto(out *InjectAbort)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type InjectDelay ¶
type InjectDelay struct { // Percentage of requests on which the delay will be injected (0-100). Percent int `json:"percent,omitempty"` // REQUIRED. Add a fixed delay before forwarding the request. Format: // 1h/1m/1s/1ms. MUST be >=1ms. FixedDelay string `json:"fixedDelay"` // (-- Add a delay (based on an exponential function) before forwarding // the request. mean delay needed to derive the exponential delay // values --) ExponentialDelay string `json:"exponentialDelay,omitempty"` }
Delay specification is used to inject latency into the request forwarding path. The following example will introduce a 5 second delay in 10% of the requests to the "v1" version of the "reviews" service from all pods with label env: prod
apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: reviews-route spec: hosts: - reviews http: - match: - sourceLabels: env: prod route: - destination: host: reviews subset: v1 fault: delay: percent: 10 fixedDelay: 5s
The _fixedDelay_ field is used to indicate the amount of delay in seconds. An optional _percent_ field, a value between 0 and 100, can be used to only delay a certain percentage of requests. If left unspecified, all request will be delayed.
func (*InjectDelay) DeepCopy ¶
func (in *InjectDelay) DeepCopy() *InjectDelay
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InjectDelay.
func (*InjectDelay) DeepCopyInto ¶
func (in *InjectDelay) DeepCopyInto(out *InjectDelay)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type L4MatchAttributes ¶
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 `json:"destinationSubnet,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 int `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 `json:"sourceSubnet,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. SourceLabel map[string]string `json:"sourceLabel,omitempty"` // 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 `json:"gateways,omitempty"` }
L4 connection match attributes. Note that L4 connection matching support is incomplete.
func (*L4MatchAttributes) DeepCopy ¶
func (in *L4MatchAttributes) DeepCopy() *L4MatchAttributes
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new L4MatchAttributes.
func (*L4MatchAttributes) DeepCopyInto ¶
func (in *L4MatchAttributes) DeepCopyInto(out *L4MatchAttributes)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type LoadBalancerSettings ¶
type LoadBalancerSettings struct { // It is required to specify exactly one of the fields: // Simple or ConsistentHash Simple SimpleLB `json:"simple,omitempty"` ConsistentHash *ConsistentHashLB `json:"consistentHash,omitempty"` // Locality load balancer settings, this will override mesh wide settings in entirety, meaning no merging would be performed // between this object and the object one in MeshConfig LocalityLbSetting *LocalityLbSetting `json:"localityLbSetting,omitempty"` // Represents the warmup duration of Service. If set, the newly created endpoint of service // remains in warmup mode starting from its creation time for the duration of this window and // Istio progressively increases amount of traffic for that endpoint instead of sending proportional amount of traffic. // This should be enabled for services that require warm up time to serve full production load with reasonable latency. // Please note that this is most effective when few new endpoints come up like scale event in Kubernetes. When all the // endpoints are relatively new like new deployment, this is not very effective as all endpoints end up getting same // amount of requests. // Currently this is only supported for ROUND_ROBIN and LEAST_REQUEST load balancers. WarmupDurationSecs string `json:"warmupDurationSecs,omitempty"` }
Load balancing policies to apply for a specific destination. See Envoy's load balancing [documentation](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/load_balancing.html) for more details.
For example, the following rule uses a round robin load balancing policy for all traffic going to the ratings service.
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: bookinfo-ratings
spec:
host: ratings.prod.svc.cluster.local trafficPolicy: loadBalancer: simple: ROUND_ROBIN
The following example sets up sticky sessions for the ratings service hashing-based load balancer for the same ratings service using the the User cookie as the hash key.
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata: name: bookinfo-ratings spec: host: ratings.prod.svc.cluster.local trafficPolicy: loadBalancer: consistentHash: httpCookie: name: user ttl: 0s
func (*LoadBalancerSettings) DeepCopy ¶
func (in *LoadBalancerSettings) DeepCopy() *LoadBalancerSettings
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoadBalancerSettings.
func (*LoadBalancerSettings) DeepCopyInto ¶
func (in *LoadBalancerSettings) DeepCopyInto(out *LoadBalancerSettings)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type LocalityLbSetting ¶ added in v1.14.0
type LocalityLbSetting struct { // Explicitly specify loadbalancing weight across different zones and geographical locations. // Refer to [Locality weighted load balancing](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/locality_weight) // If empty, the locality weight is set according to the endpoints number within it. Distribute []Distribute `json:"distribute,omitempty"` // Optional: only one of distribute, failover or failoverPriority can be set. // Explicitly specify the region traffic will land on when endpoints in local region becomes unhealthy. // Should be used together with OutlierDetection to detect unhealthy endpoints. // Note: if no OutlierDetection specified, this will not take effect. Failover []Failover `json:"failover,omitempty"` // failoverPriority is an ordered list of labels used to sort endpoints to do priority based load balancing. // This is to support traffic failover across different groups of endpoints. // Suppose there are total N labels specified: // // 1. Endpoints matching all N labels with the client proxy have priority P(0) i.e. the highest priority. // 2. Endpoints matching the first N-1 labels with the client proxy have priority P(1) i.e. second highest priority. // 3. By extension of this logic, endpoints matching only the first label with the client proxy has priority P(N-1) i.e. second lowest priority. // 4. All the other endpoints have priority P(N) i.e. lowest priority. // // Note: For a label to be considered for match, the previous labels must match, i.e. nth label would be considered matched only if first n-1 labels match. // // It can be any label specified on both client and server workloads. // The following labels which have special semantic meaning are also supported: // // - `topology.istio.io/network` is used to match the network metadata of an endpoint, which can be specified by pod/namespace label `topology.istio.io/network`, sidecar env `ISTIO_META_NETWORK` or MeshNetworks. // - `topology.istio.io/cluster` is used to match the clusterID of an endpoint, which can be specified by pod label `topology.istio.io/cluster` or pod env `ISTIO_META_CLUSTER_ID`. // - `topology.kubernetes.io/region` is used to match the region metadata of an endpoint, which maps to Kubernetes node label `topology.kubernetes.io/region` or the deprecated label `failure-domain.beta.kubernetes.io/region`. // - `topology.kubernetes.io/zone` is used to match the zone metadata of an endpoint, which maps to Kubernetes node label `topology.kubernetes.io/zone` or the deprecated label `failure-domain.beta.kubernetes.io/zone`. // - `topology.istio.io/subzone` is used to match the subzone metadata of an endpoint, which maps to Istio node label `topology.istio.io/subzone`. // // The below topology config indicates the following priority levels: // // “`yaml // failoverPriority: // - "topology.istio.io/network" // - "topology.kubernetes.io/region" // - "topology.kubernetes.io/zone" // - "topology.istio.io/subzone" // “` // // 1. endpoints match same [network, region, zone, subzone] label with the client proxy have the highest priority. // 2. endpoints have same [network, region, zone] label but different [subzone] label with the client proxy have the second highest priority. // 3. endpoints have same [network, region] label but different [zone] label with the client proxy have the third highest priority. // 4. endpoints have same [network] but different [region] labels with the client proxy have the fourth highest priority. // 5. all the other endpoints have the same lowest priority. // // Optional: only one of distribute, failover or failoverPriority can be set. // And it should be used together with `OutlierDetection` to detect unhealthy endpoints, otherwise has no effect. FailoverPriority []string `json:"failover_priority,omitempty"` // enable locality load balancing, this is DestinationRule-level and will override mesh wide settings in entirety. // e.g. true means that turn on locality load balancing for this DestinationRule no matter what mesh wide settings is. Enabled bool `json:"enabled,omitempty"` }
Locality-weighted load balancing allows administrators to control the distribution of traffic to endpoints based on the localities of where the traffic originates and where it will terminate. These localities are specified using arbitrary labels that designate a hierarchy of localities in {region}/{zone}/{sub-zone} form. For additional detail refer to [Locality Weight](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/locality_weight) The following example shows how to setup locality weights mesh-wide.
Given a mesh with workloads and their service deployed to "us-west/zone1/*" and "us-west/zone2/*". This example specifies that when traffic accessing a service originates from workloads in "us-west/zone1/*", 80% of the traffic will be sent to endpoints in "us-west/zone1/*", i.e the same zone, and the remaining 20% will go to endpoints in "us-west/zone2/*". This setup is intended to favor routing traffic to endpoints in the same locality. A similar setting is specified for traffic originating in "us-west/zone2/*".
```yaml
distribute: - from: us-west/zone1/* to: "us-west/zone1/*": 80 "us-west/zone2/*": 20 - from: us-west/zone2/* to: "us-west/zone1/*": 20 "us-west/zone2/*": 80
```
If the goal of the operator is not to distribute load across zones and regions but rather to restrict the regionality of failover to meet other operational requirements an operator can set a 'failover' policy instead of a 'distribute' policy.
The following example sets up a locality failover policy for regions. Assume a service resides in zones within us-east, us-west & eu-west this example specifies that when endpoints within us-east become unhealthy traffic should failover to endpoints in any zone or sub-zone within eu-west and similarly us-west should failover to us-east.
```yaml
failover: - from: us-east to: eu-west - from: us-west to: us-east
``` Locality load balancing settings.
func (*LocalityLbSetting) DeepCopy ¶ added in v1.14.0
func (in *LocalityLbSetting) DeepCopy() *LocalityLbSetting
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalityLbSetting.
func (*LocalityLbSetting) DeepCopyInto ¶ added in v1.14.0
func (in *LocalityLbSetting) DeepCopyInto(out *LocalityLbSetting)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type OutlierDetection ¶
type OutlierDetection struct { // Number of errors before a host is ejected from the connection // pool. Defaults to 5. When the upstream host is accessed over HTTP, a // 5xx return code qualifies as an error. When the upstream host is // accessed over an opaque TCP connection, connect timeouts and // connection error/failure events qualify as an error. ConsecutiveErrors int32 `json:"consecutiveErrors,omitempty"` // Number of gateway errors before a host is ejected from the connection pool. // When the upstream host is accessed over HTTP, a 502, 503, or 504 return // code qualifies as a gateway error. When the upstream host is accessed over // an opaque TCP connection, connect timeouts and connection error/failure // events qualify as a gateway error. // This feature is disabled by default or when set to the value 0. // // Note that consecutive_gateway_errors and consecutive_5xx_errors can be // used separately or together. Because the errors counted by // consecutive_gateway_errors are also included in consecutive_5xx_errors, // if the value of consecutive_gateway_errors is greater than or equal to // the value of consecutive_5xx_errors, consecutive_gateway_errors will have // no effect. ConsecutiveGatewayErrors *uint32 `json:"consecutiveGatewayErrors,omitempty"` // Number of 5xx errors before a host is ejected from the connection pool. // When the upstream host is accessed over an opaque TCP connection, connect // timeouts, connection error/failure and request failure events qualify as a // 5xx error. // This feature defaults to 5 but can be disabled by setting the value to 0. // // Note that consecutive_gateway_errors and consecutive_5xx_errors can be // used separately or together. Because the errors counted by // consecutive_gateway_errors are also included in consecutive_5xx_errors, // if the value of consecutive_gateway_errors is greater than or equal to // the value of consecutive_5xx_errors, consecutive_gateway_errors will have // no effect. Consecutive5xxErrors *uint32 `json:"consecutive5xxErrors,omitempty"` // Time interval between ejection sweep analysis. format: // 1h/1m/1s/1ms. MUST BE >=1ms. Default is 10s. Interval string `json:"interval,omitempty"` // Minimum ejection duration. A host will remain ejected for a period // equal to the product of minimum ejection duration and the number of // times the host has been ejected. This technique allows the system to // automatically increase the ejection period for unhealthy upstream // servers. format: 1h/1m/1s/1ms. MUST BE >=1ms. Default is 30s. BaseEjectionTime string `json:"baseEjectionTime,omitempty"` // Maximum % of hosts in the load balancing pool for the upstream // service that can be ejected. Defaults to 10%. MaxEjectionPercent int32 `json:"maxEjectionPercent,omitempty"` // Outlier detection will be enabled as long as the associated load balancing // pool has at least min_health_percent hosts in healthy mode. When the // percentage of healthy hosts in the load balancing pool drops below this // threshold, outlier detection will be disabled and the proxy will load balance // across all hosts in the pool (healthy and unhealthy). The threshold can be // disabled by setting it to 0%. The default is 0% as it's not typically // applicable in k8s environments with few pods per service. MinHealthPercent int32 `json:"minHealthPercent,omitempty"` }
A Circuit breaker implementation that tracks the status of each individual host in the upstream service. Applicable to both HTTP and TCP services. For HTTP services, hosts that continually return 5xx errors for API calls are ejected from the pool for a pre-defined period of time. For TCP services, connection timeouts or connection failures to a given host counts as an error when measuring the consecutive errors metric. See Envoy's [outlier detection](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/outlier) for more details.
The following rule sets a connection pool size of 100 connections and 1000 concurrent HTTP2 requests, with no more than 10 req/connection to "reviews" service. In addition, it configures upstream hosts to be scanned every 5 mins, such that any host that fails 7 consecutive times with 5XX error code will be ejected for 15 minutes.
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: reviews-cb-policy
spec:
host: reviews.prod.svc.cluster.local trafficPolicy: connectionPool: tcp: maxConnections: 100 http: http2MaxRequests: 1000 maxRequestsPerConnection: 10 outlierDetection: consecutiveErrors: 7 interval: 5m baseEjectionTime: 15m
func (*OutlierDetection) DeepCopy ¶
func (in *OutlierDetection) DeepCopy() *OutlierDetection
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OutlierDetection.
func (*OutlierDetection) DeepCopyInto ¶
func (in *OutlierDetection) DeepCopyInto(out *OutlierDetection)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Percent ¶
type Percent struct {
Value float64 `json:"value,omitempty"`
}
Percent specifies a percentage in the range of [0.0, 100.0].
func (*Percent) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Percent.
func (*Percent) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PortSelector ¶
type PortSelector struct { // Valid port number Number uint32 `json:"number,omitempty"` // Valid port name Name string `json:"name,omitempty"` }
PortSelector specifies the number of a port to be used for matching or selection for final routing.
func (*PortSelector) DeepCopy ¶
func (in *PortSelector) DeepCopy() *PortSelector
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortSelector.
func (*PortSelector) DeepCopyInto ¶
func (in *PortSelector) DeepCopyInto(out *PortSelector)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type PortTrafficPolicy ¶
type PortTrafficPolicy struct { // Specifies the port name or number of a port on the destination service // on which this policy is being applied. // // 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 `json:"port"` // Settings controlling the load balancer algorithms. LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty"` // Settings controlling the volume of connections to an upstream service ConnectionPool *ConnectionPoolSettings `json:"connectionPool,omitempty"` // Settings controlling eviction of unhealthy hosts from the load balancing pool OutlierDetection *OutlierDetection `json:"outlierDetection,omitempty"` // TLS related settings for connections to the upstream service. TLS *TLSSettings `json:"tls,omitempty"` }
Traffic policies that apply to specific ports of the service
func (*PortTrafficPolicy) DeepCopy ¶
func (in *PortTrafficPolicy) DeepCopy() *PortTrafficPolicy
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PortTrafficPolicy.
func (*PortTrafficPolicy) DeepCopyInto ¶
func (in *PortTrafficPolicy) DeepCopyInto(out *PortTrafficPolicy)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SimpleLB ¶
type SimpleLB string
Standard load balancing algorithms that require no tuning.
const ( // Round Robin policy. Default SimpleLBRoundRobin SimpleLB = "ROUND_ROBIN" // The least request load balancer uses an O(1) algorithm which selects // two random healthy hosts and picks the host which has fewer active // requests. SimpleLBLeastConn SimpleLB = "LEAST_CONN" // The random load balancer selects a random healthy host. The random // load balancer generally performs better than round robin if no health // checking policy is configured. SimpleLBRandom SimpleLB = "RANDOM" // This option will forward the connection to the original IP address // requested by the caller without doing any form of load // balancing. This option must be used with care. It is meant for // advanced use cases. Refer to Original Destination load balancer in // Envoy for further details. SimpleLBPassthrough SimpleLB = "PASSTHROUGH" // The least request load balancer spreads load across endpoints, // favoring endpoints with the least outstanding requests. This is generally // safer and outperforms ROUND_ROBIN in nearly all cases. Prefer to use LEAST_REQUEST // as a drop-in replacement for ROUND_ROBIN. SimpleLBLeastRequest SimpleLB = "LEAST_REQUEST" )
type Subset ¶
type Subset struct { // REQUIRED. Name of the subset. The service name and the subset name can // be used for traffic splitting in a route rule. Name string `json:"name"` // REQUIRED. Labels apply a filter over the endpoints of a service in the // service registry. See route rules for examples of usage. Labels map[string]string `json:"labels"` // Traffic policies that apply to this subset. Subsets inherit the // traffic policies specified at the DestinationRule level. Settings // specified at the subset level will override the corresponding settings // specified at the DestinationRule level. TrafficPolicy *TrafficPolicy `json:"trafficPolicy,omitempty"` }
A subset of endpoints of a service. Subsets can be used for scenarios like A/B testing, or routing to a specific version of a service. Refer to VirtualService(#VirtualService) documentation for examples of using subsets in these scenarios. In addition, traffic policies defined at the service-level can be overridden at a subset-level. The following rule uses a round robin load balancing policy for all traffic going to a subset named testversion that is composed of endpoints (e.g., pods) with labels (version:v3).
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: bookinfo-ratings
spec:
host: ratings.prod.svc.cluster.local trafficPolicy: loadBalancer: simple: LEAST_CONN subsets: - name: testversion labels: version: v3 trafficPolicy: loadBalancer: simple: ROUND_ROBIN
**Note:** Policies specified for subsets will not take effect until a route rule explicitly sends traffic to this subset.
func (*Subset) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subset.
func (*Subset) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TCPRoute ¶
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 `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 []HTTPRouteDestination `json:"route"` }
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.
```yaml 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
```
func (*TCPRoute) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPRoute.
func (*TCPRoute) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TCPSettings ¶
type TCPSettings struct { // Maximum number of HTTP1 /TCP connections to a destination host. MaxConnections int32 `json:"maxConnections,omitempty"` // TCP connection timeout. ConnectTimeout string `json:"connectTimeout,omitempty"` }
Settings common to both HTTP and TCP upstream connections.
func (*TCPSettings) DeepCopy ¶
func (in *TCPSettings) DeepCopy() *TCPSettings
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TCPSettings.
func (*TCPSettings) DeepCopyInto ¶
func (in *TCPSettings) DeepCopyInto(out *TCPSettings)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TLSSettings ¶
type TLSSettings struct { // REQUIRED: Indicates whether connections to this port should be secured // using TLS. The value of this field determines how TLS is enforced. Mode TLSmode `json:"mode"` // REQUIRED if mode is `MUTUAL`. The path to the file holding the // client-side TLS certificate to use. // Should be empty if mode is `ISTIO_MUTUAL`. ClientCertificate string `json:"clientCertificate,omitempty"` // REQUIRED if mode is `MUTUAL`. The path to the file holding the // client's private key. // Should be empty if mode is `ISTIO_MUTUAL`. PrivateKey string `json:"privateKey,omitempty"` // OPTIONAL: The path to the file containing certificate authority // certificates to use in verifying a presented server certificate. If // omitted, the proxy will not verify the server's certificate. // Should be empty if mode is `ISTIO_MUTUAL`. CaCertificates string `json:"caCertificates,omitempty"` // A list of alternate names to verify the subject identity in the // certificate. If specified, the proxy will verify that the server // certificate's subject alt name matches one of the specified values. // Should be empty if mode is `ISTIO_MUTUAL`. SubjectAltNames []string `json:"subjectAltNames,omitempty"` // SNI string to present to the server during TLS handshake. // Should be empty if mode is `ISTIO_MUTUAL`. Sni string `json:"sni,omitempty"` }
SSL/TLS related settings for upstream connections. See Envoy's [TLS context](https://www.envoyproxy.io/docs/envoy/latest/api-v1/cluster_manager/cluster_ssl.html#config-cluster-manager-cluster-ssl) for more details. These settings are common to both HTTP and TCP upstreams.
For example, the following rule configures a client to use mutual TLS for connections to upstream database cluster.
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: db-mtls
spec:
host: mydbserver.prod.svc.cluster.local trafficPolicy: tls: mode: MUTUAL clientCertificate: /etc/certs/myclientcert.pem privateKey: /etc/certs/client_private_key.pem caCertificates: /etc/certs/rootcacerts.pem
The following rule configures a client to use TLS when talking to a foreign service whose domain matches *.foo.com.
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: tls-foo
spec:
host: "*.foo.com" trafficPolicy: tls: mode: SIMPLE
The following rule configures a client to use Istio mutual TLS when talking to rating services.
apiVersion: networking.istio.io/v1alpha3 kind: DestinationRule metadata:
name: ratings-istio-mtls
spec:
host: ratings.prod.svc.cluster.local trafficPolicy: tls: mode: ISTIO_MUTUAL
func (*TLSSettings) DeepCopy ¶
func (in *TLSSettings) DeepCopy() *TLSSettings
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLSSettings.
func (*TLSSettings) DeepCopyInto ¶
func (in *TLSSettings) DeepCopyInto(out *TLSSettings)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TLSmode ¶
type TLSmode string
TLS connection mode
const ( // Do not setup a TLS connection to the upstream endpoint. TLSmodeDisable TLSmode = "DISABLE" // Originate a TLS connection to the upstream endpoint. TLSmodeSimple TLSmode = "SIMPLE" // Secure connections to the upstream using mutual TLS by presenting // client certificates for authentication. TLSmodeMutual TLSmode = "MUTUAL" // Secure connections to the upstream using mutual TLS by presenting // client certificates for authentication. // Compared to Mutual mode, this mode uses certificates generated // automatically by Istio for mTLS authentication. When this mode is // used, all other fields in `TLSSettings` should be empty. TLSmodeIstioMutual TLSmode = "ISTIO_MUTUAL" )
type TrafficPolicy ¶
type TrafficPolicy struct { // Settings controlling the load balancer algorithms. LoadBalancer *LoadBalancerSettings `json:"loadBalancer,omitempty"` // Settings controlling the volume of connections to an upstream service ConnectionPool *ConnectionPoolSettings `json:"connectionPool,omitempty"` // Settings controlling eviction of unhealthy hosts from the load balancing pool OutlierDetection *OutlierDetection `json:"outlierDetection,omitempty"` // TLS related settings for connections to the upstream service. TLS *TLSSettings `json:"tls,omitempty"` // Traffic policies specific to individual ports. Note that port level // settings will override the destination-level settings. Traffic // settings specified at the destination-level will not be inherited when // overridden by port-level settings, i.e. default values will be applied // to fields omitted in port-level traffic policies. PortLevelSettings []PortTrafficPolicy `json:"portLevelSettings,omitempty"` }
Traffic policies to apply for a specific destination, across all destination ports. See DestinationRule for examples.
func (*TrafficPolicy) DeepCopy ¶
func (in *TrafficPolicy) DeepCopy() *TrafficPolicy
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TrafficPolicy.
func (*TrafficPolicy) DeepCopyInto ¶
func (in *TrafficPolicy) DeepCopyInto(out *TrafficPolicy)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type VirtualService ¶
type VirtualService struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec VirtualServiceSpec `json:"spec"` }
VirtualService
func (*VirtualService) DeepCopy ¶
func (in *VirtualService) DeepCopy() *VirtualService
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualService.
func (*VirtualService) DeepCopyInto ¶
func (in *VirtualService) DeepCopyInto(out *VirtualService)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*VirtualService) DeepCopyObject ¶
func (in *VirtualService) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type VirtualServiceList ¶
type VirtualServiceList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata"` Items []VirtualService `json:"items"` }
VirtualServiceList is a list of VirtualService resources
func (*VirtualServiceList) DeepCopy ¶
func (in *VirtualServiceList) DeepCopy() *VirtualServiceList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualServiceList.
func (*VirtualServiceList) DeepCopyInto ¶
func (in *VirtualServiceList) DeepCopyInto(out *VirtualServiceList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*VirtualServiceList) DeepCopyObject ¶
func (in *VirtualServiceList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type VirtualServiceSpec ¶
type VirtualServiceSpec 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 `json:"hosts"` // 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 protocol-specific 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 `json:"gateways,omitempty"` // An ordered list of route rules for HTTP traffic. HTTP routes will be // applied to platform service ports named 'http-*'/'http2-*'/'grpc-*', gateway // ports with protocol HTTP/HTTP2/GRPC/ TLS-terminated-HTTPS and service // entry ports using HTTP/HTTP2/GRPC protocols. The first rule matching // an incoming request is used. Http []HTTPRoute `json:"http,omitempty"` // An ordered list of route rules for opaque TCP traffic. TCP routes will // be applied to any port that is not a HTTP or TLS port. The first rule // matching an incoming request is used. Tcp []TCPRoute `json:"tcp,omitempty"` }
VirtualServiceSpec 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 with path starting with /wpcatalog/ or /consumercatalog/ will be rewritten to /newcatalog and sent to pods with label "version: v2".
```yaml 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`.
```yaml 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
```
func (*VirtualServiceSpec) DeepCopy ¶
func (in *VirtualServiceSpec) DeepCopy() *VirtualServiceSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualServiceSpec.
func (*VirtualServiceSpec) DeepCopyInto ¶
func (in *VirtualServiceSpec) DeepCopyInto(out *VirtualServiceSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.