istio: istio.io/istio/pkg/test/framework/components/echo Index | Files | Directories

package echo

import "istio.io/istio/pkg/test/framework/components/echo"

Index

Package Files

annotations.go call.go config.go echo.go

Variables

var (
    SidecarInject                         = workloadAnnotation(annotation.SidecarInject.Name, "true")
    SidecarStatus                         = workloadAnnotation(annotation.SidecarStatus.Name, "")
    SidecarRewriteAppHTTPProbers          = workloadAnnotation(annotation.SidecarRewriteAppHTTPProbers.Name, "")
    SidecarProxyImage                     = workloadAnnotation(annotation.SidecarProxyImage.Name, "")
    SidecarInterceptionMode               = workloadAnnotation(annotation.SidecarInterceptionMode.Name, "")
    SidecarStatusPort                     = workloadAnnotation(annotation.SidecarStatusPort.Name, "")
    SidecarReadinessInitialDelaySeconds   = workloadAnnotation(annotation.SidecarStatusReadinessInitialDelaySeconds.Name, "")
    SidecarReadinessPeriodSeconds         = workloadAnnotation(annotation.SidecarStatusReadinessPeriodSeconds.Name, "")
    SidecarReadinessFailoverThreshold     = workloadAnnotation(annotation.SidecarStatusReadinessFailureThreshold.Name, "")
    SidecarApplicationPorts               = workloadAnnotation(annotation.SidecarStatusReadinessApplicationPorts.Name, "")
    SidecarTrafficIncludeOutboundIPRanges = workloadAnnotation(annotation.SidecarTrafficIncludeOutboundIPRanges.Name, "")
    SidecarTrafficExcludeOutboundIPRanges = workloadAnnotation(annotation.SidecarTrafficExcludeOutboundIPRanges.Name, "")
    SidecarTrafficIncludeInboundPorts     = workloadAnnotation(annotation.SidecarTrafficIncludeInboundPorts.Name, "")
    SidecarTrafficExcludeInboundPorts     = workloadAnnotation(annotation.SidecarTrafficExcludeInboundPorts.Name, "")
    SidecarTrafficKubeVirtInterfaces      = workloadAnnotation(annotation.SidecarTrafficKubevirtInterfaces.Name, "")

    KubeServiceAccountsOnVMA = serviceAnnotation(annotation.AlphaKubernetesServiceAccounts.Name, "")
    CanonicalServiceAccounts = serviceAnnotation(annotation.AlphaCanonicalServiceAccounts.Name, "")
    ServiceExport            = serviceAnnotation(annotation.NetworkingExportTo.Name, "")
    WorkloadIdentity         = workloadAnnotation(annotation.AlphaIdentity.Name, "")
)

type Annotation Uses

type Annotation struct {
    Name    string
    Type    AnnotationType
    Default AnnotationValue
}

type AnnotationType Uses

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

type AnnotationValue Uses

type AnnotationValue struct {
    Value string
}

func NewAnnotationValue Uses

func NewAnnotationValue() *AnnotationValue

func (*AnnotationValue) AsBool Uses

func (v *AnnotationValue) AsBool() bool

func (*AnnotationValue) AsInt Uses

func (v *AnnotationValue) AsInt() int

func (*AnnotationValue) Get Uses

func (v *AnnotationValue) Get() string

func (*AnnotationValue) Set Uses

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

func (*AnnotationValue) SetBool Uses

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

func (*AnnotationValue) SetInt Uses

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

type Annotations Uses

type Annotations map[Annotation]*AnnotationValue

func NewAnnotations Uses

func NewAnnotations() Annotations

func (Annotations) Get Uses

func (a Annotations) Get(k Annotation) string

func (Annotations) GetBool Uses

func (a Annotations) GetBool(k Annotation) bool

func (Annotations) GetInt Uses

func (a Annotations) GetInt(k Annotation) int

func (Annotations) Set Uses

func (a Annotations) Set(k Annotation, v string) Annotations

func (Annotations) SetBool Uses

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

func (Annotations) SetInt Uses

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

type Builder Uses

type Builder interface {
    // With adds a new Echo configuration to the Builder. Once built, the instance
    // pointer will be updated to point at the new Instance.
    With(i *Instance, cfg Config) Builder

    // Build and initialize all Echo Instances. Upon returning, the Instance pointers
    // are assigned and all Instances are ready to communicate with each other.
    Build() error
    BuildOrFail(t test.Failer)
}

Builder for a group of collaborating Echo Instances. Once built, all Instances in the group:

1. Are ready to receive traffic, and
2. Can call every other Instance in the group (i.e. have received Envoy config
   from Pilot).

If a test needs to verify that one Instance is NOT reachable from another, there are a couple of options:

1. Build a group while all Instances ARE reachable. Then apply a policy
   disallowing the communication.
2. Build the source and destination Instances in separate groups and then
   call `source.WaitUntilCallable(destination)`.

type CallOptions Uses

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

    // Scheme to be used when making the call. If not provided, an appropriate default for the
    // port will be used (if feasible).
    Scheme scheme.Instance

    // 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 HTTP(s) 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

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

    // Message to be sent if this is a GRPC request
    Message string
}

CallOptions defines options for calling a Endpoint.

type Config Uses

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

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

    // Annotations provides metadata hints for deployment of the instance.
    Annotations Annotations

    // IncludeInboundPorts provides the ports that inbound listener should capture
    // "*" means capture all.
    IncludeInboundPorts string

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

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

func (Config) FQDN Uses

func (c Config) FQDN() string

FQDN returns the fully qualified domain name for the service.

func (Config) String Uses

func (c Config) String() string

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

type Instance Uses

type Instance interface {
    resource.Resource

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

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

    // WaitUntilCallable waits until each of the provided instances are callable from
    // this Instance. If this instance has a sidecar, this waits until Envoy has
    // received outbound configuration (e.g. clusters, routes, listeners) for every
    // port.
    WaitUntilCallable(instances ...Instance) error
    WaitUntilCallableOrFail(t test.Failer, instances ...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 test.Failer) []Workload

    // Call makes a call from this Instance to a target Instance.
    Call(options CallOptions) (client.ParsedResponses, error)
    CallOrFail(t test.Failer, options CallOptions) client.ParsedResponses
}

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

type Port Uses

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.
    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 Uses

type Sidecar interface {
    // NodeID returns the node ID used for uniquely identifying this sidecar to Pilot.
    NodeID() string

    // Info about the Envoy instance.
    Info() (*envoyAdmin.ServerInfo, error)
    InfoOrFail(t test.Failer) *envoyAdmin.ServerInfo

    // Config of the Envoy instance.
    Config() (*envoyAdmin.ConfigDump, error)
    ConfigOrFail(t test.Failer) *envoyAdmin.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(*envoyAdmin.ConfigDump) (bool, error), options ...retry.Option) error
    WaitForConfigOrFail(t test.Failer, accept func(*envoyAdmin.ConfigDump) (bool, error), options ...retry.Option)

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

    // Listeners for the Envoy instance
    Listeners() (*envoyAdmin.Listeners, error)
    ListenersOrFail(t test.Failer) *envoyAdmin.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 Workload Uses

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

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

    // ForwardEcho executes specific call from this workload.
    ForwardEcho(context.Context, *proto.ForwardEchoRequest) (client.ParsedResponses, error)

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

Workload provides an interface for a single deployed echo server.

Directories

PathSynopsis
common
docker
docker/images
echoboot
kube

Package echo imports 18 packages (graph) and is imported by 4 packages. Updated 2019-10-17. Refresh now. Tools for package owners.