config

package
v1.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

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:

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstructProxiedTestTarget

func ConstructProxiedTestTarget(snap *cache.Snapshot) (string, error)

ConstructProxiedTestTarget finds the target of the Proxyless test based on the configuration json file

func ConstructProxylessTestTarget

func ConstructProxylessTestTarget(snap *cache.Snapshot) (string, error)

ConstructProxylessTestTarget finds the target of the Proxyless test based on the configuration json file

func GenerateSnapshotFromConfigFiles

func GenerateSnapshotFromConfigFiles(defaultConfigPath string, userSuppliedConfigPath string) (cache.Snapshot, error)

GenerateSnapshotFromConfigFiles takes a default configuration file and user supplied configuration to generate a snapshot

func IncludeSocketListenerOnly

func IncludeSocketListenerOnly(snap *cache.Snapshot) error

IncludeSocketListenerOnly takes a pointer of a snapshot, and returns only the socket listeners. This function is used for Proxied test since api_listneners which are used for the non-proxed test can not be validated by Envoy causing the entire resources slices not to be registed.

func UpdateEndpoint

func UpdateEndpoint(snap *cache.Snapshot, endpoints []TestEndpoint) error

UpdateEndpoint takes a list of endpoints to updated the Endpoint resources in the snapshot

Types

type TestEndpoint

type TestEndpoint struct {
	// TestUpstreamHost is upstream host address
	TestUpstreamHost string
	// TestUpstreamHost is upstream host port
	TestUpstreamPort uint32
}

TestEndpoint is the address and the port of the backends.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL