Skip to content

Commit eb3e544

Browse files
committed
support enabling untaint controller
1 parent 0ce8262 commit eb3e544

7 files changed

Lines changed: 212 additions & 14 deletions

File tree

charts/datadog/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Datadog changelog
22

3+
## 3.231.0
4+
5+
* Add `operator.untaintController.enabled` (default `false`). When enabled, the node Agent DaemonSet tolerates the `agent.datadoghq.com/not-ready=presence:NoSchedule` startup taint and the Datadog Operator untaint controller is enabled to remove that taint once the Agent is ready. Requires Operator v1.28.0+.
6+
37
## 3.230.0
48

59
* Bump Datadog Operator chart dependency to 2.24.0.

charts/datadog/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
apiVersion: v1
33
name: datadog
4-
version: 3.230.0
4+
version: 3.231.0
55
appVersion: "7"
66
description: Datadog Agent
77
keywords:

charts/datadog/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Datadog
22

3-
![Version: 3.230.0](https://img.shields.io/badge/Version-3.230.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
3+
![Version: 3.231.0](https://img.shields.io/badge/Version-3.231.0-informational?style=flat-square) ![AppVersion: 7](https://img.shields.io/badge/AppVersion-7-informational?style=flat-square)
44

55
> [!WARNING]
66
> The Datadog Operator is now enabled by default since version [3.157.0](https://github.com/DataDog/helm-charts/blob/main/charts/datadog/CHANGELOG.md#31570) to collect chart metadata for display in [Fleet Automation](https://docs.datadoghq.com/agent/fleet_automation/). We are aware of issues affecting some environments and are actively working on fixes. We apologize for the inconvenience and appreciate your patience while we address these issues.
@@ -1085,6 +1085,7 @@ helm install <RELEASE_NAME> \
10851085
| operator.datadogMonitor.enabled | bool | `false` | Enables the Datadog Monitor controller |
10861086
| operator.datadogSLO.enabled | bool | `false` | Enables the Datadog SLO controller |
10871087
| operator.image.tag | string | `"1.28.0"` | Define the Datadog Operator version to use |
1088+
| operator.untaintController.enabled | bool | `false` | Enables the Datadog Operator untaint controller (removes the `agent.datadoghq.com/not-ready=presence:NoSchedule` startup taint once the Agent is ready) and adds the matching toleration to the Agent DaemonSet so it can schedule on tainted nodes. Requires Operator v1.28.0+ |
10881089
| otelAgentGateway.additionalLabels | object | `{}` | Adds labels to the Agent Gateway Deployment and pods |
10891090
| otelAgentGateway.affinity | object | `{}` | Allow the Gateway Deployment to schedule using affinity rules |
10901091
| otelAgentGateway.autoscaling.annotations | object | `{}` | annotations for OTel Agent Gateway HPA |

charts/datadog/templates/daemonset.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ spec:
263263
value: windows
264264
operator: Equal
265265
{{- end }}
266+
{{- if .Values.operator.untaintController.enabled }}
267+
- key: agent.datadoghq.com/not-ready
268+
operator: Equal
269+
value: presence
270+
effect: NoSchedule
271+
{{- end }}
266272
{{- if .Values.agents.tolerations }}
267273
{{ toYaml .Values.agents.tolerations | indent 6 }}
268274
{{- end }}

charts/datadog/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3099,6 +3099,10 @@ operator:
30993099
# operator.datadogSLO.enabled -- Enables the Datadog SLO controller
31003100
enabled: false
31013101

3102+
untaintController:
3103+
# operator.untaintController.enabled -- Enables the Datadog Operator untaint controller (removes the `agent.datadoghq.com/not-ready=presence:NoSchedule` startup taint once the Agent is ready) and adds the matching toleration to the Agent DaemonSet so it can schedule on tainted nodes. Requires Operator v1.28.0+
3104+
enabled: false
3105+
31023106
datadogCRDs:
31033107
# operator.datadogCRDs.keepCrds -- Set to true to keep the CRDs when the helm chart is uninstalled. This must be set to true if datadog.operator.migration.enabled is set to true.
31043108
keepCrds: false

test/datadog/baseline/manifests/gpu_monitoring_cos.yaml

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
app.kubernetes.io/instance: datadog
66
app.kubernetes.io/managed-by: Helm
77
app.kubernetes.io/name: operator
8-
app.kubernetes.io/version: 1.27.0
8+
app.kubernetes.io/version: 1.28.0
99
name: datadog-operator
1010
namespace: datadog-agent
1111
---
@@ -406,7 +406,7 @@ metadata:
406406
app.kubernetes.io/instance: datadog
407407
app.kubernetes.io/managed-by: Helm
408408
app.kubernetes.io/name: operator
409-
app.kubernetes.io/version: 1.27.0
409+
app.kubernetes.io/version: 1.28.0
410410
name: datadog-operator
411411
rules:
412412
- nonResourceURLs:
@@ -591,6 +591,7 @@ rules:
591591
- create
592592
- get
593593
- list
594+
- patch
594595
- watch
595596
- apiGroups:
596597
- autoscaling
@@ -635,6 +636,23 @@ rules:
635636
- patch
636637
- update
637638
- watch
639+
- apiGroups:
640+
- configuration.konghq.com
641+
- consul.hashicorp.com
642+
- core.haproxy.org
643+
- datadoghq.com
644+
- gateway.envoyproxy.io
645+
- ingress.v1.haproxy.org
646+
- karpenter.azure.com
647+
- kuma.io
648+
- mesh.consul.hashicorp.com
649+
- policy.linkerd.io
650+
- traefik.containo.us
651+
resources:
652+
- '*'
653+
verbs:
654+
- list
655+
- watch
638656
- apiGroups:
639657
- coordination.k8s.io
640658
resources:
@@ -720,14 +738,6 @@ rules:
720738
- datadogpodautoscalers/status
721739
verbs:
722740
- '*'
723-
- apiGroups:
724-
- datadoghq.com
725-
- karpenter.azure.com
726-
resources:
727-
- '*'
728-
verbs:
729-
- list
730-
- watch
731741
- apiGroups:
732742
- discovery.k8s.io
733743
resources:
@@ -749,7 +759,9 @@ rules:
749759
- apiGroups:
750760
- gateway.envoyproxy.io
751761
resources:
762+
- backends
752763
- envoyextensionpolicies
764+
- envoypatchpolicies
753765
verbs:
754766
- create
755767
- delete
@@ -765,6 +777,15 @@ rules:
765777
- list
766778
- patch
767779
- watch
780+
- apiGroups:
781+
- gateway.networking.k8s.io
782+
resources:
783+
- grpcroutes
784+
- listenersets
785+
- tlsroutes
786+
verbs:
787+
- list
788+
- watch
768789
- apiGroups:
769790
- gateway.networking.k8s.io
770791
resources:
@@ -774,6 +795,14 @@ rules:
774795
- delete
775796
- get
776797
- patch
798+
- apiGroups:
799+
- k8s.nginx.org
800+
resources:
801+
- virtualserverroutes
802+
- virtualservers
803+
verbs:
804+
- list
805+
- watch
777806
- apiGroups:
778807
- karpenter.sh
779808
resources:
@@ -800,6 +829,16 @@ rules:
800829
- ksh/metrics
801830
verbs:
802831
- get
832+
- apiGroups:
833+
- networking.istio.io
834+
resources:
835+
- destinationrules
836+
- serviceentries
837+
- sidecars
838+
- virtualservices
839+
verbs:
840+
- list
841+
- watch
803842
- apiGroups:
804843
- networking.istio.io
805844
resources:
@@ -808,6 +847,22 @@ rules:
808847
- create
809848
- delete
810849
- get
850+
- apiGroups:
851+
- networking.istio.io
852+
resources:
853+
- gateways
854+
verbs:
855+
- get
856+
- list
857+
- watch
858+
- apiGroups:
859+
- networking.k8s.io
860+
resources:
861+
- ingressclasses
862+
verbs:
863+
- get
864+
- list
865+
- watch
811866
- apiGroups:
812867
- networking.k8s.io
813868
resources:
@@ -904,6 +959,13 @@ rules:
904959
- get
905960
- list
906961
- watch
962+
- apiGroups:
963+
- traefik.io
964+
resources:
965+
- ingressroutes
966+
verbs:
967+
- list
968+
- watch
907969
- apiGroups:
908970
- datadoghq.com
909971
resources:
@@ -2496,7 +2558,7 @@ metadata:
24962558
app.kubernetes.io/instance: datadog
24972559
app.kubernetes.io/managed-by: Helm
24982560
app.kubernetes.io/name: operator
2499-
app.kubernetes.io/version: 1.27.0
2561+
app.kubernetes.io/version: 1.28.0
25002562
name: datadog-operator
25012563
namespace: datadog-agent
25022564
spec:
@@ -2561,7 +2623,7 @@ spec:
25612623
value: "true"
25622624
- name: DD_REGISTRY_OVERRIDE_DEFAULT
25632625
value: "true"
2564-
image: registry.datadoghq.com/operator:1.27.0
2626+
image: registry.datadoghq.com/operator:1.28.0
25652627
imagePullPolicy: IfNotPresent
25662628
livenessProbe:
25672629
httpGet:
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
package datadog
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
appsv1 "k8s.io/api/apps/v1"
8+
corev1 "k8s.io/api/core/v1"
9+
10+
"github.com/DataDog/helm-charts/test/common"
11+
)
12+
13+
// untaintToleration is the toleration the chart must inject so the node Agent
14+
// can schedule on nodes carrying the Datadog Operator untaint controller's
15+
// startup taint agent.datadoghq.com/not-ready=presence:NoSchedule.
16+
var untaintToleration = corev1.Toleration{
17+
Key: "agent.datadoghq.com/not-ready",
18+
Operator: corev1.TolerationOpEqual,
19+
Value: "presence",
20+
Effect: corev1.TaintEffectNoSchedule,
21+
}
22+
23+
func Test_untaintToleration(t *testing.T) {
24+
tests := []struct {
25+
name string
26+
command common.HelmCommand
27+
assertions func(t *testing.T, manifest string)
28+
}{
29+
{
30+
name: "disabled by default -- toleration absent",
31+
command: common.HelmCommand{
32+
ReleaseName: "datadog",
33+
ChartPath: "../../charts/datadog",
34+
ShowOnly: []string{"templates/daemonset.yaml"},
35+
Values: []string{"../../charts/datadog/values.yaml"},
36+
Overrides: map[string]string{
37+
"datadog.apiKeyExistingSecret": "datadog-secret",
38+
"datadog.appKeyExistingSecret": "datadog-secret",
39+
},
40+
},
41+
assertions: verifyUntaintTolerationAbsent,
42+
},
43+
{
44+
name: "enabled -- toleration injected",
45+
command: common.HelmCommand{
46+
ReleaseName: "datadog",
47+
ChartPath: "../../charts/datadog",
48+
ShowOnly: []string{"templates/daemonset.yaml"},
49+
Values: []string{"../../charts/datadog/values.yaml"},
50+
Overrides: map[string]string{
51+
"datadog.apiKeyExistingSecret": "datadog-secret",
52+
"datadog.appKeyExistingSecret": "datadog-secret",
53+
"operator.untaintController.enabled": "true",
54+
},
55+
},
56+
assertions: verifyUntaintTolerationPresent,
57+
},
58+
{
59+
name: "enabled alongside user tolerations -- both present",
60+
command: common.HelmCommand{
61+
ReleaseName: "datadog",
62+
ChartPath: "../../charts/datadog",
63+
ShowOnly: []string{"templates/daemonset.yaml"},
64+
Values: []string{"../../charts/datadog/values.yaml"},
65+
Overrides: map[string]string{
66+
"datadog.apiKeyExistingSecret": "datadog-secret",
67+
"datadog.appKeyExistingSecret": "datadog-secret",
68+
"operator.untaintController.enabled": "true",
69+
"agents.tolerations[0].key": "dedicated",
70+
"agents.tolerations[0].operator": "Exists",
71+
"agents.tolerations[0].effect": "NoSchedule",
72+
},
73+
},
74+
assertions: verifyUntaintTolerationWithUserToleration,
75+
},
76+
}
77+
78+
for _, tt := range tests {
79+
t.Run(tt.name, func(t *testing.T) {
80+
manifest, err := common.RenderChart(t, tt.command)
81+
assert.Nil(t, err, "couldn't render template")
82+
tt.assertions(t, manifest)
83+
})
84+
}
85+
}
86+
87+
func hasToleration(tolerations []corev1.Toleration, want corev1.Toleration) bool {
88+
for _, tol := range tolerations {
89+
if tol == want {
90+
return true
91+
}
92+
}
93+
return false
94+
}
95+
96+
func verifyUntaintTolerationAbsent(t *testing.T, manifest string) {
97+
var ds appsv1.DaemonSet
98+
common.Unmarshal(t, manifest, &ds)
99+
assert.False(t, hasToleration(ds.Spec.Template.Spec.Tolerations, untaintToleration),
100+
"untaint toleration must not be present when operator.untaintController.enabled is false")
101+
}
102+
103+
func verifyUntaintTolerationPresent(t *testing.T, manifest string) {
104+
var ds appsv1.DaemonSet
105+
common.Unmarshal(t, manifest, &ds)
106+
assert.True(t, hasToleration(ds.Spec.Template.Spec.Tolerations, untaintToleration),
107+
"untaint toleration must be injected when operator.untaintController.enabled is true")
108+
}
109+
110+
func verifyUntaintTolerationWithUserToleration(t *testing.T, manifest string) {
111+
var ds appsv1.DaemonSet
112+
common.Unmarshal(t, manifest, &ds)
113+
tolerations := ds.Spec.Template.Spec.Tolerations
114+
assert.True(t, hasToleration(tolerations, untaintToleration),
115+
"untaint toleration must be injected")
116+
assert.True(t, hasToleration(tolerations, corev1.Toleration{
117+
Key: "dedicated",
118+
Operator: corev1.TolerationOpExists,
119+
Effect: corev1.TaintEffectNoSchedule,
120+
}), "user-provided agents.tolerations must be preserved alongside the untaint toleration")
121+
}

0 commit comments

Comments
 (0)