feat(observability): grant Target Allocator CRD watch RBAC - #327
Open
wenegiemepraise wants to merge 2 commits into
Open
feat(observability): grant Target Allocator CRD watch RBAC#327wenegiemepraise wants to merge 2 commits into
wenegiemepraise wants to merge 2 commits into
Conversation
Grant the Target Allocator get;list;watch on customresourcedefinitions (apiextensions.k8s.io), scoped under the existing prometheus-CR RBAC gate. The Target Allocator now watches the ServiceMonitor/PodMonitor CustomResourceDefinitions so it can start or stop each monitor informer as the CRD appears or disappears, letting it run healthily regardless of whether the CRDs are installed yet. That CRD watch requires this read-only, cluster-scoped grant; without it the informer is denied with Forbidden. Companion to the operator-side change "target-allocator: tolerate missing ServiceMonitor/PodMonitor CRDs".
Author
|
Thanks for the feedback, for the merge-time gating: rather than leave it to the merge, I added the customresourcedefinitions rule beside the SM/PM rule under the same $otelCIScrape gate on the scraping foundation branch (#329), so the single-switch path grants it and it can't be dropped. Verified it renders under otelContainerInsights.enabled=true and stays off by default. |
musa-asad
approved these changes
Jul 24, 2026
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.
Summary
Grant the Target Allocator (TA)
get;list;watchoncustomresourcedefinitions(
apiextensions.k8s.io), scoped under the existing prometheus-CR RBAC gateWhy
The operator-side change adds an informer over
CustomResourceDefinitionobjects.Without a grant on
customresourcedefinitions, that informer is denied at runtime:Failed to watch *v1.CustomResourceDefinition: customresourcedefinitions.apiextensions.k8s.io is forbidden:
User "system:serviceaccount:amazon-cloudwatch:cloudwatch-agent-target-allocator" cannot list resource "customresourcedefinitions"
The grant is read-only and cluster-scoped (CRDs are cluster-scoped), the minimum
required for the watch.
Scope / gating
Added inside the existing
prometheusCR.enabledgate, right beside the SM/PM(
monitoring.coreos.com) rule — so it renders only when the prometheus-CR scrapingpath is enabled, and is inert otherwise. No dependency on the CRD-bundling or flag
work; this slots into the RBAC gate already present on
main.Testing
helm templateon the TA ClusterRole:monitoring.coreos.com(podmonitors/servicemonitors) rule and the new
apiextensions.k8s.io(customresourcedefinitions) rule.
neither rule (
customresourcedefinitions: 0,podmonitors: 0) — correctly gated.