Documentation ¶
Overview ¶
Package feature provide the framework to manage Feature in a generic way.
Index ¶
- Constants
- func BuildFeatures(dda *v2alpha1.DatadogAgent, options *Options) ([]Feature, RequiredComponents)
- func Register(id IDType, buildFunc BuildFunc) error
- type BuildFunc
- type Feature
- type IDType
- type Options
- type PodTemplateManagers
- type RequiredComponent
- type RequiredComponents
- type ResourceManagers
Constants ¶
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" // 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" )
Variables ¶
This section is empty.
Functions ¶
func BuildFeatures ¶
func BuildFeatures(dda *v2alpha1.DatadogAgent, options *Options) ([]Feature, RequiredComponents)
BuildFeatures use to build a list features depending of the v2alpha1.DatadogAgent instance
Types ¶
type BuildFunc ¶
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(dda *v2alpha1.DatadogAgent) RequiredComponents // ManageDependencies allows a feature to manage its dependencies. // Feature's dependencies should be added in the store. ManageDependencies(managers ResourceManagers, components RequiredComponents) 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) 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) error }
Feature interface It returns `true` if the Feature is used, else it return `false`.
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.
- true: the feature needs the corresponding component.
- false: the feature does not need the corresponding component, but if it runs the feature needs to be configured (e.g. explicitly disabled).
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 ¶
func (rc *RequiredComponent) Merge(in *RequiredComponent) *RequiredComponent
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
func (*RequiredComponents) IsEnabled ¶
func (rc *RequiredComponents) IsEnabled() bool
IsEnabled returns true if any of the components need to be enabled
func (*RequiredComponents) Merge ¶
func (rc *RequiredComponents) Merge(in *RequiredComponents) *RequiredComponents
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