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

Move condition logic to main module #1618

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

davidor
Copy link
Member

@davidor davidor commented Jan 10, 2025

What does this PR do?

Moves the logic in api/datadoghq/v2alpha1/condition.go to the main module.

That file depends on EDS and we'd rather avoid having that dependency in the api module. Otherwise, projects importing it will indirectly depend on EDS too. It makes sense to move this logic to the main module because it doesn't have any CRD definitions, which is the point of the api module.

Describe your test plan

It's a refactor. Tests should be enough.

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

@davidor davidor added the enhancement New feature or request label Jan 10, 2025
@davidor davidor added this to the v1.13.0 milestone Jan 10, 2025
@davidor davidor requested a review from a team as a code owner January 10, 2025 13:57
@@ -31,28 +33,19 @@ const (
DatadogAgentStateFailed DatadogAgentState = "Failed"
)

// UpdateDatadogAgentStatusConditionsFailure used to update the failure StatusConditions
Copy link
Member Author

Choose a reason for hiding this comment

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

For reviewers: I deleted this function and others that were not used.

@codecov-commenter
Copy link

codecov-commenter commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 27.45098% with 37 lines in your changes missing coverage. Please review.

Project coverage is 48.82%. Comparing base (fb1cc16) to head (24adfda).

Files with missing lines Patch % Lines
pkg/controller/utils/datadog/condition.go 9.52% 19 Missing ⚠️
...troller/datadogagent/controller_reconcile_agent.go 33.33% 6 Missing ⚠️
...ler/datadogagent/controller_reconcile_v2_common.go 0.00% 4 Missing ⚠️
...controller/datadogagent/controller_reconcile_v2.go 57.14% 3 Missing ⚠️
...ontroller/datadogagent/controller_reconcile_dca.go 50.00% 2 Missing ⚠️
pkg/controller/utils/datadog/metrics_forwarder.go 0.00% 2 Missing ⚠️
...ontroller/datadogagent/controller_reconcile_ccr.go 75.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1618      +/-   ##
==========================================
- Coverage   49.28%   48.82%   -0.47%     
==========================================
  Files         216      217       +1     
  Lines       20662    20882     +220     
==========================================
+ Hits        10184    10196      +12     
- Misses       9942    10149     +207     
- Partials      536      537       +1     
Flag Coverage Δ
unittests 48.82% <27.45%> (-0.47%) ⬇️

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% <75.00%> (ø)
...ontroller/datadogagent/controller_reconcile_dca.go 52.63% <50.00%> (ø)
pkg/controller/utils/datadog/metrics_forwarder.go 31.74% <0.00%> (ø)
...controller/datadogagent/controller_reconcile_v2.go 51.89% <57.14%> (ø)
...ler/datadogagent/controller_reconcile_v2_common.go 29.96% <0.00%> (ø)
...troller/datadogagent/controller_reconcile_agent.go 53.44% <33.33%> (ø)
pkg/controller/utils/datadog/condition.go 5.45% <9.52%> (ø)

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 fb1cc16...24adfda. Read the comment docs.

To avoid depending on EDS in the api module
@davidor davidor force-pushed the davidor/move-condition-out-of-api-mod branch from 5a609e1 to 24adfda Compare January 10, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants