Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DD_AGENT_IPC_* env vars #1661

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.88.0

* Adds env vars `DD_AGENT_IPC_PORT` and `DD_AGENT_IPC_CONFIG_REFRESH_INTERVAL` when Otel Agent is enabled and adds flag `--sync-delay=30s` to otel agent.

## 3.87.0

* Launch `otel-agent` with the `--core-config` switch pointing to the main agent configuration. Note that this affects the OTel Agent beta images, early beta image releases with version tag `<7.59.0-v.1.2.0` will experience issues and should remain on older helm chart versions for their deployments. For regular users not deploying the `otel-agent` beta images, this should be a NOOP.
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
apiVersion: v1
name: datadog
version: 3.87.0
version: 3.88.0
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 3.87.0](https://img.shields.io/badge/Version-3.87.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.88.0](https://img.shields.io/badge/Version-3.88.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
32 changes: 32 additions & 0 deletions charts/datadog/templates/_container-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,38 @@
{{- include "containers-common-env" . | nindent 4 }}
{{- include "fips-envvar" . | nindent 4 }}
{{- include "processes-common-envs" . | nindent 4 }}
{{- if eq (include "should-enable-otel-agent" .) "true" }}
{{- $found := false }}
{{- range .Values.agents.containers.agent.env }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you extract the $found computation to _helpers.tpl? like this e.g.:

{{/*
Return value of "DD_PROCESS_CONFIG_RUN_IN_CORE_AGENT_ENABLED" env var in core agent container.
*/}}
{{- define "get-process-checks-in-core-agent-envvar" -}}
{{- range .Values.agents.containers.agent.env -}}
{{- if eq .name "DD_PROCESS_CONFIG_RUN_IN_CORE_AGENT_ENABLED" -}}
{{- .value -}}
{{- end -}}
{{- end -}}
{{- end -}}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved logic to helpers in: 267473a.

{{- if eq .name "DD_AGENT_IPC_PORT" }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- range .Values.datadog.env }}
{{- if eq .name "DD_AGENT_IPC_PORT" }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- if not $found }}
- name: DD_AGENT_IPC_PORT
value: "5009"
{{- end }}
{{- $found := false }}
{{- range .Values.agents.containers.agent.env }}
{{- if eq .name "DD_AGENT_IPC_CONFIG_REFRESH_INTERVAL" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this or DD_AGENT_IPC_PORT used elsewhere in the chart, do we expect them to be added?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Youre right, we dont set this in helm charts. This is to make sure we don't override it if the user sets it in datadog.env, Values.agents.containers.agent.env or Values.agents.containers.otelAgent.env.

{{- $found = true }}
{{- end }}
{{- end }}
{{- range .Values.datadog.env }}
{{- if eq .name "DD_AGENT_IPC_CONFIG_REFRESH_INTERVAL" }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- if not $found }}
- name: DD_AGENT_IPC_CONFIG_REFRESH_INTERVAL
value: "60"
{{- end }}
{{- end }}

{{- if .Values.datadog.logLevel }}
- name: DD_LOG_LEVEL
Expand Down
34 changes: 32 additions & 2 deletions charts/datadog/templates/_container-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
image: "{{ include "image-path" (dict "root" .Values "image" .Values.agents.image) }}"
imagePullPolicy: {{ .Values.agents.image.pullPolicy }}
{{- if eq .Values.targetSystem "linux" }}
command: ["otel-agent", "--config={{ template "datadog.otelconfPath" . }}/otel-config.yaml", "--core-config={{ template "datadog.confPath" . }}/datadog.yaml"]
command: ["otel-agent", "--config={{ template "datadog.otelconfPath" . }}/otel-config.yaml", "--core-config={{ template "datadog.confPath" . }}/datadog.yaml", "--sync-delay=30s"]
{{- end -}}
{{- if eq .Values.targetSystem "windows" }}
command: ["otel-agent", "-foreground", "-config={{ template "datadog.otelconfPath" . }}/otel-config.yaml", "--core-config={{ template "datadog.confPath" . }}/datadog.yaml"]
command: ["otel-agent", "-foreground", "-config={{ template "datadog.otelconfPath" . }}/otel-config.yaml", "--core-config={{ template "datadog.confPath" . }}/datadog.yaml", "--sync-delay=30s"]
{{- end -}}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.otelAgent.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
resources:
Expand All @@ -32,6 +32,36 @@
env:
{{- include "containers-common-env" . | nindent 4 }}
{{- include "containers-cluster-agent-env" . | nindent 4 }}
{{- $found := false }}
{{- range .Values.agents.containers.otelAgent.env }}
{{- if eq .name "DD_AGENT_IPC_PORT" }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- range .Values.datadog.env }}
{{- if eq .name "DD_AGENT_IPC_PORT" }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- if not $found }}
- name: DD_AGENT_IPC_PORT
value: "5009"
{{- end }}
{{- $found := false }}
{{- range .Values.agents.containers.otelAgent.env }}
{{- if eq .name "DD_AGENT_IPC_CONFIG_REFRESH_INTERVAL" }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- range .Values.datadog.env }}
{{- if eq .name "DD_AGENT_IPC_CONFIG_REFRESH_INTERVAL" }}
{{- $found = true }}
{{- end }}
{{- end }}
{{- if not $found }}
- name: DD_AGENT_IPC_CONFIG_REFRESH_INTERVAL
value: "60"
{{- end }}
{{- include "fips-envvar" . | nindent 4 }}
- name: DD_LOG_LEVEL
value: {{ .Values.agents.containers.otelAgent.logLevel | default .Values.datadog.logLevel | quote }}
Expand Down
Loading