Skip to content

Commit

Permalink
Add providers.gke.gdc option to datadog chart (#1521)
Browse files Browse the repository at this point in the history
* wip

* add providers.gke.gdc option to datadog chart

* update test baselines

* syntax fix

* add back logs hostPaths

* cleanup/wip

* fixes, add test, update baselines

* fix dd_nodename

* fix test, bump version, update baselines

* update readme, fix test

* cleanup/refactor

* apply review suggestions

* bump chart version and update baselines/docs

* remove redundant template
  • Loading branch information
fanny-jiang authored Nov 11, 2024
1 parent db5854c commit 6db36e9
Show file tree
Hide file tree
Showing 27 changed files with 920 additions and 126 deletions.
4 changes: 4 additions & 0 deletions charts/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Datadog changelog

## 3.79.0

* Add Logs Collection support for Google GKE on GDC

## 3.78.0

* Set default `Agent` and `Cluster-Agent` version to `7.59.0`.
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 3.78.0
version: 3.79.0
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
3 changes: 2 additions & 1 deletion charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 3.78.0](https://img.shields.io/badge/Version-3.78.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.79.0](https://img.shields.io/badge/Version-3.79.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)

[Datadog](https://www.datadoghq.com/) is a hosted infrastructure monitoring platform. This chart adds the Datadog Agent to all nodes in your cluster via a DaemonSet. It also optionally depends on the [kube-state-metrics chart](https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-state-metrics). For more information about monitoring Kubernetes with Datadog, please refer to the [Datadog documentation website](https://docs.datadoghq.com/agent/basic_agent_usage/kubernetes/).

Expand Down Expand Up @@ -879,6 +879,7 @@ helm install <RELEASE_NAME> \
| providers.eks.ec2.useHostnameFromFile | bool | `false` | Use hostname from EC2 filesystem instead of fetching from metadata endpoint. |
| providers.gke.autopilot | bool | `false` | Enables Datadog Agent deployment on GKE Autopilot |
| providers.gke.cos | bool | `false` | Enables Datadog Agent deployment on GKE with Container-Optimized OS (COS) |
| providers.gke.gdc | bool | `false` | Enables Datadog Agent deployment on GKE on Google Distributed Cloud (GDC) |
| registry | string | `nil` | Registry to use for all Agent images (default to [gcr.io | eu.gcr.io | asia.gcr.io | datadoghq.azurecr.io | public.ecr.aws/datadog] depending on datadog.site value) |
| remoteConfiguration.enabled | bool | `true` | Set to true to enable remote configuration on the Cluster Agent (if set) and the node agent. Can be overridden if `datadog.remoteConfiguration.enabled` Preferred way to enable Remote Configuration. |
| targetSystem | string | `"linux"` | Target OS for this deployment (possible values: linux, windows) |
Expand Down
20 changes: 20 additions & 0 deletions charts/datadog/ci/gke-gdc-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
providers:
gke:
gdc: true

datadog:
apiKey: "00000000000000000000000000000000"
appKey: "0000000000000000000000000000000000000000"

apm:
socketEnabled: false
portEnabled: false

logs:
enabled: true
containerCollectAll: true
containerCollectUsingFiles: true
autoMultiLineDetection: true

kubeStateMetricsCore:
enabled: true
6 changes: 6 additions & 0 deletions charts/datadog/templates/_components-common-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@
- name: DD_EXCLUDE_PAUSE_CONTAINER
value: "false"
{{- end }}
{{- if .Values.providers.gke.gdc }}
- name: DD_KUBELET_CLIENT_CRT
value: /certs/tls.crt
- name: DD_KUBELET_CLIENT_KEY
value: /certs/tls.key
{{- end }}
{{- end }}
10 changes: 8 additions & 2 deletions charts/datadog/templates/_container-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
- name: DD_HEALTH_PORT
{{- $healthPort := .Values.agents.containers.agent.healthPort }}
value: {{ $healthPort | quote }}
{{- if eq .Values.targetSystem "linux" }}
{{- if and (eq .Values.targetSystem "linux") (not .Values.providers.gke.gdc) }}
- name: DD_DOGSTATSD_SOCKET
value: {{ .Values.datadog.dogstatsd.socketPath | quote }}
{{- end }}
Expand Down Expand Up @@ -237,6 +237,7 @@
readOnly: true
{{- end }}
{{- if eq .Values.targetSystem "linux" }}
{{- if not .Values.providers.gke.gdc }}
- name: dsdsocket
mountPath: {{ (dir .Values.datadog.dogstatsd.socketPath) }}
readOnly: false
Expand All @@ -262,6 +263,7 @@
mountPath: /etc/passwd
readOnly: true
{{- end }}
{{- end }}
{{- if or .Values.datadog.logs.enabled .Values.datadog.logsEnabled }}
- name: pointerdir
mountPath: /opt/datadog-agent/run
Expand All @@ -275,7 +277,7 @@
mountPath: /var/log/containers
mountPropagation: {{ .Values.datadog.hostVolumeMountPropagation }}
readOnly: true
{{- if not .Values.datadog.criSocketPath }}
{{- if and (not .Values.datadog.criSocketPath) (not .Values.providers.gke.gdc) }}
- name: logdockercontainerpath
mountPath: /var/lib/docker/containers
mountPropagation: {{ .Values.datadog.hostVolumeMountPropagation }}
Expand Down Expand Up @@ -338,6 +340,10 @@
{{- if .Values.datadog.kubelet.hostCAPath }}
{{ include "datadog.kubelet.volumeMount" . | indent 4 }}
{{- end }}
{{- if .Values.providers.gke.gdc }}
- name: kubelet-cert-volume
mountPath: /certs
{{- end }}
{{- if .Values.agents.volumeMounts }}
{{ toYaml .Values.agents.volumeMounts | indent 4 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/templates/_container-cri-volumemounts.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- define "container-crisocket-volumemounts" -}}
{{- if .Values.datadog.containerRuntimeSupport.enabled }}
{{- if (eq (include "container-runtime-support-enabled" .) "true") }}
{{- if eq .Values.targetSystem "linux" }}
- name: runtimesocketdir
mountPath: {{ print "/host/" (dir (include "datadog.dockerOrCriSocketPath" .)) | clean }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- define "linux-container-host-release-volumemounts" -}}
{{- if not .Values.providers.gke.gdc }}
{{- if eq (include "should-enable-system-probe" .) "true" }}
- name: os-release-file
mountPath: /host{{ .Values.datadog.systemProbe.osReleasePath | default .Values.datadog.osReleasePath }}
Expand All @@ -9,3 +10,4 @@
readOnly: true
{{- end }}
{{- end }}
{{- end }}
4 changes: 3 additions & 1 deletion charts/datadog/templates/_container-trace-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
readOnly: true
{{- end }}
{{- if eq .Values.targetSystem "linux" }}
{{- if not .Values.providers.gke.autopilot }}
{{- if not (or .Values.providers.gke.autopilot .Values.providers.gke.gdc) }}
- name: procdir
mountPath: /host/proc
mountPropagation: {{ .Values.datadog.hostVolumeMountPropagation }}
Expand All @@ -99,6 +99,7 @@
- name: tmpdir
mountPath: /tmp
readOnly: false # Need RW for tmp directory
{{- if not .Values.providers.gke.gdc }}
- name: dsdsocket
mountPath: {{ (dir .Values.datadog.dogstatsd.socketPath) }}
readOnly: false # Need RW for UDS DSD socket
Expand All @@ -109,6 +110,7 @@
{{- end }}
{{- end }}
{{- include "container-crisocket-volumemounts" . | nindent 4 }}
{{- end }}
{{- include "container-cloudinit-volumemounts" . | nindent 4 }}
{{- if .Values.datadog.kubelet.hostCAPath }}
{{ include "datadog.kubelet.volumeMount" . | indent 4 }}
Expand Down
11 changes: 10 additions & 1 deletion charts/datadog/templates/_containers-common-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
- name: DD_KUBERNETES_HTTPS_KUBELET_PORT
value: "0"
{{- end }}
{{- if .Values.providers.gke.gdc }}
- name: DD_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: DD_HOSTNAME
value: "$(DD_NODE_NAME)-$(DD_CLUSTER_NAME)"
{{- end }}
{{- if eq .Values.targetSystem "linux" }}
{{- if .Values.providers.eks.ec2.useHostnameFromFile }}
- name: DD_HOSTNAME_FILE
Expand Down Expand Up @@ -116,7 +125,7 @@
{{- end }}
{{- end }}
{{- else }} # No support for env AD
{{- if .Values.datadog.containerRuntimeSupport.enabled }}
{{- if (eq (include "container-runtime-support-enabled" .) "true") }}
{{- if or .Values.providers.gke.autopilot .Values.datadog.criSocketPath }}
- name: DD_CRI_SOCKET_PATH
value: {{ print "/host/" (include "datadog.dockerOrCriSocketPath" .) | clean }}
Expand Down
12 changes: 7 additions & 5 deletions charts/datadog/templates/_containers-init-linux.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{- define "containers-init-linux" -}}
- name: init-volume
{{- if not .Values.providers.gke.autopilot }}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.initContainers.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
{{- include "generate-security-context" (dict "securityContext" .Values.agents.containers.initContainers.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
{{- end }}
image: "{{ include "image-path" (dict "root" .Values "image" .Values.agents.image) }}"
imagePullPolicy: {{ .Values.agents.image.pullPolicy }}
Expand All @@ -16,7 +16,7 @@
{{ toYaml .Values.agents.containers.initContainers.resources | indent 4 }}
- name: init-config
{{- if not .Values.providers.gke.autopilot }}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.initContainers.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
{{- include "generate-security-context" (dict "securityContext" .Values.agents.containers.initContainers.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
{{- end }}
image: "{{ include "image-path" (dict "root" .Values "image" .Values.agents.image) }}"
imagePullPolicy: {{ .Values.agents.image.pullPolicy }}
Expand All @@ -26,9 +26,6 @@
args:
- for script in $(find /etc/cont-init.d/ -type f -name '*.sh' | sort) ; do bash $script ; done
volumeMounts:
- name: logdatadog
mountPath: {{ template "datadog.logDirectoryPath" . }}
readOnly: false # Need RW to write logs
- name: config
mountPath: /etc/datadog-agent
readOnly: false # Need RW for config path
Expand All @@ -42,11 +39,16 @@
mountPath: /checks.d
readOnly: true
{{- end }}
{{- if not .Values.providers.gke.gdc }}
- name: logdatadog
mountPath: {{ template "datadog.logDirectoryPath" . }}
readOnly: false # Need RW to write logs
- name: procdir
mountPath: /host/proc
mountPropagation: {{ .Values.datadog.hostVolumeMountPropagation }}
readOnly: true
{{- include "container-crisocket-volumemounts" . | nindent 4 }}
{{- end }}
{{- if eq (include "should-enable-system-probe" .) "true" }}
- name: sysprobe-config
mountPath: /etc/datadog-agent/system-probe.yaml
Expand Down
31 changes: 19 additions & 12 deletions charts/datadog/templates/_daemonset-volumes-linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
emptyDir: {}
- name: tmpdir
emptyDir: {}
- name: s6-run
emptyDir: {}
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
configMap:
name: {{ include "agents.confd-configmap-name" . }}
{{- end }}
{{- if not .Values.providers.gke.gdc }}
- hostPath:
path: /proc
name: procdir
Expand Down Expand Up @@ -58,13 +66,6 @@
type: DirectoryOrCreate
name: apmsocket
{{- end }}
- name: s6-run
emptyDir: {}
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
configMap:
name: {{ include "agents.confd-configmap-name" . }}
{{- end }}
{{- if eq (include "should-enable-system-probe" .) "true" }}
- name: sysprobe-config
configMap:
Expand Down Expand Up @@ -183,6 +184,12 @@
name: {{ .Values.datadog.securityAgent.runtime.policies.configMap }}
{{- end }}
{{- end }}
{{- if (eq (include "container-runtime-support-enabled" .) "true") }}
- hostPath:
path: {{ dir (include "datadog.dockerOrCriSocketPath" .) }}
name: runtimesocketdir
{{- end }}
{{- end }}
{{- if or .Values.datadog.logs.enabled .Values.datadog.logsEnabled }}
- hostPath:
path: {{ template "datadog.hostMountRoot" . }}/logs
Expand All @@ -193,15 +200,15 @@
- hostPath:
path: /var/log/containers
name: logscontainerspath
{{- if not .Values.datadog.criSocketPath }}
{{- if and (not .Values.datadog.criSocketPath) (not .Values.providers.gke.gdc) }}
- hostPath:
path: /var/lib/docker/containers
name: logdockercontainerpath
{{- end }}
{{- end }}
{{- if .Values.datadog.containerRuntimeSupport.enabled }}
- hostPath:
path: {{ dir (include "datadog.dockerOrCriSocketPath" .) }}
name: runtimesocketdir
{{- if .Values.providers.gke.gdc }}
- secret:
secretName: datadog-kubelet-cert
name: kubelet-cert-volume
{{- end }}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/datadog/templates/_daemonset-volumes-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
path: C:/ProgramData
name: logdockercontainerpath
{{- end }}
{{- if .Values.datadog.containerRuntimeSupport.enabled }}
{{- if (eq (include "container-runtime-support-enabled" .) "true") }}
- hostPath:
path: {{ template "datadog.dockerOrCriSocketPath" . }}
name: runtimesocket
Expand Down
Loading

0 comments on commit 6db36e9

Please sign in to comment.