Skip to content

Commit

Permalink
[CWS] Configuration options for enabling CWSInstrumentation in the cl…
Browse files Browse the repository at this point in the history
…uster-agent and from the operator
  • Loading branch information
Gui774ume committed Nov 26, 2024
1 parent 3df0db9 commit ccbe271
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 4 deletions.
4 changes: 4 additions & 0 deletions charts/datadog-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.4.0

* Add configuration to grand to the operator the necessary RBAC for the CWS Instrumentation admission controller feature in the Cluster-Agent to work.

## 2.3.0

* Update Datadog Operator version to 1.10.0.
Expand Down
2 changes: 1 addition & 1 deletion charts/datadog-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: datadog-operator
version: 2.3.0
version: 2.4.0
appVersion: 1.10.0
description: Datadog Operator
keywords:
Expand Down
3 changes: 2 additions & 1 deletion charts/datadog-operator/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Datadog Operator

![Version: 2.3.0](https://img.shields.io/badge/Version-2.3.0-informational?style=flat-square) ![AppVersion: 1.10.0](https://img.shields.io/badge/AppVersion-1.10.0-informational?style=flat-square)
![Version: 2.4.0](https://img.shields.io/badge/Version-2.4.0-informational?style=flat-square) ![AppVersion: 1.10.0](https://img.shields.io/badge/AppVersion-1.10.0-informational?style=flat-square)

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| addCWSInstrumentationRBAC | bool | `false` | Defines if the operator should be deployed with the RBAC required for the cluster-agent CWSInstrumentation feature. |
| affinity | object | `{}` | Allows to specify affinity for Datadog Operator PODs |
| apiKey | string | `nil` | Your Datadog API key |
| apiKeyExistingSecret | string | `nil` | Use existing Secret which stores API key instead of creating a new one |
Expand Down
5 changes: 5 additions & 0 deletions charts/datadog-operator/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -803,4 +803,9 @@ rules:
- list
- watch
{{- end }}
{{- if .Values.addCWSInstrumentationRBAC }}
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create"]
{{- end }}
{{- end -}}
4 changes: 4 additions & 0 deletions charts/datadog-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,7 @@ clusterRole:
# allowReadAllResources is required to allow the operator to view all custom resources.
# If collecting CRDs in the Kubernetes Explorer this is required
allowReadAllResources: false

# addCWSInstrumentationRBAC -- Defines if the operator should be deployed with the RBAC required for the cluster-agent
# CWSInstrumentation feature.
addCWSInstrumentationRBAC: false
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.82.0

* Add `pods/exec` RBAC to the `Cluster-Agent` when needed and inject the service account name of the `Cluster-Agent` as environment variable.

## 3.81.0

* Add a new option to disable hostPorts for the trace-agent with `datadog.apm.useLocalService`. This option enables K8s clusters with hostPort and hostPath volumes restrictions to use the K8s local service to send traces.
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.81.0
version: 3.82.0
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.81.0](https://img.shields.io/badge/Version-3.81.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
![Version: 3.82.0](https://img.shields.io/badge/Version-3.82.0-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 @@ -571,6 +571,8 @@ helm install <RELEASE_NAME> \
| clusterAgent.admissionController.agentSidecarInjection.selectors | list | `[]` | Defines the pod selector for sidecar injection, currently only one rule is supported. |
| clusterAgent.admissionController.configMode | string | `nil` | The kind of configuration to be injected, it can be "hostip", "service", or "socket". |
| clusterAgent.admissionController.containerRegistry | string | `nil` | Override the default registry for the admission controller. |
| clusterAgent.admissionController.cwsInstrumentation.enabled | bool | `false` | Enable the CWS Instrumentation admission controller endpoint. |
| clusterAgent.admissionController.cwsInstrumentation.mode | string | `"remote_copy"` | Mode defines how the CWS Instrumentation should behave. Options are "remote_copy" or "init_container" |
| clusterAgent.admissionController.enabled | bool | `true` | Enable the admissionController to be able to inject APM/Dogstatsd config and standard tags (env, service, version) automatically into your pods |
| clusterAgent.admissionController.failurePolicy | string | `"Ignore"` | Set the failure policy for dynamic admission control.' |
| clusterAgent.admissionController.mutateUnlabelled | bool | `false` | Enable injecting config without having the pod label 'admission.datadoghq.com/enabled="true"' |
Expand Down
10 changes: 10 additions & 0 deletions charts/datadog/templates/cluster-agent-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: DD_CLUSTER_AGENT_SERVICE_ACCOUNT_NAME
valueFrom:
fieldRef:
fieldPath: spec.serviceAccountName
- name: DD_HEALTH_PORT
{{- $healthPort := .Values.clusterAgent.healthPort }}
value: {{ $healthPort | quote }}
Expand Down Expand Up @@ -248,6 +252,12 @@ spec:
{{- else }}
value: {{ include "registry" .Values | quote }}
{{- end }}
{{- if .Values.clusterAgent.admissionController.cwsInstrumentation.enabled }}
- name: DD_ADMISSION_CONTROLLER_CWS_INSTRUMENTATION_ENABLED
value: "true"
- name: DD_ADMISSION_CONTROLLER_CWS_INSTRUMENTATION_MODE
value: {{ .Values.clusterAgent.admissionController.cwsInstrumentation.mode | quote }}
{{- end }}
{{ include "ac-agent-sidecar-env" . | nindent 10 }}
- name: DD_REMOTE_CONFIGURATION_ENABLED
value: {{ include "clusterAgent-remoteConfiguration-enabled" . | quote }}
Expand Down
5 changes: 5 additions & 0 deletions charts/datadog/templates/cluster-agent-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ rules:
- apiGroups: ["apps"]
resources: ["statefulsets", "replicasets", "deployments", "daemonsets"]
verbs: ["get"]
{{- if and .Values.clusterAgent.admissionController.cwsInstrumentation.enabled (eq .Values.clusterAgent.admissionController.cwsInstrumentation.mode "remote_copy") }}
- apiGroups: [""]
resources: ["pods/exec"]
verbs: ["create"]
{{- end }}
{{- end }}
{{- if eq (include "should-enable-security-agent" .) "true" }}
{{- if .Values.datadog.securityAgent.compliance.enabled }}
Expand Down
8 changes: 8 additions & 0 deletions charts/datadog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,14 @@ clusterAgent:
# clusterAgent.admissionController.port -- Set port of cluster-agent admission controller service
port: 8000

cwsInstrumentation:
# clusterAgent.admissionController.cwsInstrumentation.enabled -- Enable the CWS Instrumentation admission controller endpoint.
enabled: false

# clusterAgent.admissionController.cwsInstrumentation.mode -- Mode defines how the CWS Instrumentation should behave.
# Options are "remote_copy" or "init_container"
mode: remote_copy

agentSidecarInjection:
# clusterAgent.admissionController.agentSidecarInjection.enabled -- Enables Datadog Agent sidecar injection.

Expand Down

0 comments on commit ccbe271

Please sign in to comment.