prober

package
v0.41.13 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIPForService added in v0.34.0

func GetIPForService(svc types.NamespacedName) string

func NewAsync

func NewAsync(ctx context.Context, client httpClient, port string, IPsLister IPsLister, enqueue EnqueueFunc) prober

NewAsync creates an async Prober.

It reports status changes using the provided EnqueueFunc.

func NewIPListerWithMapping added in v0.34.0

func NewIPListerWithMapping() *ipListerWithMapping

Types

type Cache

type Cache[K comparable, V, A interface{}] interface {
	// GetStatus retries the status associated with the given key.
	Get(key K) (V, bool)
	// UpsertStatus add or updates the status associated with the given key.
	// Once the given key expires the onExpired callback will be called passing the arg parameter.
	UpsertStatus(key K, value V, arg A, onExpired ExpirationFunc[K, V, A])
	// Expire will expire the given key.
	Expire(key K)
}

Cache is a key-status store.

func NewLocalExpiringCache

func NewLocalExpiringCache[K comparable, V, A interface{}](ctx context.Context, expiration time.Duration) Cache[K, V, A]

func NewLocalExpiringCacheWithDefault added in v0.41.9

func NewLocalExpiringCacheWithDefault[K comparable, V, A interface{}](ctx context.Context, expiration time.Duration, defaultValue V) Cache[K, V, A]

type EnqueueFunc

type EnqueueFunc func(key types.NamespacedName)

EnqueueFunc enqueues the given provided resource key.

type ExpirationFunc

type ExpirationFunc[K comparable, V, A interface{}] func(key K, value V, arg A)

ExpirationFunc is a callback called once an entry in the cache is expired.

type Func

type Func func(ctx context.Context, addressable proberAddressable, expected Status) Status

Func type is an adapter to allow the use of ordinary functions as Prober. If f is a function with the appropriate signature, Func(f) is a Prober that calls f.

type IPListerWithMapping added in v0.34.0

type IPListerWithMapping interface {
	Register(svc types.NamespacedName, ip string)
	Unregister(svc types.NamespacedName)
	List(addressable proberAddressable) ([]string, error)
}

type IPsLister added in v0.29.5

type IPsLister func(addressable proberAddressable) ([]string, error)

func IPsListerFromService added in v0.29.5

func IPsListerFromService(svc types.NamespacedName) IPsLister

func IdentityIPsLister added in v0.31.3

func IdentityIPsLister() IPsLister

type NewFunc added in v0.38.0

type NewFunc func(ctx context.Context, addressable ProberAddressable, expected Status) Status

func (NewFunc) Probe added in v0.38.0

func (p NewFunc) Probe(ctx context.Context, addressable ProberAddressable, expected Status) Status

type NewProber added in v0.38.0

type NewProber interface {
	// Probe probes the provided NewAddressable resource and returns its Status
	Probe(ctx context.Context, addressable ProberAddressable, expected Status) Status
}

NewProber probes an addressable resource

func NewComposite added in v0.38.0

func NewComposite(ctx context.Context, client httpClient, httpPort string, httpsPort string, IPsLister IPsLister, enqueue EnqueueFunc) (NewProber, error)

NewComposite creates a composite prober.

It reports status changes using the provided EnqueueFunc.

type ProberAddressable added in v0.39.0

type ProberAddressable struct {
	// Addressable status
	AddressStatus *duckv1.AddressStatus
	// Resource key
	ResourceKey types.NamespacedName
}

ProberAddressable contains addressable resource data for the new prober

type Status

type Status int

Status represents the resource status.

const (
	// StatusReady signals that a given object is ready.
	StatusReady Status = iota
	// StatusUnknown signals that a given object is not ready and its state is unknown.
	StatusUnknown
	// StatusUnknownErr signals that a given object is not ready and its state is unknown due to
	// networking problems between control plane and data plane.
	StatusUnknownErr
	// StatusNotReady signals that a given object is not ready.
	StatusNotReady
)

func (Status) String

func (s Status) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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