Unverified Commit 26bbab03 by Guangbo Committed by GitHub

Update datadog configurations and bump datadog image to v6.9.0

parent 8b6c7fa9
# 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
name: datadog
version: 1.21.0
appVersion: 6.9.0
description: DataDog Agent
keywords:
- monitoring
- alerting
- metric
home: https://www.datadoghq.com
icon: https://datadog-live.imgix.net/img/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: xvello
email: xavier.vello@datadoghq.com
- name: charlyf
email: charly@datadoghq.com
approvers:
- hkaj
- irabinovitch
- xvello
- charlyf
reviewers:
- hkaj
- irabinovitch
- xvello
- charlyf
### Enabling the Datadog Cluster Agent
Read about the Datadog Cluster Agent in the [official documentation](https://docs.datadoghq.com/agent/kubernetes/cluster/).
Run the following if you want to deploy the chart with the Datadog Cluster Agent.
Note that specifying `clusterAgent.metricsProvider.enabled=true` will enable the External Metrics Server.
If you want to learn to use this feature, you can check out this [walkthrough](https://github.com/DataDog/datadog-agent/blob/master/docs/cluster-agent/CUSTOM_METRICS_SERVER.md).
The Leader Election is enabled by default in the chart for the Cluster Agent. Only the Cluster Agent(s) participate in the election, in case you have several replicas configured (using `clusterAgent.replicas`.
You can specify the token used to secure the communication between the Cluster Agent(s)q and the Agents with `clusterAgent.token`. If not specified, a random one will be generated and you will be prompted a warning when installing the chart.
```bash
helm install --name datadog-monitoring \
--set datadog.apiKey=YOUR-API-KEY-HERE \
--set datadog.appKey=YOUR-APP-KEY-HERE \
--set clusterAgent.enabled=true \
--set clusterAgent.metricsProvider.enabled=true \
stable/datadog
```
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```bash
helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The following table lists the configurable parameters of the Datadog chart and their default values.
| Parameter | Description | Default |
|-----------------------------|------------------------------------|-------------------------------------------|
| `datadog.apiKey` | Your Datadog API key | `Nil` You must provide your own key |
| `datadog.apiKeyExistingSecret` | If set, use the secret with a provided name instead of creating a new one |`nil` |
| `datadog.appKey` | Datadog APP key required to use metricsProvider | `Nil` You must provide your own key |
| `datadog.appKeyExistingSecret` | If set, use the secret with a provided name instead of creating a new one |`nil` |
| `image.repository` | The image repository to pull from | `datadog/agent` |
| `image.tag` | The image tag to pull | `6.9.0` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `image.pullSecrets` | Image pull secrets | `nil` |
| `rbac.create` | If true, create & use RBAC resources | `true` |
| `rbac.serviceAccount` | existing ServiceAccount to use (ignored if rbac.create=true) | `default` |
| `datadog.name` | Container name if Daemonset or Deployment | `datadog` |
| `datadog.site` | Site ('datadoghq.com' or 'datadoghq.eu') | `nil` |
| `datadog.dd_url` | Datadog intake server | `nil` |
| `datadog.env` | Additional Datadog environment variables | `nil` |
| `datadog.logsEnabled` | Enable log collection | `nil` |
| `datadog.logsConfigContainerCollectAll` | Collect logs from all containers | `nil` |
| `datadog.logsPointerHostPath` | Host path to store the log tailing state in | `/var/lib/datadog-agent/logs` |
| `datadog.apmEnabled` | Enable tracing from the host | `nil` |
| `datadog.processAgentEnabled` | Enable live process monitoring | `nil` |
| `datadog.checksd` | Additional custom checks as python code | `nil` |
| `datadog.confd` | Additional check configurations (static and Autodiscovery) | `nil` |
| `datadog.criSocketPath` | Path to the container runtime socket (if different from Docker) | `nil` |
| `datadog.tags` | Set host tags | `nil` |
| `datadog.nonLocalTraffic` | Enable statsd reporting from any external ip | `False` |
| `datadog.useCriSocketVolume` | Enable mounting the container runtime socket in Agent containers | `True` |
| `datadog.dogstatsdOriginDetection` | Enable origin detection for container tagging | `False` |
| `datadog.useDogStatsDSocketVolume` | Enable dogstatsd over Unix Domain Socket | `False` |
| `datadog.volumes` | Additional volumes for the daemonset | `nil` |
| `datadog.volumeMounts` | Additional volumeMounts for the daemonset | `nil` |
| `datadog.podAnnotationsAsTags` | Kubernetes Annotations to Datadog Tags mapping | `nil` |
| `datadog.podLabelsAsTags` | Kubernetes Labels to Datadog Tags mapping | `nil` |
| `datadog.resources.requests.cpu` | CPU resource requests | `200m` |
| `datadog.resources.limits.cpu` | CPU resource limits | `200m` |
| `datadog.resources.requests.memory` | Memory resource requests | `256Mi` |
| `datadog.resources.limits.memory` | Memory resource limits | `256Mi` |
| `datadog.securityContext` | Allows you to overwrite the default securityContext applied to the container | `nil` |
| `datadog.livenessProbe` | Overrides the default liveness probe | http port 5555 |
| `datadog.hostname` | Set the hostname (write it in datadog.conf) | `nil` |
| `datadog.acInclude` | Include containers based on image name | `nil` |
| `datadog.acExclude` | Exclude containers based on image name | `nil` |
| `daemonset.podAnnotations` | Annotations to add to the DaemonSet's Pods | `nil` |
| `daemonset.tolerations` | List of node taints to tolerate (requires Kubernetes >= 1.6) | `nil` |
| `daemonset.nodeSelector` | Node selectors | `nil` |
| `daemonset.affinity` | Node affinities | `nil` |
| `daemonset.useHostNetwork` | If true, use the host's network | `nil` |
| `daemonset.useHostPID`. | If true, use the host's PID namespace | `nil` |
| `daemonset.useHostPort` | If true, use the same ports for both host and container | `nil` |
| `daemonset.priorityClassName` | Which Priority Class to associate with the daemonset| `nil` |
| `datadog.leaderElection` | Enable the leader Election feature | `false` |
| `datadog.leaderLeaseDuration`| The duration for which a leader stays elected.| `nil` |
| `datadog.collectEvents` | Enable Kubernetes event collection. Requires leader election. | `false` |
| `kubeStateMetrics.enabled` | If true, create kube-state-metrics | `true` |
| `kube-state-metrics.rbac.create`| If true, create & use RBAC resources for kube-state-metrics | `true` |
| `kube-state-metrics.rbac.serviceAccount` | existing ServiceAccount to use (ignored if rbac.create=true) for kube-state-metrics | `default` |
| `clusterAgent.enabled` | Use the cluster-agent for cluster metrics (Kubernetes 1.10+ only) | `false` |
| `clusterAgent.token` | A cluster-internal secret for agent-to-agent communication. Must be 32+ characters a-zA-Z | Generates a random value |
| `clusterAgent.containerName` | The container name for the Cluster Agent | `cluster-agent` |
| `clusterAgent.image.repository` | The image repository for the cluster-agent | `datadog/cluster-agent` |
| `clusterAgent.image.tag` | The image tag to pull | `1.0.0` |
| `clusterAgent.image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `clusterAgent.image.pullSecrets` | Image pull secrets | `nil` |
| `clusterAgent.metricsProvider.enabled` | Enable Datadog metrics as a source for HPA scaling | `false` |
| `clusterAgent.resources.requests.cpu` | CPU resource requests | `200m` |
| `clusterAgent.resources.limits.cpu` | CPU resource limits | `200m` |
| `clusterAgent.resources.requests.memory` | Memory resource requests | `256Mi` |
| `clusterAgent.resources.limits.memory` | Memory resource limits | `256Mi` |
| `clusterAgent.tolerations` | List of node taints to tolerate | `[]` |
| `clusterAgent.livenessProbe` | Overrides the default liveness probe | http port 443 if external metrics enabled |
| `clusterAgent.readinessProbe` | Overrides the default readiness probe | http port 443 if external metrics enabled |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
helm install --name my-release \
--set datadog.apiKey=YOUR-KEY-HERE,datadog.logLevel=DEBUG \
stable/datadog
```
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
helm install --name my-release -f my-values.yaml stable/datadog
```
**Tip**: You can copy and customize the default [values.yaml](values.yaml)
### Image repository and tag
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/).
Starting with version 1.0.0, this chart does not support deploying Agent 5.x anymore. 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`.
### DaemonSet and Deployment
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.
### Secret
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.
### confd and checksd
The Datadog [entrypoint
](https://github.com/DataDog/datadog-agent/blob/master/Dockerfiles/agent/entrypoint/89-copy-customfiles.sh)
will copy files with a `.yaml` extension found in `/conf.d` and files with `.py` extension in
`/check.d` to `/etc/datadog-agent/conf.d` and `/etc/datadog-agent/checks.d` respectively. The keys for
`datadog.confd` and `datadog.checksd` should mirror the content found in their
respective ConfigMaps, ie
```yaml
datadog:
confd:
redisdb.yaml: |-
ad_identifiers:
- redis
- bitnami/redis
init_config:
instances:
- host: "%%host%%"
port: "%%port%%"
jmx.yaml: |-
ad_identifiers:
- openjdk
instance_config:
instances:
- host: "%%host%%"
port: "%%port_0%%"
redisdb.yaml: |-
init_config:
instances:
- host: "outside-k8s.example.com"
port: 6379
```
For more details, please refer to [the documentation](https://docs.datadoghq.com/agent/kubernetes/integrations/).
### Kubernetes event collection
To enable event collection, you will need to set the `datadog.leaderElection`, `datadog.collectEvents` and `rbac.create` options to `true`.
It is now recommended to use the Datadog Cluster Agent to collect the events - Refer to the [Enabling the Datadog Cluster Agent](#enabling-the-datadog-cluster-agent) section.
Please read [the official documentation](https://docs.datadoghq.com/agent/kubernetes/event_collection/) for more context.
### Kubernetes Labels and Annotations
To map Kubernetes pod labels and annotations to Datadog tags, provide a dictionary with kubernetes labels/annotations as keys and datadog tags as values:
```yaml
podAnnotationsAsTags:
iam.amazonaws.com/role: kube_iamrole
```
```yaml
podLabelsAsTags:
app: kube_app
release: helm_release
```
### CRI integration
As of the version 6.6.0, the Datadog Agent supports collecting metrics from any container runtime interface used in your cluster.
Configure the location path of the socket with `datadog.criSocketPath` and make sure you allow the socket to be mounted into the pod running the agent by setting `datadog.useCriSocketVolume` to `True`.
Standard paths are:
- Containerd socket: `/var/run/containerd/containerd.sock`
- Cri-o socket: `/var/run/crio/crio.sock`
# Datadog
[Datadog](https://www.datadoghq.com/) is a hosted infrastructure monitoring platform.
## Introduction
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/).
For more details of the datadog-agent v6 environment configurations, please reference the [docs](https://github.com/DataDog/datadog-agent/tree/master/Dockerfiles/agent) here.
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: "datadog/agent"
description: "Datadog image name"
type: string
label: Datadog Image Name
- variable: image.tag
default: "6.9.0"
description: "Datadog Image Tag"
type: string
label: Datadog Image Tag
- variable: clusterAgent.image.repository
default: "datadog/cluster-agent"
description: "Datadog clusterAgent image name"
type: string
label: Datadog ClusterAgent Image Name
- variable: clusterAgent.image.tag
default: "1.1.0"
description: "Datadog ClusterAgent Image Tag"
type: string
label: Datadog ClusterAgent Image Tag
- variable: kubeStateMetrics.image.repository
default: "quay.io/coreos/kube-state-metrics"
description: "KubeState image name"
type: string
label: KubeState Image Name
show_if: "kubeStateMetrics.enabled=true&&defaultImage=false"
- variable: kubeStateMetrics.image.tag
default: "v1.4.0"
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 agent configurations
- variable: datadog.apiKey
default: ""
description: "Enter your Datadog API Key."
type: string
label: Datadog API Key
group: "Agent Configuration"
required: true
- 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: 0.13.1
digest: sha256:4eeef86887d04fc0fadad89d23d9aba59aac95bdf70b3122046bcdb3fde8a10d
generated: 2019-02-11T11:42:33.861791+08:00
dependencies:
- name: kube-state-metrics
version: 0.13.1
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 not .Values.clusterAgent.token }}
##############################################################################
#### INFO: You did not set a clusterAgent.token ####
##############################################################################
Because you enabled the Cluster Agent but did not provide a token, 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 .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.confd.fullname" . }} 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).
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 -}}
{{/*
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 -}}
{{/*
Create a default fully qualified confd name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "datadog.confd.fullname" -}}
{{- printf "%s-datadog-confd" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified checksd name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "datadog.checksd.fullname" -}}
{{- printf "%s-datadog-checksd" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified cluster-agent name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "datadog.clusterAgent.fullname" -}}
{{- printf "%s-cluster-agent" .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- 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.clusterAgent.fullname" . }}-metrics-api
namespace: {{ .Release.Namespace }}
version: v1beta1
insecureSkipTLSVerify: true
group: external.metrics.k8s.io
groupPriorityMinimum: 100
versionPriority: 100
priority: 100
{{- 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.clusterAgent.fullname" . }}
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
{{- 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.clusterAgent.fullname" . }}:system:auth-delegator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:auth-delegator
subjects:
- kind: ServiceAccount
name: {{ template "datadog.clusterAgent.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- if and .Values.rbac.create .Values.clusterAgent.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.clusterAgent.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "datadog.clusterAgent.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "datadog.clusterAgent.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- if .Values.clusterAgent.enabled -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ template "datadog.clusterAgent.fullname" . }}
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 }}
{{- if .Values.clusterAgent.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ template "datadog.clusterAgent.fullname" . }}
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.clusterAgent.fullname" . }}
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.clusterAgent.fullname" . }}-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.clusterAgent.fullname" . }}
ports:
- port: 443
name: metricsapi
protocol: TCP
{{ end }}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled -}}
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.clusterAgent.fullname" . }}
{{- end -}}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.enabled -}}
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.clusterAgent.fullname" . }}"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: extension-apiserver-authentication-reader
subjects:
- kind: ServiceAccount
name: {{ template "datadog.clusterAgent.fullname" . }}
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- 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 }}
{{- 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.datadog.checksd }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.checksd.fullname" . }}
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.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "datadog.clusterAgent.fullname" . }}
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.clusterAgent.fullname" . }}
template:
metadata:
labels:
app: {{ template "datadog.clusterAgent.fullname" . }}
name: {{ template "datadog.clusterAgent.fullname" . }}
spec:
{{- 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 12 }}
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.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 }}
{{- 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.clusterAgent.fullname" . }}
{{- end }}
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "datadog.clusterAgent.fullname" . }}
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.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.clusterAgent.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }}
{{ 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 }}
- apiGroups: # Kubelet connectivity
- ""
resources:
- nodes/metrics
- nodes/spec
- nodes/proxy
verbs:
- get
{{- end -}}
{{- if .Values.rbac.create -}}
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 -}}
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.confd.fullname" . }}
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 -}}
{{- if .Values.daemonset.enabled }}
{{- if (or (.Values.datadog.apiKeyExistingSecret) (.Values.datadog.apiKey)) }}
apiVersion: extensions/v1beta1
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:
template:
metadata:
labels:
app: {{ template "datadog.fullname" . }}
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:
- name: {{ default .Chart.Name .Values.datadog.name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{ toYaml .Values.datadog.resources | indent 12 }}
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.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.apmNonLocalTraffic }}
- name: DD_APM_NON_LOCAL_TRAFFIC
value: {{ .Values.datadog.apmNonLocalTraffic | 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.clusterAgent.fullname" . }}
- name: DD_CLUSTER_AGENT_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: {{ template "datadog.clusterAgent.fullname" . }}
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 .Values.datadog.nodeLabelsAsTags }}
- name: DD_KUBERNETES_NODE_LABELS_AS_TAGS
value: '{{ toJson .Values.datadog.nodeLabelsAsTags }}'
{{- 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.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 }}
{{- if .Values.datadog.useDogStatsDSocketVolume }}
- name: DD_DOGSTATSD_SOCKET
value: "/var/run/datadog/dsd.socket"
{{- end }}
{{- 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
- 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
{{- end }}
{{- if .Values.datadog.processAgentEnabled }}
- name: passwd
mountPath: /etc/passwd
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:
httpGet:
path: /health
port: 5555
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
successThreshold: 1
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
- name: s6-run
emptyDir: {}
{{- if (or (.Values.datadog.confd) (.Values.datadog.autoconf)) }}
- name: confd
configMap:
name: {{ template "datadog.confd.fullname" . }}
{{- end }}
{{- if .Values.datadog.checksd }}
- name: checksd
configMap:
name: {{ template "datadog.checksd.fullname" . }}
{{- end }}
{{- if .Values.datadog.logsEnabled }}
- hostPath:
path: {{ default "/var/lib/datadog-agent/logs" .Values.datadog.logsPointerHostPath | quote }}
name: pointerdir
{{- end }}
{{- if .Values.datadog.processAgentEnabled }}
- hostPath:
path: /etc/passwd
name: passwd
{{- end }}
{{- if .Values.datadog.volumes }}
{{ toYaml .Values.datadog.volumes | indent 8 }}
{{- end }}
{{- if (or (.Values.daemonset.tolerations) (.Values.daemonset.rkeETCDControlPlane)) }}
tolerations:
{{- if .Values.daemonset.rkeETCDControlPlane }}
- key: "node-role.kubernetes.io/etcd"
value: "true"
- key: "node-role.kubernetes.io/controlplane"
value: "true"
{{- end }}
{{- if .Values.daemonset.tolerations }}
{{ toYaml .Values.daemonset.tolerations | indent 8 }}
{{- end }}
{{- 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 "OnDelete" .Values.daemonset.updateStrategy | quote }}
{{ 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.clusterAgent.fullname" . }}-external-metrics-reader
rules:
- apiGroups:
- "external.metrics.k8s.io"
resources:
- "*"
verbs:
- list
- get
- watch
{{- end -}}
{{- if and .Values.rbac.create .Values.clusterAgent.enabled .Values.clusterAgent.metricsProvider.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.clusterAgent.fullname" . }}-external-metrics-reader
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ template "datadog.clusterAgent.fullname" . }}-external-metrics-reader
subjects:
- kind: ServiceAccount
name: horizontal-pod-autoscaler
namespace: kube-system
{{- end -}}
# You need to use that account for your dd-agent DaemonSet
{{ if .Values.rbac.create -}}
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 -}}
# Default values for datadog.
image:
# This chart is compatible with different images, please choose one
repository: datadog/agent # Agent6
# repository: datadog/dogstatsd # Standalone DogStatsD6
tag: 6.9.0 # Use 6.9.0-jmx to enable jmx fetch collection
pullPolicy: IfNotPresent
## It is possible to specify docker registry credentials
## See https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
# pullSecrets:
# - name: regsecret
# NB! Normally you need to keep Datadog DaemonSet enabled!
# The exceptional case could be a situation when you need to run
# single DataDog pod per every namespace, but you do not need to
# re-create a DaemonSet for every non-default namespace install.
# Note, that StatsD and DogStatsD work over UDP, so you may not
# get guaranteed delivery of the metrics in Datadog-per-namespace setup!
daemonset:
enabled: true
## Configure pods with the required tolerations to run agents
## on RKE data and control plane nodes.
rkeETCDControlPlane: true
## 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. Can be
## used for custom metrics instead of a service endpoint.
## WARNING: Make sure that hosts using this are properly firewalled otherwise
## metrics and traces will be accepted from any host able to connect to this host.
# useHostNetwork: true
## Sets the hostPort to the same value of the container port. Needs to be used
## to receive traces in a standard APM set up. Can be used as for sending custom metrics.
## The ports will need to be available on all hosts.
## WARNING: Make sure that hosts using this are properly firewalled otherwise
## metrics and traces will be accepted from any host able to connect to this host.
# useHostPort: true
## Run the agent in the host's PID namespace. This is required for Dogstatsd origin
## detection to work. See https://docs.datadoghq.com/developers/dogstatsd/unix_socket/
# useHostPID: true
## Annotations to add to the DaemonSet's Pods
# podAnnotations:
# scheduler.alpha.kubernetes.io/tolerations: '[{"key": "example", "value": "foo"}]'
## Allow the DaemonSet to schedule on tainted nodes (requires Kubernetes >= 1.6)
# tolerations: []
## Allow the DaemonSet to schedule on selected nodes
# Ref: https://kubernetes.io/docs/user-guide/node-selection/
# nodeSelector: {}
## Allow the DaemonSet to schedule ussing affinity rules
# Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
# affinity: {}
## Allow the DaemonSet to perform a rolling update on helm update
## ref: https://kubernetes.io/docs/tasks/manage-daemon/update-daemon-set/
# updateStrategy: RollingUpdate
## Sets PriorityClassName if defined
# priorityClassName:
## deploy the kube-state-metrics deployment
## ref: https://github.com/kubernetes/charts/tree/master/stable/kube-state-metrics
kubeStateMetrics:
enabled: true
image:
repository: quay.io/coreos/kube-state-metrics
tag: v1.4.0
# This is the new cluster agent implementation that handles cluster-wide
# metrics more cleanly, separates concerns for better rbac, and implements
# the external metrics API so you can autoscale HPAs based on datadog
# metrics
clusterAgent:
containerName: cluster-agent
image:
repository: datadog/cluster-agent
tag: 1.1.0
pullPolicy: IfNotPresent
enabled: false
## This needs to be at least 32 characters a-zA-z
## It is a preshared key between the node agents and the cluster agent
token: ""
replicas: 1
## Enable the metricsProvider to be able to scale based on metrics in Datadog
metricsProvider:
enabled: false
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 200m
memory: 256Mi
## Override the agent's liveness probe logic from the default:
## In case of issues with the probe, you can disable it with the
## following values, to allow easier investigating:
# livenessProbe:
# exec:
# command: ["/bin/true"]
## Override the cluster-agent's readiness probe logic from the default:
# readinessProbe:
datadog:
## You'll need to set this to your Datadog API key before the agent will run.
## ref: https://app.datadoghq.com/account/settings#agent/kubernetes
##
# apiKey:
## Starting with Agent v6.4.0, the agent proxy settings can be overridden
## with the following environment variables:
# httpProxy: ""
# httpsProxy: ""
# noProxy: ""
## You can modify the security context used to run the containers by
## modifying the label type below:
# securityContext:
# seLinuxOptions:
# seLinuxLabel: "spc_t"
## Use existing Secret which stores API key instead of creating a new one
# apiKeyExistingSecret:
## If you are using clusterAgent.metricsProvider.enabled = true, you'll need
## a datadog app key for read access to the metrics
# appKey:
## Use existing Secret which stores APP key instead of creating a new one
# appKeyExistingSecret:
## Daemonset/Deployment container name
## See clusterAgent.containerName if clusterAgent.enabled = true
##
name: datadog
# The site of the Datadog intake to send Agent data to.
# Defaults to 'datadoghq.com', set to 'datadoghq.eu' to send data to the EU site.
# site: datadoghq.com
# 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.
# Overrides the site setting defined in "site".
# dd_url: https://app.datadoghq.com
## Set logging verbosity.
## ref: https://github.com/DataDog/docker-dd-agent#environment-variables
## Note: For Agent6 (image `datadog/agent`) the valid log levels are
## trace, debug, info, warn, error, critical, and off
##
logLevel: INFO
## Un-comment this to make each node accept non-local statsd traffic.
## ref: https://github.com/DataDog/docker-dd-agent#environment-variables
##
# nonLocalTraffic: true
## Enable origin detection for container tagging
## https://docs.datadoghq.com/developers/dogstatsd/unix_socket/#using-origin-detection-for-container-tagging
##
# dogstatsdOriginDetection: true
## Enable container runtime socket volume mounting
useCriSocketVolume: true
## Enable dogstatsd over Unix Domain Socket
## ref: https://docs.datadoghq.com/developers/dogstatsd/unix_socket/
##
# useDogStatsDSocketVolume: true
## Set host tags.
## ref: https://github.com/DataDog/docker-dd-agent#environment-variables
##
# tags:
## Enables event collection from the kubernetes API
## ref: https://github.com/DataDog/docker-dd-agent#environment-variables
##
collectEvents: false
## Enables log collection
## ref: https://docs.datadoghq.com/agent/basic_agent_usage/kubernetes/#log-collection-setup
##
# logsEnabled: false
# logsConfigContainerCollectAll: false
## Un-comment this to enable APM and tracing, on port 8126
## ref: https://github.com/DataDog/docker-dd-agent#tracing-from-the-host
##
# apmEnabled: true
## Un-comment this to enable live process monitoring
## ref: https://docs.datadoghq.com/graphing/infrastructure/process/#kubernetes-daemonset
##
# processAgentEnabled: true
## The dd-agent supports many environment variables
## ref: https://github.com/DataDog/datadog-agent/tree/master/Dockerfiles/agent#environment-variables
##
# env:
# - name:
# value:
## The dd-agent supports detailed process and container monitoring and
## requires control over the volume and volumeMounts for the daemonset
## ref: https://docs.datadoghq.com/guides/process/
##
# volumes:
# - hostPath:
# path: /etc/passwd
# name: passwd
# volumeMounts:
# - name: passwd
# mountPath: /etc/passwd
# readOnly: true
## Enable leader election mechanism for event collection
##
# leaderElection: false
## Set the lease time for leader election
##
# leaderLeaseDuration: 600
## Provide additional check configurations (static and Autodiscovery)
## Each key will become a file in /conf.d
## ref: https://github.com/DataDog/datadog-agent/tree/master/Dockerfiles/agent#optional-volumes
## ref: https://docs.datadoghq.com/agent/autodiscovery/
##
# confd:
# redisdb.yaml: |-
# init_config:
# instances:
# - host: "name"
# port: "6379"
# kubernetes_state.yaml: |-
# ad_identifiers:
# - kube-state-metrics
# init_config:
# instances:
# - kube_state_url: http://%%host%%:8080/metrics
## Provide additional custom checks as python code
## Each key will become a file in /checks.d
## ref: https://github.com/DataDog/datadog-agent/tree/master/Dockerfiles/agent#optional-volumes
##
# checksd:
# service.py: |-
## Path to the container runtime socket (if different from Docker)
## This is supported starting from agent 6.6.0
# criSocketPath: /var/run/containerd/containerd.sock
## Provide a mapping of Kubernetes Labels to Datadog Tags
# podLabelsAsTags:
# app: kube_app
# release: helm_release
## Provide a mapping of Kubernetes Annotations to Datadog Tags
# podAnnotationsAsTags:
# iam.amazonaws.com/role: kube_iamrole
## Override the agent's liveness probe logic from the default:
## In case of issues with the probe, you can disable it with the
## following values, to allow easier investigating:
# livenessProbe:
# exec:
# command: ["/bin/true"]
## datadog-agent resource requests and limits
## Make sure to keep requests and limits equal to keep the pods in the Guaranteed QoS class
## Ref: http://kubernetes.io/docs/user-guide/compute-resources/
##
resources:
requests:
cpu: 200m
memory: 256Mi
limits:
cpu: 200m
memory: 256Mi
rbac:
## If true, create & use RBAC resources
create: true
## Ignored if rbac.create is true
serviceAccountName: default
tolerations: []
kube-state-metrics:
rbac:
create: true
## Ignored if rbac.create is true
serviceAccountName: default
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