Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DatadogAgent][Flare] Additional environment variables and RBAC to permit user manifests retrieval #1477

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

tbavelier
Copy link
Member

@tbavelier tbavelier commented Oct 22, 2024

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 the DatadogAgent custom resource
  • Adds RBAC allowing the DCA to get the DatadogAgent custom resource from its namespace

Motivation

Similar to DataDog/helm-charts#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: DataDog/datadog-agent#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 DatadogAgent with cluster Agent enabled (default):
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata:
  name: foo
  • Assert on DCA:
    • AGENT_DAEMONSET: foo-agent, value of kubectl get ds
    • CLUSTER_AGENT_DEPLOYMENT: foo-cluster-agent, value of kubectl get deploy
    • DATADOG_AGENT_CR_NAME: foo, value of kubectl 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 of kubectl get ds
    • CLUSTER_AGENT_DEPLOYMENT: y, value of kubectl get deploy
    • DATADOG_AGENT_CR_NAME: foo, value of kubectl get dd

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label

@tbavelier tbavelier added the enhancement New feature or request label Oct 22, 2024
@tbavelier tbavelier added this to the v1.11.0 milestone Oct 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2024

Codecov Report

Attention: Patch coverage is 76.47059% with 8 lines in your changes missing coverage. Please review.

Project coverage is 48.75%. Comparing base (7b66b25) to head (d3e2ead).

Files with missing lines Patch % Lines
...troller/datadogagent/feature/enabledefault/rbac.go 0.00% 8 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1477      +/-   ##
==========================================
+ Coverage   48.70%   48.75%   +0.04%     
==========================================
  Files         224      225       +1     
  Lines       19845    19879      +34     
==========================================
+ Hits         9666     9692      +26     
- Misses       9670     9678       +8     
  Partials      509      509              
Flag Coverage Δ
unittests 48.75% <76.47%> (+0.04%) ⬆️

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%) ⬆️
...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 data
Powered by Codecov. Last update 7b66b25...d3e2ead. Read the comment docs.

@tbavelier tbavelier marked this pull request as ready for review October 22, 2024 09:25
@tbavelier tbavelier requested a review from a team as a code owner October 22, 2024 09:25
Comment on lines +9 to +11
DDAgentDaemonSet = "AGENT_DAEMONSET"
DDClusterAgentDeployment = "CLUSTER_AGENT_DEPLOYMENT"
DDDatadogAgentCustomResource = "DATADOG_AGENT_CR_NAME"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
DDAgentDaemonSet = "AGENT_DAEMONSET"
DDClusterAgentDeployment = "CLUSTER_AGENT_DEPLOYMENT"
DDDatadogAgentCustomResource = "DATADOG_AGENT_CR_NAME"
DDAgentDaemonSet = "NODE_AGENT_DAEMONSET"
DDClusterAgentDeployment = "CLUSTER_AGENT_DEPLOYMENT"
DDDatadogAgentCustomResource = "DATADOGAGENT_CR_NAME"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants