From 1b1010afc4b45c43031024ac00b330378994e2fa Mon Sep 17 00:00:00 2001 From: Matt Wise Date: Mon, 11 Dec 2023 09:57:07 -0800 Subject: [PATCH] feat(all charts): improve datadog tagging and correlation Per the docs at https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab=kubernetes - we should not only be labeling our Pods, but the Deployments they're a part of. This PR takes that one step further and just adds the datadogLabels to all of our resource labels. The motivation here is that going forward anything that the Datadog team can use to correlate our resourcs will all be joined together with common labels. --- charts/daemonset-app/Chart.yaml | 4 ++-- charts/daemonset-app/README.md | 2 +- charts/daemonset-app/templates/daemonset.yaml | 1 - charts/nd-common/Chart.yaml | 2 +- charts/nd-common/templates/_common.tpl | 1 + charts/nd-common/templates/_datadog.tpl | 4 +++- charts/prometheus-alerts/Chart.yaml | 4 ++-- charts/prometheus-alerts/README.md | 4 ++-- charts/rollout-app/Chart.yaml | 4 ++-- charts/rollout-app/README.md | 4 ++-- charts/rollout-app/templates/rollout.yaml | 1 - charts/simple-app/Chart.yaml | 4 ++-- charts/simple-app/README.md | 4 ++-- charts/simple-app/templates/deployment.yaml | 1 - charts/stateful-app/Chart.yaml | 4 ++-- charts/stateful-app/README.md | 4 ++-- charts/stateful-app/templates/statefulset.yaml | 1 - 17 files changed, 24 insertions(+), 25 deletions(-) diff --git a/charts/daemonset-app/Chart.yaml b/charts/daemonset-app/Chart.yaml index bd027d61..0cf66f58 100644 --- a/charts/daemonset-app/Chart.yaml +++ b/charts/daemonset-app/Chart.yaml @@ -2,12 +2,12 @@ apiVersion: v2 name: daemonset-app description: Default DaemonSet Helm Chart type: application -version: 0.14.0 +version: 0.15.0 appVersion: latest maintainers: - name: diranged email: matt@nextdoor.com dependencies: - name: nd-common - version: 0.1.0 + version: 0.2.0 repository: file://../nd-common diff --git a/charts/daemonset-app/README.md b/charts/daemonset-app/README.md index 0da55b5b..cf33dc9c 100644 --- a/charts/daemonset-app/README.md +++ b/charts/daemonset-app/README.md @@ -2,7 +2,7 @@ Default DaemonSet Helm Chart -![Version: 0.14.0](https://img.shields.io/badge/Version-0.14.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) +![Version: 0.15.0](https://img.shields.io/badge/Version-0.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) [statefulsets]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/ [hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ diff --git a/charts/daemonset-app/templates/daemonset.yaml b/charts/daemonset-app/templates/daemonset.yaml index 2d7a4b9a..823f9f59 100644 --- a/charts/daemonset-app/templates/daemonset.yaml +++ b/charts/daemonset-app/templates/daemonset.yaml @@ -31,7 +31,6 @@ spec: {{- end }} labels: {{- include "nd-common.labels" . | nindent 8 }} - {{- include "nd-common.datadogLabels" . | nindent 8 }} {{- include "nd-common.istioLabels" . | nindent 8 }} {{- with .Values.podLabels }} {{- tpl (toYaml .) $ | nindent 8 }} diff --git a/charts/nd-common/Chart.yaml b/charts/nd-common/Chart.yaml index 6a07a339..5689b499 100644 --- a/charts/nd-common/Chart.yaml +++ b/charts/nd-common/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: nd-common description: A helper chart used by most of our other charts type: library -version: 0.1.0 +version: 0.2.0 appVersion: latest diff --git a/charts/nd-common/templates/_common.tpl b/charts/nd-common/templates/_common.tpl index 21657a85..cdb50b3b 100644 --- a/charts/nd-common/templates/_common.tpl +++ b/charts/nd-common/templates/_common.tpl @@ -58,6 +58,7 @@ https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab= helm.sh/chart: {{ include "nd-common.chart" . }} app.kubernetes.io/version: {{ $tag }} app.kubernetes.io/managed-by: {{ .Release.Service }} +{{ include "nd-common.datadogLabels" . }} {{ include "nd-common.selectorLabels" . }} {{- end }} diff --git a/charts/nd-common/templates/_datadog.tpl b/charts/nd-common/templates/_datadog.tpl index e15218c6..b0ff7a22 100644 --- a/charts/nd-common/templates/_datadog.tpl +++ b/charts/nd-common/templates/_datadog.tpl @@ -54,16 +54,18 @@ https://docs.datadoghq.com/getting_started/tagging/unified_service_tagging/?tab= */}} {{- define "nd-common.datadogLabels" -}} +{{- if .Values.datadog }} {{- $_tag := include "nd-common.imageTag" . -}} {{- $tag := $_tag | replace "@" "_" | replace ":" "_" | trunc 63 | quote -}} {{- if .Values.datadog.enabled -}} {{- with .Values.datadog.env -}} tags.datadoghq.com/env: {{ . | quote }} -{{- end }} +{{ end -}} tags.datadoghq.com/service: {{ default .Release.Name .Values.datadog.service | quote }} tags.datadoghq.com/version: {{ $tag }} {{- end }} {{- end }} +{{- end }} {{/* diff --git a/charts/prometheus-alerts/Chart.yaml b/charts/prometheus-alerts/Chart.yaml index 0545df77..9479f676 100644 --- a/charts/prometheus-alerts/Chart.yaml +++ b/charts/prometheus-alerts/Chart.yaml @@ -2,12 +2,12 @@ apiVersion: v2 name: prometheus-alerts description: Helm Chart that provisions a series of common Prometheus Alerts type: application -version: 1.3.0 +version: 1.3.1 appVersion: 0.0.1 maintainers: - name: diranged email: matt@nextdoor.com dependencies: - name: nd-common - version: 0.1.0 + version: 0.2.0 repository: file://../nd-common diff --git a/charts/prometheus-alerts/README.md b/charts/prometheus-alerts/README.md index 88cae73b..cfa7d06e 100644 --- a/charts/prometheus-alerts/README.md +++ b/charts/prometheus-alerts/README.md @@ -3,7 +3,7 @@ Helm Chart that provisions a series of common Prometheus Alerts -![Version: 1.3.0](https://img.shields.io/badge/Version-1.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) +![Version: 1.3.1](https://img.shields.io/badge/Version-1.3.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.0.1](https://img.shields.io/badge/AppVersion-0.0.1-informational?style=flat-square) [deployments]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ [hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ @@ -54,7 +54,7 @@ This behavior can be tuned via the `defaults.podNameSelector`, | Repository | Name | Version | |------------|------|---------| -| file://../nd-common | nd-common | 0.1.0 | +| file://../nd-common | nd-common | 0.2.0 | ## Values diff --git a/charts/rollout-app/Chart.yaml b/charts/rollout-app/Chart.yaml index 1d13ef1b..50c19482 100644 --- a/charts/rollout-app/Chart.yaml +++ b/charts/rollout-app/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: rollout-app description: Argo Rollout-based Application Helm Chart type: application -version: 0.5.0 +version: 0.6.0 appVersion: latest maintainers: - name: diranged @@ -13,5 +13,5 @@ dependencies: repository: https://k8s-charts.nextdoor.com condition: istio-alerts.enabled - name: nd-common - version: 0.1.0 + version: 0.2.0 repository: file://../nd-common diff --git a/charts/rollout-app/README.md b/charts/rollout-app/README.md index b06f7f9a..e6fbdf1b 100644 --- a/charts/rollout-app/README.md +++ b/charts/rollout-app/README.md @@ -2,7 +2,7 @@ Argo Rollout-based Application Helm Chart -![Version: 0.5.0](https://img.shields.io/badge/Version-0.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) +![Version: 0.6.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) [analysistemplate]: https://argoproj.github.io/argo-rollouts/features/analysis/?query=AnalysisTemplate#background-analysis [argo_rollouts]: https://argoproj.github.io/argo-rollouts/ @@ -167,7 +167,7 @@ kmsSecretsRegion: us-west-2 (AWS region where the KMS key is located) | Repository | Name | Version | |------------|------|---------| -| file://../nd-common | nd-common | 0.1.0 | +| file://../nd-common | nd-common | 0.2.0 | | https://k8s-charts.nextdoor.com | istio-alerts | 0.2.0 | ## Values diff --git a/charts/rollout-app/templates/rollout.yaml b/charts/rollout-app/templates/rollout.yaml index b45a4cd8..784c12f5 100644 --- a/charts/rollout-app/templates/rollout.yaml +++ b/charts/rollout-app/templates/rollout.yaml @@ -141,7 +141,6 @@ spec: {{- end }} labels: {{- include "nd-common.labels" . | nindent 8 }} - {{- include "nd-common.datadogLabels" . | nindent 8 }} {{- include "nd-common.istioLabels" . | nindent 8 }} {{- with .Values.podLabels }} {{- tpl (toYaml .) $ | nindent 8 }} diff --git a/charts/simple-app/Chart.yaml b/charts/simple-app/Chart.yaml index bfd3322e..05dffcb0 100644 --- a/charts/simple-app/Chart.yaml +++ b/charts/simple-app/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: simple-app description: Default Microservice Helm Chart type: application -version: 1.4.1 +version: 1.5.0 appVersion: latest maintainers: - name: diranged @@ -13,5 +13,5 @@ dependencies: repository: https://k8s-charts.nextdoor.com condition: istio-alerts.enabled - name: nd-common - version: 0.1.0 + version: 0.2.0 repository: file://../nd-common diff --git a/charts/simple-app/README.md b/charts/simple-app/README.md index f9c7a64d..4039baf2 100644 --- a/charts/simple-app/README.md +++ b/charts/simple-app/README.md @@ -2,7 +2,7 @@ Default Microservice Helm Chart -![Version: 1.4.1](https://img.shields.io/badge/Version-1.4.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) +![Version: 1.5.0](https://img.shields.io/badge/Version-1.5.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) [deployments]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ [hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ @@ -312,7 +312,7 @@ kmsSecretsRegion: us-west-2 (AWS region where the KMS key is located) | Repository | Name | Version | |------------|------|---------| -| file://../nd-common | nd-common | 0.1.0 | +| file://../nd-common | nd-common | 0.2.0 | | https://k8s-charts.nextdoor.com | istio-alerts | 0.2.0 | ## Values diff --git a/charts/simple-app/templates/deployment.yaml b/charts/simple-app/templates/deployment.yaml index 0ad4051d..56e6a21b 100644 --- a/charts/simple-app/templates/deployment.yaml +++ b/charts/simple-app/templates/deployment.yaml @@ -101,7 +101,6 @@ spec: {{- end }} labels: {{- include "nd-common.labels" $ | nindent 8 }} - {{- include "nd-common.datadogLabels" $ | nindent 8 }} {{- include "nd-common.istioLabels" $ | nindent 8 }} {{- with $.Values.podLabels }} {{- tpl (toYaml .) $ | nindent 8 }} diff --git a/charts/stateful-app/Chart.yaml b/charts/stateful-app/Chart.yaml index f2bce433..69ef3e09 100644 --- a/charts/stateful-app/Chart.yaml +++ b/charts/stateful-app/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: stateful-app description: Default StatefulSet Helm Chart type: application -version: 0.15.0 +version: 0.16.0 appVersion: latest maintainers: - name: diranged @@ -13,5 +13,5 @@ dependencies: repository: https://k8s-charts.nextdoor.com condition: istio-alerts.enabled - name: nd-common - version: 0.1.0 + version: 0.2.0 repository: file://../nd-common diff --git a/charts/stateful-app/README.md b/charts/stateful-app/README.md index 615acb88..3d4e31b1 100644 --- a/charts/stateful-app/README.md +++ b/charts/stateful-app/README.md @@ -2,7 +2,7 @@ Default StatefulSet Helm Chart -![Version: 0.15.0](https://img.shields.io/badge/Version-0.15.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) +![Version: 0.16.0](https://img.shields.io/badge/Version-0.16.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) [statefulsets]: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/ [hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/ @@ -259,7 +259,7 @@ kmsSecretsRegion: us-west-2 (AWS region where the KMS key is located) | Repository | Name | Version | |------------|------|---------| -| file://../nd-common | nd-common | 0.1.0 | +| file://../nd-common | nd-common | 0.2.0 | | https://k8s-charts.nextdoor.com | istio-alerts | 0.2.0 | ## Values diff --git a/charts/stateful-app/templates/statefulset.yaml b/charts/stateful-app/templates/statefulset.yaml index 16837e3b..c73ba71a 100644 --- a/charts/stateful-app/templates/statefulset.yaml +++ b/charts/stateful-app/templates/statefulset.yaml @@ -48,7 +48,6 @@ spec: {{- end }} labels: {{- include "nd-common.labels" . | nindent 8 }} - {{- include "nd-common.datadogLabels" . | nindent 8 }} {{- include "nd-common.istioLabels" . | nindent 8 }} {{- with .Values.podLabels }} {{- tpl (toYaml .) $ | nindent 8 }}