workloadinstances

package
v0.0.0-...-3a6e21b Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByServiceSelector

func ByServiceSelector(namespace string, selector labels.Instance) func(*model.WorkloadInstance) bool

ByServiceSelector returns a predicate that matches workload instances of a given service.

func FindAllInIndex

func FindAllInIndex(index Index, predicate func(*model.WorkloadInstance) bool) []*model.WorkloadInstance

FindAllInIndex returns a list of workload instances in the index that match given predicate.

The returned list is not ordered.

func FindInstance

func FindInstance(instances []*model.WorkloadInstance, predicate func(*model.WorkloadInstance) bool) *model.WorkloadInstance

FindInstance returns the first workload instance matching given predicate.

func GetInstanceForProxy

func GetInstanceForProxy(index Index, proxy *model.Proxy, proxyIP string) *model.WorkloadInstance

GetInstanceForProxy returns a workload instance that corresponds to a given proxy, if any.

func InstanceNameForProxy

func InstanceNameForProxy(proxy *model.Proxy) types.NamespacedName

InstanceNameForProxy returns a name of the workload instance that corresponds to a given proxy, if any.

Types

type Index

type Index interface {
	// Insert adds/updates given workload instance to the index.
	//
	// Returns previous value in the index, or nil otherwise.
	Insert(*model.WorkloadInstance) *model.WorkloadInstance
	// Delete removes given workload instance from the index.
	//
	// Returns value removed from the index, or nil otherwise.
	Delete(*model.WorkloadInstance) *model.WorkloadInstance
	// GetByIP returns a list of all workload instances associated with a
	// given IP address. The list is ordered by namespace/name.
	//
	// There are several use cases where multiple workload instances might
	// have the same IP address:
	// 1) there are multiple Istio Proxies running on a single host, e.g.
	//    in 'router' mode or even in 'sidecar' mode.
	// 2) workload instances have the same IP but different networks
	GetByIP(string) []*model.WorkloadInstance
	// Empty returns whether the index is empty.
	Empty() bool
	// ForEach iterates over all workload instances in the index.
	ForEach(func(*model.WorkloadInstance))
}

Index reprensents an index over workload instances from workload entries.

Indexes are thread-safe.

func NewIndex

func NewIndex() Index

NewIndex returns a new Index instance.

type MultiValueMap

type MultiValueMap map[string]sets.String

MultiValueMap represents a map where each key might be associated with multiple values.

func (MultiValueMap) Delete

func (m MultiValueMap) Delete(key, value string) MultiValueMap

Delete removes given (key, value) pair out of the map.

func (MultiValueMap) Insert

func (m MultiValueMap) Insert(key, value string) MultiValueMap

Insert adds given (key, value) pair into the map.

Jump to

Keyboard shortcuts

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