Skip to content

[DatadogDashboard] Support for yaml syntax for widgets #2423

Description

@starlightromero

Currently DatadogDashboard.spec.widgets accepts a JSON string. However, after only a few widgets this becomes cumbersome and hard to maintain, both from a readability standpoint and a validation standpoint. JSON strings cannot natively be linted or validated with standard Kubernetes tooling. Instead, widgets should accept yaml which then in the controller, is converted to json.

Before:

  widgets: |
    [
      {
        "definition": {
          "title": "Pod Count",
          "type": "query_value",
          "requests": [
            {
              "response_format": "scalar",
              "queries": [
                {
                  "data_source": "metrics",
                  "name": "query1",
                  "query": "sum:kubernetes.pods.running{cluster_name:example-cluster,service:$app.value,env:$env.value}",
                  "aggregator": "last"
                }
              ]
            }
          ],
          "precision": 0
        },
        "layout": {"x": 0, "y": 0, "width": 2, "height": 2}
      }
  ]

After:

widgets:
  - definition:
      title: Pod Count
      type: query_value
      requests:
        - response_format: scalar
          queries:
            - data_source: metrics
              name: query1
              query: sum:kubernetes.pods.running{cluster_name:example-cluster,service:$app.value,env:$env.value}
              aggregator: last
      precision: 0
    layout:
      x: 0
      y: 0
      width: 2
      height: 2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions