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

Improve support for environment autodiscovery by removing explicit setting of DOCKER_HOST by default with Agent 7.27+ #303

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

vboulineau
Copy link
Contributor

What does this PR do?

A brief description of the change being made with this pull request.

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Describe your test plan

  • Deploy Agent >= 7.27 with Operator, DOCKER_HOST should not be set and /var/run should be mounted to /host/var/run
  • Deploy Agent < 7.27 with Operator, DOCKER_HOST should be set and /var/run should be mounted to /host/var/run

@vboulineau vboulineau added this to the v0.7 milestone May 10, 2021
@vboulineau vboulineau requested a review from a team as a code owner May 10, 2021 16:05
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, documentation

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, documentation

@vboulineau vboulineau added the enhancement New feature or request label May 19, 2021
// Don't default Docker/CRI paths with Agent >= 7.27.0
// Let Env AD do the work for us
agentTag := utils.GetTagFromImageName(agent.Image.Name)
if !(agentTag == "latest" || utils.IsAboveMinVersion(agentTag, "7.27.0")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

does this support agent 6 and jmx images?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, changed.

import "github.com/Masterminds/semver/v3"

// IsAboveMinVersion uses semver to check if `version` is >= minVersion
func IsAboveMinVersion(version, minVersion string) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

mind adding a unit test? 🙇

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

…tting of DOCKER_HOST by default with Agent 7.27+
@codecov-commenter
Copy link

codecov-commenter commented Jun 1, 2021

Codecov Report

Merging #303 (d7b45a7) into main (8b4b796) will decrease coverage by 1.93%.
The diff coverage is 48.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #303      +/-   ##
==========================================
- Coverage   58.22%   56.28%   -1.94%     
==========================================
  Files          59       60       +1     
  Lines        6300     6593     +293     
==========================================
+ Hits         3668     3711      +43     
- Misses       2362     2608     +246     
- Partials      270      274       +4     
Flag Coverage Δ
unittests 56.28% <48.64%> (-1.94%) ⬇️

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

Impacted Files Coverage Δ
api/v1alpha1/datadogagent_default.go 16.42% <0.00%> (+2.35%) ⬆️
pkg/utils/utils.go 30.00% <0.00%> (-70.00%) ⬇️
pkg/utils/version.go 71.42% <71.42%> (ø)
controllers/datadogagent/utils.go 81.60% <83.78%> (-0.46%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b4b796...d7b45a7. Read the comment docs.

@vboulineau vboulineau merged commit 62d4dc7 into main Jun 1, 2021
@vboulineau vboulineau deleted the vboulineau/ad_env branch June 1, 2021 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants