Skip to content

feat(ddgr): add dashboard support#2906

Merged
tbavelier merged 4 commits intomainfrom
CONTP-1586/wassim.dhif/ddgr_dashboard
Apr 16, 2026
Merged

feat(ddgr): add dashboard support#2906
tbavelier merged 4 commits intomainfrom
CONTP-1586/wassim.dhif/ddgr_dashboard

Conversation

@wdhif
Copy link
Copy Markdown
Member

@wdhif wdhif commented Apr 15, 2026

What does this PR do?

Adds dashboard as a supported resource type in the DatadogGenericResource CRD, allowing users to manage Datadog Dashboards declaratively via a Kubernetes CR with a raw JSON spec.

Motivation

The DatadogGenericResource CRD gives users full flexibility over the dashboard payload via jsonSpec.

Additional Notes

image

Minimum Agent Versions

N/A, this is an Operator-only change with no Agent or Cluster Agent dependency.

Describe your test plan

Tested end-to-end on a local minikube cluster

  • Deploy the Opeator
  • Deploy the following configuration
apiVersion: datadoghq.com/v1alpha1
  kind: DatadogGenericResource
  metadata:
    name: ddgr-test-dashboard
    namespace: default
  spec:
    type: dashboard
    jsonSpec: |
      {
        "title": "DDGR Test Dashboard",
        "layout_type": "ordered",
        "widgets": [
          {
            "definition": {
              "type": "timeseries",
              "title": "CPU Usage",
              "requests": [
                {
                  "q": "avg:system.cpu.user{*}",
                  "display_type": "line"
                }
              ]
            }
          }
        ]
      }
  • Validate that the dashboard has been created.
  • Delete the resource and validate that the dashboard has been deleted.

Also validated with unit tests.

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
  • All commits are signed (see: signing commits)

@wdhif wdhif added this to the v1.27.0 milestone Apr 15, 2026
@wdhif wdhif added the enhancement New feature or request label Apr 15, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 15, 2026

Codecov Report

❌ Patch coverage is 21.42857% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.99%. Comparing base (a646370) to head (070fc64).

Files with missing lines Patch % Lines
...al/controller/datadoggenericresource/dashboards.go 16.00% 42 Missing ⚠️
pkg/datadogclient/client.go 0.00% 2 Missing ⚠️

❌ Your patch status has failed because the patch coverage (21.42%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2906      +/-   ##
==========================================
- Coverage   40.03%   39.99%   -0.04%     
==========================================
  Files         319      320       +1     
  Lines       28066    28122      +56     
==========================================
+ Hits        11235    11247      +12     
- Misses      16008    16052      +44     
  Partials      823      823              
Flag Coverage Δ
unittests 39.99% <21.42%> (-0.04%) ⬇️

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

Files with missing lines Coverage Δ
...al/controller/datadoggenericresource/controller.go 53.90% <100.00%> (+0.73%) ⬆️
...nternal/controller/datadoggenericresource/utils.go 86.44% <100.00%> (+0.47%) ⬆️
pkg/datadogclient/client.go 0.00% <0.00%> (ø)
...al/controller/datadoggenericresource/dashboards.go 16.00% <16.00%> (ø)

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 a646370...070fc64. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-prod-us1-3
Copy link
Copy Markdown

datadog-prod-us1-3 bot commented Apr 15, 2026

Code Coverage

Fix all issues with BitsAI

🛑 Gate Violations

🎯 1 Code Coverage issue detected

A Patch coverage percentage gate may be blocking this PR.

Patch coverage: 23.40% (threshold: 80.00%)

ℹ️ Info

🎯 Code Coverage (details)
Patch Coverage: 23.40%
Overall Coverage: 40.08% (-0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 070fc64 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@wdhif wdhif marked this pull request as ready for review April 15, 2026 11:54
@wdhif wdhif requested review from a team and Copilot April 15, 2026 11:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds Datadog Dashboard support to the DatadogGenericResource (DDGR) flow so dashboards can be managed declaratively via spec.type=dashboard and a raw JSON payload in spec.jsonSpec.

Changes:

  • Extend DDGR supported resource types to include dashboard (API types, validation, CRD schemas).
  • Add a DashboardHandler wired into the DDGR controller dispatch and Datadog generic client.
  • Add unit tests for dashboard status population and handler selection.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/datadogclient/client.go Adds DashboardsApi to the generic Datadog client initialization and struct.
internal/controller/datadoggenericresource/controller.go Wires the dashboards client into the reconciler and credential refresh path.
internal/controller/datadoggenericresource/utils.go Routes spec.type=dashboard to the new DashboardHandler.
internal/controller/datadoggenericresource/dashboards.go Implements create/get/update/delete operations for dashboards and status population.
internal/controller/datadoggenericresource/dashboards_test.go Adds unit tests for dashboard status updates and handler selection.
api/datadoghq/v1alpha1/datadoggenericresource_types.go Adds the Dashboard enum value and updates kubebuilder validation enum.
api/datadoghq/v1alpha1/datadoggenericresource_validation.go Allows dashboard as a valid DDGR resource type.
config/crd/bases/v1/datadoghq.com_datadoggenericresources.yaml Adds dashboard to the CRD enum list (YAML).
config/crd/bases/v1/datadoghq.com_datadoggenericresources_v1alpha1.json Adds dashboard to the CRD enum list (JSON).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/controller/datadoggenericresource/dashboards.go
Comment thread internal/controller/datadoggenericresource/dashboards.go
Comment thread internal/controller/datadoggenericresource/dashboards_test.go Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9aa31b0f9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread config/crd/bases/v1/datadoghq.com_datadoggenericresources.yaml
@wdhif wdhif force-pushed the CONTP-1586/wassim.dhif/ddgr_dashboard branch from 3f1ae8b to aedb981 Compare April 15, 2026 12:27
Copy link
Copy Markdown
Member

@tbavelier tbavelier left a comment

Choose a reason for hiding this comment

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

Approving, but could you please follow the post-dev tasks that are missing from this PR ?

## Post-development tasks
, tl;dr, simply update the docs/datadog_generic_resource.md to include the new one, and an example in examples ?

wdhif and others added 4 commits April 16, 2026 14:31
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
@wdhif wdhif force-pushed the CONTP-1586/wassim.dhif/ddgr_dashboard branch from aedb981 to 070fc64 Compare April 16, 2026 12:44
@wdhif wdhif requested a review from a team as a code owner April 16, 2026 12:44
@wdhif
Copy link
Copy Markdown
Member Author

wdhif commented Apr 16, 2026

Approving, but could you please follow the post-dev tasks that are missing from this PR ?

## Post-development tasks

, tl;dr, simply update the docs/datadog_generic_resource.md to include the new one, and an example in examples ?

Thanks 🙏 Good catch! Fixed in 070fc64

@tbavelier tbavelier merged commit 7c966f8 into main Apr 16, 2026
37 of 38 checks passed
@tbavelier tbavelier deleted the CONTP-1586/wassim.dhif/ddgr_dashboard branch April 16, 2026 13:48
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