Skip to content
111 changes: 111 additions & 0 deletions content/en/integrations/guide/source-code-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,117 @@

For unsupported languages, use the `git.commit.sha` and `git.repository_url` tags to link data to a specific commit. Ensure that the `git.repository_url` tag does not contain protocols. For example, if your repository URL is `https://github.com/example/repo`, the value for the `git.repository_url` tag should be `github.com/example/repo`.

## Kubernetes source code and resource mapping

Datadog's Source Code and resource mapping allow you to connect cluster resources to the source code

Check notice on line 475 in content/en/integrations/guide/source-code-integration.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.sentencelength

Suggestion: Try to keep your sentence length to 25 words or fewer.

Check notice on line 475 in content/en/integrations/guide/source-code-integration.md

View workflow job for this annotation

GitHub Actions / vale

Datadog.sentencelength

Suggestion: Try to keep your sentence length to 25 words or fewer.
that was used to deploy them, using Kubernetes annotations.

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

{{< tabs >}}
{{% tab "Raw Kubernetes YAML" %}}
If you deploy resource using `kubectl`, use the following annotation format:

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

{{% /tab %}}
{{% tab "Helm chart" %}}
If you deploy resource using `Helm`, use the following annotation format:

```json
origin.datadoghq.com/location:
{
"helm": {
"charURL": <chart location if different from repoURL>
"repoURL": <chart and/or values.yaml files location>,
"targetRevision": <sha1 for repoURL>,
"valuesPath": ["paths relative to <repoURL>"],
"chartPath": <relative to repoURL>
}
}
```

`chartPath` can either point to a folder or an archive relative to `<repoURL>`.
If the chart was unpacked, `chartPath` contains the folder unpack path.

There are 6 ways to set the annotation depending on how `helm install` is invoked.

{{% collapse-content title="1. Chart reference" level="h4" expanded=false id="chart-reference" %}}

Chart is stored in the git repo in unpacked form.
Installation command `helm install <release> <chart/path>`

* `repoURL`: repo where the chart and `values.yaml` files are stored
* `targetRevision`: commit SHA of `repoURL`
* `valuesPath`: array should contain `values.yaml` files relative to `<repoURL>` as supplied to HELM
* `chartPath`: `<chart/path>` relative `repoURL`

{{% /collapse-content %}}
{{% collapse-content title="2. Path to a packaged chart" level="h4" expanded=false id="path-to-chart" %}}

Chart is stored in the git repo in the form of an archive.
Installation command `helm install <release> <chart/path/arch-x.y.z.tgz>`

* `repoURL`: repo where the chart is stored and `values.yaml` files are stored
* `targetRevision`: commit SHA of `repoURL`
* `valuesPath`: array should contain `values.yaml` files relative to `<repoURL>` as supplied to HELM
* `chartPath`: <chart/path/arch-x.y.z.tgz> relative `repoURL`

{{% /collapse-content %}}
{{% collapse-content title="3. Path to an unpacked chart directory" level="h4" expanded=false id="path-to-unpacked-chart" %}}

Chart is stored somewhere and unpacked in the current git repo during the installation.
Installation command `helm install <release> <unpacked/path/dir>`

* `charURL`: should be set to URL of the chart
* `repoURL`: repo where the `values.yaml` files are stored
* `targetRevision`: commit SHA of `<repoURL>`
* `valuesPath`: array should contain `values.yaml` files relative to `<repoURL>` as supplied to HELM
* `chartPath`: `<unpacked/path/dir>` relative `<repoURL>`

{{% /collapse-content %}}
{{% collapse-content title="4. Absolute URL" level="h4" expanded=false id="absolute-url" %}}

Installation command `helm install mynginx https://example.com/charts/nginx-1.2.3.tgz`

* `charURL`: should be `https://example.com/charts/nginx-1.2.3.tgz`
* `repoURL`: repo where the `values.yaml` files are stored
* `targetRevision`: commit SHA of `<repoURL>`
* `valuesPath`: array should contain `values.yaml` files relative to `<repoURL>` as supplied to HELM

{{% /collapse-content %}}
{{% collapse-content title="5. Chart reference and repo url" level="h4" expanded=false id="chart-reference-and-repo" %}}

Installation command `helm install --repo https://example.com/charts/ mynginx nginx`

* `charURL`: `https://example.com/charts/nginx`
* `repoURL`: repo where the `values.yaml` files are stored
* `targetRevision`: commit SHA of `<repoURL>`
* `valuesPath`: array should contain `values.yaml` files relative to `<repoURL>` as supplied to HELM

{{% /collapse-content %}}
{{% collapse-content title="6. OCI registries" level="h4" expanded=false id="oci-registries" %}}

Installation command `helm install mynginx --version 1.2.3 oci://example.com/charts/nginx`

* `charURL`: `oci://example.com/charts/nginx`
* `repoURL`: repo where the `values.yaml` files are stored
* `targetRevision`: commit SHA of `<repoURL>`
* `valuesPath`: array should contain `values.yaml` files relative to `<repoURL>` as supplied to HELM

{{% /collapse-content %}}
{{% /tab %}}
{{< /tabs >}}

## Usage

### Links to Git providers & code snippets
Expand Down
Loading