Skip to content

feat(ddgr): add dashboard support#2906

Open
wdhif wants to merge 3 commits intomainfrom
CONTP-1586/wassim.dhif/ddgr_dashboard
Open

feat(ddgr): add dashboard support#2906
wdhif wants to merge 3 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)

Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
@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 Report

❌ Patch coverage is 22.22222% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.99%. Comparing base (56159c6) to head (9aa31b0).

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

❌ Your patch status has failed because the patch coverage (22.22%) 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    28120      +54     
==========================================
+ Hits        11235    11247      +12     
- Misses      16008    16050      +42     
  Partials      823      823              
Flag Coverage Δ
unittests 39.99% <22.22%> (-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.66% <16.66%> (ø)

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 56159c6...9aa31b0. 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

This comment has been minimized.

@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 and others added 2 commits April 15, 2026 14:08
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Wassim DHIF <wassim.dhif@datadoghq.com>
@wdhif wdhif force-pushed the CONTP-1586/wassim.dhif/ddgr_dashboard branch from 3f1ae8b to aedb981 Compare April 15, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants