echo

package
v0.0.0-...-34fc9f0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const NoServicePort = -1

NoServicePort defines the ServicePort value for a Port that is a workload-only port.

Variables

View Source
var (
	SidecarInject                  = workloadAnnotation(annotation.SidecarInject.Name, "true")
	SidecarRewriteAppHTTPProbers   = workloadAnnotation(annotation.SidecarRewriteAppHTTPProbers.Name, "")
	SidecarBootstrapOverride       = workloadAnnotation(annotation.SidecarBootstrapOverride.Name, "")
	SidecarVolumeMount             = workloadAnnotation(annotation.SidecarUserVolumeMount.Name, "")
	SidecarVolume                  = workloadAnnotation(annotation.SidecarUserVolume.Name, "")
	SidecarConfig                  = workloadAnnotation(annotation.ProxyConfig.Name, "")
	SidecarInterceptionMode        = workloadAnnotation(annotation.SidecarInterceptionMode.Name, "REDIRECT")
	SidecarIncludeInboundPorts     = workloadAnnotation(annotation.SidecarTrafficIncludeInboundPorts.Name, "")
	SidecarIncludeOutboundIPRanges = workloadAnnotation(annotation.SidecarTrafficIncludeOutboundIPRanges.Name, "")
	SidecarProxyConfig             = workloadAnnotation(annotation.ProxyConfig.Name, "")
	SidecarInjectTemplates         = workloadAnnotation(annotation.InjectTemplates.Name, "")
	SidecarStatsHistogramBuckets   = workloadAnnotation(annotation.SidecarStatsHistogramBuckets.Name, "")
	AmbientType                    = workloadAnnotation(constants.AmbientRedirection, "")
)

Functions

func DefaultCallRetryOptions

func DefaultCallRetryOptions() []retry.Option

DefaultCallRetryOptions returns the default call retry options as specified in command-line flags.

func DefaultCallsPerWorkload

func DefaultCallsPerWorkload() int

DefaultCallsPerWorkload returns the number of calls that should be made per target workload by default.

func DefaultReadinessTimeout

func DefaultReadinessTimeout() time.Duration

DefaultReadinessTimeout returns the default echo readiness check timeout.

func RegisterFactory

func RegisterFactory(kind cluster.Kind, factory FactoryFunc)

RegisterFactory globally registers a base factory of a given Kind. The given factory should be immutable, as it will be used globally.

Types

type Annotation

type Annotation struct {
	Name    string
	Type    AnnotationType
	Default AnnotationValue
}

type AnnotationType

type AnnotationType string
const (
	WorkloadAnnotation AnnotationType = "workload"
)

type AnnotationValue

type AnnotationValue struct {
	Value string
}

func NewAnnotationValue

func NewAnnotationValue() *AnnotationValue

func (*AnnotationValue) AsBool

func (v *AnnotationValue) AsBool() bool

func (*AnnotationValue) AsInt

func (v *AnnotationValue) AsInt() int

func (*AnnotationValue) Get

func (v *AnnotationValue) Get() string

func (*AnnotationValue) Set

func (v *AnnotationValue) Set(arg string) *AnnotationValue

func (*AnnotationValue) SetBool

func (v *AnnotationValue) SetBool(arg bool) *AnnotationValue

func (*AnnotationValue) SetInt

func (v *AnnotationValue) SetInt(arg int) *AnnotationValue

type Annotations

type Annotations map[Annotation]*AnnotationValue

func NewAnnotations

func NewAnnotations() Annotations

func (Annotations) Get

func (a Annotations) Get(k Annotation) string

func (Annotations) GetBool

func (a Annotations) GetBool(k Annotation) bool

func (Annotations) GetByName

func (a Annotations) GetByName(k string) string

func (Annotations) GetInt

func (a Annotations) GetInt(k Annotation) int

func (Annotations) Set

func (Annotations) SetBool

func (a Annotations) SetBool(k Annotation, v bool) Annotations

func (Annotations) SetInt

func (a Annotations) SetInt(k Annotation, v int) Annotations

type CallOptions

type CallOptions struct {
	// To is the Target to be called.
	To Target

	// ToWorkload will call a specific workload in this instance, rather than the Service.
	// If there are multiple workloads in the Instance, the first is used.
	// Can be used with `ToWorkload: to.WithWorkloads(someWl)` to send to a specific workload.
	// When using the Port field, the ServicePort should be used.
	ToWorkload Instance

	// Port to be used for the call. Ignored if Scheme == DNS. If the Port.ServicePort is set,
	// either Port.Protocol or Scheme must also be set. If Port.ServicePort is not set,
	// the port is looked up in To by either Port.Name or Port.Protocol.
	Port Port

	// Scheme to be used when making the call. If not provided, the Scheme will be selected
	// based on the Port.Protocol.
	Scheme scheme.Instance

	// Address specifies the host name or IP address to be used on the request. If not provided,
	// an appropriate default is chosen for To.
	Address string

	// Count indicates the number of exchanges that should be made with the service endpoint.
	// If Count <= 0, a default will be selected. If To is specified, the value will be set to
	// the numWorkloads * DefaultCallsPerWorkload. Otherwise, defaults to 1.
	Count int

	// Timeout used for each individual request. Must be > 0, otherwise 5 seconds is used.
	Timeout time.Duration

	// NewConnectionPerRequest if true, the forwarder will establish a new connection to the server for
	// each individual request. If false, it will attempt to reuse the same connection for the duration
	// of the forward call. This is ignored for DNS, TCP, and TLS protocols, as well as
	// Headless/StatefulSet deployments.
	NewConnectionPerRequest bool

	// ForceDNSLookup if true, the forwarder will force a DNS lookup for each individual request. This is
	// useful for any situation where DNS is used for load balancing (e.g. headless). This is ignored if
	// NewConnectionPerRequest is false or if the deployment is Headless or StatefulSet.
	ForceDNSLookup bool

	// Retry options for the call.
	Retry Retry

	// HTTP settings.
	HTTP HTTP

	// TCP settings.
	TCP TCP

	// TLS settings.
	TLS TLS

	// HBONE settings.
	HBONE HBONE

	// Message to be sent.
	Message string

	// Check the server responses. If none is provided, only the number of responses received
	// will be checked.
	Check Checker

	// If we have been asked to do TCP comms with a PROXY protocol header,
	// determine which version (1 or 2), and send the header.
	// https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
	ProxyProtocolVersion int

	PropagateResponse func(req *http.Request, resp *http.Response)
}

CallOptions defines options for calling a Endpoint.

func (CallOptions) DeepCopy

func (o CallOptions) DeepCopy() CallOptions

func (*CallOptions) FillDefaults

func (o *CallOptions) FillDefaults() error

FillDefaults fills out any defaults that haven't been explicitly specified.

func (*CallOptions) FillDefaultsOrFail

func (o *CallOptions) FillDefaultsOrFail(t test.Failer)

FillDefaultsOrFail calls FillDefaults and fails if an error occurs.

func (CallOptions) GetHost

func (o CallOptions) GetHost() string

GetHost returns the best default host for the call. Returns the first host defined from the following sources (in order of precedence): Host header, target's DefaultHostHeader, Address, target's FQDN.

type CallResult

type CallResult struct {
	From      Caller
	Opts      CallOptions
	Responses echo.Responses
}

CallResult the result of a call operation.

type Caller

type Caller interface {
	// Call from this Instance to a target Instance.
	Call(options CallOptions) (CallResult, error)
	CallOrFail(t test.Failer, options CallOptions) CallResult
}

type Callers

type Callers []Caller

func (Callers) Instances

func (c Callers) Instances() Instances

Instances returns an Instances if all callers are Instance, otherwise returns nil.

type Checker

type Checker func(CallResult, error) error

Checker inspects echo call results for errors.

func NoChecker

func NoChecker() Checker

NoChecker provides a Checker that returns the original raw call error, unaltered.

func (Checker) Check

func (c Checker) Check(result CallResult, err error) error

type Cluster

type Cluster interface {
	cluster.Cluster

	CanDeploy(Config) (Config, bool)
}

Cluster that can deploy echo instances. TODO putting this here for now to deal with circular imports, needs to be moved

type Config

type Config struct {
	// Namespace of the echo Instance. If not provided, a default namespace "apps" is used.
	Namespace namespace.Instance

	// DefaultHostHeader overrides the default Host header for calls (`service.namespace.svc.cluster.local`)
	DefaultHostHeader string

	// Domain of the echo Instance. If not provided, a default will be selected.
	Domain string

	// Service indicates the service name of the Echo application.
	Service string

	// Version indicates the version path for calls to the Echo application.
	Version string

	// Locality (k8s only) indicates the locality of the deployed app.
	Locality string

	// Headless (k8s only) indicates that no ClusterIP should be specified.
	Headless bool

	// StatefulSet indicates that the pod should be backed by a StatefulSet. This implies Headless=true
	// as well.
	StatefulSet bool

	// StaticAddress for some echo implementations is an address locally reachable within
	// the test framework and from the echo Cluster's network.
	StaticAddresses []string

	// ServiceAccount (k8s only) indicates that a service account should be created
	// for the deployment.
	ServiceAccount bool

	// DisableAutomountSAToken indicates to opt out of auto mounting ServiceAccount's API credentials
	DisableAutomountSAToken bool

	// Ports for this application. Port numbers may or may not be used, depending
	// on the implementation.
	Ports Ports

	// ServiceAnnotations is annotations on service object.
	ServiceAnnotations Annotations

	// ReadinessTimeout specifies the timeout that we wait the application to
	// become ready.
	ReadinessTimeout time.Duration

	// ReadinessTCPPort if set, use this port for the TCP readiness probe (instead of using a HTTP probe).
	ReadinessTCPPort string

	// ReadinessGRPCPort if set, use this port for the GRPC readiness probe (instead of using a HTTP probe).
	ReadinessGRPCPort string

	// Subsets contains the list of Subsets config belonging to this echo
	// service instance.
	Subsets []SubsetConfig

	// Cluster to be used in a multicluster environment
	Cluster cluster.Cluster

	// TLS settings for echo server
	TLSSettings *common.TLSSettings

	// If enabled, echo will be deployed as a "VM". This means it will run Envoy in the same pod as echo,
	// disable sidecar injection, etc.
	// This aims to simulate a VM, but instead of managing the complex test setup of spinning up a VM,
	// connecting, etc we run it inside a pod. The pod has pretty much all Kubernetes features disabled (DNS and SA token mount)
	// such that we can adequately simulate a VM and DIY the bootstrapping.
	DeployAsVM bool

	// If enabled, ISTIO_META_AUTO_REGISTER_GROUP will be set on the VM and the WorkloadEntry will be created automatically.
	AutoRegisterVM bool

	// The distro to use for a VM. For fake VMs, this maps to docker images.
	VMDistro VMDistro

	// The set of environment variables to set for `DeployAsVM` instances.
	VMEnvironment map[string]string

	// If enabled, an additional ext-authz container will be included in the deployment. This is mainly used to test
	// the CUSTOM authorization policy when the ext-authz server is deployed locally with the application container in
	// the same pod.
	IncludeExtAuthz bool

	// IPFamily for the service. This is optional field. Mainly is used for dual stack testing
	IPFamilies string

	// IPFamilyPolicy. This is optional field. Mainly is used for dual stack testing.
	IPFamilyPolicy string

	DualStack bool

	// WaypointProxy specifies if this workload should have an associated Waypoint
	WaypointProxy bool
}

Config defines the options for creating an Echo component. nolint: maligned

func ParseConfigs

func ParseConfigs(bytes []byte) ([]Config, error)

ParseConfigs unmarshals the given YAML bytes into []Config, using a namespace.Static rather than attempting to Claim the configured namespace.

func (Config) AccountName

func (c Config) AccountName() string

func (Config) ClusterLocalFQDN

func (c Config) ClusterLocalFQDN() string

ClusterLocalFQDN returns the fully qualified domain name for cluster-local host.

func (Config) ClusterSetLocalFQDN

func (c Config) ClusterSetLocalFQDN() string

ClusterSetLocalFQDN returns the fully qualified domain name for the Kubernetes Multi-Cluster Services (MCS) Cluster Set host.

func (Config) DeepCopy

func (c Config) DeepCopy() Config

DeepCopy creates a clone of IstioEndpoint.

func (*Config) FillDefaults

func (c *Config) FillDefaults(ctx resource.Context) (err error)

func (Config) HasProxyCapabilities

func (c Config) HasProxyCapabilities() bool

func (Config) HasSidecar

func (c Config) HasSidecar() bool

func (Config) HasWaypointProxy

func (c Config) HasWaypointProxy() bool

func (Config) HostHeader

func (c Config) HostHeader() string

HostHeader returns the Host header that will be used for calls to this service.

func (Config) IsAllNaked

func (c Config) IsAllNaked() bool

IsAllNaked checks if every subset is configured with no sidecar.

func (Config) IsDelta

func (c Config) IsDelta() bool

func (Config) IsExternal

func (c Config) IsExternal() bool

func (Config) IsHeadless

func (c Config) IsHeadless() bool

func (Config) IsNaked

func (c Config) IsNaked() bool

IsNaked checks if the config has no sidecar. Note: instances that mix subsets with and without sidecars are considered 'naked'.

func (Config) IsProxylessGRPC

func (c Config) IsProxylessGRPC() bool

func (Config) IsRegularPod

func (c Config) IsRegularPod() bool

IsRegularPod returns true if the echo pod is not any of the following: - VM - Naked - Headless - TProxy - Multi-Subset - DualStack Service Pods

func (Config) IsStatefulSet

func (c Config) IsStatefulSet() bool

func (Config) IsTProxy

func (c Config) IsTProxy() bool

func (Config) IsUncaptured

func (c Config) IsUncaptured() bool

func (Config) IsVM

func (c Config) IsVM() bool

func (Config) NamespaceName

func (c Config) NamespaceName() string

NamespaceName returns the string name of the namespace.

func (Config) NamespacedName

func (c Config) NamespacedName() NamespacedName

NamespacedName returns the namespaced name for the service.

func (Config) ServiceAccountName

func (c Config) ServiceAccountName() string

ServiceAccountName returns the service account name for this service.

func (Config) String

func (c Config) String() string

String implements the Configuration interface (which implements fmt.Stringer)

func (Config) WorkloadClass

func (c Config) WorkloadClass() WorkloadClass

WorkloadClass returns the type of workload a given config is.

func (Config) ZTunnelCaptured

func (c Config) ZTunnelCaptured() bool

ZTunnelCaptured returns true in ambient enabled namespaces where there is no sidecar

type ConfigGetter

type ConfigGetter func() []Config

Getter for a custom echo deployment

func ConfigFuture

func ConfigFuture(custom *[]Config) ConfigGetter

Future creates a Getter for a variable the custom echo deployment that will be set at sometime in the future. This is helpful for configuring a setup chain for a test suite that operates on global variables.

func (ConfigGetter) Get

func (g ConfigGetter) Get() []Config

Get is a utility method that helps in readability of call sites.

type Configurable

type Configurable interface {
	Config() Config

	// ServiceName is the name of this service within the namespace.
	ServiceName() string

	// NamespaceName returns the name of the namespace or "" if the Namespace is nil.
	NamespaceName() string

	// NamespacedName returns the namespaced name for this service.
	// Short form for Config().NamespacedName().
	NamespacedName() NamespacedName

	// ServiceAccountName returns the service account string for this service.
	ServiceAccountName() string

	// ClusterLocalFQDN returns the fully qualified domain name for cluster-local host.
	ClusterLocalFQDN() string

	// ClusterSetLocalFQDN returns the fully qualified domain name for the Kubernetes
	// Multi-Cluster Services (MCS) Cluster Set host.
	ClusterSetLocalFQDN() string

	// PortForName is a short form for Config().Ports.MustForName().
	PortForName(name string) Port
}

Configurable is and object that has Config.

type FactoryFunc

type FactoryFunc func(ctx resource.Context, config []Config) (Instances, error)

FactoryFunc can be used by a builder to produce instances from configs

func GetBuilder

func GetBuilder(kind cluster.Kind) (FactoryFunc, error)

type HBONE

type HBONE struct {
	Address string
	Headers http.Header
	// If non-empty, make the request with the corresponding cert and key.
	Cert string
	Key  string
	// If non-empty, verify the server CA
	CaCert string
	// If non-empty, make the request with the corresponding cert and key file.
	CertFile string
	KeyFile  string
	// If non-empty, verify the server CA with the ca cert file.
	CaCertFile string
	// Skip verifying peer's certificate.
	InsecureSkipVerify bool
}

type HTTP

type HTTP struct {
	// If true, h2c will be used in HTTP requests
	HTTP2 bool

	// If true, HTTP/3 request over QUIC will be used.
	// It is mandatory to specify TLS settings
	HTTP3 bool

	// Path specifies the URL path for the HTTP(s) request.
	Path string

	// Method to send. Defaults to GET.
	Method string

	// Headers indicates headers that should be sent in the request. Ignored for WebSocket calls.
	// If no Host header is provided, a default will be chosen for the target service endpoint.
	Headers http.Header

	// FollowRedirects will instruct the call to follow 301 redirects. Otherwise, the original 301 response
	// is returned directly.
	FollowRedirects bool

	// HTTProxy used for making ingress echo call via proxy
	HTTPProxy string
}

HTTP settings

type Instance

type Instance interface {
	Caller
	Target
	resource.Resource

	// Address of the service (e.g. Kubernetes cluster IP). May be "" if headless.
	Address() string

	// Addresses of service in dualmode
	Addresses() []string

	// Restart restarts the workloads associated with this echo instance
	Restart() error

	// UpdateWorkloadLabel update pod labels of this echo instance
	UpdateWorkloadLabel(add map[string]string, remove []string) error

	// WithWorkloads returns a target with only the specified subset of workloads
	WithWorkloads(wl ...Workload) Instance
}

Instance is a component that provides access to a deployed echo service.

type Instances

type Instances []Instance

Instances contains the instances created by the builder with methods for filtering

func (Instances) Append

func (i Instances) Append(instances Instances) Instances

Append returns a new Instances array with the given values appended.

func (Instances) Callers

func (i Instances) Callers() Callers

Callers is a convenience method to convert Instances into Callers.

func (Instances) ClusterLocalFQDN

func (i Instances) ClusterLocalFQDN() string

func (Instances) ClusterSetLocalFQDN

func (i Instances) ClusterSetLocalFQDN() string

func (Instances) Clusters

func (i Instances) Clusters() cluster.Clusters

Clusters returns a list of cluster names that the instances are deployed in

func (Instances) Config

func (i Instances) Config() Config

func (Instances) Contains

func (i Instances) Contains(instances ...Instance) bool

func (Instances) ContainsTarget

func (i Instances) ContainsTarget(t Target) bool

func (Instances) Copy

func (i Instances) Copy() Instances

Copy this Instances array.

func (Instances) Instances

func (i Instances) Instances() Instances

func (Instances) IsDeployment

func (i Instances) IsDeployment() bool

IsDeployment returns true if there is only one deployment contained in the Instances

func (Instances) Len

func (i Instances) Len() int

func (Instances) MustWorkloads

func (i Instances) MustWorkloads() Workloads

func (Instances) NamespaceName

func (i Instances) NamespaceName() string

func (Instances) NamespacedName

func (i Instances) NamespacedName() NamespacedName

func (Instances) NamespacedNames

func (i Instances) NamespacedNames() NamespacedNames

func (Instances) PortForName

func (i Instances) PortForName(name string) Port

func (Instances) Restart

func (i Instances) Restart() error

Restart each Instance

func (Instances) ServiceAccountName

func (i Instances) ServiceAccountName() string

func (Instances) ServiceName

func (i Instances) ServiceName() string

func (Instances) Services

func (i Instances) Services() Services

Services groups the Instances by FQDN. Each returned element is an Instances containing only instances of a single service.

func (Instances) Workloads

func (i Instances) Workloads() (Workloads, error)

func (Instances) WorkloadsOrFail

func (i Instances) WorkloadsOrFail(t test.Failer) Workloads

type NamespacedName

type NamespacedName struct {
	// Namespace of the echo Instance. If not provided, a default namespace "apps" is used.
	Namespace namespace.Instance

	// Name of the service within the Namespace.
	Name string
}

NamespacedName represents the full name of a service.

func (NamespacedName) NamespaceName

func (n NamespacedName) NamespaceName() string

NamespaceName returns the string name of the namespace, or "" if Namespace is nil.

func (NamespacedName) PrefixString

func (n NamespacedName) PrefixString() string

PrefixString returns a string in the form of <name>.<prefix>. This is helpful for providing more stable test names.

func (NamespacedName) String

func (n NamespacedName) String() string

String returns the Istio-formatted service name in the form of <namespace>/<name>.

type NamespacedNames

type NamespacedNames []NamespacedName

NamespacedNames is a list of NamespacedName.

func (NamespacedNames) Len

func (n NamespacedNames) Len() int

func (NamespacedNames) Less

func (n NamespacedNames) Less(i, j int) bool

func (NamespacedNames) Names

func (n NamespacedNames) Names() []string

Names returns the list of service names without any namespace appended.

func (NamespacedNames) NamesWithNamespacePrefix

func (n NamespacedNames) NamesWithNamespacePrefix() []string

func (NamespacedNames) Swap

func (n NamespacedNames) Swap(i, j int)

type Port

type Port struct {
	// Name of this port
	Name string

	// Protocol to be used for the port.
	Protocol protocol.Instance

	// ServicePort number where the service can be reached. Does not necessarily
	// map to the corresponding port numbers for the instances behind the
	// service. If zero (default), a service port will be automatically generated for this port.
	// If set to NoServicePort, this port will be assumed to be a workload-only port.
	ServicePort int

	// WorkloadPort number where the workload is listening for connections.
	// This need not be the same as the ServicePort where the service is accessed.
	WorkloadPort int

	// TLS determines whether the connection will be plain text or TLS. By default this is false (plain text).
	TLS bool

	// ServerFirst determines whether the port will use server first communication, meaning the client will not send the first byte.
	ServerFirst bool

	// InstanceIP determines if echo will listen on the instance IP; otherwise, it will listen on wildcard
	InstanceIP bool

	// LocalhostIP determines if echo will listen on the localhost IP; otherwise, it will listen on wildcard
	LocalhostIP bool
}

Port exposed by an Echo Instance

func (Port) IsWorkloadOnly

func (p Port) IsWorkloadOnly() bool

IsWorkloadOnly returns true if there is no service port specified for this Port.

func (Port) Scheme

func (p Port) Scheme() (scheme.Instance, error)

Scheme infers the scheme to be used based on the Protocol.

type Ports

type Ports []Port

func (Ports) Contains

func (ps Ports) Contains(p Port) bool

func (Ports) ForName

func (ps Ports) ForName(name string) (Port, bool)

ForName returns the first port found with the given name.

func (Ports) ForProtocol

func (ps Ports) ForProtocol(protocol protocol.Instance) (Port, bool)

ForProtocol returns the first port found with the given protocol.

func (Ports) ForServicePort

func (ps Ports) ForServicePort(port int) (Port, bool)

ForServicePort returns the first port found with the given service port.

func (Ports) GetServicePorts

func (ps Ports) GetServicePorts() Ports

GetServicePorts returns the subset of ports that contain a service port.

func (Ports) GetWorkloadOnlyPorts

func (ps Ports) GetWorkloadOnlyPorts() Ports

GetWorkloadOnlyPorts returns the subset of ports that do not contain a service port.

func (Ports) MustForName

func (ps Ports) MustForName(name string) Port

MustForName calls ForName and panics if not found.

func (Ports) MustForProtocol

func (ps Ports) MustForProtocol(protocol protocol.Instance) Port

MustForProtocol calls ForProtocol and panics if not found.

type Retry

type Retry struct {
	// NoRetry if true, no retry will be attempted.
	NoRetry bool

	// Options to be used when retrying. If not specified, defaults will be used.
	Options []retry.Option
}

Retry settings

type Services

type Services []Instances

Services is a set of Instances that share the same FQDN. While an Instance contains multiple deployments (a single service in a single cluster), Instances contains multiple deployments that may contain multiple Services.

func (Services) Append

func (d Services) Append(others ...Services) Services

Append returns a new Services array with the given values appended.

func (Services) Callers

func (d Services) Callers() Callers

func (Services) Copy

func (d Services) Copy() Services

Copy this services array.

func (Services) FQDNs

func (d Services) FQDNs() []string

FQDNs gives the fully-qualified-domain-names each deployment in order.

func (Services) GetByService

func (d Services) GetByService(service string) Target

GetByService finds the first Instances with the given Service name. It is possible to have multiple deployments with the same service name but different namespaces (and therefore different FQDNs). Use caution when relying on Service.

func (Services) Instances

func (d Services) Instances() Instances

func (Services) Len

func (d Services) Len() int

Len returns the number of deployments

func (Services) Less

func (d Services) Less(i, j int) bool

Less returns true if the element at i should appear before the element at j in a sorted Services

func (Services) MatchFQDNs

func (d Services) MatchFQDNs(fqdns ...string) Services

func (Services) NamespacedNames

func (d Services) NamespacedNames() NamespacedNames

func (Services) Swap

func (d Services) Swap(i, j int)

Swap switches the positions of elements at i and j (used for sorting).

type Sidecar

type Sidecar interface {
	// Info about the Envoy instance.
	Info() (*admin.ServerInfo, error)
	InfoOrFail(t test.Failer) *admin.ServerInfo

	// Config of the Envoy instance.
	Config() (*admin.ConfigDump, error)
	ConfigOrFail(t test.Failer) *admin.ConfigDump

	// WaitForConfig queries the Envoy configuration an executes the given accept handler. If the
	// response is not accepted, the request will be retried until either a timeout or a response
	// has been accepted.
	WaitForConfig(accept func(*admin.ConfigDump) (bool, error), options ...retry.Option) error
	WaitForConfigOrFail(t test.Failer, accept func(*admin.ConfigDump) (bool, error), options ...retry.Option)

	// Clusters for the Envoy instance
	Clusters() (*admin.Clusters, error)
	ClustersOrFail(t test.Failer) *admin.Clusters

	// Listeners for the Envoy instance
	Listeners() (*admin.Listeners, error)
	ListenersOrFail(t test.Failer) *admin.Listeners

	// Logs returns the logs for the sidecar container
	Logs() (string, error)
	// LogsOrFail returns the logs for the sidecar container, or aborts if an error is found
	LogsOrFail(t test.Failer) string
}

Sidecar provides an interface to execute queries against a single Envoy sidecar.

type SubsetConfig

type SubsetConfig struct {
	// The version of the deployment.
	Version string
	// Annotations provides metadata hints for deployment of the instance.
	Annotations Annotations
	// Labels provides metadata hints for deployment of the instance.
	Labels map[string]string
	// Replicas of this deployment
	Replicas int
}

SubsetConfig is the config for a group of Subsets (e.g. Kubernetes deployment).

type TCP

type TCP struct {
	// ExpectedResponse asserts this is in the response for TCP requests.
	ExpectedResponse *wrappers.StringValue
}

TCP settings

type TLS

type TLS struct {
	// Use the custom certificate to make the call. This is mostly used to make mTLS request directly
	// (without proxy) from naked client to test certificates issued by custom CA instead of the Istio self-signed CA.
	Cert, Key, CaCert string

	// Use the custom certificates file to make the call.
	CertFile, KeyFile, CaCertFile string

	// Skip verify peer's certificate.
	InsecureSkipVerify bool

	Alpn       []string
	ServerName string
}

TLS settings

type Target

type Target interface {
	Configurable
	WorkloadContainer

	// Instances in this target.
	Instances() Instances
}

Target of a call.

type VMDistro

type VMDistro = string
const (
	UbuntuBionic VMDistro = "UbuntuBionic"
	UbuntuJammy  VMDistro = "UbuntuJammy"
	Debian11     VMDistro = "Debian11"
	Rockylinux8  VMDistro = "Centos8"

	DefaultVMDistro = UbuntuJammy
)

type Workload

type Workload interface {
	// PodName gets the original pod name for the workload.
	PodName() string

	// Address returns the network address of the endpoint.
	Address() string

	// Addresses returns the network addresses of the endpoint.
	Addresses() []string

	// Sidecar if one was specified.
	Sidecar() Sidecar

	// Cluster where this Workload resides.
	Cluster() cluster.Cluster

	// ForwardEcho executes specific call from this workload.
	// TODO(nmittler): Instead of this, we should just make Workload implement Caller.
	ForwardEcho(context.Context, *proto.ForwardEchoRequest) (echo.Responses, error)

	// Logs returns the logs for the app container
	Logs() (string, error)
	LogsOrFail(t test.Failer) string
}

Workload provides an interface for a single deployed echo server.

type WorkloadClass

type WorkloadClass = string

WorkloadClass is the class of workload in the echo instance

const (
	Proxyless   WorkloadClass = "proxyless"
	VM          WorkloadClass = "vm"
	Delta       WorkloadClass = "delta"
	TProxy      WorkloadClass = "tproxy"
	Naked       WorkloadClass = "naked"
	External    WorkloadClass = "external"
	StatefulSet WorkloadClass = "statefulset"
	Headless    WorkloadClass = "headless"
	Captured    WorkloadClass = "captured"
	Standard    WorkloadClass = "standard"
)

type WorkloadContainer

type WorkloadContainer interface {
	// Workloads retrieves the list of all deployed workloads for this Echo service.
	// Guarantees at least one workload, if error == nil.
	Workloads() (Workloads, error)
	WorkloadsOrFail(t test.Failer) Workloads
	MustWorkloads() Workloads

	// Clusters where the workloads are deployed.
	Clusters() cluster.Clusters
}

WorkloadContainer is container for a number of Workload objects.

type Workloads

type Workloads []Workload

func (Workloads) Addresses

func (ws Workloads) Addresses() []string

Addresses returns the list of addresses for all workloads.

func (Workloads) Clusters

func (ws Workloads) Clusters() cluster.Clusters

func (Workloads) Len

func (ws Workloads) Len() int

Directories

Path Synopsis
cmd
util

Jump to

Keyboard shortcuts

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