xdsfake

package
v0.0.0-...-4477587 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	// Type of the event
	Type string

	// The id of the event
	ID string

	Reason model.ReasonStats

	Namespace string

	// The endpoints associated with an EDS push if any
	Endpoints []*model.IstioEndpoint

	// EndpointCount, used in matches only
	EndpointCount int
}

Event is used to watch XdsEvents

type Updater

type Updater struct {
	// Events tracks notifications received by the updater
	Events   chan Event
	Delegate model.XDSUpdater
	// If SplitEvents is true, updates changing multiple objects will be split into multiple events with 1 item each
	// otherwise they are joined as a CSV
	SplitEvents bool
}

Updater is used to test the registry.

func NewFakeXDS

func NewFakeXDS() *Updater

NewFakeXDS creates a XdsUpdater reporting events via a channel.

func NewWithDelegate

func NewWithDelegate(delegate model.XDSUpdater) *Updater

NewWithDelegate creates a XdsUpdater reporting events via a channel.

func (*Updater) AssertEmpty

func (fx *Updater) AssertEmpty(t test.Failer, dur time.Duration)

AssertEmpty ensures there are no events in the channel

func (*Updater) Clear

func (fx *Updater) Clear()

Clear any pending event

func (*Updater) ConfigUpdate

func (fx *Updater) ConfigUpdate(req *model.PushRequest)

func (*Updater) EDSCacheUpdate

func (fx *Updater) EDSCacheUpdate(c model.ShardKey, hostname, ns string, entry []*model.IstioEndpoint)

func (*Updater) EDSUpdate

func (fx *Updater) EDSUpdate(c model.ShardKey, hostname string, ns string, entry []*model.IstioEndpoint)

func (*Updater) MatchOrFail

func (fx *Updater) MatchOrFail(t test.Failer, events ...Event)

MatchOrFail expects the provided events to arrive, skipping unmatched events

func (*Updater) ProxyUpdate

func (fx *Updater) ProxyUpdate(c cluster.ID, ip string)

func (*Updater) RemoveShard

func (fx *Updater) RemoveShard(shardKey model.ShardKey)

func (*Updater) StrictMatchOrFail

func (fx *Updater) StrictMatchOrFail(t test.Failer, events ...Event)

StrictMatchOrFail expects the provided events to arrive, and nothing else

func (*Updater) SvcUpdate

func (fx *Updater) SvcUpdate(c model.ShardKey, hostname string, ns string, ev model.Event)

SvcUpdate is called when a service port mapping definition is updated. This interface is WIP - labels, annotations and other changes to service may be updated to force a EDS and CDS recomputation and incremental push, as it doesn't affect LDS/RDS.

func (*Updater) WaitOrFail

func (fx *Updater) WaitOrFail(t test.Failer, et string) *Event

Jump to

Keyboard shortcuts

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