feature

package
v1.18.0 Latest Latest
Warning

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

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

Documentation

Overview

Package feature provide the framework to manage Feature in a generic way.

Index

Constants

View Source
const (
	// DefaultIDType enable default component feature.
	DefaultIDType IDType = "default"
	// DogstatsdIDType Dogstatsd feature.
	DogstatsdIDType = "dogstatsd"
	// EventCollectionIDType Event Collection feature.
	EventCollectionIDType = "event_collection"
	// ExternalMetricsIDType External metrics feature.
	ExternalMetricsIDType = "external_metrics"
	// AutoscalingIDType Autoscaling feature.
	AutoscalingIDType = "autoscaling"
	// KubernetesStateCoreIDType Kubernetes state core check feature.
	KubernetesStateCoreIDType = "ksm"
	// LiveContainerIDType Live Container feature.
	LiveContainerIDType = "live_container"
	// LiveProcessIDType Live Process feature.
	LiveProcessIDType = "live_process"
	// OtelAgentIDType Otel Agent feature.
	OtelAgentIDType = "otel_agent"
	// ProcessDiscoveryIDType Process Discovery feature.
	ProcessDiscoveryIDType = "process_discovery"
	// KubernetesAPIServerIDType Kube APIServer feature.
	KubernetesAPIServerIDType = "kubernetes_apiserver"
	// OrchestratorExplorerIDType Orchestrator Explorer feature.
	OrchestratorExplorerIDType = "orchestrator_explorer"
	// LogCollectionIDType Log Collection feature.
	LogCollectionIDType = "log_collection"
	// NPMIDType NPM feature.
	NPMIDType = "npm"
	// CSPMIDType CSPM feature.
	CSPMIDType = "cspm"
	// CWSIDType CWS feature.
	CWSIDType = "cws"
	// USMIDType USM feature.
	USMIDType = "usm"
	// OOMKillIDType OOM Kill check feature
	OOMKillIDType = "oom_kill"
	// EBPFCheckIDType eBPF check feature
	EBPFCheckIDType = "ebpf_check"
	// PrometheusScrapeIDType Prometheus Scrape feature
	PrometheusScrapeIDType = "prometheus_scrape"
	// TCPQueueLengthIDType TCP Queue length check feature
	TCPQueueLengthIDType = "tcp_queue_length"
	// ClusterChecksIDType Cluster checks feature
	ClusterChecksIDType = "cluster_checks"
	// APMIDType APM feature
	APMIDType = "apm"
	// ASMIDType ASM feature
	ASMIDType = "asm"
	// AdmissionControllerIDType Admission controller feature
	AdmissionControllerIDType = "admission_controller"
	// OTLPIDType OTLP ingest feature
	OTLPIDType = "otlp"
	// RemoteConfigurationIDType Remote Config feature
	RemoteConfigurationIDType = "remote_config"
	// SBOMIDType SBOM collection feature
	SBOMIDType = "sbom"
	// HelmCheckIDType Helm Check feature.
	HelmCheckIDType = "helm_check"
	// DummyIDType Dummy feature.
	DummyIDType = "dummy"
	// ServiceDiscoveryType service discovery feature.
	ServiceDiscoveryType = "service_discovery"
	// GPUIDType GPU monitoring feature.
	GPUIDType = "gpu"
	// ControlPlaneMonitoringIDType Control Plane Monitoring feature.
	ControlPlaneMonitoringIDType = "control_plane_monitoring"
)

Variables

This section is empty.

Functions

func BuildFeatures

func BuildFeatures(dda metav1.Object, ddaSpec *v2alpha1.DatadogAgentSpec, ddaRCStatus *v2alpha1.RemoteConfigConfiguration, options *Options) ([]Feature, []Feature, RequiredComponents)

BuildFeatures use to build a list features depending of the v2alpha1.DatadogAgent instance

func Register

func Register(id IDType, buildFunc BuildFunc) error

Register use to register a Feature to the Feature factory.

Types

type BuildFunc

type BuildFunc func(options *Options) Feature

BuildFunc function type used by each Feature during its factory registration. It returns the Feature interface.

type Feature

type Feature interface {
	// ID returns the ID of the Feature
	ID() IDType
	// Configure use to configure the internal of a Feature
	// It should return `true` if the feature is enabled, else `false`.
	Configure(ddaMetaObj metav1.Object, ddaSpec *v2alpha1.DatadogAgentSpec, ddaRCStatus *v2alpha1.RemoteConfigConfiguration) RequiredComponents
	// ManageDependencies allows a feature to manage its dependencies.
	// Feature's dependencies should be added in the store.
	ManageDependencies(managers ResourceManagers, provider string) error
	// ManageClusterAgent allows a feature to configure the ClusterAgent's corev1.PodTemplateSpec
	// It should do nothing if the feature doesn't need to configure it.
	ManageClusterAgent(managers PodTemplateManagers, provider string) error
	// ManageNodeAgent allows a feature to configure the Node Agent's corev1.PodTemplateSpec
	// It should do nothing if the feature doesn't need to configure it.
	ManageNodeAgent(managers PodTemplateManagers, provider string) error
	// ManageSingleContainerNodeAgent allows a feature to configure the Agent container for the Node Agent's corev1.PodTemplateSpec
	// if SingleContainerStrategy is enabled and can be used with the configured feature set.
	// It should do nothing if the feature doesn't need to configure it.
	ManageSingleContainerNodeAgent(managers PodTemplateManagers, provider string) error
	// ManageClusterChecksRunner allows a feature to configure the ClusterChecksRunnerAgent's corev1.PodTemplateSpec
	// It should do nothing if the feature doesn't need to configure it.
	ManageClusterChecksRunner(managers PodTemplateManagers, provider string) error
}

Feature interface

type IDType

type IDType string

IDType use to identify a Feature

type Options

type Options struct {
	Logger logr.Logger
}

Options option that can be pass to the Interface.Configure function

type PodTemplateManagers

type PodTemplateManagers interface {
	// PodTemplateSpec used to access directly the PodTemplateSpec.
	PodTemplateSpec() *corev1.PodTemplateSpec
	// EnvVar used to access the EnvVarManager to manage the Environment variable defined in the PodTemplateSpec.
	EnvVar() merger.EnvVarManager
	// EnvVarFrom used to access the EnvVarFromManager to manage the Environment variable defined in the PodTemplateSpec.
	EnvFromVar() merger.EnvFromVarManager
	// Volume used to access the VolumeManager to manage the Volume defined in the PodTemplateSpec.
	Volume() merger.VolumeManager
	// VolumeMount used to access the VolumeMountManager to manage the VolumeMount defined in the PodTemplateSpec.
	VolumeMount() merger.VolumeMountManager
	// SecurityContext is used to access the SecurityContextManager to manage container Security Context defined in the PodTemplateSpec.
	SecurityContext() merger.SecurityContextManager
	// Annotation is used access the AnnotationManager to manage PodTemplateSpec annotations.
	Annotation() merger.AnnotationManager
	// Ports used to access PortManager that allows to manage the Ports defined in the PodTemplateSpec.
	Port() merger.PortManager
}

PodTemplateManagers used to access the different PodTemplateSpec manager.

func NewPodTemplateManagers

func NewPodTemplateManagers(podTmpl *corev1.PodTemplateSpec) PodTemplateManagers

NewPodTemplateManagers use to create a new instance of PodTemplateManagers from a corev1.PodTemplateSpec argument

type RequiredComponent

type RequiredComponent struct {
	IsRequired *bool
	Containers []common.AgentContainerName
}

RequiredComponent is used to know if a component is required and which containers are required. If isRequired is set to:

  • nil: the feature doesn't need the corresponding component. If the feature is disabled, isRequired should be nil.
  • true: the feature needs the corresponding component.
  • false: the component is disabled (only set in overrides).

If a feature is not enabled but needs to be configured, require at least one container.

func (*RequiredComponent) IsConfigured

func (rc *RequiredComponent) IsConfigured() bool

IsConfigured returns true if the Feature does not require the RequiredComponent, but if it runs it needs to be configured appropriately.

func (*RequiredComponent) IsEnabled

func (rc *RequiredComponent) IsEnabled() bool

IsEnabled returns true if the Feature needs the current RequiredComponent

func (*RequiredComponent) IsPrivileged

func (rc *RequiredComponent) IsPrivileged() bool

IsPrivileged checks whether component requires privileged access.

func (*RequiredComponent) Merge

Merge use to merge 2 RequiredComponents merge priority: false > true > nil *

func (*RequiredComponent) SingleContainerStrategyEnabled

func (rc *RequiredComponent) SingleContainerStrategyEnabled() bool

type RequiredComponents

type RequiredComponents struct {
	ClusterAgent        RequiredComponent
	Agent               RequiredComponent
	ClusterChecksRunner RequiredComponent
}

RequiredComponents use to know which component need to be enabled for the feature

func (*RequiredComponents) IsConfigured

func (rc *RequiredComponents) IsConfigured() bool

IsConfigured returns true if any of the components need to be configured even if not enabled Can be used for features that may require configuration even when disabled Example: setting an env var to false to disable the feature

func (*RequiredComponents) IsEnabled

func (rc *RequiredComponents) IsEnabled() bool

IsEnabled returns true if any of the components need to be enabled

func (*RequiredComponents) Merge

Merge use to merge 2 RequiredComponents merge priority: false > true > nil *

type ResourceManagers

type ResourceManagers interface {
	Store() store.StoreClient
	RBACManager() merger.RBACManager
	SecretManager() merger.SecretManager
	NetworkPolicyManager() merger.NetworkPolicyManager
	ServiceManager() merger.ServiceManager
	CiliumPolicyManager() merger.CiliumPolicyManager
	ConfigMapManager() merger.ConfigMapManager
	APIServiceManager() merger.APIServiceManager
}

ResourceManagers used to access the different resources manager.

func NewResourceManagers

func NewResourceManagers(store store.StoreClient) ResourceManagers

NewResourceManagers return new instance of the ResourceManagers interface

Directories

Path Synopsis
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.
defaultconfig
package defaultconfig exposes the otel-agent default config
package defaultconfig exposes the otel-agent default config

Jump to

Keyboard shortcuts

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