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

[cleanup] move uncommon items from api/common/v1 #1407

Merged
merged 5 commits into from
Sep 20, 2024

Conversation

celenechang
Copy link
Contributor

What does this PR do?

Move items out of common/v1 that are no longer needed there (i.e. they are specific to the v2alpha1 API)
Move a few items in common/const.go to prevent circular imports. The rest will be reviewed/moved in a future PR
Consolidate remaining common/types into a single file
Consolidate CustomConfig definitions into a single definition in the v2alpha1 API (and remove conversion function)

Motivation

What inspired you to submit this pull request?

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

Change should be noop.
Make sure that the image builds and runs without issue.
Make sure that the Dogstatsd feature works with a CustomConfig.

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

@celenechang celenechang added this to the v1.10.0 milestone Sep 11, 2024
@celenechang celenechang requested review from a team as code owners September 11, 2024 21:08
@codecov-commenter
Copy link

codecov-commenter commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 69.30533% with 190 lines in your changes missing coverage. Please review.

Project coverage is 48.94%. Comparing base (6d4bbd9) to head (d76f963).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
api/datadoghq/v2alpha1/utils.go 14.92% 57 Missing ⚠️
internal/controller/testutils/agent.go 0.00% 22 Missing ⚠️
pkg/agentprofile/agent_profile.go 48.71% 17 Missing and 3 partials ⚠️
api/datadoghq/v2alpha1/condition.go 0.00% 11 Missing ⚠️
...ler/datadogagent/controller_reconcile_v2_common.go 27.27% 8 Missing ⚠️
internal/controller/datadogagent/merger/envvars.go 0.00% 6 Missing ⚠️
...adogagent/component/clusterchecksrunner/default.go 0.00% 5 Missing ⚠️
...nal/controller/datadogagent/merger/volume_mount.go 0.00% 5 Missing ⚠️
...nal/controller/datadogagent/component/agent/new.go 0.00% 4 Missing ⚠️
.../controller/datadogagent/feature/test/testsuite.go 0.00% 4 Missing ⚠️
... and 30 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1407      +/-   ##
==========================================
+ Coverage   47.40%   48.94%   +1.53%     
==========================================
  Files         223      221       -2     
  Lines       19244    19246       +2     
==========================================
+ Hits         9123     9420     +297     
+ Misses       9635     9343     -292     
+ Partials      486      483       -3     
Flag Coverage Δ
unittests 48.94% <69.30%> (+1.53%) ⬆️

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

Files with missing lines Coverage Δ
...pi/datadoghq/v1alpha1/datadogagentprofile_types.go 100.00% <ø> (ø)
api/datadoghq/v1alpha1/datadogdashboard_types.go 100.00% <ø> (ø)
api/datadoghq/v2alpha1/datadogagent_default.go 89.31% <100.00%> (ø)
api/datadoghq/v2alpha1/datadogagent_types.go 100.00% <ø> (ø)
api/datadoghq/v2alpha1/test/builder.go 91.49% <100.00%> (+0.04%) ⬆️
api/utils/utils.go 4.34% <100.00%> (-66.87%) ⬇️
internal/controller/datadogagent/common/utils.go 83.33% <100.00%> (ø)
...ler/datadogagent/component/clusteragent/default.go 96.85% <100.00%> (ø)
...troller/datadogagent/controller_reconcile_agent.go 53.44% <100.00%> (ø)
...controller/datadogagent/controller_reconcile_v2.go 53.91% <100.00%> (ø)
... and 68 more

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...d76f963. Read the comment docs.

Copy link
Member

@davidor davidor left a comment

Choose a reason for hiding this comment

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

👍 for files owned by container-platform

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.

LGTM, left a minor comment that we can discuss offline
Bonus: .configData still works 👍

╰─❯ k get dd datadog -ojson | jq .spec.features.dogstatsd
{
  "mapperProfiles": {
    "configData": "- name: 'abc'\n  prefix: 'abc'\n  mappings:\n      - match: 'abc.*'\n        match_type: 'regex'\n        name: 'abc'"
  }
}
╭─ ~                                                                                                                                                                   ⎈ kind-local-k8s/system 15:12:16
╰─❯ k exec -it datadog-agent-tv867 -- bash
Defaulted container "agent" out of: agent, process-agent, init-volume (init), init-config (init)
root@datadog-agent-tv867:/# agent config | grep mapper_profiles -A 10
dogstatsd_mapper_profiles:
- mappings:
  - match: abc.*
    match_type: regex
    name: abc
    tags: {}
  name: abc
  prefix: abc

api/datadoghq/common/types.go Show resolved Hide resolved
@celenechang celenechang merged commit 909a576 into main Sep 20, 2024
19 checks passed
@celenechang celenechang deleted the celene/cleanup_commonv1 branch September 20, 2024 13:18
mftoure pushed a commit that referenced this pull request Oct 3, 2024
* [cleanup] move uncommon items from api/common/v1

* small fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants