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

Merged
merged 20 commits into from
Feb 12, 2025
Merged

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-commenter commented Jan 23, 2025

Codecov Report

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

Project coverage is 49.49%. Comparing base (b8dad05) to head (f5e240e).

Files with missing lines Patch % Lines
...nternal/controller/datadogagent/override/global.go 40.00% 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   49.49%   49.49%           
=======================================
  Files         218      218           
  Lines       21244    21244           
=======================================
  Hits        10515    10515           
  Misses      10182    10182           
  Partials      547      547           
Flag Coverage Δ
unittests 49.49% <79.92%> (ø)

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%> (ø)
...ler/datadogagent/controller_reconcile_v2_common.go 41.79% <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%> (ø)
... and 41 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 b8dad05...f5e240e. 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
Copy link
Contributor

@celenechang celenechang left a comment

Choose a reason for hiding this comment

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

Looked over it just at a high level. Thanks for the effort here 💪

pkg/defaulting/images.go Outdated Show resolved Hide resolved
@swang392 swang392 merged commit ba1f2e5 into main Feb 12, 2025
19 checks passed
@swang392 swang392 deleted the swang392/refactor-api-const branch February 12, 2025 15:54
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.

6 participants