diff --git a/stable/datadog/CHANGELOG.md b/stable/datadog/CHANGELOG.md index a401bed869..903589c965 100644 --- a/stable/datadog/CHANGELOG.md +++ b/stable/datadog/CHANGELOG.md @@ -1,5 +1,15 @@ # Datadog changelog +## 2.3.0 + +* Mount the directory containing the CRI socket instead of the socket itself + This is to handle the cases where the docker daemon is restarted. + In this case, the docker daemon will recreate its docker socket and, + if the container bind-mounted directly the socket, the container would + still have access to the old socket instead of the one of the new docker + daemon. + ⚠ This version of the chart requires an agent image 7.19.0 or more recent + ## 2.2.12 * Adding resources for `system-probe` init container @@ -123,7 +133,6 @@ config to this environment variable. * Fix templating error when `agents.useConfigMap` is set to true. * Add DD\_APM\_ENABLED environment variable to trace agent container. - ## 2.0.2 * Revert the docker socket path inside the agent container to its standard location to fix #21223. diff --git a/stable/datadog/Chart.yaml b/stable/datadog/Chart.yaml index 7ed1e528e6..7bf6ae3999 100644 --- a/stable/datadog/Chart.yaml +++ b/stable/datadog/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: datadog -version: 2.2.12 +version: 2.3.0 appVersion: "7" description: Datadog Agent keywords: diff --git a/stable/datadog/README.md b/stable/datadog/README.md index b8cb17a84e..0be208edb5 100644 --- a/stable/datadog/README.md +++ b/stable/datadog/README.md @@ -276,10 +276,11 @@ helm install --name \ | `datadog.apiKeyExistingSecret` | If set, use the secret with a provided name instead of creating a new one | `nil` | | `datadog.appKey` | Datadog APP key required to use metricsProvider | `nil` You must provide your own key | | `datadog.appKeyExistingSecret` | If set, use the secret with a provided name instead of creating a new one | `nil` | -| `agents.image.repository` | The image repository to pull from | `datadog/agent` | -| `agents.image.tag` | The image tag to pull | `7.18.1` | -| `agents.image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `agents.image.pullSecrets` | Image pull secrets | `nil` | +| `agents.image.repository` | The image repository to pull from | `datadog/agent` | +| `agents.image.tag` | The image tag to pull | `7.19.0` | +| `agents.image.doNotCheckTag` | By default, the helm chart will check that the version provided in `agents.image.tag` is superior to the minimal version requested by the chart. If `doNotCheckTag` is explicitly set to `true`, this check is skipped. This is useful for custom tags that are not respecting semantic versioning. | `false` | +| `agents.image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `agents.image.pullSecrets` | Image pull secrets | `nil` | | `nameOverride` | Override name of app | `""` | | `fullnameOverride` | Override full name of app | `""` | | `agents.rbac.create` | If true, create & use RBAC resources | `true` | @@ -293,7 +294,7 @@ helm install --name \ | `datadog.logs.containerCollectUsingFiles` | Collect container logs from files on disk instead of container runtime API | `true` | | `datadog.apm.enabled` | Enable tracing from the host | `false` | | `datadog.apm.port` | Used to override the default agent APM Port | `8126` | -| `datadog.clusterChecks.enabled` | Enable Cluster Checks on both the Cluster Agent and the Agent daemonset | `false` | +| `datadog.clusterChecks.enabled` | Enable Cluster Checks on both the Cluster Agent and the Agent daemonset | `false` | | `datadog.processAgent.enabled` | Enable live process and container monitoring agent. Possible values: `true` enable process-agent, `false` disable process-agent | `true` | | `datadog.processAgent.processCollection` | Enable live process collection. Possible values: `true` enable process collection, `false` disable process collection | `false` | | `datadog.checksd` | Additional custom checks as python code | `nil` | diff --git a/stable/datadog/templates/_helpers.tpl b/stable/datadog/templates/_helpers.tpl index ce96eca8c6..91e61818ff 100644 --- a/stable/datadog/templates/_helpers.tpl +++ b/stable/datadog/templates/_helpers.tpl @@ -1,5 +1,24 @@ {{/* vim: set filetype=mustache: */}} +{{- define "check-version" -}} +{{- if not .Values.agents.image.doNotCheckTag -}} +{{- $version := .Values.agents.image.tag | toString | trimSuffix "-jmx" -}} +{{- $length := len (split "." $version) -}} +{{- if and (eq $length 1) (eq $version "6") -}} +{{- $version = "6.19.0" -}} +{{- end -}} +{{- if and (eq $length 1) (eq $version "7") -}} +{{- $version = "7.19.0" -}} +{{- end -}} +{{- if and (eq $length 1) (eq $version "latest") -}} +{{- $version = "7.19.0" -}} +{{- end -}} +{{- if not (semverCompare "^6.19.0 || ^7.19.0" $version) -}} +{{- fail "This version of the chart requires an agent image 7.19.0 or greater. If you want to force and skip this check, use `--set agents.image.doNotCheckTag=true`" -}} +{{- end -}} +{{- end -}} +{{- end -}} + {{/* Expand the name of the chart. */}} diff --git a/stable/datadog/templates/container-agent.yaml b/stable/datadog/templates/container-agent.yaml index 527d2e2071..2fa5d9a2ba 100644 --- a/stable/datadog/templates/container-agent.yaml +++ b/stable/datadog/templates/container-agent.yaml @@ -93,11 +93,15 @@ volumeMounts: - name: config mountPath: {{ template "datadog.confPath" . }} + {{- if eq .Values.targetSystem "linux" }} + - name: runtimesocketdir + mountPath: {{ print "/host/" (dir (include "datadog.dockerOrCriSocketPath" .)) | clean }} + readOnly: true + {{- end }} + {{- if eq .Values.targetSystem "windows" }} - name: runtimesocket mountPath: {{ template "datadog.dockerOrCriSocketPath" . }} - {{- if eq .Values.targetSystem "linux" }} - readOnly: true - {{- end }} + {{- end }} {{- if .Values.agents.useConfigMap }} - name: {{ template "datadog.fullname" . }}-datadog-yaml mountPath: {{ template "datadog.confPath" . }}/datadog.yaml diff --git a/stable/datadog/templates/container-process-agent.yaml b/stable/datadog/templates/container-process-agent.yaml index 3f3820173f..519efdd0ff 100644 --- a/stable/datadog/templates/container-process-agent.yaml +++ b/stable/datadog/templates/container-process-agent.yaml @@ -29,10 +29,14 @@ volumeMounts: - name: config mountPath: {{ template "datadog.confPath" . }} + {{- if eq .Values.targetSystem "linux" }} + - name: runtimesocketdir + mountPath: {{ print "/host/" (dir (include "datadog.dockerOrCriSocketPath" .)) | clean }} + readOnly: true + {{- end }} + {{- if eq .Values.targetSystem "windows" }} - name: runtimesocket mountPath: {{ template "datadog.dockerOrCriSocketPath" . }} - {{- if eq .Values.targetSystem "linux" }} - readOnly: true {{- end }} {{- if .Values.agents.useConfigMap }} - name: {{ template "datadog.fullname" . }}-datadog-yaml diff --git a/stable/datadog/templates/container-trace-agent.yaml b/stable/datadog/templates/container-trace-agent.yaml index ae119414c1..f4c539c6e5 100644 --- a/stable/datadog/templates/container-trace-agent.yaml +++ b/stable/datadog/templates/container-trace-agent.yaml @@ -37,11 +37,15 @@ mountPath: {{ template "datadog.confPath" . }}/datadog.yaml subPath: datadog.yaml {{- end }} + {{- if eq .Values.targetSystem "linux" }} + - name: runtimesocketdir + mountPath: {{ print "/host/" (dir (include "datadog.dockerOrCriSocketPath" .)) | clean }} + readOnly: true + {{- end }} + {{- if eq .Values.targetSystem "windows" }} - name: runtimesocket mountPath: {{ template "datadog.dockerOrCriSocketPath" . }} - {{- if eq .Values.targetSystem "linux" }} - readOnly: true - {{- end }} + {{- end }} livenessProbe: {{ toYaml .Values.agents.containers.traceAgent.livenessProbe | indent 4 }} {{- end -}} diff --git a/stable/datadog/templates/containers-common-env.yaml b/stable/datadog/templates/containers-common-env.yaml index feec8695ed..01e92f3e8c 100644 --- a/stable/datadog/templates/containers-common-env.yaml +++ b/stable/datadog/templates/containers-common-env.yaml @@ -53,17 +53,16 @@ - name: {{ $value.name }} value: {{ $value.value | quote }} {{- end }} -{{- if .Values.datadog.dockerSocketPath }} -- name: DOCKER_HOST -{{- if eq .Values.targetSystem "linux" }} - value: unix://{{ .Values.datadog.dockerSocketPath }} -{{- end }} -{{- if eq .Values.targetSystem "windows" }} - value: npipe://{{ .Values.datadog.dockerSocketPath | replace "\\" "/" }} -{{- end }} -{{- end }} {{- if .Values.datadog.criSocketPath }} - name: DD_CRI_SOCKET_PATH - value: {{ .Values.datadog.criSocketPath }} + value: {{ print "/host/" .Values.datadog.criSocketPath | clean }} +{{- else }} +- name: DOCKER_HOST +{{- if eq .Values.targetSystem "linux" }} + value: unix://{{ print "/host/" (include "datadog.dockerOrCriSocketPath" .) | clean }} +{{- end }} +{{- if eq .Values.targetSystem "windows" }} + value: npipe://{{ (include "datadog.dockerOrCriSocketPath" .) | replace "\\" "/" }} +{{- end }} {{- end }} {{- end -}} diff --git a/stable/datadog/templates/containers-init-linux.yaml b/stable/datadog/templates/containers-init-linux.yaml index 49a71dd587..bd17281e22 100644 --- a/stable/datadog/templates/containers-init-linux.yaml +++ b/stable/datadog/templates/containers-init-linux.yaml @@ -32,17 +32,15 @@ - name: procdir mountPath: /host/proc readOnly: true - - name: runtimesocket - mountPath: {{ template "datadog.dockerOrCriSocketPath" . }} + - name: runtimesocketdir + mountPath: {{ print "/host/" (dir (include "datadog.dockerOrCriSocketPath" .)) | clean }} readOnly: true env: {{- include "containers-common-env" . | nindent 4 }} - {{- if not .Values.clusterAgent.enabled }} - {{- if .Values.datadog.leaderElection }} + {{- if and (not .Values.clusterAgent.enabled) .Values.datadog.leaderElection }} - name: DD_LEADER_ELECTION value: {{ .Values.datadog.leaderElection | quote }} {{- end }} - {{- end }} resources: {{ toYaml .Values.agents.containers.initContainers.resources | indent 4 }} {{- end -}} diff --git a/stable/datadog/templates/daemonset.yaml b/stable/datadog/templates/daemonset.yaml index 7167cb3566..f9cfe173a5 100644 --- a/stable/datadog/templates/daemonset.yaml +++ b/stable/datadog/templates/daemonset.yaml @@ -1,3 +1,4 @@ +{{- template "check-version" . }} {{- if .Values.agents.enabled }} {{- if (or (.Values.datadog.apiKeyExistingSecret) (.Values.datadog.apiKey)) }} apiVersion: apps/v1 @@ -82,9 +83,16 @@ spec: volumes: - name: config emptyDir: {} + {{- if eq .Values.targetSystem "linux" }} + - hostPath: + path: {{ dir (include "datadog.dockerOrCriSocketPath" .) }} + name: runtimesocketdir + {{- end }} + {{- if eq .Values.targetSystem "windows" }} - hostPath: path: {{ template "datadog.dockerOrCriSocketPath" . }} name: runtimesocket + {{- end }} {{- if .Values.datadog.checksd }} - name: checksd configMap: diff --git a/stable/datadog/values.yaml b/stable/datadog/values.yaml index efac3dfb88..3ece1f3f61 100644 --- a/stable/datadog/values.yaml +++ b/stable/datadog/values.yaml @@ -561,7 +561,16 @@ agents: ## Define the Agent version to use. ## Use 7-jmx to enable jmx fetch collection # - tag: "7" + tag: 7.19.0 + + ## @param doNotCheckTag - boolean - optional + ## By default, the version passed in agents.image.tag is checked + ## for compatibility with the version of the chart. + ## This boolean permits to completely skip this check. + ## This is useful, for example, for custom tags that are not + ## respecting semantic versioning + # + doNotCheckTag: # false ## @param pullPolicy - string - required ## The Kubernetes pull policy. @@ -853,7 +862,7 @@ clusterChecksRunner: ## Define the Agent version to use. ## Use 7-jmx to enable jmx fetch collection # - tag: "7" + tag: 7.19.0 ## @param pullPolicy - string - required ## The Kubernetes pull policy.