- Rules
- Action
- AttributeManifest
- AttributeManifest.AttributeInfo
- Authentication
- Connection
- DNSName
- DirectHttpResponse
- Duration
- EmailAddress
- FractionalPercent.DenominatorType
- Handler
- HttpStatusCode
- IPAddress
- Instance
- Mutual
- OAuth
- Rule
- Rule.HeaderOperationTemplate
- Rule.HeaderOperationTemplate.Operation
- StringMap
- TimeStamp
- Tls
- Tls.AuthHeader
- Uri
- Value
- ValueType
Rules
Describes the rules used to configure Mixer’s policy and telemetry features.
Action
Action describes which Handler to invoke and what data to pass to it for processing.
The following example instructs Mixer to invoke ‘prometheus-handler’ handler and pass it the object constructed using the instance ‘RequestCountByService’.
handler: prometheus-handler
instances:
- RequestCountByService
Field | Type | Description | Required |
---|---|---|---|
handler | string | Fully qualified name of the handler to invoke. Must match the | Yes |
instances | string[] | Each value must match the fully qualified name of the Instances. Referenced instances are evaluated by resolving the attributes/literals for all the fields. The constructed objects are then passed to the | Yes |
name | string | A handle to refer to the results of the action. | No |
AttributeManifest
AttributeManifest describes a set of Attributes produced by some component of an Istio deployment.
Field | Type | Description | Required |
---|---|---|---|
revision | string | The revision of this document. Assigned by server. | No |
name | string | Name of the component producing these attributes. This can be the proxy (with the canonical name | Yes |
attributes | map<string, AttributeInfo> | The set of attributes this Istio component will be responsible for producing at runtime. We map from attribute name to the attribute’s specification. The name of an attribute, which is how attributes are referred to in aspect configuration, must conform to:
Where Attribute names must be unique within a single Istio deployment. The set of canonical attributes are described at here. Attributes not in that list should be named with a component-specific suffix such as | No |
AttributeManifest.AttributeInfo
AttributeInfo describes the schema of an Istio Attribute
.
Istio Attributes
Istio uses attributes
to describe runtime activities of Istio services. An Istio attribute carries a specific piece of information about an activity, such as the error code of an API request, the latency of an API request, or the original IP address of a TCP connection. The attributes are often generated and consumed by different services. For example, a frontend service can generate an authenticated user attribute and pass it to a backend service for access control purpose.
To simplify the system and improve developer experience, Istio uses shared attribute definitions across all components. For example, the same authenticated user attribute will be used for logging, monitoring, analytics, billing, access control, auditing. Many Istio components provide their functionality by collecting, generating, and operating on attributes. For example, the proxy collects the error code attribute, and the logging stores it into a log.
Design
Each Istio attribute must conform to an AttributeInfo
in an AttributeManifest
in the current Istio deployment at runtime. An AttributeInfo
is used to define an attribute’s metadata: the type of its value and a detailed description that explains the semantics of the attribute type. Each attribute’s name is globally unique; in other words an attribute name can only appear once across all manifests.
The runtime presentation of an attribute is intentionally left out of this specification, because passing attribute using JSON, XML, or Protocol Buffers does not change the semantics of the attribute. Different implementations can choose different representations based on their needs.
HTTP Mapping
Because many systems already have REST APIs, it makes sense to define a standard HTTP mapping for Istio attributes that are compatible with typical REST APIs. The design is to map one attribute to one HTTP header, the attribute name and value becomes the HTTP header name and value. The actual encoding scheme will be decided later.
Field | Type | Description | Required |
---|---|---|---|
description | string | A human-readable description of the attribute’s purpose. | No |
valueType | ValueType | The type of data carried by this attribute. | Yes |
Authentication
Authentication allows the operator to specify the authentication of connections to out-of-process infrastructure backend.
Field | Type | Description | Required |
---|---|---|---|
tls | Tls (oneof) | Originate a TLS connection to the adapter and present an auth token in each call for client authentication. | Yes |
mutual | Mutual (oneof) | Secure connections to the adapter using mutual TLS by presenting client certificates for authentication. | Yes |
Connection
Connection allows the operator to specify the endpoint for out-of-process infrastructure backend. Connection is part of the handler custom resource and is specified alongside adapter specific configuration.
Field | Type | Description | Required |
---|---|---|---|
address | string | The address of the backend. | No |
timeout | Duration | Timeout for remote calls to the backend. | No |
authentication | Authentication | Auth config for the connection to the backend. If omitted, plain text will be used. | No |
DNSName
An instance field of type DNSName denotes that the expression for the field must evaluate to ValueType.DNS_NAME
Objects of type DNSName are also passed to the adapters during request-time for the instance fields of type DNSName
Field | Type | Description | Required |
---|---|---|---|
value | string | DNSName encoded as string. | No |
DirectHttpResponse
Direct HTTP response for a client-facing error message which can be attached to an RPC error.
Field | Type | Description | Required |
---|---|---|---|
code | HttpStatusCode | HTTP status code. If not set, RPC error code is used. | No |
body | string | HTTP response body. | No |
headers | map<string, string> | HTTP response headers. | No |
Duration
An instance field of type Duration denotes that the expression for the field must evaluate to ValueType.DURATION
Objects of type Duration are also passed to the adapters during request-time for the instance fields of type Duration
Field | Type | Description | Required |
---|---|---|---|
value | Duration | Duration encoded as google.protobuf.Duration. | No |
EmailAddress
DO NOT USE !! Under Development An instance field of type EmailAddress denotes that the expression for the field must evaluate to ValueType.EMAIL_ADDRESS
Objects of type EmailAddress are also passed to the adapters during request-time for the instance fields of type EmailAddress
Field | Type | Description | Required |
---|---|---|---|
value | string | EmailAddress encoded as string. | No |
FractionalPercent.DenominatorType
Fraction percentages support several fixed denominator values.
Name | Description |
---|---|
HUNDRED | 100. Example: 1⁄100 = 1%. |
TEN_THOUSAND | 10,000. Example: 1⁄10000 = 0.01%. |
Handler
Handler allows the operator to configure a specific adapter implementation. Each adapter implementation defines its own params
proto.
In the following example we define a metrics
handler for the prometheus
adapter. The example is in the form of a Kubernetes resource: * The metadata.name
is the name of the handler * The kind
refers to the adapter name * The spec
block represents adapter-specific configuration as well as the connection information
### Sample-1: No connection specified (for compiled in adapters)
### Note: if connection information is not specified, the adapter configuration is directly inside
### `spec` block. This is going to be DEPRECATED in favor of Sample-2
apiVersion: "config.istio.io/v1alpha2"
kind: handler
metadata:
name: requestcount
namespace: istio-system
spec:
compiledAdapter: prometheus
params:
metrics:
- name: request_count
instance_name: requestcount.metric.istio-system
kind: COUNTER
label_names:
- source_service
- source_version
- destination_service
- destination_version
---
### Sample-2: With connection information (for out-of-process adapters)
### Note: Unlike sample-1, the adapter configuration is parallel to `connection` and is nested inside `param` block.
apiVersion: "config.istio.io/v1alpha2"
kind: handler
metadata:
name: requestcount
namespace: istio-system
spec:
compiledAdapter: prometheus
params:
param:
metrics:
- name: request_count
instance_name: requestcount.metric.istio-system
kind: COUNTER
label_names:
- source_service
- source_version
- destination_service
- destination_version
connection:
address: localhost:8090
---
Field | Type | Description | Required |
---|---|---|---|
name | string | Must be unique in the entire Mixer configuration. Used by Actions to refer to this handler. | Yes |
compiledAdapter | string | The name of the compiled in adapter this handler instantiates. For referencing non compiled-in adapters, use the The value must match the name of the available adapter Mixer is built with. An adapter’s name is typically a constant in its code. | Yes |
adapter | string | The name of a specific adapter implementation. For referencing compiled-in adapters, use the An adapter’s implementation name is typically a constant in its code. | No |
params | Struct | Depends on adapter implementation. Struct representation of a proto defined by the adapter implementation; this varies depending on the value of field | No |
connection | Connection | Information on how to connect to the out-of-process adapter. This is used if the adapter is not compiled into Mixer binary and is running as a separate process. | No |
HttpStatusCode
HTTP response codes. For more details: http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml
Name | Description |
---|---|
Empty | Empty - This code not part of the HTTP status code specification, but it is needed for proto |
Continue | |
OK | |
Created | |
Accepted | |
NonAuthoritativeInformation | |
NoContent | |
ResetContent | |
PartialContent | |
MultiStatus | |
AlreadyReported | |
IMUsed | |
MultipleChoices | |
MovedPermanently | |
Found | |
SeeOther | |
NotModified | |
UseProxy | |
TemporaryRedirect | |
PermanentRedirect | |
BadRequest | |
Unauthorized | |
PaymentRequired | |
Forbidden | |
NotFound | |
MethodNotAllowed | |
NotAcceptable | |
ProxyAuthenticationRequired | |
RequestTimeout | |
Conflict | |
Gone | |
LengthRequired | |
PreconditionFailed | |
PayloadTooLarge | |
URITooLong | |
UnsupportedMediaType | |
RangeNotSatisfiable | |
ExpectationFailed | |
MisdirectedRequest | |
UnprocessableEntity | |
Locked | |
FailedDependency | |
UpgradeRequired | |
PreconditionRequired | |
TooManyRequests | |
RequestHeaderFieldsTooLarge | |
InternalServerError | |
NotImplemented | |
BadGateway | |
ServiceUnavailable | |
GatewayTimeout | |
HTTPVersionNotSupported | |
VariantAlsoNegotiates | |
InsufficientStorage | |
LoopDetected | |
NotExtended | |
NetworkAuthenticationRequired |
IPAddress
An instance field of type IPAddress denotes that the expression for the field must evaluate to ValueType.IP_ADDRESS
Objects of type IPAddress are also passed to the adapters during request-time for the instance fields of type IPAddress
Field | Type | Description | Required |
---|---|---|---|
value | bytes | IPAddress encoded as bytes. | No |
Instance
An Instance tells Mixer how to create instances for particular template.
Instance is defined by the operator. Instance is defined relative to a known template. Their purpose is to tell Mixer how to use attributes or literals to produce instances of the specified template at runtime.
The following example instructs Mixer to construct an instance associated with template ‘istio.mixer.adapter.metric.Metric’. It provides a mapping from the template’s fields to expressions. Instances produced with this instance can be referenced by Actions using name ‘RequestCountByService’
- name: RequestCountByService
template: istio.mixer.adapter.metric.Metric
params:
value: 1
dimensions:
source: source.name
destination_ip: destination.ip
Field | Type | Description | Required |
---|---|---|---|
name | string | The name of this instance Must be unique amongst other Instances in scope. Used by Action to refer to an instance produced by this instance. | Yes |
compiledTemplate | string | The name of the compiled in template this instance creates instances for. For referencing non compiled-in templates, use the The value must match the name of the available template Mixer is built with. | Yes |
template | string | The name of the template this instance creates instances for. For referencing compiled-in templates, use the The value must match the name of the available template in scope. | No |
params | Struct | Depends on referenced template. Struct representation of a proto defined by the template; this varies depending on the value of field | Yes |
attributeBindings | map<string, string> | Defines attribute bindings to map the output of attribute-producing adapters back into the attribute space. The variable
| No |
Mutual
Mutual let operator specify TLS configuration for Mixer as client if mutual TLS is used to secure connection to adapter backend.
Field | Type | Description | Required |
---|---|---|---|
privateKey | string | The path to the file holding the private key for mutual TLS. If omitted, the default Mixer private key will be used. | No |
clientCertificate | string | The path to the file holding client certificate for mutual TLS. If omitted, the default Mixer certificates will be used. | No |
caCertificates | string | The path to the file holding additional CA certificates that are needed to verify the presented adapter certificates. By default Mixer should already include Istio CA certificates and system certificates in cert pool. | No |
serverName | string | Used to configure mixer mutual TLS client to supply server name for SNI. It is not used to verify the hostname of the peer certificate, since Istio verifies whitelisted SAN fields in mutual TLS. | No |
OAuth
OAuth let operator specify config to fetch access token via oauth when using TLS for connection to the backend.
Field | Type | Description | Required |
---|---|---|---|
clientId | string | OAuth client id for mixer. | Yes |
clientSecret | string | The path to the file holding the client secret for oauth. | Yes |
tokenUrl | string | The Resource server’s token endpoint URL. | Yes |
scopes | string[] | List of requested permissions. | No |
endpointParams | map<string, string> | Additional parameters for requests to the token endpoint. | No |
Rule
A Rule is a selector and a set of intentions to be executed when the selector is true
The following example instructs Mixer to invoke prometheus-handler
handler for all services and pass it the instance constructed using the ‘RequestCountByService’ instance.
- match: match(destination.service.host, "*")
actions:
- handler: prometheus-handler
instances:
- RequestCountByService
Field | Type | Description | Required |
---|---|---|---|
match | string | Match is an attribute based predicate. When Mixer receives a request it evaluates the match expression and executes all the associated A few example match:
| No |
actions | Action[] | The actions that will be executed when match evaluates to | No |
requestHeaderOperations | HeaderOperationTemplate[] | Templatized operations on the request headers using values produced by the rule actions. Require the check action result to be OK. | No |
responseHeaderOperations | HeaderOperationTemplate[] | Templatized operations on the response headers using values produced by the rule actions. Require the check action result to be OK. | No |
Rule.HeaderOperationTemplate
A template for an HTTP header manipulation. Values in the template are expressions that may reference action outputs by name. For example, if an action x
produces an output with a field f
, then the header value expressions may use attribute x.output.f
to reference the field value:
request_header_operations:
- name: x-istio-header
values:
- x.output.f
If the header value expression evaluates to an empty string, and the operation is to either replace or append a header, then the operation is not applied. This permits conditional behavior on behalf of the adapter to optionally modify the headers.
Field | Type | Description | Required |
---|---|---|---|
name | string | Header name literal value. | Yes |
values | string[] | Header value expressions. | No |
operation | Operation | Header operation type. Default operation is to replace the value of the header by name. | No |
Rule.HeaderOperationTemplate.Operation
Header operation type.
Name | Description |
---|---|
REPLACE | Replace a header by name. |
REMOVE | Remove a header by name. Values are ignored. |
APPEND | Append values to the existing header values. |
StringMap
An instance field of type StringMap denotes that the expression for the field must evaluate to ValueType.STRING_MAP
Objects of type StringMap are also passed to the adapters during request-time for the instance fields of type StringMap
Field | Type | Description | Required |
---|---|---|---|
value | map<string, string> | StringMap encoded as a map of strings | No |
TimeStamp
An instance field of type TimeStamp denotes that the expression for the field must evaluate to ValueType.TIMESTAMP
Objects of type TimeStamp are also passed to the adapters during request-time for the instance fields of type TimeStamp
Field | Type | Description | Required |
---|---|---|---|
value | Timestamp | TimeStamp encoded as google.protobuf.Timestamp. | No |
Tls
Tls let operator specify client authentication setting when TLS is used for connection to the backend.
Field | Type | Description | Required |
---|---|---|---|
caCertificates | string | The path to the file holding additional CA certificates to well known public certs. | No |
tokenPath | string (oneof) | The path to the file holding the auth token (password, jwt token, api key, etc). | Yes |
oauth | OAuth (oneof) | Oauth config to fetch access token from auth provider. | Yes |
authHeader | AuthHeader (oneof) | Access token is passed as authorization header. | Yes |
customHeader | string (oneof) | Customized header key to hold access token, e.g. x-api-key. Token will be passed as what it is. | Yes |
serverName | string | Used to configure mixer TLS client to verify the hostname on the returned certificates. It is also included in the client’s handshake to support SNI. | No |
Tls.AuthHeader
AuthHeader specifies how to pass access token with authorization header.
Name | Description |
---|---|
PLAIN | Access token is passed in authorization header as what it is (authorization: some-token). |
BEARER | Access token is passed to adapter as bearer token (i.e. authorization: bearer some-token). |
Uri
DO NOT USE !! Under Development An instance field of type Uri denotes that the expression for the field must evaluate to ValueType.URI
Objects of type Uri are also passed to the adapters during request-time for the instance fields of type Uri
Field | Type | Description | Required |
---|---|---|---|
value | string | Uri encoded as string. | No |
Value
An instance field of type Value denotes that the expression for the field is of dynamic type and can evaluate to any ValueType enum values. For example, when authoring an instance configuration for a template that has a field data
of type istio.policy.v1beta1.Value
, both of the following expressions are valid data: source.ip | ip("0.0.0.0")
, data: request.id | ""
; the resulting type is either ValueType.IP_ADDRESS or ValueType.STRING for the two cases respectively.
Objects of type Value are also passed to the adapters during request-time. There is a 1:1 mapping between oneof fields in Value
and enum values inside ValueType
. Depending on the expression’s evaluated ValueType
, the equivalent oneof field in Value
is populated by Mixer and passed to the adapters.
Field | Type | Description | Required |
---|---|---|---|
stringValue | string (oneof) | Used for values of type STRING | Yes |
int64Value | int64 (oneof) | Used for values of type INT64 | Yes |
doubleValue | double (oneof) | Used for values of type DOUBLE | Yes |
boolValue | bool (oneof) | Used for values of type BOOL | Yes |
ipAddressValue | IPAddress (oneof) | Used for values of type IPAddress | Yes |
timestampValue | TimeStamp (oneof) | Used for values of type TIMESTAMP | Yes |
durationValue | Duration (oneof) | Used for values of type DURATION | Yes |
emailAddressValue | EmailAddress (oneof) | Used for values of type EmailAddress | Yes |
dnsNameValue | DNSName (oneof) | Used for values of type DNSName | Yes |
uriValue | Uri (oneof) | Used for values of type Uri | Yes |
stringMapValue | StringMap (oneof) | Used for values of type STRING_MAP | Yes |
ValueType
ValueType describes the types that values in the Istio system can take. These are used to describe the type of Attributes at run time, describe the type of the result of evaluating an expression, and to describe the runtime type of fields of other descriptors.
Name | Description |
---|---|
VALUE_TYPE_UNSPECIFIED | Invalid, default value. |
STRING | An undiscriminated variable-length string. |
INT64 | An undiscriminated 64-bit signed integer. |
DOUBLE | An undiscriminated 64-bit floating-point value. |
BOOL | An undiscriminated boolean value. |
TIMESTAMP | A point in time. |
IP_ADDRESS | An IP address. |
EMAIL_ADDRESS | An email address. |
URI | A URI. |
DNS_NAME | A DNS name. |
DURATION | A span between two points in time. |
STRING_MAP | A map string -> string, typically used by headers. |