# The purpose of this template is to define a minimal set of environment
# variables required to operate dedicated containers in the daemonset.
{{- define "containers-common-env" -}}
- name: DD_API_KEY
  valueFrom:
    secretKeyRef:
      name: {{ template "datadog.apiSecretName" . }}
      key: api-key
{{- if semverCompare "^1.7-0" .Capabilities.KubeVersion.GitVersion }}
- name: DD_KUBERNETES_KUBELET_HOST
  valueFrom:
    fieldRef:
      fieldPath: status.hostIP
{{- end }}
{{- if .Values.datadog.hostname }}
- name: DD_HOSTNAME
  value: {{ .Values.datadog.hostname | quote }}
{{- end }}
{{- if .Values.datadog.tags }}
- name: DD_TAGS
  value: {{ .Values.datadog.tags | quote }}
{{- end }}
- name: KUBERNETES
  value: "yes"
{{- end -}}
