match

package
v0.0.0-...-d547b85 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoStatefulSet = Not(StatefulSet)

NotStatefulSet is equivalent to Not(StatefulSet)

View Source
var NotExternal = Not(External)

NotExternal is equivalent to Not(External)

View Source
var NotHeadless = Not(Headless)

NotHeadless is equivalent to Not(Headless)

View Source
var NotMultiVersion = Not(MultiVersion)
View Source
var NotNaked = Not(Naked)

NotNaked is equivalent to Not(Naked)

View Source
var NotProxylessGRPC = Not(ProxylessGRPC)

NotProxylessGRPC is equivalent to Not(ProxylessGRPC)

View Source
var NotRegularPod = Not(RegularPod)
View Source
var NotTProxy = Not(TProxy)
View Source
var NotVM = Not(VM)

NotVM is matches against instances that are NOT VMs.

Functions

This section is empty.

Types

type Matcher

type Matcher func(echo.Instance) bool

Matcher is used to filter matching instances

var AllNaked Matcher = func(i echo.Instance) bool {
	return i.Config().IsAllNaked()
}

AllNaked matches instances where every subset has SidecarInject set to false.

var Any Matcher = func(_ echo.Instance) bool {
	return true
}

Any doesn't filter out any echos.

var External Matcher = func(i echo.Instance) bool {
	return i.Config().IsExternal()
}

External matches instances that have a custom DefaultHostHeader defined

var Headless Matcher = func(i echo.Instance) bool {
	return i.Config().Headless
}

Headless matches instances that are backed by headless services.

var MultiVersion Matcher = func(i echo.Instance) bool {
	if len(i.Config().Subsets) != 2 {
		return false
	}
	var matchIstio, matchLegacy bool
	for _, s := range i.Config().Subsets {
		if s.Version == "vistio" {
			matchIstio = true
		} else if s.Version == "vlegacy" && s.Annotations[annotation.SidecarInject.Name] == "false" {
			matchLegacy = true
		}
	}
	return matchIstio && matchLegacy
}

MultiVersion matches echos that have Multi-version specific setup.

var Naked Matcher = func(i echo.Instance) bool {
	return i.Config().IsNaked()
}

Naked matches instances with any subset marked with SidecarInject equal to false.

var ProxylessGRPC Matcher = func(i echo.Instance) bool {
	return i.Config().IsProxylessGRPC()
}

ProxylessGRPC matches instances that are Pods with a SidecarInjectTemplate annotation equal to grpc.

var RegularPod Matcher = func(instance echo.Instance) bool {
	return instance.Config().IsRegularPod()
}

RegularPod matches echos that don't meet any of the following criteria: - VM - Naked - Headless - TProxy - Multi-Subset

var ServiceAddressedWaypoint Matcher = func(i echo.Instance) bool {
	return i.Config().HasServiceAddressedWaypointProxy()
}
var StatefulSet Matcher = func(i echo.Instance) bool {
	return i.Config().StatefulSet
}

StatefulSet matches instances that are a stateful set

var TProxy Matcher = func(i echo.Instance) bool {
	return i.Config().IsTProxy()
}
var VM Matcher = func(i echo.Instance) bool {
	return i.Config().IsVM()
}

VM matches instances with DeployAsVM

var WorkloadAddressedWaypoint Matcher = func(i echo.Instance) bool {
	return i.Config().HasWorkloadAddressedWaypointProxy()
}

func AmbientCaptured

func AmbientCaptured() Matcher

func And

func And(ms ...Matcher) Matcher

And is an aggregate Matcher that requires all matches return true.

func AnyServiceName

func AnyServiceName(expected echo.NamespacedNames) Matcher

AnyServiceName matches instances if they have the same Service and Namespace as any of the provided instances.

func Cluster

func Cluster(c cluster.Cluster) Matcher

Cluster matches instances deployed on the given cluster.

func Namespace

func Namespace(n namespace.Instance) Matcher

Namespace matches instances within the given namespace name.

func NamespaceName

func NamespaceName(ns string) Matcher

NamespaceName matches instances within the given namespace name.

func Network

func Network(n string) Matcher

Network matches instances deployed in the given network.

func Not

func Not(m Matcher) Matcher

Not negates the given matcher. Example:

Not(Naked())

func Or

func Or(ms ...Matcher) Matcher

Or is an aggregate Matcher that requires at least one matches return true.

func ServiceName

func ServiceName(n echo.NamespacedName) Matcher

ServiceName matches instances with the given namespace and service name.

func WaypointService

func WaypointService() Matcher

add a "waypointed service" matcher

func (Matcher) All

func (m Matcher) All(i echo.Instances) bool

func (Matcher) Any

func (m Matcher) Any(i echo.Instances) bool

Any indicates whether any echo.Instance matches this matcher.

func (Matcher) First

func (m Matcher) First(i echo.Instances) (echo.Instance, error)

First finds the first Instance that matches the Matcher.

func (Matcher) FirstOrFail

func (m Matcher) FirstOrFail(t test.Failer, i echo.Instances) echo.Instance

FirstOrFail calls First and then fails the test if an error occurs.

func (Matcher) GetMatches

func (m Matcher) GetMatches(i echo.Instances) echo.Instances

GetMatches returns the subset of echo.Instances that match this Matcher.

func (Matcher) GetServiceMatches

func (m Matcher) GetServiceMatches(services echo.Services) echo.Services

GetServiceMatches returns the subset of echo.Services that match this Matcher.

Jump to

Keyboard shortcuts

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