[orchestrator] Grant networkpolicies to the orchestrator-explorer ClusterRole - #3382
Merged
Conversation
The orchestrator explorer's `other` collector lists `networkpolicies`, but the operator-generated ClusterRole for the cluster-checks runner only grants `ingresses` under `networking.k8s.io`. When the check runs on the CCR the missing permission fails silently; when it runs on the cluster-agent leader (the default customer setup) it surfaces as a visible RBAC-denied error: Failed to watch networkpolicies.networking.k8s.io: forbidden ... cannot watch resource "networkpolicies" ... at the cluster scope The public Datadog Helm chart already grants this exact permission to the cluster-agent for orchestrator-explorer: https://github.com/DataDog/helm-charts/blob/main/charts/datadog/templates/cluster-agent-rbac.yaml#L239-L243 Add `networkpolicies` alongside `ingresses` in the networking.k8s.io rule so operator-managed setups match the Helm chart and can collect NetworkPolicy manifests through the orchestrator check regardless of where it runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
aminechamlidd
approved these changes
Aug 21, 2026
|
🎯 Code Coverage (details) 🔗 Commit SHA: c33b36c | Docs | View more details | Give us feedback! |
`make golden-update` — picks up `networkpolicies` on the operator-generated orchestrator-explorer ClusterRole across all 10 render scenarios. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tbavelier
approved these changes
Aug 21, 2026
gh-worker-dd-mergequeue-cf854d Bot
pushed a commit
that referenced
this pull request
Aug 21, 2026
…sterRole (#3382) (#3383) [orchestrator] Grant networkpolicies to the orchestrator-explorer ClusterRole (#3382) * [orchestrator] Grant networkpolicies to the CCR ClusterRole The orchestrator explorer's `other` collector lists `networkpolicies`, but the operator-generated ClusterRole for the cluster-checks runner only grants `ingresses` under `networking.k8s.io`. When the check runs on the CCR the missing permission fails silently; when it runs on the cluster-agent leader (the default customer setup) it surfaces as a visible RBAC-denied error: Failed to watch networkpolicies.networking.k8s.io: forbidden ... cannot watch resource "networkpolicies" ... at the cluster scope The public Datadog Helm chart already grants this exact permission to the cluster-agent for orchestrator-explorer: https://github.com/DataDog/helm-charts/blob/main/charts/datadog/templates/cluster-agent-rbac.yaml#L239-L243 Add `networkpolicies` alongside `ingresses` in the networking.k8s.io rule so operator-managed setups match the Helm chart and can collect NetworkPolicy manifests through the orchestrator check regardless of where it runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * Regenerate golden renderer fixtures after adding networkpolicies `make golden-update` — picks up `networkpolicies` on the operator-generated orchestrator-explorer ClusterRole across all 10 render scenarios. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> (cherry picked from commit 007a456) Co-authored-by: kangyili <kangyi.li@datadoghq.com> Co-authored-by: timothee.bavelier <timothee.bavelier@datadoghq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
networkpoliciesto thenetworking.k8s.iorule in the orchestrator-explorer feature's ClusterRole (used by the cluster-checks runner / cluster-agent when it runs the orchestrator check).Why — this is a bug
The orchestrator check already lists
networkpoliciesas a collected resource, but the operator-generated ClusterRole only grantsingressesundernetworking.k8s.io.The public Datadog Helm chart already grants this exact permission to the cluster-agent for orchestrator-explorer, confirming this is a gap on the operator side:
https://github.com/DataDog/helm-charts/blob/main/charts/datadog/templates/cluster-agent-rbac.yaml#L239-L243
Change
One line in
internal/controller/datadogagent/feature/orchestratorexplorer/rbac.go:Test plan
go build ./...— passesgo test ./internal/controller/datadogagent/feature/orchestratorexplorer/...— passesgo test ./internal/controller/datadogagent/...— passes (all features + controller + override + store + global + merger + object)*-orch-exp-ccrClusterRole includesnetworkpoliciesand that the orchestrator check (DCA or CCR) no longer logs the RBAC-denied error.🤖 Generated with Claude Code