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

Add global environment variable config #1406

Merged
merged 6 commits into from
Sep 13, 2024
Merged

Conversation

swang392
Copy link
Contributor

@swang392 swang392 commented Sep 11, 2024

What does this PR do?

Added configuration for global environment variables; environment variables defined in global.env of the Datadog Agent CRD will be set across all agents in Operator.

Motivation

issue 961

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: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

  • add example env variables to local Datadog Agent yaml file and check the logs and CRD when deploying to operator

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

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

This pull request does not contain a valid label. Please add one of the following labels: bug, enhancement, refactoring, documentation, tooling, dependencies

@swang392 swang392 added the enhancement New feature or request label Sep 11, 2024
@swang392 swang392 added this to the v1.10.0 milestone Sep 11, 2024
@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 35.00000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 47.63%. Comparing base (6d4bbd9) to head (4a0a15a).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
internal/controller/testutils/agent.go 0.00% 13 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1406      +/-   ##
==========================================
+ Coverage   47.40%   47.63%   +0.22%     
==========================================
  Files         223      224       +1     
  Lines       19244    19522     +278     
==========================================
+ Hits         9123     9299     +176     
- Misses       9635     9723      +88     
- Partials      486      500      +14     
Flag Coverage Δ
unittests 47.63% <35.00%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
api/datadoghq/v2alpha1/datadogagent_types.go 100.00% <ø> (ø)
api/datadoghq/v2alpha1/test/builder.go 91.49% <100.00%> (+0.04%) ⬆️
...nternal/controller/datadogagent/override/global.go 42.14% <100.00%> (+0.97%) ⬆️
internal/controller/testutils/agent.go 0.00% <0.00%> (ø)

... and 2 files with indirect coverage changes


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 6d4bbd9...4a0a15a. Read the comment docs.

@swang392 swang392 marked this pull request as ready for review September 11, 2024 21:05
@swang392 swang392 requested review from a team as code owners September 11, 2024 21:05
Copy link
Member

@tbavelier tbavelier left a comment

Choose a reason for hiding this comment

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

Left some comments, looks good overall, a few things to tweak

@@ -137,6 +137,14 @@ func applyGlobalSettings(logger logr.Logger, manager feature.PodTemplateManagers
}
}

// Env is a list of custom global variables that are set across all agents.
if config.Env != nil {
logger.V(1).Info(fmt.Sprintf("Adding custom environment variable %s", config.Env))
Copy link
Member

Choose a reason for hiding this comment

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

Let's discuss with the team offline if we add this log in the end or not

@swang392 swang392 merged commit 69ef43b into main Sep 13, 2024
19 checks passed
@swang392 swang392 deleted the sarah-globalenv-config branch September 13, 2024 17:27
mftoure pushed a commit that referenced this pull request Oct 3, 2024
* add global environment variable

* add tests for global env

* update comments

* update formatting, logging, config docs

* update CRD

* remove global env log statement
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.

4 participants