--- title: Writing Configuration overview: How to write Istio config YAML content. order: 70 layout: docs type: markdown --- This page describes how to write configuration that conforms to Istio's schemas. All configuration schemas in Istio are defined as [protobuf messages](https://developers.google.com/protocol-buffers/docs/proto3). When in doubt, search for the protos. ## Translating to YAML There's an implicit mapping from protobuf to YAML using [protobuf's mapping to JSON](https://developers.google.com/protocol-buffers/docs/proto3#json). Below are a few examples showing common mappings you'll encounter writing configuration in Istio. **Important things to note:** - YAML fields are implicitly strings - Proto `repeated` fields map to YAML lists; each element in a YAML list is prefixed by a dash (`-`) - Proto `message`s map to objects; in YAML objects are field names all at the same indentation level - YAML is whitespace sensitive and must use spaces; tabs are never allowed ### `map` and `message` fields
| Proto | YAML |
|---|---|
message Metric {
string descriptor_name = 1;
string value = 2;
map
|
descriptorName: request_count value: "1" labels: source: origin.ip destination: destination.service |
| Proto | YAML |
|---|---|
message Metric {
string descriptor_name = 1;
string value = 2;
map
|
metrics:
- descriptorName: request_count
value: "1"
labels:
source: origin.ip
destination: destination.service
- descriptorName: request_latency
value: response.duration
labels:
source: origin.ip
destination: destination.service
|
| Proto | YAML |
|---|---|
enum ValueType {
STRING = 1;
INT64 = 2;
DOUBLE = 3;
// more values omitted
}
message AttributeDescriptor {
string name = 1;
string description = 2;
ValueType value_type = 3;
}
|
name: request.duration value_type: INT64or name: request.duration valueType: INT64 |
| Proto | YAML |
|---|---|
enum ValueType {
STRING = 1;
INT64 = 2;
DOUBLE = 3;
// more values omitted
}
message LabelDescriptor {
string name = 1;
string description = 2;
ValueType value_type = 3;
}
message MonitoredResourceDescriptor {
string name = 1;
string description = 2;
repeated LabelDescriptor labels = 3;
}
|
name: My Monitored Resource labels: - name: label one valueType: STRING - name: second label valueType: DOUBLE |
| Proto | YAML |
|---|---|
message Quota {
string descriptor_name = 1;
map
|
descriptorName: RequestCount labels: label one: STRING second label: DOUBLE maxAmount: "7" expiration: 1.000340012s |