controller

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package controller provides the Kubernetes controller for watching pods and managing eBPF program attachments.

Index

Constants

View Source
const (
	// AnnotationEnabled is the annotation that enables Kloak for a pod.
	AnnotationEnabled = "getkloak.io/enabled"

	// CgroupBasePath is the base path for cgroups v2.
	CgroupBasePath = "/sys/fs/cgroup"
)
View Source
const (
	// AnnotationSecretEnabled is the label/annotation to enable Kloak secret replication.
	AnnotationSecretEnabled = "getkloak.io/enabled"

	// AnnotationPort is the annotation to specify an allowed port for a secret.
	AnnotationPort = "getkloak.io/port"

	// AnnotationHosts is the annotation to specify allowed hosts for a secret.
	AnnotationHosts = "getkloak.io/hosts"

	// ShadowSecretSuffix is the suffix appended to the name of the shadow secret.
	ShadowSecretSuffix = "-kloak"

	// ValuePrefix is the prefix for generated UUID values.
	// Must match what the eBPF program expects.
	ValuePrefix = "kloak:"

	// ShadowPrefixLen is the length of the prefix used for BPF map key collision detection.
	// The BPF program uses the first 8 bytes as the lookup key.
	ShadowPrefixLen = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Reconciler

type Reconciler struct {
	client.Client
	Log           *zap.SugaredLogger
	Scheme        *runtime.Scheme
	UprobeManager *ebpf.TLSUprobeManager
	CgroupRoot    string
	// NodeName filters pods to only those on this node (empty = all nodes)
	NodeName string
	// contains filtered or unexported fields
}

Reconciler watches pods and manages eBPF cgroup tracking.

func NewReconciler

func NewReconciler(c client.Client, log *zap.SugaredLogger, scheme *runtime.Scheme, uprobeMgr *ebpf.TLSUprobeManager, cgroupRoot, nodeName string) *Reconciler

NewReconciler creates a new pod reconciler.

func (*Reconciler) GetTrackedPodCount

func (r *Reconciler) GetTrackedPodCount() int

GetTrackedPodCount returns the number of currently tracked pods.

func (*Reconciler) Reconcile

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

Reconcile handles pod create/update/delete events.

func (*Reconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SecretReconciler

type SecretReconciler struct {
	client.Client
	Log    *zap.SugaredLogger
	Scheme *runtime.Scheme
}

SecretReconciler reconciles a Secret object

func (*SecretReconciler) Reconcile

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

Reconcile handles Secret events.

func (*SecretReconciler) SetupWithManager

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

Jump to

Keyboard shortcuts

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