diff --git a/content/en/integrations/guide/source-code-integration.md b/content/en/integrations/guide/source-code-integration.md index c26cde5534b..5aec72b97c6 100644 --- a/content/en/integrations/guide/source-code-integration.md +++ b/content/en/integrations/guide/source-code-integration.md @@ -470,6 +470,117 @@ If your build process is executed in CI within a Docker container, perform the f 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 +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": + "targetRevision": + "path": + } +} +``` + +{{% /tab %}} +{{% tab "Helm chart" %}} +If you deploy resource using `Helm`, use the following annotation format: + +```json +origin.datadoghq.com/location: +{ + "helm": { + "charURL": + "repoURL": , + "targetRevision": , + "valuesPath": ["paths relative to "], + "chartPath": + } +} +``` + +`chartPath` can either point to a folder or an archive relative to ``. +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 ` + +* `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 `` as supplied to HELM +* `chartPath`: `` 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 ` + +* `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 `` as supplied to HELM +* `chartPath`: 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 ` + +* `charURL`: should be set to URL of the chart +* `repoURL`: repo where the `values.yaml` files are stored +* `targetRevision`: commit SHA of `` +* `valuesPath`: array should contain `values.yaml` files relative to `` as supplied to HELM +* `chartPath`: `` relative `` + +{{% /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 `` +* `valuesPath`: array should contain `values.yaml` files relative to `` 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 `` +* `valuesPath`: array should contain `values.yaml` files relative to `` 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 `` +* `valuesPath`: array should contain `values.yaml` files relative to `` as supplied to HELM + +{{% /collapse-content %}} +{{% /tab %}} +{{< /tabs >}} + ## Usage ### Links to Git providers & code snippets