Skip to content

Add RBAC for network topology CRD collection#2541

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
eliottness/ootb-crd-gateway-mesh-ingress
Jun 9, 2026
Merged

Add RBAC for network topology CRD collection#2541
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
mainfrom
eliottness/ootb-crd-gateway-mesh-ingress

Conversation

@eliottness

@eliottness eliottness commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds list/watch RBAC permissions for 14 new API groups to the cluster agent ClusterRole, enabling OOTB collection of network topology CRDs for Cloud Security internet-reachability analysis.

Gated behind datadog.orchestratorExplorer.networkCRDs.enabled (default: false, opt-in).

New API groups:

  • Gateway API: gateway.networking.k8s.io (resource-specific)
  • Service mesh: networking.istio.io (resource-specific), gateway.envoyproxy.io, traefik.containo.us, policy.linkerd.io, consul.hashicorp.com, mesh.consul.hashicorp.com, kuma.io
  • Ingress controllers: k8s.nginx.org, traefik.io (resource-specific), configuration.konghq.com, core.haproxy.org, ingress.v1.haproxy.org, ingress.v3.haproxy.org

Motivation

The Datadog Agent is adding OOTB collection of these CRDs for Cloud Security internet-reachability analysis. The cluster agent needs RBAC permissions to list/watch these resources.

RFC: https://datadoghq.atlassian.net/wiki/x/4IOyfAE

Describe how you validated your changes

  • RBAC rules follow the same pattern as existing karpenter/argoproj/fluxcd entries
  • Resource-specific entries for high-volume vendors (Istio, NGINX, Traefik, Gateway API)
  • Group-level ("*" resources) for less common vendors
  • Baseline test manifests regenerated

Additional Notes

This PR should be merged before the corresponding agent PR. Collection is opt-in — both the Helm value and the agent-side flags must be enabled.

Related PRs

Repo PR Purpose
DataDog/datadog-agent DataDog/datadog-agent#48966 Agent collection (merge AFTER)
DataDog/dd-go DataDog/dd-go#230589 Backend allowlist (deploy FIRST)
DataDog/datadog-operator DataDog/datadog-operator#2874 Operator RBAC

@github-actions github-actions Bot added the chart/datadog This issue or pull request is related to the datadog chart label Apr 7, 2026
@eliottness
eliottness force-pushed the eliottness/ootb-crd-gateway-mesh-ingress branch from e0273ea to 8ea94a3 Compare April 7, 2026 16:49
@eliottness
eliottness marked this pull request as ready for review April 7, 2026 19:35
@eliottness
eliottness requested a review from a team as a code owner April 7, 2026 19:35
gh-worker-dd-mergequeue-cf854d Bot pushed a commit to DataDog/datadog-agent that referenced this pull request Apr 9, 2026
…mesh, and ingress controllers (#48966)

### What does this PR do?

Adds 22 new builtin CRD entries to the orchestrator explorer so Cloud Security can determine internet-reachability paths for k8s workloads. Uses a hybrid collection strategy: resource-specific entries for high-volume vendors (Istio, NGINX, Traefik) and group-level entries for less common vendors.

Three new per-family config flags (all **opt-in, default: false**):
- `orchestrator_explorer.custom_resources.ootb.gateway_api`
- `orchestrator_explorer.custom_resources.ootb.service_mesh`
- `orchestrator_explorer.custom_resources.ootb.ingress_controllers`

**New families:**
- **Gateway API** (5 resource-specific): gateways, httproutes, grpcroutes, tlsroutes, listenersets
- **Service mesh — Istio** (5 resource-specific): virtualservices, gateways, destinationrules, serviceentries, sidecars (with v1beta1 fallback)
- **Service mesh — others** (6 group-level): Envoy Gateway, Traefik (legacy), Linkerd, Consul, Consul Mesh, Kuma
- **Ingress controllers — NGINX** (2 resource-specific): virtualservers, virtualserverroutes
- **Ingress controllers — Traefik** (1 resource-specific): ingressroutes
- **Ingress controllers — others** (3 group-level): Kong, HAProxy Core, HAProxy v1

### Motivation

Cloud Security needs to tell customers which container workloads are internet-reachable. Today, the agent collects standard Ingress and Service objects, covering ~16% of EKS customers. Over 36% use service meshes or non-standard ingress controllers whose exposure paths go through CRDs we don't collect.

RFC: https://datadoghq.atlassian.net/wiki/x/4IOyfAE
Technical implementation: https://datadoghq.atlassian.net/wiki/x/EgO6fAE

### Describe how you validated your changes

- All existing tests pass: `TestNewBuiltinCRDConfigs`, `TestImportBuiltinCollectors`, `TestGetDatadogCustomResourceCollectors`, `TestFilterCRCollectorsByPermission`
- New test `TestNewBuiltinCRDConfigsPerFamilyFlags` verifies each per-family flag independently disables its family, and the global OOTB flag disables everything
- Package compiles cleanly with `go build -tags "kubeapiserver orchestrator"`

### Additional Notes

**All three flags default to `false` (opt-in).** Collection is only activated when RBAC is granted (via helm/operator) and the corresponding flag is set to `true`.

**Merge order:** The backend allowlist PR (dd-go) must be deployed before this PR merges, otherwise collected CRs will be silently dropped.

- [ ] Backend allowlist deployed: DataDog/dd-go#230589
- [ ] Helm chart RBAC merged: DataDog/helm-charts#2541
- [ ] Operator RBAC merged: DataDog/datadog-operator#2874

## Related PRs

| Repo | PR | Purpose |
|------|----|---------|
| DataDog/dd-go | DataDog/dd-go#230589 | Backend allowlist (deploy FIRST) |
| DataDog/helm-charts | DataDog/helm-charts#2541 | Helm chart RBAC |
| DataDog/datadog-operator | DataDog/datadog-operator#2874 | Operator RBAC |

Co-authored-by: eliott.bouhana <[email protected]>
@eliottness
eliottness marked this pull request as draft April 10, 2026 12:36
@eliottness
eliottness force-pushed the eliottness/ootb-crd-gateway-mesh-ingress branch from 56427cd to 06a8921 Compare May 26, 2026 08:01
@eliottness
eliottness marked this pull request as ready for review May 26, 2026 09:30
@eliottness
eliottness requested a review from a team as a code owner May 26, 2026 09:30
@eliottness
eliottness requested review from raymondeah and removed request for a team May 26, 2026 09:30
@eliottness eliottness changed the title [datadog] Add RBAC for network topology CRD collection Add RBAC for network topology CRD collection May 26, 2026

@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: 06a8921e66

ℹ️ 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 thread charts/datadog/templates/cluster-agent-rbac.yaml Outdated
…ler CRDs

Add list/watch RBAC rules for 15 new API groups needed by the orchestrator
explorer to collect network topology CRDs for internet-reachability analysis.
Gated behind datadog.orchestratorExplorer.networkCRDs.enabled (default: true).

API groups: gateway.networking.k8s.io, networking.istio.io, gateway.envoyproxy.io,
traefik.containo.us, traefik.io, policy.linkerd.io, consul.hashicorp.com,
mesh.consul.hashicorp.com, kuma.io, k8s.nginx.org, configuration.konghq.com,
core.haproxy.org, ingress.v1.haproxy.org, ingress.v3.haproxy.org
- Add missing get verb to group-level RBAC rules (Envoy Gateway, Linkerd,
  Consul, Kuma, Kong, HAProxy)
- Add DD_ORCHESTRATOR_EXPLORER_CUSTOM_RESOURCES_OOTB_* env vars to the
  cluster agent deployment, gated by networkCRDs.enabled
@eliottness
eliottness force-pushed the eliottness/ootb-crd-gateway-mesh-ingress branch from 06a8921 to b7d2f07 Compare June 9, 2026 11:48
Comment thread charts/datadog/README.md Outdated
Apply swang392's suggestion to add a period between the two sentences of
the networkCRDs.enabled description. Edit the values.yaml helm-docs source
comment and regenerate README so lint-docs stays green.

Confidence: high
Scope-risk: narrow
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Jun 9, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

Lint and Test Charts | install-chart (v1.29.8, v0.22.0)   View in Datadog   GitHub Actions

Lint and Test Charts | pr-validated   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 933b1ae | Docs | Datadog PR Page | Give us feedback!

@eliottness
eliottness removed the request for review from raymondeah June 9, 2026 15:09
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit b63a149 into main Jun 9, 2026
54 of 64 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the eliottness/ootb-crd-gateway-mesh-ingress branch June 9, 2026 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chart/datadog This issue or pull request is related to the datadog chart mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants