このページは日本語には対応しておりません。随時翻訳に取り組んでいます。
翻訳に関してご質問やご意見ございましたら、お気軽にご連絡ください

Overview

Datadog’s source code and resource mapping allow you to connect cluster resources to the source code that was used to deploy them, using Kubernetes annotations.

Configuration

origin.datadoghq.com/location contains different content depending on how the resources were deployed.

If you deployed resources using kubectl, use the following annotation format:

origin.datadoghq.com/location:
{
	"repo": {
		"url": "<repo URL>",
		"targetRevision": "<SHA for commit being deployed>",
		"path": "<file path of the resource>"
	}
}

If you deployed resources using helm, the annotation format you need to use depends on how helm install was invoked. These are the possible ways to do it:

Use this option when the chart is stored in the git repo in unpacked form.

Use the installation command helm install <release> <chart/path>.

Use the following annotation format:

origin.datadoghq.com/location:
{
  "helm": {
    "repoURL": "<repo where the chart and values.yaml files are stored>",
    "targetRevision": "<commit SHA of repoURL>",
    "valuesPath": ["location of values.yaml files relative to <repoURL>"],
    "chartPath": "<chart/path> relative to <repoURL>"
  }
}

Use this option when the chart is stored in the git repo in the form of an archive.

Use the installation command helm install <release> <chart/path/arch-x.y.z.tgz>.

Use the following annotation format:

origin.datadoghq.com/location:
{
  "helm": {
    "repoURL": "<repo where the chart and values.yaml files are stored>",
    "targetRevision": "<commit SHA of repoURL>",
    "valuesPath": ["location of values.yaml files relative to <repoURL>"],
    "chartPath": "<chart/path/arch-x.y.z.tgz relative to repoURL>"
  }
}

Use this option when the chart is stored somewhere in the current git repo and unpacked during the installation.

Use the installation command helm install <release> <unpacked/path/dir>.

Use the following annotation format:

origin.datadoghq.com/location:
{
  "helm": {
    "chartURL": "<URL of the chart>",
    "repoURL": "<repo where the values.yaml files are stored>",
    "targetRevision": "<commit SHA of repoURL>",
    "valuesPath": ["location of values.yaml files relative to <repoURL>"],
    "chartPath": "<unpacked/path/dir relative to repoURL>"
  }
}

Use the installation command helm install mynginx https://example.com/charts/nginx-1.2.3.tgz.

Use the following annotation format:

origin.datadoghq.com/location:
{
  "helm": {
    "chartURL": "<URL in the format https://example.com/charts/nginx-1.2.3.tgz>",
    "repoURL": "<repo where the values.yaml files are stored>",
    "targetRevision": "<commit SHA of repoURL>",
    "valuesPath": ["location of values.yaml files relative to <repoURL>"]
  }
}

Use the installation command helm install --repo https://example.com/charts/ mynginx nginx.

Use the following annotation format:

origin.datadoghq.com/location:
{
  "helm": {
    "chartURL": "<URL in the format https://example.com/charts/nginx>",
    "repoURL": "<repo where the values.yaml files are stored>",
    "targetRevision": "<commit SHA of repoURL>",
    "valuesPath": ["location of values.yaml files relative to <repoURL>"]
  }
}

Use the installation command helm install mynginx --version 1.2.3 oci://example.com/charts/nginx.

Use the following annotation format:

origin.datadoghq.com/location:
{
  "helm": {
    "chartURL": "<URL in the format oci://example.com/charts/nginx>",
    "repoURL": "<repo where the values.yaml files are stored>",
    "targetRevision": "<commit SHA of repoURL>",
    "valuesPath": ["location of `values.yaml` files relative to <repoURL>"]
  }
}

For the Helm use case, Datadog provides an open-source Helm plugin that you can install and use to add annotations automatically. Check the plugin repo on GitHub.