From b18135316105ab61131d2b5634381fa9a8b3895a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Tue, 17 Mar 2020 20:53:27 +0100 Subject: [PATCH] [stable/datalog] Do not enable the `cri` check when running on a `docker` setup (#21476) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Lénaïc Huard --- stable/datadog/CHANGELOG.md | 6 +++++- stable/datadog/Chart.yaml | 2 +- stable/datadog/README.md | 3 ++- stable/datadog/templates/_helpers.tpl | 13 +++++++++++++ stable/datadog/templates/container-agent.yaml | 12 +++++++----- .../datadog/templates/container-process-agent.yaml | 4 +--- stable/datadog/templates/containers-init.yaml | 8 +++++--- stable/datadog/templates/daemonset.yaml | 6 ++---- stable/datadog/values.yaml | 9 +++++++-- 9 files changed, 43 insertions(+), 20 deletions(-) diff --git a/stable/datadog/CHANGELOG.md b/stable/datadog/CHANGELOG.md index 15e83fa8910a..30926590f5ce 100644 --- a/stable/datadog/CHANGELOG.md +++ b/stable/datadog/CHANGELOG.md @@ -2,6 +2,10 @@ ## 2.0 +## 2.0.10 + +* Do not enable the `cri` check when running on a `docker` setup. + ## 2.0.7 * Pass expected `DD_DOGSTATSD_PORT` to datadog-agent rather than invalid `DD_DOGSTATD_PORT` @@ -22,7 +26,7 @@ ## 2.0.3 * Fix templating error when `agents.useConfigMap` is set to true. -* Add DD_APM_ENABLED environment variable to trace agent container. +* Add DD\_APM\_ENABLED environment variable to trace agent container. ## 2.0.2 diff --git a/stable/datadog/Chart.yaml b/stable/datadog/Chart.yaml index bae031b0ad85..7935794d5d09 100644 --- a/stable/datadog/Chart.yaml +++ b/stable/datadog/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: datadog -version: 2.0.9 +version: 2.0.10 appVersion: "7" description: Datadog Agent keywords: diff --git a/stable/datadog/README.md b/stable/datadog/README.md index 713d381a5393..d086a614a25c 100644 --- a/stable/datadog/README.md +++ b/stable/datadog/README.md @@ -275,7 +275,8 @@ helm install --name \ | `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` | | `datadog.confd` | Additional check configurations (static and Autodiscovery) | `nil` | -| `datadog.criSocketPath` | Path to the container runtime socket (default is Docker runtime) | `/var/run/docker.sock` | +| `datadog.dockerSocketPath` | Path to the docker socket | `/var/run/docker.sock` | +| `datadog.criSocketPath` | Path to the container runtime socket (default is Docker runtime) | `nil` | | `datadog.tags` | Set host tags | `nil` | | `datadog.useCriSocketVolume` | Enable mounting the container runtime socket in Agent containers | `True` | | `datadog.dogstatsd.originDetection` | Enable origin detection for container tagging | `False` | diff --git a/stable/datadog/templates/_helpers.tpl b/stable/datadog/templates/_helpers.tpl index 7532307ff835..e22c801491b7 100644 --- a/stable/datadog/templates/_helpers.tpl +++ b/stable/datadog/templates/_helpers.tpl @@ -69,3 +69,16 @@ Return the appropriate apiVersion for RBAC APIs. "rbac.authorization.k8s.io/v1beta1" {{- end -}} {{- end -}} + +{{/* +Return the container runtime socket +*/}} +{{- define "datadog.dockerOrCriSocketPath" -}} +{{- if .Values.datadog.dockerSocketPath -}} +{{- .Values.dockerSocketPath -}} +{{- else if .Values.datadog.criSocketPath -}} +{{- .Values.datadog.criSocketPath -}} +{{- else -}} +/var/run/docker.sock +{{- end -}} +{{- end -}} diff --git a/stable/datadog/templates/container-agent.yaml b/stable/datadog/templates/container-agent.yaml index df545191786e..b2e8b34128f8 100644 --- a/stable/datadog/templates/container-agent.yaml +++ b/stable/datadog/templates/container-agent.yaml @@ -24,7 +24,7 @@ {{- if .Values.datadog.logLevel }} - name: DD_LOG_LEVEL value: {{ .Values.agents.containers.agent.logLevel | default .Values.datadog.logLevel | quote }} - {{- end }} + {{- end }} {{- if .Values.datadog.dogstatsd.port }} - name: DD_DOGSTATSD_PORT value: {{ .Values.datadog.dogstatsd.port | quote }} @@ -85,6 +85,10 @@ value: {{ (default false (or .Values.datadog.logs.enabled .Values.datadog.logsEnabled)) | quote}} - name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL value: {{ (default false (or .Values.datadog.logs.containerCollectAll .Values.datadog.logsConfigContainerCollectAll)) | quote}} + {{- if .Values.datadog.dockerSocketPath }} + - name: DOCKER_HOST + value: unix://{{ .Values.datadog.dockerSocketPath }} + {{- end }} {{- if .Values.datadog.criSocketPath }} - name: DD_CRI_SOCKET_PATH value: {{ .Values.datadog.criSocketPath }} @@ -112,11 +116,9 @@ mountPath: /etc/datadog-agent/datadog.yaml subPath: datadog.yaml {{- end }} - {{- if .Values.datadog.criSocketPath }} - name: runtimesocket - mountPath: {{ .Values.datadog.criSocketPath }} + mountPath: {{ template "datadog.dockerOrCriSocketPath" . }} readOnly: true - {{- end }} {{- if .Values.datadog.dogstatsd.useSocketVolume }} - name: dsdsocket mountPath: "/var/run/datadog" @@ -133,7 +135,7 @@ - name: logpodpath mountPath: /var/log/pods readOnly: true - {{- if regexFind "^.*docker.*$" $.Values.datadog.criSocketPath }} + {{- if not .Values.datadog.criSocketPath }} - name: logdockercontainerpath mountPath: /var/lib/docker/containers readOnly: true diff --git a/stable/datadog/templates/container-process-agent.yaml b/stable/datadog/templates/container-process-agent.yaml index ccf8c8e264da..b0be06d14c4d 100644 --- a/stable/datadog/templates/container-process-agent.yaml +++ b/stable/datadog/templates/container-process-agent.yaml @@ -38,11 +38,9 @@ - name: procdir mountPath: /host/proc readOnly: true - {{- if .Values.datadog.criSocketPath }} - name: runtimesocket - mountPath: {{ .Values.datadog.criSocketPath }} + mountPath: {{ template "datadog.dockerOrCriSocketPath" . }} readOnly: true - {{- end }} {{- if .Values.datadog.systemProbe.enabled }} - name: sysprobe-socket-dir mountPath: /opt/datadog-agent/run diff --git a/stable/datadog/templates/containers-init.yaml b/stable/datadog/templates/containers-init.yaml index 1c5c26fc0380..2897cc3726f3 100644 --- a/stable/datadog/templates/containers-init.yaml +++ b/stable/datadog/templates/containers-init.yaml @@ -32,16 +32,18 @@ - name: procdir mountPath: /host/proc readOnly: true - {{- if .Values.datadog.criSocketPath }} - name: runtimesocket - mountPath: {{ .Values.datadog.criSocketPath }} + mountPath: {{ template "datadog.dockerOrCriSocketPath" . }} readOnly: true - {{- end }} env: {{- include "containers-common-env" . | nindent 4 }} {{- if .Values.datadog.env }} {{ toYaml .Values.datadog.env | nindent 4 }} {{- end }} + {{- if .Values.datadog.dockerSocketPath }} + - name: DOCKER_HOST + value: unix://{{ .Values.datadog.dockerSocketPath }} + {{- end }} {{- if .Values.datadog.criSocketPath }} - name: DD_CRI_SOCKET_PATH value: {{ .Values.datadog.criSocketPath }} diff --git a/stable/datadog/templates/daemonset.yaml b/stable/datadog/templates/daemonset.yaml index e8fc94cf93bd..b5b3b20cb486 100644 --- a/stable/datadog/templates/daemonset.yaml +++ b/stable/datadog/templates/daemonset.yaml @@ -77,11 +77,9 @@ spec: volumes: - name: config emptyDir: {} - {{- if .Values.datadog.criSocketPath }} - hostPath: - path: {{ .Values.datadog.criSocketPath }} + path: {{ template "datadog.dockerOrCriSocketPath" . }} name: runtimesocket - {{- end }} {{- if .Values.datadog.dogstatsd.useSocketVolume }} - hostPath: path: "/var/run/datadog/" @@ -112,7 +110,7 @@ spec: - hostPath: path: /var/log/pods name: logpodpath - {{- if regexFind "^.*docker.*$" $.Values.datadog.criSocketPath }} + {{- if not .Values.datadog.criSocketPath }} - hostPath: path: /var/lib/docker/containers name: logdockercontainerpath diff --git a/stable/datadog/values.yaml b/stable/datadog/values.yaml index a41d12be060c..b41664d3dce0 100644 --- a/stable/datadog/values.yaml +++ b/stable/datadog/values.yaml @@ -268,11 +268,16 @@ datadog: # checksd: # service.py: |- - ## @param criSocketPath - string - required + ## @param dockerSocketPath - string - optional + ## Path to the docker socket + # + # dockerSocketPath: /var/run/docker.sock + + ## @param criSocketPath - string - optional ## Path to the container runtime socket (if different from Docker) ## This is supported starting from agent 6.6.0 # - criSocketPath: /var/run/docker.sock + # criSocketPath: /var/run/containerd/containerd.sock ## @param processAgent - object - required