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

[CECO-1763] Controller for generic custom resource #1534

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

Conversation

tbavelier
Copy link
Member

@tbavelier tbavelier commented Nov 21, 2024

What does this PR do?

Introduces a generic controller relying on Datadog Go client to handle CRUD operations on multiple resources. Initial support includes notebooks and synthetics (api/browser tests).
Examples:

apiVersion: datadoghq.com/v1alpha1
kind: DatadogGenericCR
metadata:
  name: api-test
spec:
    type: synthetics_api_test
    jsonSpec: |-
        {
           [...]
        }
apiVersion: datadoghq.com/v1alpha1
kind: DatadogGenericCR
metadata:
  name: notebook
spec:
    type: notebook
    jsonSpec: |-
        {
           [...]
        }

Additional Notes

Next steps:

  • Document fully-fledged examples
  • Document onboarding strategy (e.g. export current resource from the API, create the associated YAML, deploy them)
  • Document internally how to add new resources
  • UI button to export to manifest
  • Add option to start the controller in the Helm chart

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

  1. Include -datadogGenericCREnabled=true in args for the manager container to enable the controller
  2. Deploy examples
  3. Update their jsonSpec
  4. Ensure the changes are reflected in the UI
  5. Delete the resources
  6. Ensure they are removed from the UI

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

@tbavelier tbavelier added this to the v1.12.0 milestone Nov 21, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 40.28926% with 289 lines in your changes missing coverage. Please review.

Project coverage is 48.46%. Comparing base (6ff015c) to head (1f9164f).

Files with missing lines Patch % Lines
internal/controller/datadoggenericcr/controller.go 38.97% 74 Missing and 9 partials ⚠️
internal/controller/datadoggenericcr/utils.go 57.05% 67 Missing ⚠️
internal/controller/datadoggenericcr/synthetics.go 0.00% 48 Missing ⚠️
internal/controller/datadoggenericcr/notebooks.go 17.02% 39 Missing ⚠️
internal/controller/datadoggenericcr_controller.go 0.00% 15 Missing ⚠️
pkg/datadogclient/client.go 0.00% 14 Missing ⚠️
internal/controller/setup.go 31.25% 11 Missing ⚠️
internal/controller/datadoggenericcr/finalizer.go 74.35% 7 Missing and 3 partials ⚠️
cmd/main.go 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1534      +/-   ##
==========================================
- Coverage   48.66%   48.46%   -0.20%     
==========================================
  Files         226      234       +8     
  Lines       20363    20847     +484     
==========================================
+ Hits         9909    10104     +195     
- Misses       9937    10214     +277     
- Partials      517      529      +12     
Flag Coverage Δ
unittests 48.46% <40.28%> (-0.20%) ⬇️

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

Files with missing lines Coverage Δ
api/datadoghq/v1alpha1/datadoggenericcr_types.go 100.00% <100.00%> (ø)
.../datadoghq/v1alpha1/datadoggenericcr_validation.go 100.00% <100.00%> (ø)
cmd/main.go 0.00% <0.00%> (ø)
internal/controller/datadoggenericcr/finalizer.go 74.35% <74.35%> (ø)
internal/controller/setup.go 49.66% <31.25%> (-2.19%) ⬇️
pkg/datadogclient/client.go 0.00% <0.00%> (ø)
internal/controller/datadoggenericcr_controller.go 0.00% <0.00%> (ø)
internal/controller/datadoggenericcr/notebooks.go 17.02% <17.02%> (ø)
internal/controller/datadoggenericcr/synthetics.go 0.00% <0.00%> (ø)
internal/controller/datadoggenericcr/utils.go 57.05% <57.05%> (ø)
... and 1 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 6ff015c...1f9164f. Read the comment docs.

@tbavelier tbavelier added enhancement New feature or request and removed do-not-merge labels Nov 29, 2024
@tbavelier tbavelier marked this pull request as ready for review November 29, 2024 15:49
@tbavelier tbavelier requested a review from a team as a code owner November 29, 2024 15:49
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