DatadogGenericResource CRD

To create and manage Datadog resources with the Datadog Operator, use the DatadogGenericResource custom resource definition (CRD). DatadogGenericResource uses the Datadog API JSON payload for each supported resource type in spec.jsonSpec.

DatadogGenericResource is the preferred CRD for Datadog resources that are supported by both DatadogGenericResource and older resource-specific CRDs, such as DatadogMonitor, DatadogDashboard, and DatadogSLO.

Prerequisites

Supported resources

TypeOperator versionAPI reference
notebookv1.12.0Create a notebook
synthetics_api_testv1.12.0Create an API test
synthetics_browser_testv1.12.0Create a browser test
monitorv1.13.0Create a monitor
downtimev1.22.0Schedule a downtime
dashboardv1.27.0Create a dashboard
slov1.28.0Create an SLO object

Setup

  1. Run the installation command, substituting your Datadog API and application keys:

    helm install datadog-operator datadog/datadog-operator \
      --set apiKey=<DATADOG_API_KEY> \
      --set appKey=<DATADOG_APP_KEY> \
      --set datadogCRDs.crds.datadogGenericResources=true \
      --set datadogGenericResource.enabled=true
    
  2. Create a file with the spec of your DatadogGenericResource configuration.

    Example: Monitor

    datadog-generic-resource-monitor.yaml

       apiVersion: datadoghq.com/v1alpha1
       kind: DatadogGenericResource
       metadata:
         name: example-monitor
         namespace: <operator namespace>
       spec:
         type: monitor
         jsonSpec: |-
           {
             "name": "Example Monitor",
             "type": "metric alert",
             "query": "avg(last_10m):avg:system.cpu.user{*} > 80",
             "message": "CPU usage is high",
             "tags": [
               "team:example"
             ],
             "options": {
               "notify_no_data": false
             }
           }
       
  3. Deploy your DatadogGenericResource:

    kubectl apply -f /path/to/your/datadog-generic-resource-monitor.yaml
    

Further reading

Additional helpful documentation, links, and articles: