echo

package
v0.0.0-...-1a56975 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallOptions

type CallOptions struct {
	// Target instance of the call. Required.
	Target Instance

	// Port on the target Instance. Either Port or PortName must be specified.
	Port *Port

	// PortName of the port on the target Instance. Either Port or PortName must be specified.
	PortName string

	// Protocol to be used when making the call. If not provided, the protocol of the port
	// will be used.
	Protocol CallProtocol

	// Host specifies the host to be used on the request. If not provided, an appropriate
	// default is chosen for the target Instance.
	Host string

	// Path specifies the URL path for the request.
	Path string

	// Count indicates the number of exchanges that should be made with the service endpoint.
	// If Count <= 0, defaults to 1.
	Count int

	// Headers indicates headers that should be sent in the request. Ignored for WebSocket calls.
	Headers http.Header
}

CallOptions defines options for calling a Endpoint.

type CallProtocol

type CallProtocol string

CallProtocol enumerates the protocol options for calling an Endpoint endpoint.

const (
	HTTP       CallProtocol = "http"
	HTTPS      CallProtocol = "https"
	GRPC       CallProtocol = "grpc"
	GRPCS      CallProtocol = "grpcs"
	WebSocket  CallProtocol = "ws"
	WebSocketS CallProtocol = "wss"
)

type Config

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

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

	// Galley component (may be required, depending on the environment/configuration).
	Galley galley.Instance

	// Pilot component reference (may be required, depending on the environment/configuration).
	Pilot pilot.Instance

	// 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

	// Sidecar indicates that no Envoy sidecar should be created for the instance.
	Sidecar bool

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

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

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

func (Config) FQDN

func (c Config) FQDN() string

FQDN returns the fully qualified domain name for the service.

func (Config) String

func (c Config) String() string

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

type Instance

type Instance interface {
	resource.Resource

	// Config returns the configuration of the Echo instance.
	Config() Config

	// WaitUntilReady waits until this instance is up and ready to receive traffic. If
	// outbound are specified, the wait also includes readiness for each
	// outbound instance as well as waiting for receipt of outbound Envoy configuration
	// (i.e. clusters, routes, listeners from Pilot) in order to enable outbound
	// communication from this instance to each instance in the list.
	WaitUntilReady(outbound ...Instance) error
	WaitUntilReadyOrFail(t testing.TB, outbound ...Instance)

	// Workloads retrieves the list of all deployed workloads for this Echo service.
	// Guarantees at least one workload, if error == nil.
	Workloads() ([]Workload, error)
	WorkloadsOrFail(t testing.TB) []Workload

	// Call makes a call from this Instance to a target Instance.
	Call(options CallOptions) (echo.ParsedResponses, error)
	CallOrFail(t testing.TB, options CallOptions) echo.ParsedResponses
}

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

type Port

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

	// Protocol to be used for the port.
	Protocol model.Protocol

	// ServicePort number where the service can be reached. Does not necessarily
	// map to the corresponding port numbers for the instances behind the
	// service.
	ServicePort int

	// InstancePort number where this instance is listening for connections.
	// This need not be the same as the ServicePort where the service is accessed.
	InstancePort int
}

Port exposed by an Echo Instance

type Sidecar

type Sidecar interface {
	// Info about the Envoy instance.
	Info() (*envoyAdmin.ServerInfo, error)

	// Config of the Envoy instance.
	Config() (*envoyAdmin.ConfigDump, error)

	// 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(*envoyAdmin.ConfigDump) (bool, error), options ...retry.Option) error
}

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

type Workload

type Workload interface {
	// Address returns the network address of the endpoint.
	Address() string

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

Workload provides an interface for a single deployed echo server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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