Skip to content

[Host Profiler][PROF-15459] Add annotation to deploy as dd-agent - #3430

Open
theomagellan wants to merge 3 commits into
mainfrom
theomagellan/host-profiler-nonroot
Open

theomagellan wants to merge 3 commits into
mainfrom
theomagellan/host-profiler-nonroot

Conversation

@theomagellan

@theomagellan theomagellan commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds agent.datadoghq.com/host-profiler-non-root-enabled annotation to allow operator users to easily enable the profiler run as non root (dd-agent UID/GID)

Supports DataDog/datadog-agent#54004

Motivation

Additional Notes

This should be enabled by default at a later point once most host profiler images include the necessary changes.

Minimum Agent Versions

Are there minimum versions of the Datadog Agent and/or Cluster Agent required?

  • Agent: vX.Y.Z
  • Cluster Agent: vX.Y.Z

Describe your test plan

Write there any instructions and details you may have to test your PR.

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies
  • PR has a milestone or the qa/skip-qa label
  • All commits are signed (see: signing commits)

@theomagellan
theomagellan force-pushed the theomagellan/host-profiler-nonroot branch 2 times, most recently from a96daa0 to 72093ce Compare September 3, 2026 16:23
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Sep 3, 2026

Copy link
Copy Markdown

Pipelines  Code Coverage

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 51.26% (+0.51%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: beae41c | Docs | View more details | Give us feedback!

@theomagellan
theomagellan force-pushed the theomagellan/host-profiler-nonroot branch from 755a9c8 to f30710a Compare September 3, 2026 16:58
@theomagellan theomagellan changed the title [PROF-15459] deploy host profiler as dd-agent by default [PROF-15459] Add annotation to deploy as dd-agent Sep 4, 2026
@theomagellan theomagellan changed the title [PROF-15459] Add annotation to deploy as dd-agent [Host Profiler][PROF-15459] Add annotation to deploy as dd-agent Sep 4, 2026
@theomagellan theomagellan added enhancement New feature or request qa/skip-qa labels Sep 4, 2026
@theomagellan
theomagellan marked this pull request as ready for review September 4, 2026 14:27
@theomagellan
theomagellan requested a review from a team September 4, 2026 14:27
@theomagellan
theomagellan requested a review from a team as a code owner September 4, 2026 14:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T14:29:29.446978Z f30710a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f30710a80d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +145 to +146
sc.RunAsUser = ptr.To(common.DDAgentID)
sc.RunAsGroup = ptr.To(common.DDAgentID)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Set runAsNonRoot with the non-root annotation

When agent.datadoghq.com/host-profiler-non-root-enabled is enabled, this sets the numeric UID/GID but leaves securityContext.runAsNonRoot unset, contrary to the behavior documented in docs/host_profiler.md. Clusters with admission policies that require an explicit runAsNonRoot: true declaration can therefore reject the generated pod despite this opt-in annotation; set sc.RunAsNonRoot alongside the UID and GID.

Useful? React with 👍 / 👎.

HostProfilerSELinuxTypeAnnotation = "agent.datadoghq.com/host-profiler-selinux-type"
EnableKSMApiServerCacheAnnotation = "agent.datadoghq.com/ksm-use-apiserver-cache"
HostProfilerSELinuxTypeAnnotation = "agent.datadoghq.com/host-profiler-selinux-type"
HostProfilerRunAsNonRootAnnotation = "agent.datadoghq.com/host-profiler-non-root-enabled"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: keep the same naming pattern as other bool annotations

Suggested change
HostProfilerRunAsNonRootAnnotation = "agent.datadoghq.com/host-profiler-non-root-enabled"
EnableHostProfilerNonRootAnnotation = "agent.datadoghq.com/host-profiler-non-root-enabled"


// This file tracks constants used in features, component default code

const DDAgentID int64 = 100

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add a short comment describing what is this constant

Suggested change
const DDAgentID int64 = 100
const DDAgentUserID int64 = 100

// of the DDA-level annotation.
imageOverrideAnnotationKey := fmt.Sprintf("%s/%s", experimental.ExperimentalAnnotationPrefix, experimental.ExperimentalImageOverrideConfigSubkey)
for _, annotationKey := range []string{featureutils.EnableHostProfilerAnnotation, featureutils.EnableHostProfilerSeccompAnnotation, featureutils.EnableHostProfilerLoggingSeccompAnnotation, featureutils.HostProfilerSELinuxTypeAnnotation, imageOverrideAnnotationKey} {
for _, annotationKey := range []string{featureutils.EnableHostProfilerAnnotation, featureutils.EnableHostProfilerSeccompAnnotation, featureutils.EnableHostProfilerLoggingSeccompAnnotation, featureutils.HostProfilerRunAsNonRootAnnotation, featureutils.HostProfilerSELinuxTypeAnnotation, imageOverrideAnnotationKey} {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add the new key to Test_setProfileDDAIMeta‎

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants