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 consts out of api/v2alpha1 #1639

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

Conversation

swang392
Copy link
Contributor

@swang392 swang392 commented Jan 23, 2025

What does this PR do?

moves constants not used in the CRDs out of the /api folder to:

  • internal/controller/datadogagent/common/const.go if they are used in the controller and in multiple features
  • a specific const.go file in a feature if it's used exclusively in one feature
  • a new package pkg/constants/ if they are used in a package

Motivation

We don't need to have the constants in /api if they aren't relevant to the CRDs. Moving the constants closer to where they are used makes the code easier to maintain.

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

should have no effect, everything builds and runs as normal

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

@swang392 swang392 added this to the v1.13.0 milestone Jan 23, 2025
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 79.01235% with 51 lines in your changes missing coverage. Please review.

Project coverage is 48.93%. Comparing base (98ae1c6) to head (361a791).

Files with missing lines Patch % Lines
...nternal/controller/datadogagent/override/global.go 33.33% 5 Missing and 1 partial ⚠️
...adogagent/component/clusterchecksrunner/default.go 0.00% 5 Missing ⚠️
...troller/datadogagent/controller_reconcile_agent.go 28.57% 5 Missing ⚠️
...oller/datadogagent/component/clusteragent/utils.go 0.00% 4 Missing ⚠️
...ntroller/datadogagent/feature/dogstatsd/feature.go 55.55% 4 Missing ⚠️
...controller/datadogagent/component/agent/default.go 80.00% 3 Missing ⚠️
pkg/condition/condition.go 0.00% 3 Missing ⚠️
...ntroller/datadogagent/component/objects/network.go 0.00% 2 Missing ⚠️
...ontroller/datadogagent/controller_reconcile_dca.go 33.33% 2 Missing ⚠️
...atadogagent/feature/admissioncontroller/feature.go 66.66% 2 Missing ⚠️
... and 14 more
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1639   +/-   ##
=======================================
  Coverage   48.93%   48.93%           
=======================================
  Files         217      217           
  Lines       20892    20892           
=======================================
  Hits        10223    10223           
  Misses      10129    10129           
  Partials      540      540           
Flag Coverage Δ
unittests 48.93% <79.01%> (ø)

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

Files with missing lines Coverage Δ
internal/controller/datadogagent/common/utils.go 83.33% <100.00%> (ø)
internal/controller/datadogagent/common/volumes.go 100.00% <100.00%> (ø)
...ler/datadogagent/component/clusteragent/default.go 96.89% <100.00%> (ø)
...rnal/controller/datadogagent/feature/cspm/const.go 100.00% <ø> (ø)
...al/controller/datadogagent/feature/cspm/feature.go 75.20% <100.00%> (ø)
...nal/controller/datadogagent/feature/cws/feature.go 79.55% <100.00%> (ø)
...ntroller/datadogagent/feature/ebpfcheck/feature.go 83.60% <100.00%> (ø)
...ller/datadogagent/feature/eventcollection/const.go 100.00% <ø> (ø)
...er/datadogagent/feature/eventcollection/feature.go 62.31% <100.00%> (ø)
...controller/datadogagent/feature/helmcheck/const.go 100.00% <ø> (ø)
... and 39 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 98ae1c6...361a791. Read the comment docs.

@swang392 swang392 marked this pull request as ready for review January 23, 2025 21:22
@swang392 swang392 requested review from a team as code owners January 23, 2025 21:22
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.

2 participants