Skip to content

Commit

Permalink
feat(all charts): improve datadog tagging and correlation (#253)
Browse files Browse the repository at this point in the history
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.

Co-authored-by: Matt Wise <[email protected]>
  • Loading branch information
diranged and diranged authored Dec 11, 2023
1 parent a9637aa commit ed34754
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 26 deletions.
4 changes: 2 additions & 2 deletions charts/daemonset-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
dependencies:
- name: nd-common
version: 0.1.0
version: 0.2.0
repository: file://../nd-common
2 changes: 1 addition & 1 deletion charts/daemonset-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
1 change: 0 additions & 1 deletion charts/daemonset-app/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/nd-common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion charts/nd-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A helper chart used by most of our other charts

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: library](https://img.shields.io/badge/Type-library-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)

**This chart is a [Library Chart](https://helm.sh/docs/topics/library_charts/)** -
this means that the chart itself deploys no resources, and has no `.yaml`
Expand Down
1 change: 1 addition & 0 deletions charts/nd-common/templates/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
4 changes: 3 additions & 1 deletion charts/nd-common/templates/_datadog.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

{{/*
Expand Down
4 changes: 2 additions & 2 deletions charts/prometheus-alerts/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: [email protected]
dependencies:
- name: nd-common
version: 0.1.0
version: 0.2.0
repository: file://../nd-common
4 changes: 2 additions & 2 deletions charts/prometheus-alerts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions charts/rollout-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions charts/rollout-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion charts/rollout-app/templates/rollout.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/simple-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions charts/simple-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion charts/simple-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions charts/stateful-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions charts/stateful-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion charts/stateful-app/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down

0 comments on commit ed34754

Please sign in to comment.