ciliumidentity

package
v1.17.0-pre.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// LabelResource indicates resources that the metrics are attributed to.
	LabelResource = "resource"
	// LabelPhase indicates the phases the metrics are attributed to.
	LabelPhase = "phase"

	LabelValueCID               = "cid"
	LabelValuePod               = "pod"
	LabelValueEnqueuedLatency   = "enqueued"
	LabelValueProcessingLatency = "processing"
)

Variables

View Source
var Cell = cell.Module(
	"k8s-cid-controller",
	"Cilium Identity Controller Operator",
	cell.Invoke(registerController),
	metrics.Metric(NewMetrics),
	cell.Config(defaultConfig),
)

Cell implements the CID Controller. It subscribes to CID, CES, Pods and Namespace events and reconciles the state of CID in the cluster.

Functions

This section is empty.

Types

type CIDItem

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

func (CIDItem) Key

func (c CIDItem) Key() resource.Key

func (CIDItem) Meter

func (c CIDItem) Meter(enqueuedLatency float64, processingLatency float64, isErr bool, metrics *Metrics)

func (CIDItem) Reconcile

func (c CIDItem) Reconcile(reconciler *reconciler) error

type CIDState

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

func NewCIDState

func NewCIDState(logger *slog.Logger) *CIDState

func (*CIDState) LookupByID

func (c *CIDState) LookupByID(id string) (*key.GlobalIdentity, bool)

func (*CIDState) LookupByKey

func (c *CIDState) LookupByKey(k *key.GlobalIdentity) (string, bool)

func (*CIDState) Remove

func (c *CIDState) Remove(id string)

func (*CIDState) Upsert

func (c *CIDState) Upsert(id string, k *key.GlobalIdentity)

type CIDUsageInCES

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

func NewCIDUsageInCES

func NewCIDUsageInCES() *CIDUsageInCES

func (*CIDUsageInCES) CIDUsageCount

func (c *CIDUsageInCES) CIDUsageCount(cidName string) int

func (*CIDUsageInCES) ProcessCESDelete

func (c *CIDUsageInCES) ProcessCESDelete(cesName string, endpoints []v2alpha1.CoreCiliumEndpoint) []int64

ProcessCESDelete reduces the CID usage in CES, based on the provided CES.

func (*CIDUsageInCES) ProcessCESUpsert

func (c *CIDUsageInCES) ProcessCESUpsert(cesName string, endpoints []v2alpha1.CoreCiliumEndpoint) []int64

ProcessCESUpsert updates the CID usage in CES based on the provided CES. When the CES is new, it will just add all used CIDs. When CES is updated, it uses previous CID usage for the same CES, that it tracks, to accordingly reduce CID usage in CES.

type CIDUsageInPods

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

func NewCIDUsageInPods

func NewCIDUsageInPods() *CIDUsageInPods

func (*CIDUsageInPods) AssignCIDToPod

func (c *CIDUsageInPods) AssignCIDToPod(podName, cidName string) (string, int)

AssignCIDToPod updates the pod to CID map and increments the CID usage. It also decrements the previous CID usage and returns the CID name of previously set CID and its usage count after decrementing the CID usage. The return values are used to track when old CIDs are no longer used.

func (*CIDUsageInPods) CIDUsageCount

func (c *CIDUsageInPods) CIDUsageCount(cidName string) int

func (*CIDUsageInPods) RemovePod

func (c *CIDUsageInPods) RemovePod(podName string) (string, int, bool)

RemovePod removes the pod from the pod to CID map, decrements the CID usage and returns the CID name and its usage count after decrementing the usage. If the pod does not exist in the pod to CID map it returns empty values. The return values are used to track when old CIDs are no longer used.

type Controller

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

func (*Controller) Start

func (c *Controller) Start(_ cell.HookContext) error

func (*Controller) Stop

func (c *Controller) Stop(_ cell.HookContext) error

type EnqueueTimeTracker

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

EnqueueTimeTracker provides a thread safe mechanism to record and manage the time when items are enqueued.

func (*EnqueueTimeTracker) GetAndReset

func (e *EnqueueTimeTracker) GetAndReset(item string) (time.Time, bool)

func (*EnqueueTimeTracker) Track

func (e *EnqueueTimeTracker) Track(item string)

type Metrics

type Metrics struct {
	EventCount   metric.Vec[metric.Counter]
	QueueLatency metric.Vec[metric.Observer]
}

func NewMetrics

func NewMetrics() *Metrics

type PodItem

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

func (PodItem) Key

func (p PodItem) Key() resource.Key

func (PodItem) Meter

func (p PodItem) Meter(enqueuedLatency float64, processingLatency float64, isErr bool, metrics *Metrics)

func (PodItem) Reconcile

func (p PodItem) Reconcile(reconciler *reconciler) error

type QueuedItem

type QueuedItem interface {
	Key() resource.Key
	Reconcile(reconciler *reconciler) error
	Meter(enqueuedLatency float64, processingLatency float64, isErr bool, metrics *Metrics)
}

type SecIDs

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

SecIDs is used to handle duplicate CIDs. Operator itself will not generate duplicate CIDs. This is required when migrating to Operator managing CIDs. Operator is compatible with Agents simultaneously managing CIDs.

type SharedConfig

type SharedConfig struct {
	// EnableCiliumEndpointSlice indicates if the Cilium Endpoint Slice feature is
	// enabled.
	EnableCiliumEndpointSlice bool
}

SharedConfig contains the configuration that is shared between this module and others. It is a temporary solution meant to avoid polluting this module with a direct dependency on global operator and daemon configurations.

Jump to

Keyboard shortcuts

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