Skip to content

Commit 5f05966

Browse files
jeremy-hannamisteriauddatadog-githubops-containers[bot]levan-m
authored
[AGENTRUN-230] Add support for a fips_mode value that will add the -fips image tagSuffix (#1835)
Co-authored-by: misteriaud <[email protected]> Co-authored-by: datadog-githubops-containers[bot] <152526959+datadog-githubops-containers[bot]@users.noreply.github.com> Co-authored-by: levan-m <[email protected]>
1 parent c3b98a8 commit 5f05966

13 files changed

+189
-24
lines changed

charts/datadog/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Datadog changelog
22

3+
## 3.114.0
4+
5+
* Add a new parameter `useFIPSAgent` to use FIPS-compliant images for the Agent and DCA.
6+
37
## 3.113.0
48

59
* Add configuration option for `datadog.kubelet.useApiServer` to get the pod list from the API Server instead of the Kubelet. Disabled by default. This option requires Agent **7.65.0+**.

charts/datadog/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
apiVersion: v1
33
name: datadog
4-
version: 3.113.0
4+
version: 3.114.0
55
appVersion: "7"
66
description: Datadog Agent
77
keywords:

charts/datadog/README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Datadog
22

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

55
[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/).
66

7-
Datadog [offers two variants](https://hub.docker.com/r/datadog/agent/tags/), switch to a `-jmx` tag if you need to run JMX/java integrations. The chart also supports running [the standalone dogstatsd image](https://hub.docker.com/r/datadog/dogstatsd/tags/).
7+
Datadog [offers three build variants](https://hub.docker.com/r/datadog/agent/tags/), switch to a `-jmx` tag if you need to run JMX/java integrations or set the `useFIPSAgent: true` value to use the `-fips` tags if you require FIPS compliant cryptography modules. The chart also supports running [the standalone dogstatsd image](https://hub.docker.com/r/datadog/dogstatsd/tags/).
88

99
See the [Datadog JMX integration](https://docs.datadoghq.com/integrations/java/) to learn more.
1010

@@ -907,17 +907,17 @@ helm install <RELEASE_NAME> \
907907
| existingClusterAgent.serviceName | string | `nil` | Existing service name to use for reaching the external Cluster Agent |
908908
| existingClusterAgent.tokenSecretName | string | `nil` | Existing secret name to use for external Cluster Agent token |
909909
| fips.customFipsConfig | object | `{}` | Configure a custom configMap to provide the FIPS configuration. Specify custom contents for the FIPS proxy sidecar container config (/etc/datadog-fips-proxy/datadog-fips-proxy.cfg). If empty, the default FIPS proxy sidecar container config is used. |
910-
| fips.enabled | bool | `false` | Enable fips sidecar |
910+
| fips.enabled | bool | `false` | Enable fips proxy sidecar. The fips-proxy method is getting phased out in favor of FIPS-compliant images (refer to the `useFIPSAgent` setting). |
911911
| fips.image.digest | string | `""` | Define the FIPS sidecar image digest to use, takes precedence over `fips.image.tag` if specified. |
912912
| fips.image.name | string | `"fips-proxy"` | |
913913
| fips.image.pullPolicy | string | `"IfNotPresent"` | Datadog the FIPS sidecar image pull policy |
914914
| fips.image.repository | string | `nil` | Override default registry + image.name for the FIPS sidecar container. |
915915
| fips.image.tag | string | `"1.1.10"` | Define the FIPS sidecar container version to use. |
916-
| fips.local_address | string | `"127.0.0.1"` | Set local IP address |
917-
| fips.port | int | `9803` | Specifies which port is used by the containers to communicate to the FIPS sidecar. |
918-
| fips.portRange | int | `15` | Specifies the number of ports used, defaults to 13 https://github.com/DataDog/datadog-agent/blob/7.44.x/pkg/config/config.go#L1564-L1577 |
919-
| fips.resources | object | `{}` | Resource requests and limits for the FIPS sidecar container. |
920-
| fips.use_https | bool | `false` | Option to enable https |
916+
| fips.local_address | string | `"127.0.0.1"` | Set local IP address. This setting is only used for the fips-proxy sidecar. |
917+
| fips.port | int | `9803` | Specifies which port is used by the containers to communicate to the FIPS sidecar. This setting is only used for the fips-proxy sidecar. |
918+
| fips.portRange | int | `15` | Specifies the number of ports used, defaults to 13 https://github.com/DataDog/datadog-agent/blob/7.44.x/pkg/config/config.go#L1564-L1577. This setting is only used for the fips-proxy sidecar. |
919+
| fips.resources | object | `{}` | Resource requests and limits for the FIPS sidecar container. This setting is only used for the fips-proxy sidecar. |
920+
| fips.use_https | bool | `false` | Option to enable https. This setting is only used for the fips-proxy sidecar. |
921921
| fullnameOverride | string | `nil` | Override the full qualified app name |
922922
| kube-state-metrics.image.repository | string | `"registry.k8s.io/kube-state-metrics/kube-state-metrics"` | Default kube-state-metrics image repository. |
923923
| kube-state-metrics.nodeSelector | object | `{"kubernetes.io/os":"linux"}` | Node selector for KSM. KSM only supports Linux. |
@@ -935,6 +935,7 @@ helm install <RELEASE_NAME> \
935935
| registry | string | `nil` | Registry to use for all Agent images (default to [gcr.io | eu.gcr.io | asia.gcr.io | datadoghq.azurecr.io | public.ecr.aws/datadog] depending on datadog.site value) |
936936
| remoteConfiguration.enabled | bool | `true` | Set to true to enable remote configuration on the Cluster Agent (if set) and the node agent. Can be overridden if `datadog.remoteConfiguration.enabled` Preferred way to enable Remote Configuration. |
937937
| targetSystem | string | `"linux"` | Target OS for this deployment (possible values: linux, windows) |
938+
| useFIPSAgent | bool | `false` | Setting useFIPSAgent to true makes the helm chart use Agent images that are FIPS-compliant for use in GOVCLOUD environments. Setting this to true disables the fips-proxy sidecar and is the recommended method for enabling FIPS compliance. |
938939

939940
## Configuration options for Windows deployments
940941
<a name="windows-config"></a>

charts/datadog/README.md.gotmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[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/).
66

7-
Datadog [offers two variants](https://hub.docker.com/r/datadog/agent/tags/), switch to a `-jmx` tag if you need to run JMX/java integrations. The chart also supports running [the standalone dogstatsd image](https://hub.docker.com/r/datadog/dogstatsd/tags/).
7+
Datadog [offers three build variants](https://hub.docker.com/r/datadog/agent/tags/), switch to a `-jmx` tag if you need to run JMX/java integrations or set the `useFIPSAgent: true` value to use the `-fips` tags if you require FIPS compliant cryptography modules. The chart also supports running [the standalone dogstatsd image](https://hub.docker.com/r/datadog/dogstatsd/tags/).
88

99
See the [Datadog JMX integration](https://docs.datadoghq.com/integrations/java/) to learn more.
1010

charts/datadog/templates/NOTES.txt

+13
Original file line numberDiff line numberDiff line change
@@ -658,3 +658,16 @@ OTel collector is not supported on GKE Autopilot.
658658
#################################################################
659659
OTel collector is in preview. Please reach out to your Datadog representative for more information.
660660
{{- end }}
661+
662+
663+
{{- if (eq (include "should-enable-fips-proxy" .) "true") }}
664+
#################################################################
665+
#### WARNING: Deprecation notice ####
666+
#################################################################
667+
The FIPS Proxy is getting phased out in favor of FIPS-compliant images.
668+
For new deployments, we recommend using the FIPS Agent.
669+
You can enable it by setting `useFIPSAgent` to true in your datadog-agent.yaml file.
670+
671+
To learn more about it please refer to the following documentation:
672+
https://docs.datadoghq.com/agent/guide/fips-agent/
673+
{{- end }}

charts/datadog/templates/_container-fips-proxy.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{{- end -}}
2424

2525
{{- define "fips-envvar" -}}
26-
{{- if eq (include "should-enable-fips" .) "true" }}
26+
{{- if eq (include "should-enable-fips-proxy" .) "true" }}
2727
- name: DD_FIPS_ENABLED
2828
value: {{ .Values.fips.enabled | quote }}
2929
- name: DD_FIPS_PORT_RANGE_START

charts/datadog/templates/_daemonset-volumes-linux.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
path: /etc/system-release
4242
name: etc-system-release
4343
{{- end -}}
44-
{{- if eq (include "should-enable-fips" . ) "true" }}
44+
{{- if eq (include "should-enable-fips-proxy" . ) "true" }}
4545
{{ include "linux-container-fips-proxy-cfg-volume" . }}
4646
{{- end }}
4747
{{- if eq (include "should-mount-hostPath-for-dsd-socket" .) "true" }}

charts/datadog/templates/_helpers.tpl

+18-4
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,11 @@ Return a remote image path based on `.Values` (passed as root) and `.` (any `.im
359359
{{- end -}}
360360
{{- else -}}
361361
{{- $tagSuffix := "" -}}
362+
{{- if (eq (include "use-fips-images" .root) "true") -}}
363+
{{- $tagSuffix = printf "-%s" "fips" -}}
364+
{{- end -}}
362365
{{- if .image.tagSuffix -}}
363-
{{- $tagSuffix = printf "-%s" .image.tagSuffix -}}
366+
{{- $tagSuffix = printf "%s-%s" $tagSuffix .image.tagSuffix -}}
364367
{{- end -}}
365368
{{- if .image.repository -}}
366369
{{- .image.repository -}}:{{ .image.tag }}{{ $tagSuffix }}
@@ -408,11 +411,22 @@ false
408411
{{- end -}}
409412
{{- end -}}
410413

414+
{{/*
415+
Return true if we should use the -fips image tags.
416+
*/}}
417+
{{- define "use-fips-images" -}}
418+
{{- if .useFIPSAgent -}}
419+
true
420+
{{- else -}}
421+
false
422+
{{- end -}}
423+
{{- end -}}
424+
411425
{{/*
412426
Return true if the fips side car container should be created.
413427
*/}}
414-
{{- define "should-enable-fips" -}}
415-
{{- if and (not (or .Values.providers.gke.autopilot .Values.providers.gke.gdc )) (eq .Values.targetSystem "linux") .Values.fips.enabled -}}
428+
{{- define "should-enable-fips-proxy" -}}
429+
{{- if and (not (or (eq (include "use-fips-images" .Values) "true") (or .Values.providers.gke.autopilot .Values.providers.gke.gdc ))) (eq .Values.targetSystem "linux") .Values.fips.enabled -}}
416430
true
417431
{{- else -}}
418432
false
@@ -423,7 +437,7 @@ false
423437
Return true if the fips side car configMap should be mounted.
424438
*/}}
425439
{{- define "should-mount-fips-configmap" -}}
426-
{{- if and (eq (include "should-enable-fips" .) "true") (not (empty .Values.fips.customFipsConfig)) -}}
440+
{{- if and (eq (include "should-enable-fips-proxy" .) "true") (not (empty .Values.fips.customFipsConfig)) -}}
427441
true
428442
{{- else -}}
429443
false

charts/datadog/templates/agent-clusterchecks-deployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ spec:
118118
{{ toYaml .Values.agents.containers.initContainers.resources | indent 10 }}
119119
{{- end }}
120120
containers:
121-
{{- if eq (include "should-enable-fips" .) "true" }}
121+
{{- if eq (include "should-enable-fips-proxy" .) "true" }}
122122
{{- include "fips-proxy" . | nindent 6 }}
123123
{{- end }}
124124
- name: agent

charts/datadog/templates/cluster-agent-deployment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ spec:
119119
- name: config
120120
mountPath: /opt/datadog-agent
121121
containers:
122-
{{- if eq (include "should-enable-fips" .) "true" }}
122+
{{- if eq (include "should-enable-fips-proxy" .) "true" }}
123123
{{- include "fips-proxy" . | nindent 6 }}
124124
{{- end }}
125125
- name: cluster-agent

charts/datadog/templates/daemonset.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ spec:
125125
{{- if eq (include "should-enable-trace-agent" .) "true" }}
126126
{{- include "container-trace-agent" . | nindent 6 }}
127127
{{- end }}
128-
{{- if eq (include "should-enable-fips" .) "true" }}
128+
{{- if eq (include "should-enable-fips-proxy" .) "true" }}
129129
{{- include "fips-proxy" . | nindent 6 }}
130130
{{- end }}
131131
{{- if eq (include "should-enable-process-agent" .) "true" }}

charts/datadog/values.yaml

+15-5
Original file line numberDiff line numberDiff line change
@@ -1578,24 +1578,33 @@ existingClusterAgent:
15781578
# existingClusterAgent.clusterchecksEnabled -- set this to false if you don’t want the agents to run the cluster checks of the joined external cluster agent
15791579
clusterchecksEnabled: true
15801580

1581-
# fips is used to enable the fips sidecar container for GOVCLOUD environments.
1581+
# useFIPSAgent -- Setting useFIPSAgent to true makes the helm chart use Agent images that are FIPS-compliant for use in GOVCLOUD environments.
1582+
# Setting this to true disables the fips-proxy sidecar and is the recommended method for enabling FIPS compliance.
1583+
useFIPSAgent: false
1584+
1585+
## fips is used to enable and configure the fips-proxy sidecar.
15821586
fips:
1583-
# fips.enabled -- Enable fips sidecar
1587+
# fips.enabled -- Enable fips proxy sidecar.
1588+
# The fips-proxy method is getting phased out in favor of FIPS-compliant images (refer to the `useFIPSAgent` setting).
15841589
enabled: false
15851590

15861591
# TODO: Option to override config of the FIPS side car: /etc/datadog-fips-proxy/datadog-fips-proxy.cfg
15871592
# customConfig: false
15881593

15891594
# fips.port -- Specifies which port is used by the containers to communicate to the FIPS sidecar.
1595+
# This setting is only used for the fips-proxy sidecar.
15901596
port: 9803
15911597

1592-
# fips.portRange -- Specifies the number of ports used, defaults to 13 https://github.com/DataDog/datadog-agent/blob/7.44.x/pkg/config/config.go#L1564-L1577
1598+
# fips.portRange -- Specifies the number of ports used, defaults to 13 https://github.com/DataDog/datadog-agent/blob/7.44.x/pkg/config/config.go#L1564-L1577.
1599+
# This setting is only used for the fips-proxy sidecar.
15931600
portRange: 15
15941601

1595-
# fips.use_https -- Option to enable https
1602+
# fips.use_https -- Option to enable https.
1603+
# This setting is only used for the fips-proxy sidecar.
15961604
use_https: false
15971605

15981606
# fips.resources -- Resource requests and limits for the FIPS sidecar container.
1607+
# This setting is only used for the fips-proxy sidecar.
15991608
resources: {}
16001609
# limits:
16011610
# cpu: 100m
@@ -1604,7 +1613,8 @@ fips:
16041613
# cpu: 20m
16051614
# memory: 64Mi
16061615

1607-
# fips.local_address -- Set local IP address
1616+
# fips.local_address -- Set local IP address.
1617+
# This setting is only used for the fips-proxy sidecar.
16081618
local_address: "127.0.0.1"
16091619

16101620
## Define the Datadog image to work with

test/datadog/fips_mode_test.go

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
package datadog
2+
3+
import (
4+
"fmt"
5+
"strings"
6+
"testing"
7+
8+
"strconv"
9+
10+
"github.com/DataDog/helm-charts/test/common"
11+
"github.com/stretchr/testify/require"
12+
appsv1 "k8s.io/api/apps/v1"
13+
corev1 "k8s.io/api/core/v1"
14+
)
15+
16+
func TestFIPSModeConditions(t *testing.T) {
17+
tests := []struct {
18+
name string
19+
enableFIPSProxy bool
20+
enableFIPSAgent bool
21+
expectFIPSProxy bool
22+
expectFIPSAgent bool
23+
enableJMX bool
24+
}{
25+
{
26+
name: "neither fips proxy nor fips agent",
27+
enableFIPSProxy: false,
28+
enableFIPSAgent: false,
29+
expectFIPSProxy: false,
30+
expectFIPSAgent: false,
31+
},
32+
{
33+
name: "fips proxy only",
34+
enableFIPSProxy: true,
35+
enableFIPSAgent: false,
36+
expectFIPSProxy: true,
37+
expectFIPSAgent: false,
38+
},
39+
{
40+
name: "fips image only",
41+
enableFIPSProxy: false,
42+
enableFIPSAgent: true,
43+
expectFIPSProxy: false,
44+
expectFIPSAgent: true,
45+
},
46+
{
47+
name: "fips proxy and fips image",
48+
enableFIPSProxy: true,
49+
enableFIPSAgent: true,
50+
expectFIPSProxy: false, // fips proxy should be disabled when fips agent is enabled
51+
expectFIPSAgent: true,
52+
},
53+
{
54+
name: "fips image with JMX enabled",
55+
enableFIPSProxy: false,
56+
enableFIPSAgent: true,
57+
expectFIPSProxy: false,
58+
expectFIPSAgent: true,
59+
enableJMX: true,
60+
},
61+
}
62+
63+
for _, tt := range tests {
64+
t.Run(tt.name, func(t *testing.T) {
65+
values := map[string]string{
66+
"useFIPSAgent": strconv.FormatBool(tt.enableFIPSAgent),
67+
"fips.enabled": strconv.FormatBool(tt.enableFIPSProxy),
68+
"datadog.apiKeyExistingSecret": "datadog-secret",
69+
"datadog.appKeyExistingSecret": "datadog-secret",
70+
}
71+
72+
if tt.enableJMX {
73+
values["agents.image.tagSuffix"] = "jmx"
74+
}
75+
76+
manifest, err := common.RenderChart(t, common.HelmCommand{
77+
ReleaseName: "datadog",
78+
ChartPath: "../../charts/datadog",
79+
ShowOnly: []string{"templates/daemonset.yaml"},
80+
Values: []string{"../../charts/datadog/values.yaml"},
81+
Overrides: values,
82+
})
83+
require.NoError(t, err, "couldn't render template")
84+
85+
// Parse the manifest to find the should-enable-fips-proxy value and check image tags
86+
var daemonSet appsv1.DaemonSet
87+
common.Unmarshal(t, manifest, &daemonSet)
88+
89+
// Checking that daemonSet contains or not fips-proxy container based on the fips proxy configuration
90+
checkFIPSProxy(t, daemonSet.Spec.Template.Spec.Containers, tt.expectFIPSProxy)
91+
92+
// Checking that all containers have the fips image suffix if fips agent is enabled
93+
checkFIPSImage(t, daemonSet.Spec.Template.Spec.Containers, tt.expectFIPSAgent)
94+
})
95+
}
96+
}
97+
98+
func checkFIPSProxy(t *testing.T, containers []corev1.Container, expectFIPSProxy bool) {
99+
hasFIPSProxy := false
100+
for _, container := range containers {
101+
if strings.Contains(container.Image, "fips-proxy") {
102+
hasFIPSProxy = true
103+
break
104+
}
105+
}
106+
if expectFIPSProxy {
107+
require.True(t, hasFIPSProxy, "fips proxy container should be present")
108+
} else {
109+
require.False(t, hasFIPSProxy, "fips proxy container should not be present")
110+
}
111+
}
112+
113+
func checkFIPSImage(t *testing.T, containers []corev1.Container, expectFIPSImage bool) {
114+
if expectFIPSImage {
115+
for _, container := range containers {
116+
require.Contains(t, container.Image, "-fips", fmt.Sprintf("fips container %s should have the fips image suffix: %s", container.Name, container.Image))
117+
}
118+
} else {
119+
for _, container := range containers {
120+
require.NotContains(t, container.Image, "-fips", fmt.Sprintf("fips container %s should not have the fips image suffix: %s", container.Name, container.Image))
121+
}
122+
}
123+
}

0 commit comments

Comments
 (0)