controller

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttunePolicyReconciler

type AttunePolicyReconciler struct {
	client.Client
	Scheme                  *runtime.Scheme
	MetricsFactory          MetricsCollectorFactory
	Clientset               kubernetes.Interface // for resize subresource calls
	Recorder                events.EventRecorder
	MinCooldown             time.Duration // minimum cooldown floor (default: 1m)
	CollectorTTL            time.Duration // how long unused collectors stay cached (default: 10m)
	MaxConcurrentReconciles int           // max parallel reconcile goroutines (default: 1)
	PrometheusTimeout       time.Duration // max time for Prometheus queries per reconcile (default: 5m)
	// contains filtered or unexported fields
}

AttunePolicyReconciler reconciles an AttunePolicy object.

func NewAttunePolicyReconciler added in v0.1.10

func NewAttunePolicyReconciler() *AttunePolicyReconciler

NewAttunePolicyReconciler creates a reconciler with all internal state initialized. Callers should set exported fields (Client, Scheme, Recorder, etc.) before calling SetupWithManager or using the reconciler directly.

func (*AttunePolicyReconciler) Reconcile

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

func (*AttunePolicyReconciler) SetNowFunc

func (r *AttunePolicyReconciler) SetNowFunc(fn func() time.Time)

SetNowFunc sets an injectable clock for testing. Safe for concurrent use.

func (*AttunePolicyReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type MetricsCollectorFactory

type MetricsCollectorFactory func(address string, opts *rsmetrics.CollectorOptions) (rsmetrics.MetricsCollector, error)

MetricsCollectorFactory creates MetricsCollector instances from a Prometheus address and optional collector options (headers, bearer token, TLS). This enables dependency injection for testing.

type WorkloadAdapter

type WorkloadAdapter interface {
	// Object returns the underlying Kubernetes object.
	Object() client.Object

	// PodSelectorLabels returns the labels used to select pods owned by this workload.
	PodSelectorLabels() map[string]string

	// PodSpec returns the pod template spec from the workload.
	PodSpec() *corev1.PodSpec

	// IsRollingOut returns true if the workload is mid-rollout.
	IsRollingOut() bool

	// PodNameRegexSuffix returns the PromQL regex suffix that matches pods for this kind.
	PodNameRegexSuffix() string

	// IsBatch returns true for Job and CronJob workloads.
	IsBatch() bool
}

WorkloadAdapter provides kind-specific behavior for a concrete workload instance. This eliminates scattered type-switches across workload helper functions.

Jump to

Keyboard shortcuts

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