datadog-operator
datadog-operator copied to clipboard
[profiles] Override node agent env vars with profiles
What does this PR do?
Adds the ability to override node agent env vars with profiles
Motivation
Internal request https://datadoghq.atlassian.net/browse/CECO-1225
Additional Notes
Anything else we should know when reviewing?
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
- Agent: n/a
- Cluster Agent: n/a
Describe your test plan
- Spin up the operator with profiles enabled
- Deploy a DatadogAgent with an env var override for one of the agent containers. Example:
override:
nodeAgent:
containers:
agent:
env:
- name: TEST
value: "foo"
- Check that the override works. In the above example, the
agent
container should have env varTEST: foo
- Apply a profile that:
- overrides the DatadogAgent's env var
- adds a new env var using
value
- adds a new env var using
valueFrom
override:
nodeAgent:
containers:
agent:
env:
- name: TEST
value: "test"
- {name: TEST_VALUE_FROM, valueFrom: {fieldRef: {fieldPath: status.hostIP}}}
- name: ANOTHER_VALUE_FROM
valueFrom:
fieldRef:
fieldPath: status.hostIP
resources:
limits:
cpu: "0.25"
trace-agent:
env:
- name: TRACE_TEST
value: "trace_test"
- Check for expected results. If using the above examples, we'd expect the
agent
container for a profile-created node agent had env varTEST:test
but the node agent container that wasn't created by the profile still hadTEST:foo
. The profile-created node agent should also have bothTEST_VALUE_FROM
andANOTHER_VALUE_FROM
set to the node'sstatus.hostIP
. The trace agent should haveTRACE_TEST:trace_test
and the process agent shouldn't have any env var overrides
# profile-created node agent
# agent container
TEST: test
TEST_VALUE_FROM: (v1:status.hostIP)
ANOTHER_VALUE_FROM: (v1:status.hostIP)
# trace agent container
TRACE_TEST: trace_test
Checklist
- [x] PR has at least one valid label:
bug
,enhancement
,refactoring
,documentation
,tooling
, and/ordependencies
- [x] PR has a milestone or the
qa/skip-qa
label