callbacks

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DataplaneCallbacksToXdsCallbacks added in v1.8.1

func DataplaneCallbacksToXdsCallbacks(callbacks DataplaneCallbacks) util_xds.Callbacks

func NewNackBackoff

func NewNackBackoff(backoff time.Duration) util_xds.Callbacks

Types

type DataplaneCallbacks added in v1.8.1

type DataplaneCallbacks interface {
	// OnProxyConnected is executed when proxy is connected after it was disconnected before.
	OnProxyConnected(streamID core_xds.StreamID, dpKey core_model.ResourceKey, ctx context.Context, metadata core_xds.DataplaneMetadata) error
	// OnProxyReconnected is executed when proxy is already connected, but there is another stream.
	// This can happen when there is a delay with closing the old connection from the proxy to the control plane.
	OnProxyReconnected(streamID core_xds.StreamID, dpKey core_model.ResourceKey, ctx context.Context, metadata core_xds.DataplaneMetadata) error
	// OnProxyDisconnected is executed only when the last stream of the proxy disconnects.
	OnProxyDisconnected(ctx context.Context, streamID core_xds.StreamID, dpKey core_model.ResourceKey)
}

DataplaneCallbacks are XDS callbacks that keep the context of Kuma Dataplane. In the ideal world we could assume that one Dataplane has one xDS stream. Due to race network latencies etc. there might be a situation when one Dataplane has many xDS streams for the short period of time. Those callbacks helps us to deal with such situation.

Keep in mind that it does not solve many xDS streams across many instances of the Control Plane. If there are many instances of the Control Plane and Dataplane reconnects, there might be an old stream in one instance of CP and a new stream in a new instance of CP.

func NewDataplaneSyncTracker

func NewDataplaneSyncTracker(factoryFunc NewDataplaneWatchdogFunc) DataplaneCallbacks

type DataplaneInsightSink

type DataplaneInsightSink interface {
	Start(stop <-chan struct{})
}

func NewDataplaneInsightSink

func NewDataplaneInsightSink(
	dataplaneType core_model.ResourceType,
	accessor SubscriptionStatusAccessor,
	secrets secrets.Secrets,
	newTicker func() *time.Ticker,
	generationTicker func() *time.Ticker,
	flushBackoff time.Duration,
	store DataplaneInsightStore) DataplaneInsightSink

type DataplaneInsightStore

type DataplaneInsightStore interface {
	// Upsert creates or updates the subscription, storing it with
	// the key dataplaneID. dataplaneType gives the resource type of
	// the dataplane proxy that has subscribed.
	Upsert(dataplaneType core_model.ResourceType, dataplaneID core_model.ResourceKey, subscription *mesh_proto.DiscoverySubscription, secretsInfo *secrets.Info) error
}

func NewDataplaneInsightStore

func NewDataplaneInsightStore(resManager manager.ResourceManager) DataplaneInsightStore

type DataplaneLifecycle

type DataplaneLifecycle struct {
	sync.RWMutex // protects createdDpByCallbacks
	// contains filtered or unexported fields
}

DataplaneLifecycle is responsible for creating a deleting dataplanes that are passed through metadata There are two possible workflows 1) apply Dataplane resource before kuma-dp run and run kuma-dp 2) run kuma-dp and pass Dataplane resource as an argument to kuma-dp This component support second use case. When user passes Dataplane to kuma-dp it is attached to bootstrap request. Then, bootstrap server generates bootstrap configuration with Dataplane embedded in Envoy metadata. Here, we read Dataplane resource from metadata and a create resource on first DiscoveryRequest and remove on StreamClosed.

This flow is optional, you may still want to go with 1. an example of this is Kubernetes deployment.

func NewDataplaneLifecycle

func NewDataplaneLifecycle(
	appCtx context.Context,
	resManager manager.ResourceManager,
	authenticator xds_auth.Authenticator,
	deregistrationDelay time.Duration,
	cpInstanceID string,
) *DataplaneLifecycle

func (*DataplaneLifecycle) OnProxyConnected added in v1.8.1

func (d *DataplaneLifecycle) OnProxyConnected(streamID core_xds.StreamID, dpKey model.ResourceKey, ctx context.Context, md core_xds.DataplaneMetadata) error

func (*DataplaneLifecycle) OnProxyDisconnected added in v1.8.1

func (d *DataplaneLifecycle) OnProxyDisconnected(_ context.Context, streamID core_xds.StreamID, dpKey model.ResourceKey)

func (*DataplaneLifecycle) OnProxyReconnected added in v1.8.1

func (d *DataplaneLifecycle) OnProxyReconnected(streamID core_xds.StreamID, dpKey model.ResourceKey, ctx context.Context, md core_xds.DataplaneMetadata) error

type DataplaneMetadataTracker

type DataplaneMetadataTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDataplaneMetadataTracker

func NewDataplaneMetadataTracker() *DataplaneMetadataTracker

func (*DataplaneMetadataTracker) Metadata

func (*DataplaneMetadataTracker) OnProxyConnected added in v1.8.1

func (*DataplaneMetadataTracker) OnProxyDisconnected added in v1.8.1

func (d *DataplaneMetadataTracker) OnProxyDisconnected(_ context.Context, _ core_xds.StreamID, dpKey core_model.ResourceKey)

func (*DataplaneMetadataTracker) OnProxyReconnected added in v1.8.1

type DataplaneStatusTracker

type DataplaneStatusTracker interface {
	util_xds.Callbacks
	GetStatusAccessor(streamID int64) (SubscriptionStatusAccessor, bool)
}

func NewDataplaneStatusTracker

func NewDataplaneStatusTracker(
	runtimeInfo core_runtime.RuntimeInfo,
	createStatusSink DataplaneInsightSinkFactoryFunc,
) DataplaneStatusTracker

type NewDataplaneWatchdogFunc

type NewDataplaneWatchdogFunc func(key core_model.ResourceKey) util_watchdog.Watchdog

type NoopDataplaneCallbacks added in v1.8.1

type NoopDataplaneCallbacks struct {
}

NoopDataplaneCallbacks are empty callbacks that helps to implement DataplaneCallbacks without need to implement every function.

func (*NoopDataplaneCallbacks) OnProxyConnected added in v1.8.1

func (*NoopDataplaneCallbacks) OnProxyDisconnected added in v1.8.1

func (*NoopDataplaneCallbacks) OnProxyReconnected added in v1.8.1

type SubscriptionStatusAccessor

type SubscriptionStatusAccessor interface {
	GetStatus() (core_model.ResourceKey, *mesh_proto.DiscoverySubscription)
}

Jump to

Keyboard shortcuts

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