[stable/datadog] Make the datadog agent resilient to docker daemon restarts (#21300)

* [stable/datadog] Honor image pull policy setting in init containers

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Pass DD_CRI_SOCKET_PATH to the init container

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Bump version and fill changelog

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Revert "[stable/datadog] Revert "Mount the directory containing the CRI socket instead of the socket itself" (#21268)"

This reverts commit 6de689e7e4.

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Explicitly set DOCKER_HOST

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Bump version and fill changelog

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datalog] Do not enable the `cri` check when running on a `docker` setup

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Add a check for the version of the image

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* fixup! [stable/datadog] Add a check for the version of the image

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Bump the version to highlight the non-backward compatible change

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Do not touch the docker named pipe for Windows

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Add an `agents.image.tag.doNotCheckTag` parameter

to skip the compatibility check with the docker image version.

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Do not use by default a “floating” tag

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>

* [stable/datadog] Document the `agents.image.doNotCheckTag` parameter

Signed-off-by: Lénaïc Huard <lenaic.huard@datadoghq.com>
This commit is contained in:
Lénaïc Huard
2020-05-07 03:15:09 -07:00
committed by GitHub
parent 740135ed99
commit de0939a800
11 changed files with 87 additions and 32 deletions
+10 -1
View File
@@ -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.
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 2.2.12
version: 2.3.0
appVersion: "7"
description: Datadog Agent
keywords:
+6 -5
View File
@@ -276,10 +276,11 @@ helm install --name <RELEASE_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 <RELEASE_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` |
+19
View File
@@ -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.
*/}}
@@ -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
@@ -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
@@ -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 -}}
@@ -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 -}}
@@ -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 -}}
+8
View File
@@ -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:
+11 -2
View File
@@ -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.