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] reorganize rbac-related methods #1351

Merged
merged 6 commits into from
Aug 26, 2024

Conversation

celenechang
Copy link
Contributor

@celenechang celenechang commented Aug 13, 2024

What does this PR do?

  • Move RBACs only used in enabledefault feature into enabledefault/rbac.go
  • Move configmap only used in enabledefault feature into enabledefault/configmap.go
  • Move most items from github.com/DataDog/datadog-operator/controllers/datadogagent/component/utils.go to github.com/DataDog/datadog-operator/controllers/datadogagent/common, and have this package be "lowest" (doesn't import from most other operator packages)
  • Move network-related methods into github.com/DataDog/datadog-operator/controllers/datadogagent/component/objects , since one of these methods requires importing from the component files. Unfortunately can't group it with the volume functions because that results in a dependency loop.

Planned future work: see if we can consolidate common files

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

Write there any instructions and details you may have to test your PR.

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.9.0 milestone Aug 13, 2024
@celenechang celenechang requested a review from a team as a code owner August 13, 2024 14:30
@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 34.75027% with 614 lines in your changes missing coverage. Please review.

Project coverage is 47.13%. Comparing base (4d6eaaf) to head (5e772b0).

Files Patch % Lines
...rollers/datadogagent/feature/enabledefault/rbac.go 0.00% 239 Missing ⚠️
...rs/datadogagent/feature/enabledefault/configmap.go 0.00% 223 Missing ⚠️
...ontrollers/datadogagent/component/agent/default.go 0.00% 97 Missing ⚠️
...adogagent/component/clusterchecksrunner/default.go 6.66% 14 Missing ⚠️
controllers/datadogagent/common/utils.go 83.33% 11 Missing and 2 partials ⚠️
...lers/datadogagent/feature/enabledefault/feature.go 20.00% 8 Missing ⚠️
...rs/datadogagent/feature/externalmetrics/feature.go 55.55% 4 Missing ⚠️
controllers/datadogagent/feature/otlp/feature.go 0.00% 1 Missing and 2 partials ⚠️
controllers/datadogagent/component/agent/new.go 0.00% 2 Missing ⚠️
...ers/datadogagent/component/clusteragent/default.go 92.30% 2 Missing ⚠️
... and 5 more
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1351      +/-   ##
==========================================
- Coverage   47.18%   47.13%   -0.06%     
==========================================
  Files         215      217       +2     
  Lines       18702    18714      +12     
==========================================
- Hits         8824     8820       -4     
- Misses       9411     9427      +16     
  Partials      467      467              
Flag Coverage Δ
unittests 47.13% <34.75%> (-0.06%) ⬇️

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

Files Coverage Δ
controllers/datadogagent/common/volumes.go 100.00% <100.00%> (ø)
...llers/datadogagent/component/clusteragent/utils.go 0.00% <ø> (-12.73%) ⬇️
...rollers/datadogagent/controller_reconcile_agent.go 53.44% <100.00%> (ø)
controllers/datadogagent/dependencies/store.go 64.47% <100.00%> (ø)
...lers/datadogagent/feature/clusterchecks/feature.go 62.04% <100.00%> (ø)
...tadogagent/feature/orchestratorexplorer/feature.go 79.23% <100.00%> (ø)
controllers/datadogagent/feature/utils/utils.go 100.00% <100.00%> (ø)
controllers/datadogagent/override/dependencies.go 54.05% <100.00%> (+1.27%) ⬆️
...trollers/datadogagent/component/objects/network.go 3.31% <75.00%> (ø)
controllers/datadogagent/component/agent/new.go 4.00% <0.00%> (ø)
... and 13 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 4d6eaaf...5e772b0. Read the comment docs.

@celenechang celenechang requested review from a team as code owners August 14, 2024 11:59
@celenechang celenechang merged commit a473ab0 into main Aug 26, 2024
19 checks passed
@celenechang celenechang deleted the celene/serviceaccount_cleanup branch August 26, 2024 17:14
mftoure pushed a commit that referenced this pull request Oct 3, 2024
* [cleanup] reorganize rbac-related methods

* separate out networks into objects

* small fix
mftoure pushed a commit that referenced this pull request Oct 3, 2024
* [cleanup] reorganize rbac-related methods

* separate out networks into objects

* 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.

3 participants