[DatadogAgent][Flare] Additional environment variables and RBAC to permit user manifests retrieval
What does this PR do?
- Adds 3 env vars to the cluster Agent:
-
AGENT_DAEMONSET: name of the node Agent ds -
CLUSTER_AGENT_DEPLOYMENT: name of the DCA deployment -
DATADOG_AGENT_CR_NAME: name of theDatadogAgentcustom resource
-
- Adds RBAC allowing the DCA to
gettheDatadogAgentcustom resource from its namespace
Motivation
Similar to https://github.com/DataDog/helm-charts/pull/965, we need to inject a few variables/give some permissions to be able to collect the Agent deployment files while creating a flare to help with troubleshooting.
Additional Notes
The flare feature depending on these variables is available at: https://github.com/DataDog/datadog-agent/pull/30372
Minimum Agent Versions
Are there minimum versions of the Datadog Agent and/or Cluster Agent required?
- Agent: vX.Y.Z
- Cluster Agent: vX.Y.Z
Describe your test plan
- Deploy the operator
- Deploy a
DatadogAgentwith cluster Agent enabled (default):
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: foo
- Assert on DCA:
-
AGENT_DAEMONSET:foo-agent, value ofkubectl get ds -
CLUSTER_AGENT_DEPLOYMENT:foo-cluster-agent, value ofkubectl get deploy -
DATADOG_AGENT_CR_NAME:foo, value ofkubectl get dd
-
- Add overrides:
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
name: foo
override:
nodeAgent:
name: "x"
clusterAgent:
name: "y"
- Assert on DCA:
-
AGENT_DAEMONSET:x, value ofkubectl get ds -
CLUSTER_AGENT_DEPLOYMENT:y, value ofkubectl get deploy -
DATADOG_AGENT_CR_NAME:foo, value ofkubectl get dd
-
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-qalabel
Codecov Report
:x: Patch coverage is 76.47059% with 8 lines in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 48.69%. Comparing base (7c7d028) to head (efec96e).
:warning: Report is 468 commits behind head on main.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| ...troller/datadogagent/feature/enabledefault/rbac.go | 0.00% | 8 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #1477 +/- ##
==========================================
+ Coverage 48.64% 48.69% +0.04%
==========================================
Files 224 225 +1
Lines 19869 19903 +34
==========================================
+ Hits 9666 9692 +26
- Misses 9694 9702 +8
Partials 509 509
| Flag | Coverage Δ | |
|---|---|---|
| unittests | 48.69% <76.47%> (+0.04%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| ...ller/datadogagent/feature/enabledefault/feature.go | 37.36% <100.00%> (+2.79%) |
:arrow_up: |
| ...roller/datadogagent/feature/enabledefault/utils.go | 100.00% <100.00%> (ø) |
|
| ...troller/datadogagent/feature/enabledefault/rbac.go | 0.00% <0.00%> (ø) |
Continue to review full report in Codecov by Sentry.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 7c7d028...efec96e. Read the comment docs.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.