controller

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvEventsEnabled     = "DD_UNTAINT_CONTROLLER_EVENTS_ENABLED"
	EnvReadinessTimeout  = "DD_UNTAINT_CONTROLLER_TIMEOUT"
	EnvSchedulingTimeout = "DD_UNTAINT_CONTROLLER_SCHEDULING_TIMEOUT"
	EnvTimeoutPolicy     = "DD_UNTAINT_CONTROLLER_TIMEOUT_POLICY"
)

Environment variables consumed by the untaint controller. Reading them here (rather than in cmd/main.go) keeps the controller's configuration surface self-contained so callers do not need to know about them.

View Source
const (

	// DefaultReadinessTimeout is applied when an agent pod exists on a tainted
	// node but never reaches Ready. Clock: pod.Status.StartTime.
	DefaultReadinessTimeout = 10 * time.Minute
	// DefaultSchedulingTimeout is applied when no agent pod is ever scheduled
	// on a tainted node. Clock: node.CreationTimestamp.
	DefaultSchedulingTimeout = 5 * time.Minute
)

Variables

This section is empty.

Functions

func SetupControllers

func SetupControllers(logger logr.Logger, mgr manager.Manager, platformInfo kubernetes.PlatformInfo, options SetupOptions) error

SetupControllers starts all controllers (also used by e2e tests)

Types

type DatadogAgentInternalReconciler added in v1.16.0

type DatadogAgentInternalReconciler struct {
	client.Client
	PlatformInfo kubernetes.PlatformInfo
	Scheme       *runtime.Scheme
	Recorder     record.EventRecorder
	Options      datadogagentinternal.ReconcilerOptions
	// contains filtered or unexported fields
}

DatadogAgentInternalReconciler reconciles a DatadogAgentInternal object.

func (*DatadogAgentInternalReconciler) Reconcile added in v1.16.0

Reconcile loop for DatadogAgent.

func (*DatadogAgentInternalReconciler) SetupWithManager added in v1.16.0

func (r *DatadogAgentInternalReconciler) SetupWithManager(mgr ctrl.Manager, metricForwardersMgr datadog.MetricsForwardersManager) error

SetupWithManager creates a new DatadogAgent controller.

type DatadogAgentProfileReconciler

type DatadogAgentProfileReconciler struct {
	Client   client.Client
	Log      logr.Logger
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

DatadogAgentProfileReconciler reconciles a DatadogAgentProfile object.

func (*DatadogAgentProfileReconciler) Reconcile

Reconcile loop for DatadogAgentProfile.

func (*DatadogAgentProfileReconciler) SetupWithManager

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

SetupWithManager creates a new DatadogAgentProfile controller.

type DatadogAgentReconciler

type DatadogAgentReconciler struct {
	client.Client
	PlatformInfo kubernetes.PlatformInfo
	Log          logr.Logger
	Scheme       *runtime.Scheme
	Recorder     record.EventRecorder
	Options      datadogagent.ReconcilerOptions
	// contains filtered or unexported fields
}

DatadogAgentReconciler reconciles a DatadogAgent object.

func (*DatadogAgentReconciler) Reconcile

Reconcile loop for DatadogAgent.

func (*DatadogAgentReconciler) SetupWithManager

func (r *DatadogAgentReconciler) SetupWithManager(mgr ctrl.Manager, metricForwardersMgr datadog.MetricsForwardersManager) error

SetupWithManager creates a new DatadogAgent controller.

type DatadogCSIDriverReconciler added in v1.26.0

type DatadogCSIDriverReconciler struct {
	Client                            client.Client
	Scheme                            *runtime.Scheme
	Recorder                          record.EventRecorder
	UntaintInjectCSIStartupToleration bool
	// contains filtered or unexported fields
}

DatadogCSIDriverReconciler reconciles a DatadogCSIDriver object.

func (*DatadogCSIDriverReconciler) Reconcile added in v1.26.0

Reconcile loop for DatadogCSIDriver.

func (*DatadogCSIDriverReconciler) SetupWithManager added in v1.26.0

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

SetupWithManager creates a new DatadogCSIDriver controller.

type DatadogDashboardReconciler

type DatadogDashboardReconciler struct {
	Client       client.Client
	CredsManager *config.CredentialManager
	Log          logr.Logger
	Scheme       *runtime.Scheme
	Recorder     record.EventRecorder
	// contains filtered or unexported fields
}

DatadogDashboardReconciler reconciles a DatadogDashboard object

func (*DatadogDashboardReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type DatadogGenericResourceReconciler added in v1.12.0

type DatadogGenericResourceReconciler struct {
	Client       client.Client
	CredsManager *config.CredentialManager
	Log          logr.Logger
	Scheme       *runtime.Scheme
	Recorder     record.EventRecorder
	Options      DatadogGenericResourceReconcilerOptions
	// contains filtered or unexported fields
}

DatadogGenericResourceReconciler reconciles a DatadogGenericResource object

func (*DatadogGenericResourceReconciler) Reconcile added in v1.12.0

func (*DatadogGenericResourceReconciler) SetupWithManager added in v1.12.0

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

SetupWithManager sets up the controller with the Manager.

type DatadogGenericResourceReconcilerOptions added in v1.29.0

type DatadogGenericResourceReconcilerOptions struct {
	MaxConcurrentReconciles int
	RequeuePeriod           time.Duration
}

type DatadogMonitorReconciler

type DatadogMonitorReconciler struct {
	Client       client.Client
	CredsManager *config.CredentialManager
	Log          logr.Logger
	Scheme       *runtime.Scheme
	Recorder     record.EventRecorder
	// contains filtered or unexported fields
}

DatadogMonitorReconciler reconciles a DatadogMonitor object.

func (*DatadogMonitorReconciler) Reconcile

Reconcile loop for DatadogMonitor.

func (*DatadogMonitorReconciler) SetupWithManager

func (r *DatadogMonitorReconciler) SetupWithManager(mgr ctrl.Manager, metricForwardersMgr datadog.MetricsForwardersManager) error

SetupWithManager creates a new DatadogMonitor controller.

type DatadogSLOReconciler

type DatadogSLOReconciler struct {
	Client       client.Client
	CredsManager *config.CredentialManager
	Log          logr.Logger
	Scheme       *runtime.Scheme
	Recorder     record.EventRecorder
	// contains filtered or unexported fields
}

func (*DatadogSLOReconciler) Reconcile

Reconcile loop for Datadog SLO

func (*DatadogSLOReconciler) SetupWithManager

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

type ExtendedDaemonsetOptions

type ExtendedDaemonsetOptions struct {
	Enabled                   bool
	MaxPodUnavailable         string
	MaxPodSchedulerFailure    string
	SlowStartAdditiveIncrease string

	CanaryDuration                      time.Duration
	CanaryReplicas                      string
	CanaryAutoPauseEnabled              bool
	CanaryAutoPauseMaxRestarts          int
	CanaryAutoFailEnabled               bool
	CanaryAutoFailMaxRestarts           int
	CanaryAutoPauseMaxSlowStartDuration time.Duration
}

ExtendedDaemonsetOptions defines ExtendedDaemonset options

type SetupOptions

type SetupOptions struct {
	SupportExtendedDaemonset          ExtendedDaemonsetOptions
	SupportCilium                     bool
	CredsManager                      *config.CredentialManager
	DatadogAgentEnabled               bool
	DatadogMonitorEnabled             bool
	DatadogSLOEnabled                 bool
	OperatorMetricsEnabled            bool
	V2APIEnabled                      bool
	IntrospectionEnabled              bool
	DatadogAgentProfileEnabled        bool
	OtelAgentEnabled                  bool
	DatadogDashboardEnabled           bool
	DatadogGenericResourceEnabled     bool
	DatadogGenericResourceMaxWorkers  int
	DatadogGenericResourceRequeue     time.Duration
	CreateControllerRevisions         bool
	DatadogCSIDriverEnabled           bool
	UntaintControllerEnabled          bool
	UntaintControllerWaitForCSIDriver bool
	RolloutOnConfigMapChangeEnabled   bool
	ClusterProviderDetector           datadogagent.ProviderReader
}

SetupOptions defines options for setting up controllers to ease testing

type TimeoutPolicy added in v1.28.0

type TimeoutPolicy string

TimeoutPolicy controls what the controller does when a timeout fires.

const (
	// PolicyRemove untaints the node despite the agent never becoming ready.
	PolicyRemove TimeoutPolicy = metrics.UntaintTimeoutPolicyRemove
	// PolicyKeep leaves the taint in place; the controller only emits
	// observability signals (metric, event, log).
	PolicyKeep TimeoutPolicy = metrics.UntaintTimeoutPolicyKeep
)

func ParseTimeoutPolicy added in v1.28.0

func ParseTimeoutPolicy(s string) (TimeoutPolicy, error)

ParseTimeoutPolicy returns PolicyRemove for the empty string or "remove", PolicyKeep for "keep", and an error for any other value.

type UntaintReconciler added in v1.28.0

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

UntaintReconciler watches agent pods and nodes and removes the taint agent.datadoghq.com/not-ready=presence:NoSchedule once readiness criteria are met, or after a configurable timeout depending on the policy. When waitForCSIDriver is true (--untaintControllerWaitForCSIDriver), the node agent and CSI node-server pods must both be Ready before untainting.

func NewUntaintReconciler added in v1.28.0

func NewUntaintReconciler(c client.Client, log logr.Logger, rec record.EventRecorder, waitForCSIDriver bool) (*UntaintReconciler, error)

NewUntaintReconciler builds an UntaintReconciler. All tuning knobs are sourced from environment variables (DD_UNTAINT_CONTROLLER_*) with the constants on this package as fallback defaults. Any invalid env value (unparseable duration, unknown policy) returns an error and aborts startup — we fail loud rather than silently substituting defaults so operator misconfiguration is caught at boot, not discovered later when timeouts fire at the wrong time.

The effective configuration is logged once at INFO so the operator can confirm what was actually applied.

waitForCSIDriver should match SetupOptions.UntaintControllerWaitForCSIDriver. It is only consulted when the untaint controller is running (--untaintControllerEnabled).

func (*UntaintReconciler) Reconcile added in v1.28.0

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

Reconcile decides what to do with a tainted node:

  • by default: if any agent pod on the node is Ready, untaint
  • with --untaintControllerWaitForCSIDriver: agent and CSI node-server pods must both be Ready before untaint
  • if pods exist but readiness criteria are not met and the readiness timeout has elapsed, apply the timeout policy (remove or keep)
  • if no agent pod is scheduled and the scheduling timeout has elapsed, apply the timeout policy
  • with --untaintControllerWaitForCSIDriver: readiness timeout uses the later of max(agent StartTime) and max(CSI StartTime) when both workloads have a pod on the node with Status.StartTime set; if either workload is missing on the node use the scheduling timeout (node creation); if both are on the node but either side still lacks StartTime, requeue with readinessTimeout (same coarse poll as agent-only) until StartTime appears
  • otherwise, requeue after the remaining timeout window so we re-evaluate.

func (*UntaintReconciler) SetupWithManager added in v1.28.0

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

SetupWithManager wires the Pod and Node watches and registers the cache field index used to list pods by node name.

Directories

Path Synopsis
feature
Package feature provide the framework to manage Feature in a generic way.
Package feature provide the framework to manage Feature in a generic way.
feature/dogstatsd
Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
feature/otelagentgateway/defaultconfig
package defaultconfig exposes the otel-agent default config in gateway
package defaultconfig exposes the otel-agent default config in gateway
feature/otelcollector/defaultconfig
package defaultconfig exposes the otel-agent default config
package defaultconfig exposes the otel-agent default config
override
Package override provides a set of function to override generic resource such as corev1.PodTemplate and corev1.Container.
Package override provides a set of function to override generic resource such as corev1.PodTemplate and corev1.Container.
providercaps
Package providercaps holds the provider-conditional pod-template mutation framework.
Package providercaps holds the provider-conditional pod-template mutation framework.
store
Package store provides a store use to manage deployment dependencies.
Package store provides a store use to manage deployment dependencies.
testutils
Package testutils_test contains a set of unit-test helper functions to ease the creation of unit-test around the DatadogAgent CRD controller
Package testutils_test contains a set of unit-test helper functions to ease the creation of unit-test around the DatadogAgent CRD controller
renderer
Package renderer simulates the Datadog Operator's reconciliation loop offline.
Package renderer simulates the Datadog Operator's reconciliation loop offline.

Jump to

Keyboard shortcuts

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