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] Remove operator reference in /api folder, refactor v2alpha files #1576

Merged
merged 7 commits into from
Dec 26, 2024

Conversation

swang392
Copy link
Contributor

@swang392 swang392 commented Dec 17, 2024

What does this PR do?

Moved:

  • some consts and a v2alpha1/utils from api/datadoghq/v2alpha1 to a new directory pkg/constants/.
  • v2alpha1/test to pkg/testutils
  • v2alpha1/datadogagent_default to a new folder, internal/controller/defaults

Motivation

We want to create a new go module for /api, so files that are not specific to the CRDs should be moved out of the /api folder. There are some files in /api that depended on datadog-operator/pkg/defaulting -- this dependency should be removed because a project depending on the /api module would indirectly depend on datadog-operator too.

Additional Notes

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

Make sure the binary builds and runs as expected. The change is noop.

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.12.0 milestone Dec 17, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2024

Codecov Report

Attention: Patch coverage is 76.84729% with 47 lines in your changes missing coverage. Please review.

Project coverage is 48.94%. Comparing base (efaa4e9) to head (f2d0ac3).

Files with missing lines Patch % Lines
pkg/constants/utils.go 65.38% 8 Missing and 1 partial ⚠️
...adogagent/component/clusterchecksrunner/default.go 30.00% 7 Missing ⚠️
internal/controller/testutils/agent.go 0.00% 6 Missing ⚠️
...nal/controller/datadogagent/feature/apm/feature.go 60.00% 3 Missing and 1 partial ⚠️
...controller/datadogagent/component/agent/default.go 80.00% 3 Missing ⚠️
...ller/datadogagent/defaults/datadogagent_default.go 95.08% 3 Missing ⚠️
...nternal/controller/datadogagent/override/global.go 25.00% 3 Missing ⚠️
...oller/datadogagent/component/clusteragent/utils.go 33.33% 2 Missing ⚠️
pkg/testutils/builder.go 50.00% 2 Missing ⚠️
internal/controller/datadogagent/common/utils.go 0.00% 1 Missing ⚠️
... and 7 more
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1576   +/-   ##
=======================================
  Coverage   48.94%   48.94%           
=======================================
  Files         227      227           
  Lines       20635    20635           
=======================================
  Hits        10100    10100           
  Misses      10010    10010           
  Partials      525      525           
Flag Coverage Δ
unittests 48.94% <76.84%> (ø)

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

Files with missing lines Coverage Δ
...ontroller/datadogagent/controller_reconcile_ccr.go 65.34% <100.00%> (ø)
...ontroller/datadogagent/controller_reconcile_dca.go 52.63% <100.00%> (ø)
...controller/datadogagent/controller_reconcile_v2.go 51.89% <100.00%> (ø)
...atadogagent/feature/admissioncontroller/feature.go 66.26% <100.00%> (ø)
...roller/datadogagent/feature/autoscaling/feature.go 72.91% <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/dogstatsd/feature.go 68.42% <100.00%> (ø)
...ller/datadogagent/feature/enabledefault/feature.go 36.62% <100.00%> (ø)
...er/datadogagent/feature/eventcollection/feature.go 62.31% <100.00%> (ø)
... and 26 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 efaa4e9...f2d0ac3. Read the comment docs.

@swang392 swang392 marked this pull request as ready for review December 17, 2024 22:06
@swang392 swang392 requested review from a team as code owners December 17, 2024 22:06
@levan-m
Copy link
Contributor

levan-m commented Dec 18, 2024

See this discussion here #1562 (comment).
Given there are api->controller dependencies not considered earlier, instead of eliminating the dependencies we should just move everything not related to CRDs to the main module now - things like env vars, constants, some utilities (secrets.go, condition.go, utils.go, etc).
cc @celenechang

swang392 and others added 3 commits December 19, 2024 14:20
v2alpha1/test to pkg/testutils and v2alpha1/datadogagent_default to internal/controller/defaults
@swang392 swang392 requested a review from a team as a code owner December 26, 2024 16:16
@swang392 swang392 force-pushed the swang392/refactor-api branch from 9b7ec48 to 2de4baf Compare December 26, 2024 18:25
@levan-m
Copy link
Contributor

levan-m commented Dec 26, 2024

this is a non-functional change and can be merged without approvals from other teams.

@swang392 swang392 changed the title [cleanup] Remove reference to operator in /api folder [cleanup] Remove operator reference in /api folder, refactor v2alpha files Dec 26, 2024
@swang392 swang392 merged commit 6eae617 into main Dec 26, 2024
19 checks passed
@swang392 swang392 deleted the swang392/refactor-api branch December 26, 2024 20:27
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