# README
Configuration for xDS server
Configuration JSON files are used to generate the xDS configuration for an xDS server. The xDS server consumes this configuration and servers this configuration to an xDS client or an Envoy sidecar.
The configuration JSON files are directly unmarshalled to Snapshot struct.
The configuration files should follow the structure in the daufult_config.json file.
- Resources: An array holding the resources, there are currently 8 types of resources, the index of this array corresponds to the resource type.
- Version: Versions indicate the version of current group of resource. This field is served as key in VersionMap.
- TTL: Optional fields to set TTL for each resource item.
- Items: Items are maps within each resource type, the maps' keys are the individual resource names and the values are the actual resources with an optional TTL
- VersionMap: VersionMap holds the current hash map of all resources in the snapshot. This field should remain nil until it is used. In our use case, we only unmarshal the configuration into Snapshot, the VersionMap remains nil. VersionMap is only to be used with delta xDS.
The source of truth for the fields within each resource in the resource map is their protos. The 8 types of resources:
- Listener: config.listener.v3.Listener proto
- Endpoint: config.endpoint.v3.ClusterLoadAssignment proto
- Cluster: config.cluster.v3.Cluster proto
- Route: config.route.v3.RouteConfiguration proto
- ScopedRoute: config.route.v3.ScopedRouteConfiguration proto
- ExtensionConfig: config.core.v3.ExtensionConfigSource proto
- Secret: extensions.transport_sockets.tls.v3.Secret proto
- Runtime: service.runtime.v3.Runtime proto
Default configuration JSON file
The default_config.json file contains a piece of configuration that has two
listeners named: default_testEnvoyListenerName
and
default_testGrpcListenerName
, one cluster, one route and one Endpoint
resource. The two listeners are pointing to the same cluster, eventually the
same Endpoint resource.
User supplied configuration JSON file
If user wish to alter the default configuration, a user defined configuration
can be used instead of the default configuration. User can create a
configuration json file just like the default_config.json
in the same
directory with default_config.json
, which is containers/runtime/xds/config
within the test-infra repo. User supplied configurations are updated on top of
the default configuration, so user only need to supply the part that they wish
to alter, but the user defined the configuration has to follow the same
structure with default_config.json
.
If the user did not supply any configuration, the default configuration will be used for an xDS server.
The user defined configuration can be supplied at the time starting the xDS
server, using flag -u config/name-of-user-supplied-config.json
.