Skip to content

Commit

Permalink
api/datadoghq/v2alpha1: add support for SSI targets (#1670)
Browse files Browse the repository at this point in the history
* api/datadoghq/v2alpha1: add support for SSI targets

* error cleanup

* revert example

* Update docs/configuration.v2alpha1.md

Co-authored-by: Alicia Scott <[email protected]>

* feat(ssi): add tracer config options

This commit adds the tracer config options we've just added.

* Fix tests

* Address PR feedback

* Address PR feedback

* add log to warn for non-compatible agent version

* fix

* fix lint

* fix tests

* update types

---------

Co-authored-by: Mark Spicer <[email protected]>
Co-authored-by: Alicia Scott <[email protected]>
Co-authored-by: Mark Spicer <[email protected]>
Co-authored-by: Celene <[email protected]>
  • Loading branch information
5 people committed Feb 26, 2025
1 parent ff534a8 commit 4d23512
Show file tree
Hide file tree
Showing 10 changed files with 1,205 additions and 13 deletions.
47 changes: 47 additions & 0 deletions api/datadoghq/v2alpha1/datadogagent_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,53 @@ type SingleStepInstrumentation struct {
// Injector configures the APM Injector.
// +optional
Injector *InjectorConfig `json:"injector,omitempty"`

// Targets is a list of targets to apply the auto instrumentation to. The first target that matches the pod will be
// used. If no target matches, the auto instrumentation will not be applied.
// (Requires Cluster Agent 7.64.0+)
// +optional
Targets []SSITarget `json:"targets,omitempty"`
}

// SSITarget is a rule to apply the auto instrumentation to a specific workload using the pod and namespace selectors.
type SSITarget struct {
// Name is the name of the target. It will be appended to the pod annotations to identify the target that was used.
// +optional
Name string `json:"name,omitempty"`
// PodSelector is the pod selector to match the pods to apply the auto instrumentation to. It will be used in
// conjunction with the NamespaceSelector to match the pods.
// +optional
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`
// NamespaceSelector is the namespace selector to match the namespaces to apply the auto instrumentation to. It will
// be used in conjunction with the Selector to match the pods.
// +optional
NamespaceSelector *NamespaceSelector `json:"namespaceSelector,omitempty"`
// TracerVersions is a map of tracer versions to inject for workloads that match the target. The key is the tracer
// name and the value is the version to inject.
// +optional
TracerVersions map[string]string `json:"ddTraceVersions,omitempty"`
// TracerConfigs is a list of configuration options to use for the installed tracers. These options will be added
// as environment variables in addition to the injected tracer.
// +optional
// +listType=map
// +listMapKey=name
TracerConfigs []corev1.EnvVar `json:"ddTraceConfigs,omitempty"`
}

// NamespaceSelector is a struct to store the configuration for the namespace selector. It can be used to match the
// namespaces to apply the auto instrumentation to.
type NamespaceSelector struct {
// MatchNames is a list of namespace names to match. If empty, all namespaces are matched.
// +optional
MatchNames []string `json:"matchNames,omitempty"`
// MatchLabels is a map of key-value pairs to match the labels of the namespace. The labels and expressions are
// ANDed. This cannot be used with MatchNames.
// +optional
MatchLabels map[string]string `json:"matchLabels,omitempty"`
// MatchExpressions is a list of label selector requirements to match the labels of the namespace. The labels and
// expressions are ANDed. This cannot be used with MatchNames.
// +optional
MatchExpressions []metav1.LabelSelectorRequirement `json:"matchExpressions,omitempty"`
}

// LanguageDetectionConfig contains the config for Language Detection.
Expand Down
80 changes: 80 additions & 0 deletions api/datadoghq/v2alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4d23512

Please sign in to comment.