contour

package
v1.30.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package contour contains the translation business logic that listens to Kubernetes ResourceEventHandler events and translates those into additions/deletions in caches connected to the Envoy xDS gRPC API server.

Package contour contains the translation business logic that listens to Kubernetes ResourceEventHandler events and translates those into additions/deletions in caches connected to the Envoy xDS gRPC API server.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cond added in v0.3.0

type Cond struct {
	// contains filtered or unexported fields
}

Cond implements a condition variable, a rendezvous point for goroutines waiting for or announcing the ocurence of an event.

Unlike sync.Cond, Cond communciates with waiters via channels registered by the waiters. This permits goroutines to wait on Cond events using select.

Example
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Second)
defer cancel()
ch := make(chan int, 1)
last := 0
var c Cond
go func() {
	for {
		time.Sleep(100 * time.Millisecond)
		c.Notify()
	}
}()

for {
	c.Register(ch, last)
	select {
	case last = <-ch:
		fmt.Println("notification received:", last)
	case <-ctx.Done():
		fmt.Println("timeout")
		return
	}
}
Output:

func (*Cond) Notify added in v0.3.0

func (c *Cond) Notify(hints ...string)

Notify notifies all interested waiters that an event has ocured.

func (*Cond) Register added in v0.3.0

func (c *Cond) Register(ch chan int, last int, hints ...string)

Register registers ch to receive a value when Notify is called. The value of last is the count of the times Notify has been called on this Cond. It functions of a sequence counter, if the value of last supplied to Register is less than the Conds internal counter, then the caller has missed at least one notification and will fire immediately.

Sends by the broadcaster to ch must not block, therefore ch must have a capacity of at least 1.

type EventHandler added in v1.0.0

type EventHandler struct {
	logrus.FieldLogger
	// contains filtered or unexported fields
}

EventHandler implements cache.ResourceEventHandler, filters k8s events towards a dag.Builder and calls through to the Observer to notify it that a new DAG is available.

func NewEventHandler added in v1.20.0

func NewEventHandler(config EventHandlerConfig, upstreamHasSynced cache.InformerSynced) *EventHandler

func (*EventHandler) HasBuiltInitialDag added in v1.27.0

func (e *EventHandler) HasBuiltInitialDag() bool

func (*EventHandler) NeedLeaderElection added in v1.20.0

func (e *EventHandler) NeedLeaderElection() bool

NeedLeaderElection is included to implement manager.LeaderElectionRunnable

func (*EventHandler) OnAdd added in v1.0.0

func (e *EventHandler) OnAdd(obj any, isInInitialList bool)

func (*EventHandler) OnDelete added in v1.0.0

func (e *EventHandler) OnDelete(obj any)

func (*EventHandler) OnElectedLeader added in v1.20.0

func (e *EventHandler) OnElectedLeader()

Implements leadership.NeedLeaderElectionNotification

func (*EventHandler) OnUpdate added in v1.0.0

func (e *EventHandler) OnUpdate(oldObj, newObj any)

func (*EventHandler) Sequence added in v1.0.0

func (e *EventHandler) Sequence() <-chan int

Sequence returns a channel that receives a incrementing sequence number for each update processed. The updates may be processed immediately, or delayed by a holdoff timer. In each case a non blocking send to the sequence channel will be made once the resource update is received (note that the DAG is not guaranteed to be called each time).

func (*EventHandler) Start added in v1.0.0

func (e *EventHandler) Start(ctx context.Context) error

type EventHandlerConfig added in v1.20.0

type EventHandlerConfig struct {
	Logger                        logrus.FieldLogger
	Builder                       *dag.Builder
	Observer                      dag.Observer
	HoldoffDelay, HoldoffMaxDelay time.Duration
	StatusUpdater                 k8s.StatusUpdater
}

type EventRecorder added in v1.2.0

type EventRecorder struct {
	Next    cache.ResourceEventHandler
	Counter *prometheus.CounterVec
}

EventRecorder records the count and kind of events forwarded to another ResourceEventHandler.

func (*EventRecorder) OnAdd added in v1.2.0

func (e *EventRecorder) OnAdd(obj any, isInInitialList bool)

func (*EventRecorder) OnDelete added in v1.2.0

func (e *EventRecorder) OnDelete(obj any)

func (*EventRecorder) OnUpdate added in v1.2.0

func (e *EventRecorder) OnUpdate(oldObj, newObj any)

type Observer added in v1.9.0

type Observer interface {
	Refresh()
}

Observer is an interface for receiving notifications.

func ComposeObservers added in v1.9.0

func ComposeObservers(observers ...Observer) Observer

ComposeObservers returns a new Observer that calls each of its arguments in turn.

type ObserverFunc added in v1.9.0

type ObserverFunc func()

ObserverFunc is a function that implements the Observer interface by calling itself. It can be nil.

func (ObserverFunc) Refresh added in v1.9.0

func (f ObserverFunc) Refresh()

type RebuildMetricsObserver added in v1.8.0

type RebuildMetricsObserver struct {
	// contains filtered or unexported fields
}

RebuildMetricsObserver is a dag.Observer that emits metrics for DAG rebuilds.

func NewRebuildMetricsObserver added in v1.20.0

func NewRebuildMetricsObserver(metrics *metrics.Metrics, nextObserver dag.Observer) *RebuildMetricsObserver

func (*RebuildMetricsObserver) OnChange added in v1.8.0

func (m *RebuildMetricsObserver) OnChange(d *dag.DAG)

func (*RebuildMetricsObserver) OnElectedLeader added in v1.20.0

func (m *RebuildMetricsObserver) OnElectedLeader()

Jump to

Keyboard shortcuts

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