Skip to content

Commit 849be07

Browse files
dd-octo-sts[bot]betterengineeringMathew-Estafanous
authored
feat: Add APM to DatadogInstrumentation CRD (#2984) (#2994)
This commit adds the schema required to utilize the DatadogInstrumentation CRD for APM. (cherry picked from commit d97a3dc) Co-authored-by: Mark Spicer <mark.spicer@datadoghq.com> Co-authored-by: Mathew Estafanous <56979977+Mathew-Estafanous@users.noreply.github.com>
1 parent b066672 commit 849be07

4 files changed

Lines changed: 400 additions & 0 deletions

File tree

api/datadoghq/v1alpha1/datadoginstrumentation_types.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package v1alpha1
77

88
import (
99
autoscalingv2 "k8s.io/api/autoscaling/v2"
10+
corev1 "k8s.io/api/core/v1"
1011
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1112
"k8s.io/apimachinery/pkg/runtime"
1213
)
@@ -26,6 +27,27 @@ type DatadogInstrumentationConfig struct {
2627
// +optional
2728
// +listType=atomic
2829
Checks []DatadogInstrumentationCheckConfig `json:"checks,omitempty"`
30+
31+
// APM configures the APM product through Single Step Instrumentation for the target workload.
32+
// +optional
33+
APM DatadogInstrumentationAPMConfig `json:"apm,omitempty"`
34+
}
35+
36+
// DatadogInstrumentationAPMConfig defines workload-scoped APM configuration.
37+
type DatadogInstrumentationAPMConfig struct {
38+
// Enabled turns on APM via Single Step Instrumentation to automatically install the Datadog SDKs for supported
39+
// languages with no additional configuration required.
40+
Enabled bool `json:"enabled,omitempty"`
41+
// TracerVersions is a map of SDK versions to install for target workload. The key is the language name and the
42+
// value is the version to use. If omitted, all default supported SDKs will be added to the application runtime.
43+
// +optional
44+
TracerVersions map[string]string `json:"ddTraceVersions,omitempty"`
45+
// TracerConfigs is a list of configuration options to use for the installed SDKs. These options will be added
46+
// as environment variables to the workload in addition to the configured SDKs.
47+
// +optional
48+
// +listType=map
49+
// +listMapKey=name
50+
TracerConfigs []corev1.EnvVar `json:"ddTraceConfigs,omitempty"`
2951
}
3052

3153
// DatadogInstrumentationCheckConfig defines an Autodiscovery check configuration.

api/datadoghq/v1alpha1/zz_generated.deepcopy.go

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/v1/datadoghq.com_datadoginstrumentations.yaml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,174 @@ spec:
5757
config:
5858
description: Config defines the Datadog instrumentation configuration to apply to the target workload.
5959
properties:
60+
apm:
61+
description: APM configures the APM product through Single Step Instrumentation for the target workload.
62+
properties:
63+
ddTraceConfigs:
64+
description: |-
65+
TracerConfigs is a list of configuration options to use for the installed SDKs. These options will be added
66+
as environment variables to the workload in addition to the configured SDKs.
67+
items:
68+
description: EnvVar represents an environment variable present in a Container.
69+
properties:
70+
name:
71+
description: |-
72+
Name of the environment variable.
73+
May consist of any printable ASCII characters except '='.
74+
type: string
75+
value:
76+
description: |-
77+
Variable references $(VAR_NAME) are expanded
78+
using the previously defined environment variables in the container and
79+
any service environment variables. If a variable cannot be resolved,
80+
the reference in the input string will be unchanged. Double $$ are reduced
81+
to a single $, which allows for escaping the $(VAR_NAME) syntax: i.e.
82+
"$$(VAR_NAME)" will produce the string literal "$(VAR_NAME)".
83+
Escaped references will never be expanded, regardless of whether the variable
84+
exists or not.
85+
Defaults to "".
86+
type: string
87+
valueFrom:
88+
description: Source for the environment variable's value. Cannot be used if value is not empty.
89+
properties:
90+
configMapKeyRef:
91+
description: Selects a key of a ConfigMap.
92+
properties:
93+
key:
94+
description: The key to select.
95+
type: string
96+
name:
97+
default: ""
98+
description: |-
99+
Name of the referent.
100+
This field is effectively required, but due to backwards compatibility is
101+
allowed to be empty. Instances of this type with an empty value here are
102+
almost certainly wrong.
103+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
104+
type: string
105+
optional:
106+
description: Specify whether the ConfigMap or its key must be defined
107+
type: boolean
108+
required:
109+
- key
110+
type: object
111+
x-kubernetes-map-type: atomic
112+
fieldRef:
113+
description: |-
114+
Selects a field of the pod: supports metadata.name, metadata.namespace, `metadata.labels['<KEY>']`, `metadata.annotations['<KEY>']`,
115+
spec.nodeName, spec.serviceAccountName, status.hostIP, status.podIP, status.podIPs.
116+
properties:
117+
apiVersion:
118+
description: Version of the schema the FieldPath is written in terms of, defaults to "v1".
119+
type: string
120+
fieldPath:
121+
description: Path of the field to select in the specified API version.
122+
type: string
123+
required:
124+
- fieldPath
125+
type: object
126+
x-kubernetes-map-type: atomic
127+
fileKeyRef:
128+
description: |-
129+
FileKeyRef selects a key of the env file.
130+
Requires the EnvFiles feature gate to be enabled.
131+
properties:
132+
key:
133+
description: |-
134+
The key within the env file. An invalid key will prevent the pod from starting.
135+
The keys defined within a source may consist of any printable ASCII characters except '='.
136+
During Alpha stage of the EnvFiles feature gate, the key size is limited to 128 characters.
137+
type: string
138+
optional:
139+
default: false
140+
description: |-
141+
Specify whether the file or its key must be defined. If the file or key
142+
does not exist, then the env var is not published.
143+
If optional is set to true and the specified key does not exist,
144+
the environment variable will not be set in the Pod's containers.
145+
146+
If optional is set to false and the specified key does not exist,
147+
an error will be returned during Pod creation.
148+
type: boolean
149+
path:
150+
description: |-
151+
The path within the volume from which to select the file.
152+
Must be relative and may not contain the '..' path or start with '..'.
153+
type: string
154+
volumeName:
155+
description: The name of the volume mount containing the env file.
156+
type: string
157+
required:
158+
- key
159+
- path
160+
- volumeName
161+
type: object
162+
x-kubernetes-map-type: atomic
163+
resourceFieldRef:
164+
description: |-
165+
Selects a resource of the container: only resources limits and requests
166+
(limits.cpu, limits.memory, limits.ephemeral-storage, requests.cpu, requests.memory and requests.ephemeral-storage) are currently supported.
167+
properties:
168+
containerName:
169+
description: 'Container name: required for volumes, optional for env vars'
170+
type: string
171+
divisor:
172+
anyOf:
173+
- type: integer
174+
- type: string
175+
description: Specifies the output format of the exposed resources, defaults to "1"
176+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
177+
x-kubernetes-int-or-string: true
178+
resource:
179+
description: 'Required: resource to select'
180+
type: string
181+
required:
182+
- resource
183+
type: object
184+
x-kubernetes-map-type: atomic
185+
secretKeyRef:
186+
description: Selects a key of a secret in the pod's namespace
187+
properties:
188+
key:
189+
description: The key of the secret to select from. Must be a valid secret key.
190+
type: string
191+
name:
192+
default: ""
193+
description: |-
194+
Name of the referent.
195+
This field is effectively required, but due to backwards compatibility is
196+
allowed to be empty. Instances of this type with an empty value here are
197+
almost certainly wrong.
198+
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
199+
type: string
200+
optional:
201+
description: Specify whether the Secret or its key must be defined
202+
type: boolean
203+
required:
204+
- key
205+
type: object
206+
x-kubernetes-map-type: atomic
207+
type: object
208+
required:
209+
- name
210+
type: object
211+
type: array
212+
x-kubernetes-list-map-keys:
213+
- name
214+
x-kubernetes-list-type: map
215+
ddTraceVersions:
216+
additionalProperties:
217+
type: string
218+
description: |-
219+
TracerVersions is a map of SDK versions to install for target workload. The key is the language name and the
220+
value is the version to use. If omitted, all default supported SDKs will be added to the application runtime.
221+
type: object
222+
enabled:
223+
description: |-
224+
Enabled turns on APM via Single Step Instrumentation to automatically install the Datadog SDKs for supported
225+
languages with no additional configuration required.
226+
type: boolean
227+
type: object
60228
checks:
61229
description: Checks configures Datadog Agent Autodiscovery checks for the target workload.
62230
items:

0 commit comments

Comments
 (0)