Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency DataDog/datadog-agent to v7.61.0 #134

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ RUN apk add --no-cache \
py3-yaml \
python3-dev

ARG DATADOG_VERSION=7.60.1
ARG DATADOG_VERSION=7.61.0
# datadog-agent has both branch and tag of the version. refs/tags/version must be checked-out.
RUN git clone --depth=1 https://github.com/DataDog/datadog-agent.git /build/datadog-agent \
&& cd /build/datadog-agent \
Expand Down Expand Up @@ -146,7 +146,11 @@ RUN strip -s /build/datadog-agent/dev/lib/*.so

COPY --from=systemd-builder /work/systemd/src/systemd/ /usr/include/systemd/

COPY disable-gpu-module.patch /
RUN patch -p1 < /disable-gpu-module.patch

RUN invoke agent.build \
--no-glibc \
--exclude-rtloader \
--build-exclude=jmx,kubeapiserver,gce,ec2,orchestrator

Expand Down Expand Up @@ -307,7 +311,7 @@ ARG INTEGRATIONS_CORE="\
system_core \
system_swap"

ARG DATADOG_INTEGRATIONS_CORE_VERSION=7.60.1
ARG DATADOG_INTEGRATIONS_CORE_VERSION=7.61.0
RUN apk add --virtual .build-deps \
g++ \
gcc \
Expand Down Expand Up @@ -362,7 +366,7 @@ EXPOSE 8125/udp 8126/tcp
HEALTHCHECK --interval=30s --timeout=5s --retries=2 \
CMD ["/probe.sh"]

ARG DATADOG_VERSION=7.60.1
ARG DATADOG_VERSION=7.61.0
ENV DATADOG_INTEGRATIONS_CORE_VERSION=${DATADOG_INTEGRATIONS_CORE_VERSION} \
DATADOG_VERSION=${DATADOG_VERSION}

Expand Down
223 changes: 223 additions & 0 deletions disable-gpu-module.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
diff --git a/cmd/system-probe/modules/all_linux_arm64.go b/cmd/system-probe/modules/all_glibc_linux.go
similarity index 93%
rename from cmd/system-probe/modules/all_linux_arm64.go
rename to cmd/system-probe/modules/all_glibc_linux.go
index e5a81541e5..9a4545e769 100644
--- a/cmd/system-probe/modules/all_linux_arm64.go
+++ b/cmd/system-probe/modules/all_glibc_linux.go
@@ -1,9 +1,9 @@
// Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
-// Copyright 2024-present Datadog, Inc.
+// Copyright 2016-present Datadog, Inc.

-//go:build linux && arm64
+//go:build linux && glibc

// Package modules is all the module definitions for system-probe
package modules
diff --git a/cmd/system-probe/modules/all_linux.go b/cmd/system-probe/modules/all_linux.go
index 79b6f3d74a..24fb877689 100644
--- a/cmd/system-probe/modules/all_linux.go
+++ b/cmd/system-probe/modules/all_linux.go
@@ -3,7 +3,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

-//go:build linux && !arm64
+//go:build linux && !glibc

// Package modules is all the module definitions for system-probe
package modules
@@ -30,7 +30,6 @@ var All = []module.Factory{
Pinger,
Traceroute,
DiscoveryModule,
- GPUMonitoring, // GPU monitoring needs to be initialized afer EventMonitor, so that we have the event consumer ready
}

func inactivityEventLog(_ time.Duration) {
diff --git a/cmd/system-probe/modules/gpu.go b/cmd/system-probe/modules/gpu.go
index 7ec273e7c2..47b4f3991f 100644
--- a/cmd/system-probe/modules/gpu.go
+++ b/cmd/system-probe/modules/gpu.go
@@ -3,7 +3,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2024-present Datadog, Inc.

-//go:build linux
+//go:build linux && glibc

package modules

diff --git a/pkg/collector/corechecks/gpu/gpu.go b/pkg/collector/corechecks/gpu/gpu.go
index 1083db30ad..c62e07cead 100644
--- a/pkg/collector/corechecks/gpu/gpu.go
+++ b/pkg/collector/corechecks/gpu/gpu.go
@@ -3,7 +3,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2024-present Datadog, Inc.

-//go:build linux
+//go:build linux && glibc

package gpu

diff --git a/pkg/collector/corechecks/gpu/gpu_stub.go b/pkg/collector/corechecks/gpu/gpu_stub.go
index 5aefc60217..577a4ed494 100644
--- a/pkg/collector/corechecks/gpu/gpu_stub.go
+++ b/pkg/collector/corechecks/gpu/gpu_stub.go
@@ -3,7 +3,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2024-present Datadog, Inc.

-//go:build !linux
+//go:build !linux || !glibc

package gpu

diff --git a/releasenotes/notes/add-option-to-disable-gpu-module-3301f07d73244d06.yaml b/releasenotes/notes/add-option-to-disable-gpu-module-3301f07d73244d06.yaml
new file mode 100644
index 0000000000..2a873b9f03
--- /dev/null
+++ b/releasenotes/notes/add-option-to-disable-gpu-module-3301f07d73244d06.yaml
@@ -0,0 +1,7 @@
+---
+enhancements:
+ - |
+ Add a build option (`--glibc`, enabled by default) to build the Agent on `glibc` environment.
+ On the other libc environments like `musl`, the Agent should be built with `--no-glibc` option.
+ The option enables system-probe gpu module and corechecks gpu collector using
+ `github.com/NVIDIA/go-nvml` which depends on a glibc-extended definition.
diff --git a/tasks/agent.py b/tasks/agent.py
index b0220fcb60..ae6b80def5 100644
--- a/tasks/agent.py
+++ b/tasks/agent.py
@@ -140,6 +140,7 @@ def build(
bundle_ebpf=False,
agent_bin=None,
run_on=None, # noqa: U100, F841. Used by the run_on_devcontainer decorator
+ glibc=True,
):
"""
Build the agent. If the bits to include in the build are not specified,
@@ -213,6 +214,9 @@ def build(
all_tags |= set(build_tags)
build_tags = list(all_tags)

+ if not glibc:
+ build_tags = list(set(build_tags).difference({"glibc"}))
+
cmd = "go build -mod={go_mod} {race_opt} {build_type} -tags \"{go_build_tags}\" "

if not agent_bin:
diff --git a/tasks/build_tags.py b/tasks/build_tags.py
index 81b0564285..190d83ff62 100644
--- a/tasks/build_tags.py
+++ b/tasks/build_tags.py
@@ -28,7 +28,7 @@ ALL_TAGS = {
"ec2",
"etcd",
"fargateprocess",
- "gce",
+ "glibc", # Build the modules depending on the glibc extension.
"jmx",
"jetson",
"kubeapiserver",
@@ -68,7 +68,7 @@ AGENT_TAGS = {
"docker",
"ec2",
"etcd",
- "gce",
+ "glibc",
"jetson",
"jmx",
"kubeapiserver",
@@ -109,19 +109,19 @@ AGENT_HEROKU_TAGS = AGENT_TAGS.difference(
FIPS_AGENT_TAGS = AGENT_TAGS.union({"goexperiment.systemcrypto"})

# CLUSTER_AGENT_TAGS lists the tags needed when building the cluster-agent
-CLUSTER_AGENT_TAGS = {"clusterchecks", "datadog.no_waf", "kubeapiserver", "orchestrator", "zlib", "zstd", "ec2", "gce"}
+CLUSTER_AGENT_TAGS = {"clusterchecks", "datadog.no_waf", "glibc", "kubeapiserver", "orchestrator", "zlib", "zstd", "ec2", "gce"}

# CLUSTER_AGENT_CLOUDFOUNDRY_TAGS lists the tags needed when building the cloudfoundry cluster-agent
-CLUSTER_AGENT_CLOUDFOUNDRY_TAGS = {"clusterchecks"}
+CLUSTER_AGENT_CLOUDFOUNDRY_TAGS = {"clusterchecks", "glibc"}

# DOGSTATSD_TAGS lists the tags needed when building dogstatsd
-DOGSTATSD_TAGS = {"containerd", "docker", "kubelet", "podman", "zlib", "zstd"}
+DOGSTATSD_TAGS = {"containerd", "docker", "glibc", "kubelet", "podman", "zlib", "zstd"}

# IOT_AGENT_TAGS lists the tags needed when building the IoT agent
-IOT_AGENT_TAGS = {"jetson", "otlp", "systemd", "zlib", "zstd"}
+IOT_AGENT_TAGS = {"glibc", "jetson", "otlp", "systemd", "zlib", "zstd"}

# INSTALLER_TAGS lists the tags needed when building the installer
-INSTALLER_TAGS = {"docker", "ec2", "gce", "kubelet"}
+INSTALLER_TAGS = {"docker", "ec2", "gce", "glibc", "kubelet"}

# PROCESS_AGENT_TAGS lists the tags necessary to build the process-agent
PROCESS_AGENT_TAGS = AGENT_TAGS.union({"fargateprocess"}).difference({"otlp", "python", "trivy"})
@@ -149,6 +149,7 @@ SECURITY_AGENT_TAGS = {
"datadog.no_waf",
"docker",
"containerd",
+ "glibc",
"kubeapiserver",
"kubelet",
"podman",
@@ -158,13 +159,13 @@ SECURITY_AGENT_TAGS = {
}

# SERVERLESS_TAGS lists the tags necessary to build serverless
-SERVERLESS_TAGS = {"serverless", "otlp"}
+SERVERLESS_TAGS = {"glibc", "serverless", "otlp"}

# SYSTEM_PROBE_TAGS lists the tags necessary to build system-probe
SYSTEM_PROBE_TAGS = AGENT_TAGS.union({"linux_bpf", "npm", "pcap", "remotewmonly"}).difference({"python", "systemd"})

# TRACE_AGENT_TAGS lists the tags that have to be added when the trace-agent
-TRACE_AGENT_TAGS = {"docker", "containerd", "datadog.no_waf", "kubeapiserver", "kubelet", "otlp", "netcgo", "podman"}
+TRACE_AGENT_TAGS = {"docker", "containerd", "datadog.no_waf", "glibc", "kubeapiserver", "kubelet", "otlp", "netcgo", "podman"}

# TRACE_AGENT_HEROKU_TAGS lists the tags necessary to build the trace-agent for Heroku
TRACE_AGENT_HEROKU_TAGS = TRACE_AGENT_TAGS.difference(
diff --git a/tasks/system_probe.py b/tasks/system_probe.py
index 5ddffee149..bbc237bcf4 100644
--- a/tasks/system_probe.py
+++ b/tasks/system_probe.py
@@ -684,6 +684,7 @@ def build(
with_unit_test=False,
ebpf_compiler='clang',
static=False,
+ glibc=True,
):
"""
Build the system-probe
@@ -710,6 +711,7 @@ def build(
strip_binary=strip_binary,
arch=arch,
static=static,
+ glibc=glibc,
)


@@ -737,6 +739,7 @@ def build_sysprobe_binary(
strip_binary=False,
fips_mode=False,
static=False,
+ glibc=True,
) -> None:
arch_obj = Arch.from_str(arch)

@@ -759,6 +762,9 @@ def build_sysprobe_binary(
build_tags.extend(["osusergo", "netgo"])
build_tags = list(set(build_tags).difference({"netcgo"}))

+ if not glibc:
+ build_tags = list(set(build_tags).difference({"glibc"}))
+
if not is_windows and "pcap" in build_tags:
build_libpcap(ctx)
cgo_flags = get_libpcap_cgo_flags(ctx, install_path)
Loading