Skip to content

Commit

Permalink
use helper function to know if language detection should be enabled o…
Browse files Browse the repository at this point in the history
…r not
  • Loading branch information
adel121 committed Apr 3, 2024
1 parent 90d304b commit c62aac1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions charts/datadog/templates/_components-common-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# variables shared between components: agent, cluster-agent
{{- define "components-common-env" -}}
- name: DD_LANGUAGE_DETECTION_ENABLED
value: {{ (and .Values.datadog.apm.instrumentation.enabled .Values.datadog.apm.instrumentation.language_detection.enabled) | quote }}
value: {{ include "language-detection-enabled" . | quote }}
- name: DD_LANGUAGE_DETECTION_REPORTING_ENABLED
value: {{ (and .Values.datadog.apm.instrumentation.enabled .Values.datadog.apm.instrumentation.language_detection.enabled) | quote }}
value: {{ include "language-detection-enabled" . | quote }}
{{- if .Values.datadog.secretBackend.command }}
- name: DD_SECRET_BACKEND_COMMAND
value: {{ .Values.datadog.secretBackend.command | quote }}
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 @@ -52,10 +52,8 @@
{{- end }}
- name: DD_ORCHESTRATOR_EXPLORER_ENABLED
value: {{ (include "should-enable-k8s-resource-monitoring" .) | quote }}
{{- if and .Values.datadog.apm.instrumentation.enabled .Values.datadog.apm.instrumentation.language_detection.enabled }}
- name: DD_PROCESS_CONFIG_PROCESS_COLLECTION_ENABLED
value: "true"
{{- end }}
- name: DD_PROCESS_AGENT_PROCESS_COLLECTION_ENABLED
value: {{ include "language-detection-enabled" . | quote }}
{{- include "additional-env-entries" .Values.agents.containers.processAgent.env | indent 4 }}
{{- include "additional-env-dict-entries" .Values.agents.containers.processAgent.envDict | indent 4 }}
volumeMounts:
Expand Down
11 changes: 11 additions & 0 deletions charts/datadog/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -903,4 +903,15 @@ Create RBACs for custom resources
{{- end -}}
{{- end -}}

{{/*
Return true if language detection feature is enabled
*/}}
{{- define "language-detection-enabled" -}}
{{- if and .Values.datadog.apm.instrumentation.enabled .Values.datadog.apm.instrumentation.language_detection.enabled -}}
true
{{- else -}}
false
{{- end -}}
{{- end -}}


2 changes: 1 addition & 1 deletion charts/datadog/templates/cluster-agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ spec:
value: {{ .Values.datadog.orchestratorExplorer.container_scrubbing.enabled | quote }}
{{- end }}
- name: DD_CLUSTER_AGENT_LANGUAGE_DETECTION_PATCHER_ENABLED
value: {{ (and .Values.datadog.apm.instrumentation.enabled .Values.datadog.apm.instrumentation.language_detection.enabled) | quote }}
value: {{ include "language-detection-enabled" . | quote }}
{{- if eq (include "should-enable-security-agent" .) "true" }}
- name: DD_COMPLIANCE_CONFIG_ENABLED
value: {{ .Values.datadog.securityAgent.compliance.enabled | quote }}
Expand Down

0 comments on commit c62aac1

Please sign in to comment.