Skip to content

Commit

Permalink
Add the ability to include security contexts in container level for c…
Browse files Browse the repository at this point in the history
…luster checks runners (#1598)

* add security context in container level for cluster checks runners

* small edit in changelog

* move cluster check runner container security context to be adjactent to clusterChecksRunner.securityContext

* Update charts/datadog/CHANGELOG.md

Co-authored-by: Celene <celene@datadoghq.com>

---------

Co-authored-by: Celene <celene@datadoghq.com>
  • Loading branch information
mrdoggopat and celenechang authored Nov 5, 2024
1 parent fd50dbe commit d6f1eb6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 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.77.2

* Add the ability to include Security Contexts at the container level for Cluster Checks Runners.

## 3.77.1

* Modify command that removes the default conf.d directory from the Cluster Checks Runners and only removes the default YAML files.
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: 3.77.1
version: 3.77.2
appVersion: "7"
description: Datadog Agent
keywords:
Expand Down
4 changes: 3 additions & 1 deletion charts/datadog/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Datadog

![Version: 3.77.1](https://img.shields.io/badge/Version-3.77.1-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.77.2](https://img.shields.io/badge/Version-3.77.2-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 Expand Up @@ -629,6 +629,8 @@ helm install <RELEASE_NAME> \
| clusterAgent.volumes | list | `[]` | Specify additional volumes to mount in the cluster-agent container |
| clusterChecksRunner.additionalLabels | object | `{}` | Adds labels to the cluster checks runner deployment and pods |
| clusterChecksRunner.affinity | object | `{}` | Allow the ClusterChecks Deployment to schedule using affinity rules. |
| clusterChecksRunner.containers.agent.securityContext | object | `{}` | Specify securityContext on the agent container |
| clusterChecksRunner.containers.initContainers.securityContext | object | `{}` | Specify securityContext on the init containers |
| clusterChecksRunner.createPodDisruptionBudget | bool | `false` | Create the pod disruption budget to apply to the cluster checks agents |
| clusterChecksRunner.deploymentAnnotations | object | `{}` | Annotations to add to the cluster-checks-runner's Deployment |
| clusterChecksRunner.dnsConfig | object | `{}` | specify dns configuration options for datadog cluster agent containers e.g ndots |
Expand Down
12 changes: 12 additions & 0 deletions charts/datadog/templates/agent-clusterchecks-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ spec:
command: ["bash", "-c"]
args:
- cp -r /etc/datadog-agent /opt
{{- if .Values.clusterChecksRunner.containers.initContainers.securityContext }}
securityContext:
{{ toYaml .Values.clusterChecksRunner.containers.initContainers.securityContext | indent 10 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /opt/datadog-agent
Expand All @@ -90,6 +94,10 @@ spec:
command: ["bash", "-c"]
args:
- for script in $(find /etc/cont-init.d/ -type f -name '*.sh' | sort) ; do bash $script ; done
{{- if .Values.clusterChecksRunner.containers.initContainers.securityContext }}
securityContext:
{{ toYaml .Values.clusterChecksRunner.containers.initContainers.securityContext | indent 10 }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/datadog-agent
Expand Down Expand Up @@ -177,6 +185,10 @@ spec:
{{- include "additional-env-dict-entries" .Values.clusterChecksRunner.envDict | indent 10 }}
resources:
{{ toYaml .Values.clusterChecksRunner.resources | indent 10 }}
{{- if .Values.clusterChecksRunner.containers.agent.securityContext }}
securityContext:
{{ toYaml .Values.clusterChecksRunner.containers.agent.securityContext | indent 10 }}
{{- end }}
volumeMounts:
- name: installinfo
subPath: install_info
Expand Down
8 changes: 8 additions & 0 deletions charts/datadog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,14 @@ clusterChecksRunner:
# clusterChecksRunner.securityContext -- Allows you to overwrite the default PodSecurityContext on the clusterchecks pods.
securityContext: {}

containers:
agent:
# clusterChecksRunner.containers.agent.securityContext -- Specify securityContext on the agent container
securityContext: {}
initContainers:
# clusterChecksRunner.containers.initContainers.securityContext -- Specify securityContext on the init containers
securityContext: {}

# clusterChecksRunner.ports -- Allows to specify extra ports (hostPorts for instance) for this container
ports: []

Expand Down

0 comments on commit d6f1eb6

Please sign in to comment.