endpointsv2

package
v0.0.0-...-7754ea6 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientPodFetcher

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

ClientPodFetcher wraps a Kubernetes client to implement PodFetcher. This is the only implementation outside of tests.

func (*ClientPodFetcher) GetPod

type Controller

type Controller struct {
	client.Client
	// ConsulServerConnMgr is the watcher for the Consul server addresses used to create Consul API v2 clients.
	ConsulServerConnMgr consul.ServerConnectionManager
	// K8sNamespaceConfig manages allow/deny Kubernetes namespaces.
	common.K8sNamespaceConfig
	// ConsulTenancyConfig manages settings related to Consul namespaces and partitions.
	common.ConsulTenancyConfig

	// WriteCache keeps track of records already written to Consul in order to enable debouncing of writes.
	// This is useful in particular for this controller which will see potentially many more reconciles due to
	// endpoint changes (e.g. pod health) than changes to service data written to Consul.
	// It is intentionally simple and best-effort, and does not guarantee against all redundant writes.
	// It is not persistent across restarts of the controller process.
	WriteCache WriteCache

	Log logr.Logger

	Scheme *runtime.Scheme
	context.Context
}

func (*Controller) Logger

func (r *Controller) Logger(name types.NamespacedName) logr.Logger

func (*Controller) Reconcile

func (r *Controller) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile reads the state of an Endpoints object for a Kubernetes Service and reconciles Consul services which correspond to the Kubernetes Service. These events are driven by changes to the Pods backing the Kube service.

func (*Controller) SetupWithManager

func (r *Controller) SetupWithManager(mgr ctrl.Manager) error

type PodFetcher

type PodFetcher interface {
	GetPod(context.Context, types.NamespacedName) (*corev1.Pod, error)
}

PodFetcher fetches pods by NamespacedName. This interface primarily exists for testing.

type WriteCache

type WriteCache interface {
	// contains filtered or unexported methods
}

WriteCache is a simple, unbounded, thread-safe in-memory cache for tracking writes of Consul resources. It can be used to deduplicate identical writes client-side to "debounce" writes during repeat reconciles that do not impact data already written to Consul.

func NewWriteCache

func NewWriteCache(log logr.Logger) WriteCache

Jump to

Keyboard shortcuts

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