Unverified Commit e870c8ab by Denise Committed by GitHub

Merge pull request #220 from guangbochen/datadog2.3

Bump datadog chart to v1.33.0
parents 97969130 686f95f2
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
# OWNERS file for Kubernetes
OWNERS
apiVersion: v1
name: datadog
version: 1.33.0
appVersion: 6.13.0
description: DataDog Agent
keywords:
- monitoring
- alerting
- metric
home: https://www.datadoghq.com
icon: file://../dd_logo_70x75.png
sources:
- https://app.datadoghq.com/account/settings#agent/kubernetes
- https://github.com/DataDog/datadog-agent
maintainers:
- name: hkaj
email: haissam@datadoghq.com
- name: irabinovitch
email: ilan@datadoghq.com
- name: charlyf
email: charly@datadoghq.com
- name: mfpierre
email: pierre.margueritte@datadoghq.com
- name: clamoriniere
email: cedric.lamoriniere@datadoghq.com
- name: xlucas
email: xavier.lucas@datadoghq.com
approvers:
- hkaj
- irabinovitch
- charlyf
- mfpierre
- clamoriniere
- xlucas
reviewers:
- hkaj
- irabinovitch
- charlyf
- mfpierre
- clamoriniere
- xlucas
# Datadog
[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/kubernetes/charts/tree/master/stable/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/).
Datadog [offers two variants](https://hub.docker.com/r/datadog/agent/tags/), switch to a `-jmx` tag if you need to run JMX/java integrations. The chart also supports running [the standalone dogstatsd image](https://hub.docker.com/r/datadog/dogstatsd/tags/).
See the [Datadog JMX integration](https://docs.datadoghq.com/integrations/java/) to learn more.
## Prerequisites
Kubernetes 1.4+ or OpenShift 3.4+, note that:
* the Datadog Agent supports Kubernetes 1.3+
* The Datadog chart's defaults are tailored to Kubernetes 1.7.6+, see [Datadog Agent legacy Kubernetes versions documentation](https://github.com/DataDog/datadog-agent/tree/master/Dockerfiles/agent#legacy-kubernetes-versions) for adjustments you might need to make for older versions
## Quick start
By default, the Datadog Agent runs in a DaemonSet. It can alternatively run inside a Deployment for special use cases.
**Note:** simultaneous DaemonSet + Deployment installation within a single release will be deprecated in a future version, requiring two releases to achieve this.
### Installing the Datadog Chart
To install the chart with the release name `<RELEASE_NAME>`, retrieve your Datadog API key from your [Agent Installation Instructions](https://app.datadoghq.com/account/settings#agent/kubernetes) and run:
```bash
helm install --name <RELEASE_NAME> \
--set datadog.apiKey=<DATADOG_API_KEY> stable/datadog
```
By default, this Chart creates a Secret and puts an API key in that Secret.
However, you can use manually created secret by setting the `datadog.apiKeyExistingSecret` value. After a few minutes, you should see hosts and metrics being reported in Datadog.
labels:
io.cattle.role: cluster # options are cluster/project
rancher_min_version: 2.3.0
questions:
#image configurations
- variable: defaultImage
default: true
description: "Use default Datadog image or specify a custom one"
label: Use Default Datadog Image
type: boolean
show_subquestion_if: false
group: "Container Images"
subquestions:
- variable: image.repository
default: "ranchercharts/datadog-agent"
description: "Datadog image name"
type: string
label: Datadog Image Name
- variable: image.tag
default: "6.13.0"
description: "Datadog Image Tag"
type: string
label: Datadog Image Tag
- variable: clusterAgent.image.repository
default: "ranchercharts/datadog-cluster-agent"
description: "Datadog clusterAgent image name"
type: string
label: Datadog ClusterAgent Image Name
- variable: clusterAgent.image.tag
default: "1.3.2"
description: "Datadog ClusterAgent Image Tag"
type: string
label: Datadog ClusterAgent Image Tag
- variable: kube-state-metrics.image.repository
default: "ranchercharts/coreos-kube-state-metrics"
description: "KubeState image name"
type: string
label: KubeState Image Name
show_if: "kubeStateMetrics.enabled=true&&defaultImage=false"
- variable: kube-state-metrics.image.tag
default: "v1.7.2"
description: "KubeState Image Tag"
type: string
label: KubeState Image Tag
show_if: "kubeStateMetrics.enabled=true&&defaultImage=false"
#cluster agent configurations
- variable: clusterAgent.enabled
default: false
description: "Use the cluster-agent for cluster metrics (Kubernetes 1.10+ only), https://docs.datadoghq.com/agent/kubernetes/cluster/"
type: boolean
label: Enable Cluster Agent Metrics(Kubernetes 1.10+ only)
group: "Cluster Agent"
- variable: clusterAgent.metricsProvider.enabled
default: true
description: "Enable the metricsProvider to be able to scale based on metrics in Datadog"
type: boolean
label: Enable the metricsProvider
show_if: "clusterAgent.enabled=true"
group: "Cluster Agent"
- variable: datadog.appKey
default: ""
description: "Datadog App key required to use metricsProvider"
type: string
required: true
label: Datadog Metrics App Key
group: "Cluster Agent"
show_if: "clusterAgent.enabled=true&&clusterAgent.metricsProvider.enabled=true&&datadog.appKeyExistingSecret="
- variable: datadog.appKeyExistingSecret
default: ""
description: "If set, use the secret with a provided name instead of creating a new appKey secret."
type: secret
label: Select Existing Datadog App Key(Secret)
group: "Cluster Agent"
show_if: "clusterAgent.enabled=true&&clusterAgent.metricsProvider.enabled=true&&datadog.appKey="
#datadog agent configurations
- variable: datadog.apiKey
default: ""
description: "Enter your Datadog API Key."
type: string
label: Datadog API Key
group: "Agent Configuration"
required: true
show_if: "datadog.apiKeyExistingSecret="
- variable: datadog.apiKeyExistingSecret
default: ""
description: "If set, use the secret with a provided name instead of creating a new apiKey secret."
type: secret
label: Select Existing Datadog API Key(Secret)
group: "Agent Configuration"
show_if: "datadog.apiKey="
- variable: datadog.site
default: "datadoghq.com"
description: "The site of the Datadog intake to send Agent data to"
type: enum
label: Datadog Site URL
group: "Agent Configuration"
required: true
options:
- "datadoghq.com"
- "datadoghq.eu"
- "custom"
- variable: datadog.dd_url
required: true
default: ""
description: "The host of the Datadog intake server to send Agent data to, only set this option if you need the Agent to send data to a custom URL"
type: string
label: Datadog Custom Site URL
group: "Agent Configuration"
show_if: "datadog.site=custom"
- variable: datadog.logLevel
default: "warn"
description: "Set Agent logging verbosity"
type: enum
options:
- "trace"
- "debug"
- "info"
- "warn"
- "error"
- "critical"
- "off"
label: Log Level
group: "Agent Configuration"
- variable: datadog.tags
default: ""
description: "Host tags, separated by spaces. For example: 'simple-tag-0 tag-key-1:tag-value-1'"
type: string
label: Host Tags
group: "Agent Configuration"
- variable: datadog.useCriSocketVolume
default: true
description: "Enable container runtime socket volume mounting"
type: boolean
label: Enable Mounting The Container Runtime Socket In Agent Containers
group: "Agent Configuration"
- variable: datadog.criSocketPath
default: ""
description: "Path to the container runtime socket (if different from Docker), default to `/var/run/docker.sock`"
type: string
label: Path To The Container Runtime Socket(Optional)
group: "Agent Configuration"
show_if: "datadog.useCriSocketVolume=true"
- variable: datadog.nonLocalTraffic
default: false
description: "Whether DogStatsD should listen to non local UDP traffic, required to send custom metrics"
type: boolean
label: DogStatsD Non-Local Traffic
group: "Agent Configuration"
- variable: datadog.collectEvents
default: false
description: "Enable event collection from the kubernetes API"
type: boolean
label: Collect Events
group: "Agent Configuration"
# Datadog Tagging
- variable: datadog.podLabelsAsTags
default: ""
description: "Specify a JSON map, where the map key is the source label name and the map value the datadog tag name. E.g: '{\"app\":\"kube_app\",\"release\":\"helm_release\"}'"
type: string
label: Extract Pod Labels as Tags
group: "Datadog Tagging"
- variable: datadog.podAnnotationsAsTags
default: ""
description: "Specify a JSON map, where the map key is the source label name and the map value the datadog tag name. E.g: '{\"app\":\"kube_app\",\"release\":\"helm_release\"}'"
type: string
label: Extract Pod Annotations as Tags
group: "Datadog Tagging"
- variable: datadog.nodeLabelsAsTags
default: ""
description: "Specify a JSON map, where the map key is the source label name and the map value the datadog tag name. E.g: '{\"app\":\"kube_app\",\"release\":\"helm_release\"}'"
type: string
label: Extract Node Labels As Tags
group: "Datadog Tagging"
# DaemonSet configurations
- variable: daemonset.rkeETCDControlPlane
default: true
description: "Configure Datadog Agent pods with the required tolerations to be deployed on the RKE etcd and control plane."
type: boolean
label: Run datadog pod on RKE Control Plane Nodes
group: "Daemonset Configuration"
- variable: daemonset.useHostNetwork
default: false
description: "Bind ports on the hostNetwork. Useful for CNI networking where hostPort might not be supported. The ports will need to be available on all hosts"
type: boolean
label: Use HostNetwork
group: "Daemonset Configuration"
- variable: daemonset.useHostPort
default: false
description: "Sets the hostPort to the same value of the container port"
type: boolean
label: Use HostPort
group: "Daemonset Configuration"
- variable: daemonset.useHostPID
default: false
description: "Run the agent in the host's PID namespace"
type: boolean
label: Use HostPID
group: "Daemonset Configuration"
#proxy configurations
- variable: datadog.httpProxy
default: ""
description: "An http URL to use as a proxy for http requests"
type: string
label: Datadog Proxy for HTTP Requests
group: "Proxy Configuration"
- variable: datadog.httpsProxy
default: ""
description: "An http URL to use as a proxy for https requests"
type: string
label: Datadog Proxy for HTTPS Requests
group: "Proxy Configuration"
- variable: datadog.noProxy
default: ""
description: "a space-separated list of URLs for which no proxy should be used"
type: string
label: Datadog No-Proxy List(separated by a space)
group: "Proxy Configuration"
# Optional Collection agents
- variable: datadog.apmEnabled
default: false
description: "Run the trace-agent along with the infrastructure agent, allowing the container to accept traces on 8126/tcp"
type: boolean
label: Enable APM
group: "Optional Collection Agents"
- variable: datadog.apmNonLocalTraffic
default: false
description: "Allow non-local traffic when tracing from other containers"
type: boolean
label: Allow APM Non-local Traffic
group: "Optional Collection Agents"
- variable: datadog.processAgentEnabled
default: false
description: "Enable live process collection in the process-agent"
type: boolean
label: Enable Live Process Agent
group: "Optional Collection Agents"
- variable: datadog.logsEnabled
default: false
description: "Run the log-agent along with the infrastructure agent"
type: boolean
label: Collect Logs
group: "Optional Collection Agents"
#Kube State Metrics
- variable: kubeStateMetrics.enabled
default: true
description: "Create a kube-state-metrics deployment"
type: boolean
label: Deployment KubeState Metrics Deployment
group: "Kube-State-Metrics"
dependencies:
- name: kube-state-metrics
repository: https://kubernetes-charts.storage.googleapis.com/
version: 2.2.3
digest: sha256:28fd41002af09316b9f614d320ea4171db39a144b595c68f616c546dd5292709
generated: "2019-08-13T09:53:34.977562+02:00"
dependencies:
- name: kube-state-metrics
version: ~2.2.3
repository: https://kubernetes-charts.storage.googleapis.com/
condition: kubeStateMetrics.enabled
{{- if (or (.Values.datadog.apiKeyExistingSecret) (.Values.datadog.apiKey)) }}
DataDog agents are spinning up on each node in your cluster. After a few
minutes, you should see your agents starting in your event stream:
https://app.datadoghq.com/event/stream
{{- if .Values.datadog.apiKeyExistingSecret }}
You disabled creation of Secret containing API key, therefore it is expected
that you create Secret named '{{ .Values.datadog.apiKeyExistingSecret }}' which includes a key called 'api-key' containing the API key.
{{- else if (.Values.datadog.apiKey) }}
{{- end }}
{{- else }}
##############################################################################
#### ERROR: You did not set a datadog.apiKey. ####
##############################################################################
This deployment will be incomplete until you get your API key from Datadog.
One can sign up for a free Datadog trial at https://app.datadoghq.com/signup
Once registered you can request an API key at:
https://app.datadoghq.com/account/settings#agent/kubernetes
Then run:
helm upgrade {{ .Release.Name }} \
--set datadog.apiKey=YOUR-KEY-HERE stable/datadog
{{- end }}
{{- if .Values.clusterAgent.enabled }}
{{- if .Values.clusterAgent.metricsProvider.enabled }}
{{- if .Values.datadog.appKeyExistingSecret }}
You disabled creation of Secret containing APP key, therefore it is expected
that you create a Secret named '{{ .Values.datadog.appKeyExistingSecret }}' which includes a key called 'app-key' containing the APP key.
{{- else if (.Values.datadog.appKey) }}
{{- else }}
##############################################################################
#### ERROR: You did not set a datadog.appKey. ####
##############################################################################
This deployment will be incomplete until you get your APP key from Datadog.
Create an application key at https://app.datadoghq.com/account/settings#api
{{- end }}
{{- end }}
{{- if and (not .Values.clusterAgent.token) (not .Values.clusterAgent.tokenExistingSecret) }}
##############################################################################
#### INFO: You did not set a clusterAgent.token ####
##############################################################################
Because you enabled the Cluster Agent but did not either provide a token or a reference to an existing token via '{{ .Values.clusterAgent.tokenExistingSecret }}', a random token was generated.
This token is used to secure the communication between the Agents and the Cluster Agent.
Make sure to recreate all pods on upgrade (with the --recreate-pods flag) to ensure all
agents use the same shared token.
{{- end }}
{{- end }}
{{- if .Values.datadog.apmEnabled }}
The datadog agent is listening on port 8126.
{{- end }}
{{- if (and (.Values.daemonset.enabled) (.Values.deployment.enabled)) }}
#################################################################
#### WARNING: Deprecation notice ####
#################################################################
Simultaneous DaemonSet + Deployment installation within a single
release will be deprecated in a future version. You will still be
able to run both as separate releases with separate value files.
Running as a Deployment is not necessary for event collection
anymore, thanks to the leader election feature.
We encourage you to migrate to a single DaemonSet, or split your
chart if your use case still requires a separate Deployment.
{{- end }}
{{- if .Values.datadog.autoconf }}
#################################################################
#### WARNING: Deprecation notice ####
#################################################################
The autoconf value is deprecated, Autodiscovery templates can now
be safely moved to the confd value. As a temporary measure, both
values were merged into the {{ template "datadog.fullname" . }}-confd configmap,
but this will be removed in a future chart release.
Please note that duplicate file names may have conflicted during
the merge. In that case, the confd entry will take precedence.
{{- end }}
{{- if eq .Values.image.repository "datadog/docker-dd-agent" }}
######################################################################
#### ERROR: Unsupported agent version ####
######################################################################
This version of the chart does not support deploying Agent 5.x.
If you cannot upgrade to Agent 6.x, you can use a previous version
of the chart by calling helm install with `--version 0.18.0`.
{{- end }}
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "datadog.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
And depending on the resources the name is completed with an extension.
If release name contains chart name it will be used as a full name.
*/}}
{{- define "datadog.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "datadog.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Return secret name to be used based on provided values.
*/}}
{{- define "datadog.apiSecretName" -}}
{{- $fullName := include "datadog.fullname" . -}}
{{- default $fullName .Values.datadog.apiKeyExistingSecret | quote -}}
{{- end -}}
{{/*
Return secret name to be used based on provided values.
*/}}
{{- define "datadog.appKeySecretName" -}}
{{- $fullName := printf "%s-appkey" (include "datadog.fullname" .) -}}
{{- default $fullName .Values.datadog.appKeyExistingSecret | quote -}}
{{- end -}}
{{/*
Return secret name to be used based on provided values.
*/}}
{{- define "clusterAgent.tokenSecretName" -}}
{{- if not .Values.clusterAgent.tokenExistingSecret -}}
{{- include "datadog.fullname" . -}}-cluster-agent
{{- else -}}
{{- .Values.clusterAgent.tokenExistingSecret -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for RBAC APIs.
*/}}
{{- define "rbac.apiVersion" -}}
{{- if semverCompare "^1.8-0" .Capabilities.KubeVersion.GitVersion -}}
"rbac.authorization.k8s.io/v1"
{{- else -}}
"rbac.authorization.k8s.io/v1beta1"
{{- end -}}
{{- end -}}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.enabled -}}
apiVersion: apiregistration.k8s.io/v1beta1
kind: APIService
metadata:
name: v1beta1.external.metrics.k8s.io
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
spec:
service:
name: {{ template "datadog.fullname" . }}-cluster-agent-metrics-api
namespace: {{ .Release.Namespace }}
version: v1beta1
insecureSkipTLSVerify: true
group: external.metrics.k8s.io
groupPriorityMinimum: 100
versionPriority: 100
{{- end -}}
{{- if and .Values.clusterAgent.enabled .Values.clusterAgent.clusterChecks.enabled .Values.clusterchecksDeployment.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "datadog.fullname" . }}-clusterchecks
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
selector:
matchLabels:
app: {{ template "datadog.fullname" . }}-clusterchecks
replicas: {{ .Values.clusterchecksDeployment.replicas }}
template:
metadata:
labels:
app: {{ template "datadog.fullname" . }}-clusterchecks
name: {{ template "datadog.fullname" . }}-clusterchecks
spec:
{{- if .Values.clusterchecksDeployment.rbac.dedicated }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "datadog.fullname" . }}-cluster-checks{{ else }}"{{ .Values.clusterchecksDeployment.rbac.serviceAccountName }}"{{ end }}
{{- else }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "datadog.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
{{- end }}
containers:
- name: {{ default .Chart.Name .Values.datadog.name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: DD_API_KEY
valueFrom:
secretKeyRef:
name: {{ template "datadog.apiSecretName" . }}
key: api-key
- name: DD_EXTRA_CONFIG_PROVIDERS
value: "clusterchecks"
- {name: DD_HEALTH_PORT, value: "5555"}
# Cluster checks
- name: DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME
value: {{ template "datadog.fullname" . }}-cluster-agent
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
- name: DD_CLUSTER_AGENT_ENABLED
value: {{ .Values.clusterAgent.enabled | quote }}
- {name: DD_EXTRA_CONFIG_PROVIDERS, value: "clusterchecks"}
# Remove unused features
- {name: DD_APM_ENABLED, value: "false"}
- {name: DD_PROCESS_AGENT_ENABLED, value: "false"}
- {name: DD_LOGS_ENABLED, value: "false"}
# Safely run alongside the daemonset
- {name: DD_ENABLE_METADATA_COLLECTION, value: "false"}
- name: DD_HOSTNAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- if .Values.clusterchecksDeployment.env }}
{{ toYaml .Values.clusterchecksDeployment.env | indent 10 }}
{{- end }}
resources:
{{ toYaml .Values.clusterchecksDeployment.resources | indent 10 }}
volumeMounts:
- {name: s6-run, mountPath: /var/run/s6}
- {name: remove-corechecks, mountPath: /etc/datadog-agent/conf.d}
{{- if .Values.clusterchecksDeployment.livenessProbe }}
livenessProbe:
{{ toYaml .Values.clusterchecksDeployment.livenessProbe | indent 10 }}
{{- else }}
livenessProbe:
httpGet:
path: /health
port: 5555
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6
{{- end }}
volumes:
- {name: s6-run, emptyDir: {}}
- {name: remove-corechecks, emptyDir: {}}
affinity:
{{- if .Values.clusterchecksDeployment.affinity }}
{{ toYaml .Values.clusterchecksDeployment.affinity | indent 8 }}
{{- else }}
# Ensure we only run one worker per node, to avoid name collisions
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: {{ template "datadog.fullname" . }}-clusterchecks
topologyKey: kubernetes.io/hostname
{{- end }}
{{- if .Values.clusterchecksDeployment.nodeSelector }}
nodeSelector:
{{ toYaml .Values.clusterchecksDeployment.nodeSelector | indent 8 }}
{{- end }}
{{- if .Values.clusterchecksDeployment.tolerations }}
tolerations:
{{ toYaml .Values.clusterchecksDeployment.tolerations | indent 8 }}
{{- end }}
{{ end }}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled .Values.clusterAgent.clusterChecks.enabled .Values.clusterchecksDeployment.enabled -}}
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
name: {{ template "datadog.fullname" . }}-cluster-checks
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "datadog.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "datadog.fullname" . }}-cluster-checks
namespace: {{ .Release.Namespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
name: {{ template "datadog.fullname" . }}-cluster-checks
{{- end -}}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled -}}
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRole
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent
rules:
- apiGroups:
- ""
resources:
- services
- events
- endpoints
- pods
- nodes
- componentstatuses
verbs:
- get
- list
- watch
- apiGroups: ["quota.openshift.io"]
resources:
- clusterresourcequotas
verbs:
- get
- list
- apiGroups:
- "autoscaling"
resources:
- horizontalpodautoscalers
verbs:
- list
- watch
{{- if .Values.datadog.collectEvents }}
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- datadogtoken # Kubernetes event collection state
verbs:
- get
- update
{{- end }}
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- datadog-leader-election # Leader election token
{{- if .Values.clusterAgent.metricsProvider.enabled }}
- datadog-custom-metrics
- extension-apiserver-authentication
{{- end }}
verbs:
- get
- update
- apiGroups: # To create the leader election token
- ""
resources:
- configmaps
verbs:
- create
- nonResourceURLs:
- "/version"
- "/healthz"
verbs:
- get
---
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "datadog.fullname" . }}-cluster-agent
subjects:
- kind: ServiceAccount
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent
{{- end }}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.enabled }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent:system:auth-delegator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- if not .Values.clusterAgent.tokenExistingSecret }}
{{- if .Values.clusterAgent.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
type: Opaque
data:
{{ if .Values.clusterAgent.token -}}
token: {{ .Values.clusterAgent.token | b64enc | quote }}
{{ else -}}
token: {{ randAlphaNum 32 | b64enc | quote }}
{{ end }}
{{- end }}
{{ end }}
\ No newline at end of file
{{- if .Values.clusterAgent.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
type: ClusterIP
selector:
app: {{ template "datadog.fullname" . }}-cluster-agent
ports:
- port: 5005
name: agentport
protocol: TCP
{{ end }}
{{- if and .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.enabled -}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent-metrics-api
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
type: ClusterIP
selector:
app: {{ template "datadog.fullname" . }}-cluster-agent
ports:
- port: 443
name: metricsapi
protocol: TCP
{{ end }}
{{- if .Values.datadog.checksd }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-checksd
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
annotations:
checksum/checksd-config: {{ tpl (toYaml .Values.datadog.checksd) . | sha256sum }}
data:
{{ tpl (toYaml .Values.datadog.checksd) . | indent 2 }}
{{- end -}}
{{- if .Values.clusterAgent.confd }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent-confd
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
annotations:
checksum/confd-config: {{ tpl (toYaml .Values.clusterAgent.confd) . | sha256sum }}
data:
{{ tpl (toYaml .Values.clusterAgent.confd) . | indent 2 }}
{{- end -}}
{{- if .Values.clusterAgent.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
replicas: {{ .Values.clusterAgent.replicas }}
selector:
matchLabels:
app: {{ template "datadog.fullname" . }}-cluster-agent
release: {{ .Release.Name | quote }}
template:
metadata:
labels:
app: {{ template "datadog.fullname" . }}-cluster-agent
release: {{ .Release.Name | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent
annotations:
ad.datadoghq.com/{{ .Values.clusterAgent.containerName }}.check_names: '["prometheus"]'
ad.datadoghq.com/{{ .Values.clusterAgent.containerName }}.init_configs: '[{}]'
ad.datadoghq.com/{{ .Values.clusterAgent.containerName }}.instances: |
[{
"prometheus_url": "http://%%host%%:5000/metrics",
"namespace": "datadog.cluster_agent",
"metrics": [
"go_goroutines", "go_memstats_*", "process_*",
"api_requests",
"datadog_requests", "external_metrics",
"cluster_checks_*"
]
}]
{{- if .Values.clusterAgent.podAnnotations }}
{{ toYaml .Values.clusterAgent.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.clusterAgent.priorityClassName }}
priorityClassName: "{{ .Values.clusterAgent.priorityClassName }}"
{{- end }}
{{- if .Values.clusterAgent.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.clusterAgent.image.pullSecrets | indent 8 }}
{{- end }}
containers:
- name: {{ .Values.clusterAgent.containerName }}
image: "{{ .Values.clusterAgent.image.repository }}:{{ .Values.clusterAgent.image.tag }}"
imagePullPolicy: {{ .Values.clusterAgent.image.pullPolicy }}
resources:
{{ toYaml .Values.clusterAgent.resources | indent 10 }}
ports:
- containerPort: 5005
name: agentport
protocol: TCP
{{- if .Values.clusterAgent.metricsProvider.enabled }}
- containerPort: 443
name: metricsapi
protocol: TCP
{{- end }}
env:
- name: DD_API_KEY
valueFrom:
secretKeyRef:
name: {{ template "datadog.apiSecretName" . }}
key: api-key
{{- if .Values.clusterAgent.metricsProvider.enabled }}
- name: DD_EXTERNAL_METRICS_PROVIDER_ENABLED
value: {{ .Values.clusterAgent.metricsProvider.enabled | quote }}
- name: DD_APP_KEY
valueFrom:
secretKeyRef:
name: {{ template "datadog.appKeySecretName" . }}
key: app-key
{{- end }}
{{- if .Values.clusterAgent.clusterChecks.enabled }}
- name: DD_CLUSTER_CHECKS_ENABLED
value: {{ .Values.clusterAgent.clusterChecks.enabled | quote }}
- name: DD_EXTRA_CONFIG_PROVIDERS
value: "kube_services"
- name: DD_EXTRA_LISTENERS
value: "kube_services"
{{- end }}
{{- if .Values.datadog.clusterName }}
- name: DD_CLUSTER_NAME
value: {{ .Values.datadog.clusterName | quote }}
{{- end }}
{{- if .Values.datadog.site }}
- name: DD_SITE
value: {{ .Values.datadog.site | quote }}
{{- end }}
{{- if .Values.datadog.dd_url }}
- 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_LEADER_ELECTION
value: {{ .Values.datadog.leaderElection | default "true" | quote}}
{{- if .Values.datadog.leaderLeaseDuration }}
- name: DD_LEADER_LEASE_DURATION
value: {{ .Values.datadog.leaderLeaseDuration | quote }}
{{- else if .Values.clusterAgent.clusterChecks.enabled }}
- name: DD_LEADER_LEASE_DURATION
value: "15"
{{- end }}
{{- if .Values.datadog.collectEvents }}
- name: DD_COLLECT_KUBERNETES_EVENTS
value: {{ .Values.datadog.collectEvents | quote}}
- name: DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME
value: {{ template "datadog.fullname" . }}-cluster-agent
{{- end }}
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
- name: DD_KUBE_RESOURCES_NAMESPACE
value: {{ .Release.Namespace }}
{{- if .Values.clusterAgent.env }}
{{ toYaml .Values.clusterAgent.env | indent 10 }}
{{- end }}
{{- if .Values.clusterAgent.livenessProbe }}
livenessProbe:
{{ toYaml .Values.clusterAgent.livenessProbe | indent 10 }}
{{- else if .Values.clusterAgent.metricsProvider.enabled }}
livenessProbe:
httpGet:
port: 443
path: /healthz
scheme: HTTPS
{{- end }}
{{- if .Values.clusterAgent.readinessProbe }}
readinessProbe:
{{ toYaml .Values.clusterAgent.readinessProbe | indent 10 }}
{{- else if .Values.clusterAgent.metricsProvider.enabled}}
readinessProbe:
httpGet:
port: 443
path: /healthz
scheme: HTTPS
{{- end }}
{{- if .Values.clusterAgent.confd }}
volumeMounts:
- name: confd
mountPath: /conf.d
readOnly: true
volumes:
- name: confd
configMap:
name: {{ template "datadog.fullname" . }}-cluster-agent-confd
{{- end }}
{{- if .Values.clusterAgent.tolerations }}
tolerations:
{{ toYaml .Values.clusterAgent.tolerations | indent 8 }}
{{- end }}
{{- if .Values.clusterAgent.affinity }}
affinity:
{{ toYaml .Values.clusterAgent.affinity | indent 8 }}
{{- end }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "datadog.fullname" . }}-cluster-agent{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
{{ end }}
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-confd
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
annotations:
checksum/confd-config: {{ tpl (toYaml .Values.datadog.confd) . | sha256sum }}
checksum/autoconf-config: {{ tpl (toYaml .Values.datadog.autoconf) . | sha256sum }}
data:
{{/*
Merge the legacy autoconf dict before so confd static configurations
override duplicates
*/}}
{{- if .Values.datadog.autoconf }}
{{ tpl (toYaml .Values.datadog.autoconf) . | indent 2 }}
{{- end }}
{{- if .Values.datadog.confd }}
{{ tpl (toYaml .Values.datadog.confd) . | indent 2 }}
{{- end }}
{{- end -}}
{{- define "container-agent" -}}
- name: agent
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["agent", "start"]
resources:
{{ toYaml .Values.daemonset.containers.agent.resources | indent 4 }}
ports:
- containerPort: 8125
{{- if .Values.daemonset.useHostPort }}
hostPort: 8125
{{- end }}
name: dogstatsdport
protocol: UDP
env:
{{- include "containers-common-env" . | nindent 4 }}
{{- if .Values.datadog.clusterName }}
- name: DD_CLUSTER_NAME
value: {{ .Values.datadog.clusterName | quote }}
{{- end }}
{{- if .Values.datadog.site }}
- name: DD_SITE
value: {{ .Values.datadog.site | quote }}
{{- end }}
{{- if .Values.datadog.dd_url }}
- name: DD_DD_URL
value: {{ .Values.datadog.dd_url | quote }}
{{- end }}
{{- if .Values.datadog.logLevel }}
- name: DD_LOG_LEVEL
value: {{ .Values.daemonset.containers.agent.logLevel | default .Values.datadog.logLevel | quote }}
{{- end }}
{{- if .Values.datadog.nonLocalTraffic }}
- name: DD_DOGSTATSD_NON_LOCAL_TRAFFIC
value: {{ .Values.datadog.nonLocalTraffic | quote }}
{{- end }}
{{- if .Values.datadog.dogstatsdOriginDetection }}
- name: DD_DOGSTATSD_ORIGIN_DETECTION
value: {{ .Values.datadog.dogstatsdOriginDetection | quote }}
{{- end }}
{{- if .Values.datadog.acInclude }}
- name: DD_AC_INCLUDE
value: {{ .Values.datadog.acInclude | quote }}
{{- end }}
{{- if .Values.datadog.acExclude }}
- name: DD_AC_EXCLUDE
value: {{ .Values.datadog.acExclude | quote }}
{{- end }}
{{- if not .Values.clusterAgent.enabled }}
{{- if .Values.datadog.leaderElection }}
- name: DD_LEADER_ELECTION
value: {{ .Values.datadog.leaderElection | quote}}
{{- end }}
{{- if .Values.datadog.leaderLeaseDuration }}
- name: DD_LEADER_LEASE_DURATION
value: {{ .Values.datadog.leaderLeaseDuration | quote }}
{{- end }}
{{- if .Values.datadog.collectEvents }}
- name: DD_COLLECT_KUBERNETES_EVENTS
value: {{.Values.datadog.collectEvents | quote}}
{{- end }}
{{- else }}
- name: DD_CLUSTER_AGENT_ENABLED
value: {{ .Values.clusterAgent.enabled | quote }}
- name: DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME
value: {{ template "datadog.fullname" . }}-cluster-agent
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
{{- end }}
{{- if .Values.datadog.podLabelsAsTags }}
- name: DD_KUBERNETES_POD_LABELS_AS_TAGS
value: '{{ toJson .Values.datadog.podLabelsAsTags }}'
{{- end }}
{{- if .Values.datadog.podAnnotationsAsTags }}
- name: DD_KUBERNETES_POD_ANNOTATIONS_AS_TAGS
value: '{{ toJson .Values.datadog.podAnnotationsAsTags }}'
{{- end }}
{{- if .Values.datadog.logsEnabled }}
- name: DD_LOGS_ENABLED
value: {{.Values.datadog.logsEnabled | quote}}
{{- end }}
{{- if .Values.datadog.logsConfigContainerCollectAll }}
- name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL
value: {{.Values.datadog.logsConfigContainerCollectAll | quote}}
{{- end }}
{{- if .Values.datadog.criSocketPath }}
- name: DD_CRI_SOCKET_PATH
value: {{ .Values.datadog.criSocketPath | quote }}
{{- end }}
{{- if not .Values.datadog.livenessProbe }}
- name: DD_HEALTH_PORT
value: "5555"
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- name: DD_DOGSTATSD_SOCKET
value: {{ default "/var/run/datadog/dsd.socket" .Values.datadog.dogStatsDSocketPath | quote }}
{{- end }}
{{- if and .Values.clusterAgent.clusterChecks.enabled (not .Values.clusterchecksDeployment.enabled) }}
- name: DD_EXTRA_CONFIG_PROVIDERS
value: "clusterchecks"
{{- end }}
{{- if .Values.datadog.httpProxy }}
- name: DD_PROXY_HTTP
value: {{ .Values.datadog.httpProxy | quote }}
{{- end }}
{{- if .Values.datadog.httpsProxy }}
- name: DD_PROXY_HTTPS
value: {{ .Values.datadog.httpsProxy | quote }}
{{- end }}
{{- if .Values.datadog.noProxy }}
- name: DD_PROXY_NO_PROXY
value: {{ .Values.datadog.noProxy | quote }}
{{- end }}
{{- if .Values.datadog.apmNonLocalTraffic }}
- name: DD_APM_NON_LOCAL_TRAFFIC
value: {{ .Values.datadog.apmNonLocalTraffic | quote }}
{{- end }}
{{- if .Values.daemonset.containers.agent.env }}
{{ toYaml .Values.daemonset.containers.agent.env | indent 4 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/datadog-agent
{{- if .Values.datadog.useCriSocketVolume }}
- name: runtimesocket
mountPath: {{ default "/var/run/docker.sock" .Values.datadog.criSocketPath | quote }}
readOnly: true
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- name: dsdsocket
mountPath: "/var/run/datadog"
{{- end }}
- name: procdir
mountPath: /host/proc
readOnly: true
- name: cgroups
mountPath: /host/sys/fs/cgroup
readOnly: true
{{- if .Values.datadog.logsEnabled }}
- name: pointerdir
mountPath: /opt/datadog-agent/run
- name: logpodpath
mountPath: /var/log/pods
readOnly: true
{{- if .Values.datadog.containerLogsPath }}
- name: logcontainerpath
mountPath: {{ .Values.datadog.containerLogsPath | quote }}
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.datadog.volumeMounts }}
{{ toYaml .Values.datadog.volumeMounts | indent 4 }}
{{- end }}
{{- if .Values.datadog.livenessProbe }}
livenessProbe:
{{ toYaml .Values.datadog.livenessProbe | indent 4 }}
{{- else }}
livenessProbe:
httpGet:
path: /health
port: 5555
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6
{{- end }}
{{- end -}}
{{- define "container-agents" -}}
- name: {{ default .Chart.Name .Values.datadog.name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{ toYaml .Values.datadog.resources | indent 4 }}
ports:
- containerPort: 8125
{{- if .Values.daemonset.useHostPort }}
hostPort: 8125
{{- end }}
name: dogstatsdport
protocol: UDP
{{- if .Values.datadog.apmEnabled }}
- containerPort: 8126
{{- if .Values.daemonset.useHostPort }}
hostPort: 8126
{{- end }}
name: traceport
protocol: TCP
{{- end }}
env:
- name: DD_API_KEY
valueFrom:
secretKeyRef:
name: {{ template "datadog.apiSecretName" . }}
key: api-key
{{- if .Values.datadog.clusterName }}
- name: DD_CLUSTER_NAME
value: {{ .Values.datadog.clusterName | quote }}
{{- end }}
{{- if .Values.datadog.site }}
- name: DD_SITE
value: {{ .Values.datadog.site | quote }}
{{- end }}
{{- if .Values.datadog.dd_url }}
- 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 }}
{{- if .Values.datadog.nonLocalTraffic }}
- name: DD_DOGSTATSD_NON_LOCAL_TRAFFIC
value: {{ .Values.datadog.nonLocalTraffic | quote }}
{{- end }}
{{- if .Values.datadog.dogstatsdOriginDetection }}
- name: DD_DOGSTATSD_ORIGIN_DETECTION
value: {{ .Values.datadog.dogstatsdOriginDetection | quote }}
{{- end }}
{{- if .Values.datadog.tags }}
- name: DD_TAGS
value: {{ .Values.datadog.tags | quote }}
{{- end }}
{{- if .Values.datadog.apmEnabled }}
- name: DD_APM_ENABLED
value: {{ .Values.datadog.apmEnabled | quote }}
{{- end }}
{{- if .Values.datadog.processAgentEnabled }}
- name: DD_PROCESS_AGENT_ENABLED
value: {{ .Values.datadog.processAgentEnabled | quote }}
{{- end }}
{{- if .Values.datadog.hostname }}
- name: DD_HOSTNAME
value: {{ .Values.datadog.hostname | quote }}
{{- end }}
{{- if .Values.datadog.acInclude }}
- name: DD_AC_INCLUDE
value: {{ .Values.datadog.acInclude | quote }}
{{- end }}
{{- if .Values.datadog.acExclude }}
- name: DD_AC_EXCLUDE
value: {{ .Values.datadog.acExclude | quote }}
{{- end }}
{{- if not .Values.clusterAgent.enabled }}
{{- if .Values.datadog.leaderElection }}
- name: DD_LEADER_ELECTION
value: {{ .Values.datadog.leaderElection | quote}}
{{- end }}
{{- if .Values.datadog.leaderLeaseDuration }}
- name: DD_LEADER_LEASE_DURATION
value: {{ .Values.datadog.leaderLeaseDuration | quote }}
{{- end }}
{{- if .Values.datadog.collectEvents }}
- name: DD_COLLECT_KUBERNETES_EVENTS
value: {{.Values.datadog.collectEvents | quote}}
{{- end }}
{{- else }}
- name: DD_CLUSTER_AGENT_ENABLED
value: {{ .Values.clusterAgent.enabled | quote }}
- name: DD_CLUSTER_AGENT_KUBERNETES_SERVICE_NAME
value: {{ template "datadog.fullname" . }}-cluster-agent
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "clusterAgent.tokenSecretName" . }}
key: token
{{- end }}
- name: KUBERNETES
value: "yes"
{{- if .Values.datadog.podLabelsAsTags }}
- name: DD_KUBERNETES_POD_LABELS_AS_TAGS
value: '{{ toJson .Values.datadog.podLabelsAsTags }}'
{{- end }}
{{- if .Values.datadog.podAnnotationsAsTags }}
- name: DD_KUBERNETES_POD_ANNOTATIONS_AS_TAGS
value: '{{ toJson .Values.datadog.podAnnotationsAsTags }}'
{{- end }}
{{- if semverCompare "^1.7-0" .Capabilities.KubeVersion.GitVersion }}
- name: DD_KUBERNETES_KUBELET_HOST
valueFrom:
fieldRef:
fieldPath: status.hostIP
{{- end }}
{{- if .Values.datadog.logsEnabled }}
- name: DD_LOGS_ENABLED
value: {{.Values.datadog.logsEnabled | quote}}
{{- end }}
{{- if .Values.datadog.logsConfigContainerCollectAll }}
- name: DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL
value: {{.Values.datadog.logsConfigContainerCollectAll | quote}}
{{- end }}
{{- if .Values.datadog.criSocketPath }}
- name: DD_CRI_SOCKET_PATH
value: {{ .Values.datadog.criSocketPath | quote }}
{{- end }}
{{- if not .Values.datadog.livenessProbe }}
- name: DD_HEALTH_PORT
value: "5555"
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- name: DD_DOGSTATSD_SOCKET
value: {{ default "/var/run/datadog/dsd.socket" .Values.datadog.dogStatsDSocketPath | quote }}
{{- end }}
{{- if and .Values.clusterAgent.clusterChecks.enabled (not .Values.clusterchecksDeployment.enabled) }}
- name: DD_EXTRA_CONFIG_PROVIDERS
value: "clusterchecks"
{{- end }}
{{- if .Values.datadog.httpProxy }}
- name: DD_PROXY_HTTP
value: {{ .Values.datadog.httpProxy | quote }}
{{- end }}
{{- if .Values.datadog.httpsProxy }}
- name: DD_PROXY_HTTPS
value: {{ .Values.datadog.httpsProxy | quote }}
{{- end }}
{{- if .Values.datadog.noProxy }}
- name: DD_PROXY_NO_PROXY
value: {{ .Values.datadog.noProxy | quote }}
{{- end }}
{{- if .Values.datadog.apmNonLocalTraffic }}
- name: DD_APM_NON_LOCAL_TRAFFIC
value: {{ .Values.datadog.apmNonLocalTraffic | quote }}
{{- end }}
{{- if .Values.datadog.env }}
{{ toYaml .Values.datadog.env | indent 4 }}
{{- end }}
volumeMounts:
{{- if .Values.datadog.useCriSocketVolume }}
- name: runtimesocket
mountPath: {{ default "/var/run/docker.sock" .Values.datadog.criSocketPath | quote }}
readOnly: true
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- name: dsdsocket
mountPath: "/var/run/datadog"
{{- end }}
- name: procdir
mountPath: /host/proc
readOnly: true
- name: cgroups
mountPath: /host/sys/fs/cgroup
readOnly: true
- name: s6-run
mountPath: /var/run/s6
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
mountPath: /conf.d
readOnly: true
{{- end }}
{{- if .Values.datadog.checksd }}
- name: checksd
mountPath: /checks.d
readOnly: true
{{- end }}
{{- if .Values.datadog.logsEnabled }}
- name: pointerdir
mountPath: /opt/datadog-agent/run
- name: logpodpath
mountPath: /var/log/pods
readOnly: true
{{- if .Values.datadog.containerLogsPath }}
- name: logcontainerpath
mountPath: {{ .Values.datadog.containerLogsPath | quote }}
readOnly: true
{{- end }}
{{- end }}
{{- if .Values.datadog.processAgentEnabled }}
- name: passwd
mountPath: /etc/passwd
readOnly: true
{{- end }}
{{- if .Values.daemonset.useConfigMap }}
- name: {{ template "datadog.fullname" . }}-datadog-yaml
mountPath: /etc/datadog-agent/datadog.yaml
subPath: datadog.yaml
{{- end }}
{{- if .Values.datadog.volumeMounts }}
{{ toYaml .Values.datadog.volumeMounts | indent 4 }}
{{- end }}
{{- if .Values.datadog.livenessProbe }}
livenessProbe:
{{ toYaml .Values.datadog.livenessProbe | indent 4 }}
{{- else }}
livenessProbe:
httpGet:
path: /health
port: 5555
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 6
{{- end }}
{{- end -}}
{{- define "container-process-agent" -}}
- name: process-agent
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["process-agent", "-config=/etc/datadog-agent/datadog.yaml"]
resources:
{{ toYaml .Values.daemonset.containers.processAgent.resources | indent 4 }}
env:
{{- include "containers-common-env" . | nindent 4 }}
- name: DD_PROCESS_AGENT_ENABLED
value: {{ .Values.datadog.processAgentEnabled | quote }}
- name: DD_LOG_LEVEL
value: {{ .Values.daemonset.containers.processAgent.logLevel | default .Values.datadog.logLevel | quote }}
{{- if .Values.daemonset.containers.processAgent.env }}
{{ toYaml .Values.daemonset.containers.processAgent.env | indent 4 }}
{{- end }}
volumeMounts:
- name: cgroups
mountPath: /host/sys/fs/cgroup
readOnly: true
- name: config
mountPath: /etc/datadog-agent
- name: passwd
mountPath: /etc/passwd
- name: procdir
mountPath: /host/proc
readOnly: true
{{- if .Values.datadog.useCriSocketVolume }}
- name: runtimesocket
mountPath: {{ default "/var/run/docker.sock" .Values.datadog.criSocketPath | quote }}
readOnly: true
{{- end }}
{{- end -}}
{{- define "container-trace-agent" -}}
- name: trace-agent
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["trace-agent", "--config=/etc/datadog-agent/datadog.yaml"]
resources:
{{ toYaml .Values.daemonset.containers.traceAgent.resources | indent 4 }}
ports:
- containerPort: 8126
{{- if .Values.daemonset.useHostPort }}
hostPort: 8126
{{- end }}
name: traceport
protocol: TCP
env:
{{- include "containers-common-env" . | nindent 4 }}
- name: DD_APM_ENABLED
value: {{ .Values.datadog.apmEnabled | quote }}
- name: DD_LOG_LEVEL
value: {{ .Values.daemonset.containers.traceAgent.logLevel | default .Values.datadog.logLevel | quote }}
{{- if .Values.daemonset.containers.traceAgent.env }}
{{ toYaml .Values.daemonset.containers.traceAgent.env | indent 4 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/datadog-agent
livenessProbe:
tcpSocket:
port: 8126
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
{{- end -}}
# 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 -}}
{{- define "containers-init" -}}
- name: init-volume
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command: ["bash", "-c"]
args:
- cp -r /etc/datadog-agent /opt
volumeMounts:
- name: config
mountPath: /opt/datadog-agent
- name: init-config
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command: ["bash", "-c"]
args:
- for script in $(find /etc/cont-init.d/ -type f -name '*.sh' | sort) ; do bash $script ; done
volumeMounts:
- name: config
mountPath: /etc/datadog-agent
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
mountPath: /conf.d
readOnly: true
{{- end }}
{{- if .Values.datadog.checksd }}
- name: checksd
mountPath: /checks.d
readOnly: true
{{- end }}
- name: procdir
mountPath: /host/proc
readOnly: true
{{- if .Values.datadog.useCriSocketVolume }}
- name: runtimesocket
mountPath: {{ default "/var/run/docker.sock" .Values.datadog.criSocketPath | quote }}
readOnly: true
{{- end }}
env:
{{- include "containers-common-env" . | nindent 4 }}
{{- if .Values.datadog.env }}
{{ toYaml .Values.datadog.env | nindent 4 }}
{{- end }}
{{- end -}}
{{- if .Values.daemonset.enabled }}
{{- if (or (.Values.datadog.apiKeyExistingSecret) (.Values.datadog.apiKey)) }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ template "datadog.fullname" . }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
selector:
matchLabels:
app: {{ template "datadog.fullname" . }}
template:
metadata:
labels:
app: {{ template "datadog.fullname" . }}
{{- if .Values.daemonset.podLabels }}
{{ toYaml .Values.daemonset.podLabels | indent 8 }}
{{- end }}
name: {{ template "datadog.fullname" . }}
annotations:
checksum/autoconf-config: {{ tpl (toYaml .Values.datadog.autoconf) . | sha256sum }}
checksum/confd-config: {{ tpl (toYaml .Values.datadog.confd) . | sha256sum }}
checksum/checksd-config: {{ tpl (toYaml .Values.datadog.checksd) . | sha256sum }}
{{- if .Values.daemonset.podAnnotations }}
{{ toYaml .Values.daemonset.podAnnotations | indent 8 }}
{{- end }}
spec:
{{- if .Values.datadog.securityContext }}
securityContext:
{{ toYaml .Values.datadog.securityContext | indent 8 }}
{{- end }}
{{- if .Values.daemonset.useHostNetwork }}
hostNetwork: {{ .Values.daemonset.useHostNetwork }}
dnsPolicy: ClusterFirstWithHostNet
{{- end }}
{{- if .Values.daemonset.useHostPID }}
hostPID: {{ .Values.daemonset.useHostPID }}
{{- end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 8 }}
{{- end }}
{{- if .Values.daemonset.priorityClassName }}
priorityClassName: {{ .Values.daemonset.priorityClassName }}
{{- end }}
containers:
{{- if .Values.daemonset.useDedicatedContainers }}
{{- include "container-agent" . | nindent 8 }}
{{- if .Values.datadog.apmEnabled }}
{{- include "container-trace-agent" . | nindent 8 }}
{{- end }}
{{- if .Values.datadog.processAgentEnabled }}
{{- include "container-process-agent" . | nindent 8 }}
{{- end }}
initContainers:
{{ include "containers-init" . | nindent 8 }}
{{- else }}
{{- include "container-agents" . | nindent 8 }}
{{- end}}
volumes:
{{- if .Values.daemonset.useDedicatedContainers }}
- name: config
emptyDir: {}
{{- end }}
{{- if .Values.datadog.useCriSocketVolume }}
- hostPath:
path: {{ default "/var/run/docker.sock" .Values.datadog.criSocketPath | quote }}
name: runtimesocket
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- hostPath:
path: "/var/run/datadog/"
name: dsdsocket
{{- end }}
- hostPath:
path: /proc
name: procdir
- hostPath:
path: /sys/fs/cgroup
name: cgroups
- name: s6-run
emptyDir: {}
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
configMap:
name: {{ template "datadog.fullname" . }}-confd
{{- end }}
{{- if .Values.datadog.checksd }}
- name: checksd
configMap:
name: {{ template "datadog.fullname" . }}-checksd
{{- end }}
{{- if .Values.datadog.logsEnabled }}
- hostPath:
path: {{ default "/var/lib/datadog-agent/logs" .Values.datadog.logsPointerHostPath | quote }}
name: pointerdir
- hostPath:
path: /var/log/pods
name: logpodpath
{{- if .Values.datadog.containerLogsPath }}
- hostPath:
path: {{ .Values.datadog.containerLogsPath | quote }}
name: logcontainerpath
{{- end }}
{{- end }}
{{- if .Values.datadog.processAgentEnabled }}
- hostPath:
path: /etc/passwd
name: passwd
{{- end }}
{{- if .Values.daemonset.useConfigMap }}
- name: {{ template "datadog.fullname" . }}-datadog-yaml
configMap:
name: {{ template "datadog.fullname" . }}-datadog-yaml
{{- end }}
{{- if .Values.datadog.volumes }}
{{ toYaml .Values.datadog.volumes | indent 8 }}
{{- end }}
{{- if .Values.daemonset.tolerations }}
tolerations:
{{- if .Values.daemonset.rkeETCDControlPlane }}
- key: "node-role.kubernetes.io/etcd"
value: "true"
- key: "node-role.kubernetes.io/controlplane"
value: "true"
{{- end }}
{{ toYaml .Values.daemonset.tolerations | indent 8 }}
{{- end }}
{{- if .Values.daemonset.affinity }}
affinity:
{{ toYaml .Values.daemonset.affinity | indent 8 }}
{{- end }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "datadog.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
{{- if .Values.daemonset.nodeSelector }}
nodeSelector:
{{ toYaml .Values.daemonset.nodeSelector | indent 8 }}
{{- end }}
updateStrategy:
type: {{ default "RollingUpdate" .Values.daemonset.updateStrategy | quote }}
{{ end }}
{{ end }}
{{- if .Values.daemonset.useConfigMap }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-datadog-yaml
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
annotations:
data:
datadog.yaml: |
## Provides autodetected defaults, for kubernetes environments,
## please see datadog.yaml.example for all supported options
# Autodiscovery for Kubernetes
listeners:
- name: kubelet
config_providers:
- name: kubelet
polling: true
# Enable APM by setting the DD_APM_ENABLED envvar to true, or override this configuration
apm_config:
enabled: false
apm_non_local_traffic: true
# Use java cgroup memory awareness
jmx_use_cgroup_memory_limit: true
{{- end }}
{{- if .Values.deployment.enabled }}
{{- if (or (.Values.datadog.apiKeyExistingSecret) (.Values.datadog.apiKey)) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "datadog.fullname" . }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
spec:
selector:
matchLabels:
app: {{ template "datadog.fullname" . }}
type: deployment
replicas: {{ .Values.deployment.replicas }}
template:
metadata:
labels:
app: {{ template "datadog.fullname" . }}
type: deployment
name: {{ template "datadog.fullname" . }}
annotations:
checksum/autoconf-config: {{ tpl (toYaml .Values.datadog.autoconf) . | sha256sum }}
checksum/confd-config: {{ tpl (toYaml .Values.datadog.confd) . | sha256sum }}
checksum/checksd-config: {{ tpl (toYaml .Values.datadog.checksd) . | sha256sum }}
spec:
{{- if .Values.datadog.securityContext }}
securityContext:
{{ toYaml .Values.datadog.securityContext | indent 8 }}
{{- end }}
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{ toYaml .Values.image.pullSecrets | indent 8 }}
{{- end }}
{{- if .Values.deployment.priorityClassName }}
priorityClassName: {{ .Values.deployment.priorityClassName }}
{{- end }}
containers:
- name: {{ default .Chart.Name .Values.datadog.name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{ toYaml .Values.datadog.resources | indent 10 }}
ports:
- containerPort: 8125
name: dogstatsdport
protocol: UDP
{{- if .Values.datadog.apmEnabled }}
- containerPort: 8126
name: traceport
protocol: TCP
{{- end }}
env:
- name: DD_API_KEY
valueFrom:
secretKeyRef:
name: {{ template "datadog.apiSecretName" . }}
key: api-key
{{- if .Values.datadog.site }}
- name: DD_SITE
value: {{ .Values.datadog.site | quote }}
{{- end }}
{{- if .Values.datadog.dd_url }}
- 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 }}
{{- if .Values.datadog.nonLocalTraffic }}
- name: DD_DOGSTATSD_NON_LOCAL_TRAFFIC
value: {{ .Values.datadog.nonLocalTraffic | quote }}
{{- end }}
{{- if .Values.datadog.dogstatsdOriginDetection }}
- name: DD_DOGSTATSD_ORIGIN_DETECTION
value: {{ .Values.datadog.dogstatsdOriginDetection | quote }}
{{- end }}
{{- if .Values.datadog.tags }}
- name: DD_TAGS
value: {{ .Values.datadog.tags | quote }}
{{- end }}
{{- if .Values.datadog.apmEnabled }}
- name: DD_APM_ENABLED
value: {{ .Values.datadog.apmEnabled | quote }}
{{- end }}
- name: KUBERNETES
value: "yes"
{{- if .Values.datadog.collectEvents }}
- name: KUBERNETES_COLLECT_EVENTS
value: "yes"
{{- end }}
{{- if .Values.datadog.criSocketPath }}
- name: DD_CRI_SOCKET_PATH
value: {{ .Values.datadog.criSocketPath | quote }}
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- name: DD_DOGSTATSD_SOCKET
value: {{ default "/var/run/datadog/dsd.socket" .Values.datadog.dogStatsDSocketPath | quote }}
{{- end }}
{{- if .Values.datadog.env }}
{{ toYaml .Values.datadog.env | indent 10 }}
{{- end }}
volumeMounts:
{{- if .Values.datadog.useCriSocketVolume }}
- name: runtimesocket
mountPath: {{ default "/var/run/docker.sock" .Values.datadog.criSocketPath | quote }}
readOnly: true
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- name: dsdsocket
mountPath: "/var/run/datadog"
{{- end }}
- name: procdir
mountPath: /host/proc
readOnly: true
- name: cgroups
mountPath: /host/sys/fs/cgroup
readOnly: true
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
mountPath: /conf.d
readOnly: true
{{- end }}
{{- if .Values.datadog.checksd }}
- name: checksd
mountPath: /checks.d
readOnly: true
{{- end }}
{{- if .Values.datadog.volumeMounts }}
{{ toYaml .Values.datadog.volumeMounts | indent 10 }}
{{- end }}
{{- if .Values.datadog.livenessProbe }}
livenessProbe:
{{ toYaml .Values.datadog.livenessProbe | indent 10 }}
{{- else }}
livenessProbe:
exec:
command:
- ./probe.sh
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 6
{{- end }}
volumes:
{{- if .Values.datadog.useCriSocketVolume }}
- hostPath:
path: {{ default "/var/run/docker.sock" .Values.datadog.criSocketPath | quote }}
name: runtimesocket
{{- end }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- hostPath:
path: "/var/run/datadog/"
name: dsdsocket
{{- end }}
- hostPath:
path: /proc
name: procdir
- hostPath:
path: /sys/fs/cgroup
name: cgroups
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
configMap:
name: {{ template "datadog.fullname" . }}-confd
{{- end }}
{{- if .Values.datadog.checksd }}
- name: checksd
configMap:
name: {{ template "datadog.fullname" . }}-checksd
{{- end }}
{{- if .Values.datadog.volumes }}
{{ toYaml .Values.datadog.volumes | indent 8 }}
{{- end }}
{{- if .Values.deployment.tolerations }}
tolerations:
{{ toYaml .Values.deployment.tolerations | indent 8 }}
{{- end }}
{{- if .Values.deployment.affinity }}
affinity:
{{ toYaml .Values.deployment.affinity | indent 8 }}
{{- end }}
serviceAccountName: {{ if .Values.rbac.create }}{{ template "datadog.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
{{ end }}
{{ end }}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.enabled -}}
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRole
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent-external-metrics-reader
rules:
- apiGroups:
- "external.metrics.k8s.io"
resources:
- "*"
verbs:
- list
- get
- watch
---
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent-external-metrics-reader
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "datadog.fullname" . }}-cluster-agent-external-metrics-reader
subjects:
- kind: ServiceAccount
name: horizontal-pod-autoscaler
namespace: kube-system
---
apiVersion: {{ template "rbac.apiVersion" . }}
kind: RoleBinding
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
name: "{{ template "datadog.fullname" . }}-cluster-agent"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: extension-apiserver-authentication-reader
subjects:
- kind: ServiceAccount
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- if .Values.rbac.create -}}
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRole
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
name: {{ template "datadog.fullname" . }}
rules:
{{- if not .Values.clusterAgent.enabled }}
- apiGroups:
- ""
resources:
- services
- events
- endpoints
- pods
- nodes
- componentstatuses
verbs:
- get
- list
- watch
- apiGroups: ["quota.openshift.io"]
resources:
- clusterresourcequotas
verbs:
- get
- list
{{- if .Values.datadog.collectEvents }}
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- datadogtoken # Kubernetes event collection state
verbs:
- get
- update
{{- end }}
{{- if .Values.datadog.leaderElection }}
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
- datadog-leader-election # Leader election token
verbs:
- get
- update
- apiGroups: # To create the leader election token
- ""
resources:
- configmaps
verbs:
- create
{{- end }}
- nonResourceURLs:
- "/version"
- "/healthz"
verbs:
- get
{{- end }}
- nonResourceURLs:
- "/metrics"
verbs:
- get
- apiGroups: # Kubelet connectivity
- ""
resources:
- nodes/metrics
- nodes/spec
- nodes/proxy
verbs:
- get
- apiGroups: # leader election check
- ""
resources:
- endpoints
verbs:
- get
---
{{- if not .Values.clusterchecksDeployment.rbac.dedicated }}
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
name: {{ template "datadog.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "datadog.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "datadog.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
---
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
heritage: {{ .Release.Service | quote }}
release: {{ .Release.Name | quote }}
name: {{ template "datadog.fullname" . }}
{{- end -}}
# API Key
{{- if not .Values.datadog.apiKeyExistingSecret }}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "datadog.fullname" . }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
type: Opaque
data:
api-key: {{ default "MISSING" .Values.datadog.apiKey | b64enc | quote }}
{{- end }}
# APP Key
{{- if not .Values.datadog.appKeyExistingSecret }}
{{- if and .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.enabled }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ template "datadog.appKeySecretName" . }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
type: Opaque
data:
app-key: {{ default "MISSING" .Values.datadog.appKey | b64enc | quote }}
{{- end }}
{{- end }}
{{ if .Values.deployment.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template "datadog.fullname" . }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
release: {{ .Release.Name | quote }}
heritage: {{ .Release.Service | quote }}
{{- if .Values.deployment.service.annotations }}
annotations:
{{ toYaml .Values.deployment.service.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.deployment.service.type }}
selector:
app: {{ template "datadog.fullname" . }}
type: deployment
ports:
- port: 8125
name: dogstatsdport
protocol: UDP
{{- if .Values.deployment.dogstatsdNodePort }}
nodePort: {{ .Values.deployment.dogstatsdNodePort }}
{{- end }}
{{- if .Values.datadog.apmEnabled }}
- port: 8126
name: traceport
protocol: TCP
{{- if .Values.deployment.traceNodePort }}
nodePort: {{ .Values.deployment.traceNodePort }}
{{- end }}
{{- end }}
{{ end }}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment