Skip to content

Commit

Permalink
Add namespace to datadog helm chart templates (#233)
Browse files Browse the repository at this point in the history
* add namespace to datadog templates

Co-authored-by: Cedric Lamoriniere <[email protected]>
  • Loading branch information
afirth and clamoriniere authored May 7, 2021
1 parent 5a8f740 commit f74f7b0
Show file tree
Hide file tree
Showing 29 changed files with 43 additions and 7 deletions.
4 changes: 4 additions & 0 deletions charts/datadog/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Datadog changelog

## 2.12.4

* Fix missing namespaces in chart templates

## 2.12.3

* Added `datadog.ignoreAutoConfig` config option to ignore `auto_conf.yaml` configurations.
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: datadog
version: 2.12.3
version: 2.12.4
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 2.12.3](https://img.shields.io/badge/Version-2.12.3-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 2.12.4](https://img.shields.io/badge/Version-2.12.4-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)

[Datadog](https://www.datadoghq.com/) is a hosted infrastructure monitoring platform. This chart adds the Datadog Agent to all nodes in your cluster via a DaemonSet. It also optionally depends on the [kube-state-metrics chart](https://github.com/kubernetes/kube-state-metrics/tree/master/charts/kube-state-metrics). For more information about monitoring Kubernetes with Datadog, please refer to the [Datadog documentation website](https://docs.datadoghq.com/agent/basic_agent_usage/kubernetes/).

Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/agent-cilium-network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}-clusterchecks
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "datadog.fullname" . }}-clusterchecks
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "networking.k8s.io/v1"
kind: NetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}-clusterchecks
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/agent-clusterchecks-pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ template "datadog.fullname" . }}-clusterchecks
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/agent-clusterchecks-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: {{ template "datadog.fullname" . }}-cluster-checks
namespace: {{ .Release.Namespace }}
{{- if .Values.clusterChecksRunner.rbac.serviceAccountAnnotations }}
annotations: {{ toYaml .Values.clusterChecksRunner.rbac.serviceAccountAnnotations | nindent 4 }}
{{- end }}
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/agent-network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "networking.k8s.io/v1"
kind: NetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
4 changes: 4 additions & 0 deletions charts/datadog/templates/agent-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand All @@ -25,6 +26,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent-metrics-api
namespace: {{ .Release.Namespace }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
Expand All @@ -51,6 +53,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent-admission-controller
namespace: {{ .Release.Namespace }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
Expand All @@ -75,6 +78,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ .Values.datadog.serviceTopology.serviceName | quote }}
namespace: {{ .Release.Namespace }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/checksd-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-checksd
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent-confd
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent-config
namespace: {{ .Release.Namespace }}
labels:
app: "{{ template "datadog.fullname" . }}"
chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/cluster-agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/cluster-agent-network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "networking.k8s.io/v1"
kind: NetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/cluster-agent-pdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
6 changes: 5 additions & 1 deletion charts/datadog/templates/cluster-agent-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,9 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent
---
namespace: {{ .Release.Namespace }}
{{- if .Values.clusterAgent.admissionController.enabled }}
---
apiVersion: {{ template "rbac.apiVersion" . }}
kind: Role
metadata:
Expand All @@ -323,6 +324,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""]
resources: ["secrets"]
Expand All @@ -338,6 +340,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: "{{ template "datadog.fullname" . }}-cluster-agent"
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand Down Expand Up @@ -384,6 +387,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: "{{ template "datadog.fullname" . }}-cluster-agent-apiserver"
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/confd-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-confd
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ template "datadog.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/datadog-yaml-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-datadog-yaml
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/install_info-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "datadog.fullname" . }}-installinfo
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "cilium.io/v2"
kind: CiliumNetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}-kube-state-metrics
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: "networking.k8s.io/v1"
kind: NetworkPolicy
metadata:
name: {{ template "datadog.fullname" . }}-kube-state-metrics
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
7 changes: 4 additions & 3 deletions charts/datadog/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRole
metadata:
name: {{ template "datadog.fullname" . }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: {{ template "datadog.fullname" . }}
rules:
{{- if eq (include "should-deploy-cluster-agent" .) "false" }}
- apiGroups:
Expand Down Expand Up @@ -110,13 +110,13 @@ rules:
apiVersion: {{ template "rbac.apiVersion" . }}
kind: ClusterRoleBinding
metadata:
name: {{ template "datadog.fullname" . }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: {{ template "datadog.fullname" . }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand All @@ -129,11 +129,12 @@ subjects:
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ template "datadog.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
name: {{ template "datadog.fullname" . }}
{{- end -}}
1 change: 1 addition & 0 deletions charts/datadog/templates/secret-api-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "datadog.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
1 change: 1 addition & 0 deletions charts/datadog/templates/secret-application-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "datadog.appKeySecretName" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand Down
3 changes: 2 additions & 1 deletion charts/datadog/templates/secret-cluster-agent-token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ template "clusterAgent.tokenSecretName" . }}
namespace: {{ .Release.Namespace }}
labels:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
app.kubernetes.io/name: "{{ template "datadog.fullname" . }}"
Expand All @@ -18,4 +19,4 @@ data:
token: {{ randAlphaNum 32 | b64enc | quote }}
{{ end }}
{{- end }}
{{ end }}
{{ end }}

0 comments on commit f74f7b0

Please sign in to comment.