Skip to content

Commit

Permalink
fix(datadog): RBAC for resources labels/annotations as tags
Browse files Browse the repository at this point in the history
  • Loading branch information
jscaltreto committed Feb 2, 2025
1 parent 43810e6 commit ec02444
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 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

## 3.90.1

* Fix RBAC rendering and map merge when `datadog.kubernetesResourcesAnnotationsAsTags` and/or `datadog.kubernetesResourcesLabelsAsTags` are used.

## 3.90.0

* Set default `Agent` and `Cluster-Agent` version to `7.62.0`.
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
apiVersion: v1
name: datadog
version: 3.90.0
version: 3.90.1
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: 3.90.0](https://img.shields.io/badge/Version-3.90.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.90.1](https://img.shields.io/badge/Version-3.90.1-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/prometheus-community/helm-charts/tree/main/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
13 changes: 6 additions & 7 deletions charts/datadog/templates/cluster-agent-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,13 @@ metadata:
namespace: {{ .Release.Namespace }}

{{- $groupedResources := dict }}
{{- $mergedResources := merge (default dict .Values.datadog.kubernetesResourcesAnnotationsAsTags) (default dict .Values.datadog.kubernetesResourcesLabelsAsTags)}}
{{- $mergedResources := mergeOverwrite dict (default dict .Values.datadog.kubernetesResourcesAnnotationsAsTags) (default dict .Values.datadog.kubernetesResourcesLabelsAsTags)}}
{{- range $resource, $labels := $mergedResources }}
{{- $parts := split "." $resource }}
{{- $parts := splitList "." $resource }}
{{- $apiGroup := "" }}
{{- $resourceName := $resource }}
{{- if eq (len $parts) 2 }}
{{- $apiGroup = index $parts "_1" }}
{{- $resourceName = index $parts "_0" }}
{{- $resourceName := mustFirst $parts }}
{{- if gt (len $parts) 1 }}
{{- $apiGroup = join "." (mustRest $parts) }}
{{- end }}
{{- $existing := index $groupedResources $apiGroup | default (list) }}
{{- $groupedResources = set $groupedResources $apiGroup (append $existing $resourceName) }}
Expand Down Expand Up @@ -559,4 +558,4 @@ subjects:
- kind: ServiceAccount
name: {{ template "datadog.fullname" . }}-cluster-agent
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- end -}}

0 comments on commit ec02444

Please sign in to comment.