feat(orchestrator): grant KubeAI collection RBAC - #3439
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The RBAC addition is narrowly scoped (list/watch), consistently wired through constants, generation outputs, and unit/golden tests, with no behavioral risk beyond the intended permission change.
Pull request overview
This PR extends the Datadog Operator’s orchestrator-explorer RBAC to allow list/watch on KubeAI kubeai.org/models, so Cluster Agent roles rendered/generated by the operator can collect KubeAI model manifests without manual RBAC edits. It also updates the operator’s own generated RBAC role and all related golden fixtures/tests to reflect the new permission.
Changes:
- Add KubeAI API group/resource constants and include
kubeai.org/modelsin orchestrator-explorer Cluster Agent RBAC rules. - Grant the operator manager RBAC
list/watchonkubeai.org/modelsvia kubebuilder markers and regeneratedconfig/rbac/role.yaml. - Update orchestrator-explorer RBAC unit tests and renderer golden YAML outputs to include the new rule.
File summaries
| File | Description |
|---|---|
| pkg/kubernetes/rbac/const.go | Adds KubeAIAPIGroup and KubeAIModelsResource constants used by RBAC generation. |
| internal/controller/datadogagent/feature/orchestratorexplorer/rbac.go | Adds a policy rule for kubeai.org/models (defaulting to list/watch via existing verb-defaulting logic). |
| internal/controller/datadogagent/feature/orchestratorexplorer/rbac_test.go | Extends RBAC unit test expectations to include the new KubeAI rule. |
| internal/controller/datadogagent_controller.go | Adds kubebuilder RBAC marker granting operator list/watch on kubeai.org/models. |
| config/rbac/role.yaml | Regenerated operator role YAML including the new kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/suppression-baseline.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/suppression-autopilot.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/override-baseline.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/override-autopilot.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/minimal-baseline.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/minimal-autopilot.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/comprehensive-eks-hostname-from-file.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/comprehensive-baseline.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/comprehensive-autopilot.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
| internal/controller/testutils/renderer/testdata/golden/comprehensive-aks.golden.yaml | Updates golden RBAC output to include kubeai.org/models rule. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
What does this PR do?
Grants
listandwatchaccess tokubeai.org/modelsin Cluster Agent roles generated by the Datadog Operator and in the operator's own RBAC role.Motivation
Make KubeAI model manifests collectable by the Cluster Agent without manual RBAC changes. The operator itself needs the same access so it can create the generated Cluster Agent roles.
Additional Notes
Minimum Agent Versions
Describe your test plan
make generatemake golden-updatego test ./internal/controller/datadogagent/feature/orchestratorexplorer ./pkg/kubernetes/rbacChecklist
enhancementlabelv1.31.0