Version: v0.7.1 Latest Latest

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

Go to latest
Published: Apr 19, 2019 License: Apache-2.0 Imports: 15 Imported by: 0



Package resource creates test xDS resources



View Source
const (

	// XdsCluster is the cluster name for the control server (used by non-ADS set-up)
	XdsCluster = "xds_cluster"

	// Ads mode for resources: one aggregated xDS service
	Ads = "ads"

	// Xds mode for resources: individual xDS services
	Xds = "xds"

	// Rest mode for resources: polling using Fetch
	Rest = "rest"


View Source
var (
	// RefreshDelay for the polling config source
	RefreshDelay = 500 * time.Millisecond


func MakeCluster

func MakeCluster(mode string, clusterName string) *v2.Cluster

MakeCluster creates a cluster using either ADS or EDS.

func MakeEndpoint

func MakeEndpoint(clusterName string, port uint32) *v2.ClusterLoadAssignment

MakeEndpoint creates a localhost endpoint on a given port.

func MakeHTTPListener

func MakeHTTPListener(mode string, listenerName string, port uint32, route string) *v2.Listener

MakeHTTPListener creates a listener using either ADS or RDS for the route.

func MakeRoute

func MakeRoute(routeName, clusterName string) *v2.RouteConfiguration

MakeRoute creates an HTTP route that routes to a given cluster.

func MakeSecrets

func MakeSecrets(tlsName, rootName string) []cache.Resource

MakeSecrets generates an SDS secret

func MakeTCPListener

func MakeTCPListener(listenerName string, port uint32, clusterName string) *v2.Listener

MakeTCPListener creates a TCP listener for a cluster.


type TestSnapshot

type TestSnapshot struct {
	// Xds indicates snapshot mode: ads, xds, or rest
	Xds string
	// Version for the snapshot.
	Version string
	// UpstreamPort for the single endpoint on the localhost.
	UpstreamPort uint32
	// BasePort is the initial port for the listeners.
	BasePort uint32
	// NumClusters is the total number of clusters to generate.
	NumClusters int
	// NumHTTPListeners is the total number of HTTP listeners to generate.
	NumHTTPListeners int
	// NumTCPListeners is the total number of TCP listeners to generate.
	// Listeners are assigned clusters in a round-robin fashion.
	NumTCPListeners int
	// TLS enables SDS-enabled TLS mode on all listeners
	TLS bool

TestSnapshot holds parameters for a synthetic snapshot.

func (TestSnapshot) Generate

func (ts TestSnapshot) Generate() cache.Snapshot

Generate produces a snapshot from the parameters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to