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

Get rid of logs in interactive CLI commands #1488

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion charts/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Datadog changelog

## 3.69.4

* Remove logs in the output of interactive CLI commands executed by users via `kubectl exec`.

## 3.69.3

* Update `datadog-crds` dependency to `1.7.2`.
Expand All @@ -14,7 +18,7 @@

## 3.69.0

* Add support OTel Agent container. OTel Agent is Datadog's distribution of OTel collector.
* Add support OTel Agent container. OTel Agent is Datadog's distribution of OTel collector.

## 3.68.2

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.69.3
version: 3.69.4
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
4 changes: 2 additions & 2 deletions charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 3.69.3](https://img.shields.io/badge/Version-3.69.3-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.69.4](https://img.shields.io/badge/Version-3.69.4-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 @@ -569,7 +569,7 @@ helm install <RELEASE_NAME> \
| clusterAgent.admissionController.webhookName | string | `"datadog-webhook"` | Name of the mutatingwebhookconfigurations created by the cluster-agent |
| clusterAgent.advancedConfd | object | `{}` | Provide additional cluster check configurations. Each key is an integration containing several config files. |
| clusterAgent.affinity | object | `{}` | Allow the Cluster Agent Deployment to schedule using affinity rules |
| clusterAgent.command | list | `[]` | Command to run in the Cluster Agent container as entrypoint |
| clusterAgent.command | list | `["datadog-cluster-agent","start"]` | Command to run in the Cluster Agent container as entrypoint |
| clusterAgent.confd | object | `{}` | Provide additional cluster check configurations. Each key will become a file in /conf.d. |
| clusterAgent.containerExclude | string | `nil` | Exclude containers from the Cluster Agent Autodiscovery, as a space-separated list. (Requires Agent/Cluster Agent 7.50.0+) |
| clusterAgent.containerInclude | string | `nil` | Include containers in the Cluster Agent Autodiscovery, as a space-separated list. If a container matches an include rule, it’s always included in the Autodiscovery. (Requires Agent/Cluster Agent 7.50.0+) |
Expand Down
11 changes: 6 additions & 5 deletions charts/datadog/templates/_container-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
- name: agent
image: "{{ include "image-path" (dict "root" .Values "image" .Values.agents.image) }}"
imagePullPolicy: {{ .Values.agents.image.pullPolicy }}
command: ["agent", "run"]
{{- if eq .Values.targetSystem "linux" }}
command: ["env", "DD_LOG_LEVEL={{ .Values.agents.containers.agent.logLevel | default .Values.datadog.logLevel }}", "agent", "run"]
{{- end }}
{{- if eq .Values.targetSystem "windows" }}
command: ["pwsh", "-Command", "$env:DD_LOG_LEVEL='{{ .Values.agents.containers.agent.logLevel | default .Values.datadog.logLevel }}'; & agent run"]
{{- end }}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.agent.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version "sysAdmin" .Values.datadog.sbom.containerImage.uncompressedLayersSupport) | indent 2 }}
resources:
{{ toYaml .Values.agents.containers.agent.resources | indent 4 }}
Expand Down Expand Up @@ -60,10 +65,6 @@
{{- include "fips-envvar" . | nindent 4 }}
{{- include "processes-common-envs" . | nindent 4 }}

{{- if .Values.datadog.logLevel }}
- name: DD_LOG_LEVEL
value: {{ .Values.agents.containers.agent.logLevel | default .Values.datadog.logLevel | quote }}
{{- end }}
{{- if .Values.datadog.dogstatsd.port }}
- name: DD_DOGSTATSD_PORT
value: {{ .Values.datadog.dogstatsd.port | quote }}
Expand Down
6 changes: 2 additions & 4 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"]
command: ["env", "DD_LOG_LEVEL={{ .Values.agents.containers.otelAgent.logLevel | default .Values.datadog.logLevel | quote }}", "otel-agent", "--config={{ template "datadog.otelconfPath" . }}/otel-config.yaml"]
{{- end -}}
{{- if eq .Values.targetSystem "windows" }}
command: ["otel-agent", "-foreground", "-config={{ template "datadog.otelconfPath" . }}/datadog.yaml"]
command: ["pwsh", "-Command", "$env:DD_LOG_LEVEL='{{ .Values.agents.containers.otelAgent.logLevel | default .Values.datadog.logLevel }}'; & otel-agent -foreground -config={{ template "datadog.otelconfPath" . }}/datadog.yaml"]
{{- 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 @@ -33,8 +33,6 @@
{{- include "containers-common-env" . | nindent 4 }}
{{- include "containers-cluster-agent-env" . | nindent 4 }}
{{- include "fips-envvar" . | nindent 4 }}
- name: DD_LOG_LEVEL
value: {{ .Values.agents.containers.otelAgent.logLevel | default .Values.datadog.logLevel | quote }}
{{- include "additional-env-entries" .Values.agents.containers.otelAgent.env | indent 4 }}
{{- include "additional-env-dict-entries" .Values.agents.containers.otelAgent.envDict | indent 4 }}
volumeMounts:
Expand Down
6 changes: 2 additions & 4 deletions charts/datadog/templates/_container-process-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: ["process-agent", "{{template "process-agent-config-file-flag" . }}={{ template "datadog.confPath" . }}/datadog.yaml"]
command: ["env", "DD_LOG_LEVEL={{ .Values.agents.containers.processAgent.logLevel | default .Values.datadog.logLevel }}", "process-agent", "{{template "process-agent-config-file-flag" . }}={{ template "datadog.confPath" . }}/datadog.yaml"]
{{- end }}
{{- if eq .Values.targetSystem "windows" }}
command: ["process-agent", "-foreground", "{{template "process-agent-config-file-flag" . }}={{ template "datadog.confPath" . }}/datadog.yaml"]
command: ["pwsh", "-Command", "$env:DD_LOG_LEVEL='{{ .Values.agents.containers.processAgent.logLevel | default .Values.datadog.logLevel }}'; & process-agent -foreground {{template "process-agent-config-file-flag" . }}={{ template "datadog.confPath" . }}/datadog.yaml"]
{{- end -}}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.processAgent.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
{{- if .Values.agents.containers.processAgent.ports }}
Expand All @@ -29,8 +29,6 @@
{{- include "containers-cluster-agent-env" . | nindent 4 }}
{{- include "fips-envvar" . | nindent 4 }}
{{- include "processes-common-envs" . | nindent 4 }}
- name: DD_LOG_LEVEL
value: {{ .Values.agents.containers.processAgent.logLevel | default .Values.datadog.logLevel | quote }}
- name: DD_SYSTEM_PROBE_ENABLED
value: {{ .Values.datadog.networkMonitoring.enabled | quote }}
{{- if .Values.datadog.networkMonitoring.enabled }}
Expand Down
9 changes: 6 additions & 3 deletions charts/datadog/templates/_container-security-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
capabilities:
add: ["AUDIT_CONTROL", "AUDIT_READ"]
{{- end }}
command: ["security-agent", "start", "-c={{ template "datadog.confPath" . }}/datadog.yaml"]
{{- if eq .Values.targetSystem "linux" }}
command: ["env", "DD_LOG_LEVEL={{ .Values.agents.containers.securityAgent.logLevel | default .Values.datadog.logLevel }}", "security-agent", "start", "-c={{ template "datadog.confPath" . }}/datadog.yaml"]

Choose a reason for hiding this comment

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

I see some containers have a | quote filter on the log level (otel-agent ) and others don't. Why the difference?

{{- end }}
{{- if eq .Values.targetSystem "windows" }}
command: ["pwsh", "-Command", "$env:DD_LOG_LEVEL='{{ .Values.agents.containers.securityAgent.logLevel | default .Values.datadog.logLevel }}'; & security-agent start -c ={{ template "datadog.confPath" . }}/datadog.yaml"]
{{- end }}
resources:
{{ toYaml .Values.agents.containers.securityAgent.resources | indent 4 }}
{{- if .Values.agents.containers.securityAgent.ports }}
Expand All @@ -27,8 +32,6 @@
{{- include "containers-common-env" . | nindent 4 }}
{{- include "containers-cluster-agent-env" . | nindent 4 }}
{{- include "fips-envvar" . | nindent 4 }}
- name: DD_LOG_LEVEL
value: {{ .Values.agents.containers.securityAgent.logLevel | default .Values.datadog.logLevel | quote }}
- name: DD_COMPLIANCE_CONFIG_ENABLED
value: {{ .Values.datadog.securityAgent.compliance.enabled | quote }}
{{- if .Values.datadog.securityAgent.compliance.enabled }}
Expand Down
9 changes: 6 additions & 3 deletions charts/datadog/templates/_container-system-probe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
image: "{{ include "image-path" (dict "root" .Values "image" .Values.agents.image) }}"
imagePullPolicy: {{ .Values.agents.image.pullPolicy }}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.systemProbe.securityContext "targetSystem" .Values.targetSystem "seccomp" .Values.datadog.systemProbe.seccomp "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
command: ["/opt/datadog-agent/embedded/bin/system-probe", "--config=/etc/datadog-agent/system-probe.yaml"]
{{- if eq .Values.targetSystem "linux" }}
command: ["env", "DD_LOG_LEVEL={{ .Values.agents.containers.systemProbe.logLevel | default .Values.datadog.logLevel }}", "/opt/datadog-agent/embedded/bin/system-probe", "--config=/etc/datadog-agent/system-probe.yaml"]
{{- end }}
{{- if eq .Values.targetSystem "windows" }}
command: ["pwsh", "-Command", "$env:DD_LOG_LEVEL='{{ .Values.agents.containers.systemProbe.logLevel | default .Values.datadog.logLevel }}'; & /opt/datadog-agent/embedded/bin/system-probe --config=/etc/datadog-agent/system-probe.yaml"]
{{- end }}
{{- if .Values.agents.containers.systemProbe.ports }}
ports:
{{ toYaml .Values.agents.containers.systemProbe.ports | indent 2 }}
Expand All @@ -19,8 +24,6 @@
{{- end }}
env:
{{- include "containers-common-env" . | nindent 4 }}
- name: DD_LOG_LEVEL
value: {{ .Values.agents.containers.systemProbe.logLevel | default .Values.datadog.logLevel | quote }}
{{- if .Values.datadog.serviceMonitoring.enabled }}
- name: HOST_ROOT
value: "/host/root"
Expand Down
6 changes: 2 additions & 4 deletions charts/datadog/templates/_container-trace-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: ["trace-agent", "-config={{ template "datadog.confPath" . }}/datadog.yaml"]
command: ["env", "DD_LOG_LEVEL={{ .Values.agents.containers.traceAgent.logLevel | default .Values.datadog.logLevel }}", "trace-agent", "-config={{ template "datadog.confPath" . }}/datadog.yaml"]
{{- end -}}
{{- if eq .Values.targetSystem "windows" }}
command: ["trace-agent", "-foreground", "-config={{ template "datadog.confPath" . }}/datadog.yaml"]
command: ["pwsh", "-Command", "$env:DD_LOG_LEVEL='{{ .Values.agents.containers.traceAgent.logLevel | default .Values.datadog.logLevel }}'; & trace-agent -foreground -config={{ template "datadog.confPath" . }}/datadog.yaml"]
{{- end -}}
{{ include "generate-security-context" (dict "securityContext" .Values.agents.containers.traceAgent.securityContext "targetSystem" .Values.targetSystem "seccomp" "" "kubeversion" .Capabilities.KubeVersion.Version) | indent 2 }}
resources:
Expand Down Expand Up @@ -34,8 +34,6 @@
{{- include "containers-common-env" . | nindent 4 }}
{{- include "containers-cluster-agent-env" . | nindent 4 }}
{{- include "fips-envvar" . | nindent 4 }}
- name: DD_LOG_LEVEL
value: {{ .Values.agents.containers.traceAgent.logLevel | default .Values.datadog.logLevel | quote }}
- name: DD_APM_ENABLED
value: "true"
- name: DD_APM_NON_LOCAL_TRAFFIC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ spec:
image: "{{ include "image-path" (dict "root" .Values "image" .Values.clusterChecksRunner.image) }}"
command: ["bash", "-c"]
args:
- rm -rf /etc/datadog-agent/conf.d && touch /etc/datadog-agent/datadog.yaml && exec agent run
- rm -rf /etc/datadog-agent/conf.d && touch /etc/datadog-agent/datadog.yaml && exec env DD_LOG_LEVEL={{ .Values.datadog.logLevel | quote }} agent run
imagePullPolicy: {{ .Values.clusterChecksRunner.image.pullPolicy }}
{{- if .Values.clusterChecksRunner.ports }}
ports:
Expand Down Expand Up @@ -152,10 +152,6 @@ spec:
- name: DD_DD_URL
value: {{ .Values.datadog.dd_url | quote }}
{{- end }}
{{- if .Values.datadog.logLevel }}
- name: DD_LOG_LEVEL
value: {{ .Values.datadog.logLevel | quote }}
{{- end }}
- name: DD_EXTRA_CONFIG_PROVIDERS
value: "clusterchecks"
- name: DD_HEALTH_PORT
Expand Down
9 changes: 4 additions & 5 deletions charts/datadog/templates/cluster-agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ spec:
- name: cluster-agent
image: "{{ include "image-path" (dict "root" .Values "image" .Values.clusterAgent.image) }}"
{{- with .Values.clusterAgent.command }}
command: {{ range . }}
command:
- env
- DD_LOG_LEVEL={{ $.Values.datadog.logLevel }}
{{- range . }}
- {{ . | quote }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -274,10 +277,6 @@ spec:
- name: DD_EXTRA_LISTENERS
value: "kube_endpoints kube_services"
{{- end }}
{{- if .Values.datadog.logLevel }}
- name: DD_LOG_LEVEL
value: {{ .Values.datadog.logLevel | quote }}
{{- end }}
- name: DD_LEADER_ELECTION
value: {{ .Values.datadog.leaderElection | quote}}
- name: DD_LEADER_ELECTION_DEFAULT_RESOURCE
Expand Down
4 changes: 3 additions & 1 deletion charts/datadog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,9 @@ clusterAgent:
securityContext: {}

# clusterAgent.command -- Command to run in the Cluster Agent container as entrypoint
command: []
command:
- datadog-cluster-agent
- start

# clusterAgent.token -- Cluster Agent token is a preshared key between node agents and cluster agent (autogenerated if empty, needs to be at least 32 characters a-zA-z)
token: ""
Expand Down
Loading