forked from llm-d/llm-d-workload-variant-autoscaler
-
Notifications
You must be signed in to change notification settings - Fork 4
fix(openshift): use controller-manager SA for metrics RBAC #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
zdtsw
merged 2 commits into
opendatahub-io:main
from
Gregory-Pereira:ocp-use-authorization-credentials-for-metrics-v2
Mar 29, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Grant GET /metrics permission to the controller-manager SA whose token is | ||
| # used by Prometheus (via authorization.credentials) to scrape the WVA | ||
| # metrics endpoint. The WVA metrics endpoint performs a SubjectAccessReview | ||
| # checking this permission. | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: workload-variant-autoscaler-ocp-prometheus-metrics-reader | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: metrics-reader | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: controller-manager | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Grant GET /metrics permission to the Prometheus SA so the | ||
| # SubjectAccessReview performed by the WVA metrics endpoint passes. | ||
| # This complements metrics_auth_role_binding.yaml (which grants | ||
| # tokenreview/SAR permissions to the controller-manager) and | ||
| # prometheus_metrics_auth_role_binding.yaml (which grants the | ||
| # Prometheus SA authentication permissions). | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: metrics-reader-rolebinding | ||
| labels: | ||
| app.kubernetes.io/name: workload-variant-autoscaler | ||
| app.kubernetes.io/managed-by: kustomize | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: metrics-reader | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: kube-prometheus-stack-prometheus | ||
| namespace: workload-variant-autoscaler-monitoring |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: opendatahub-io/workload-variant-autoscaler
Length of output: 262
Add
namespaceto ServiceAccount subject — binding targets wrong namespace (CWE-863: Improper Authorization).Lines 14–15 define a ServiceAccount subject without
namespace. Kubernetes defaults this to the "default" namespace, but the overlay (kustomization.yaml line 32) places thecontroller-managerServiceAccount inworkload-variant-autoscaler-system. This mismatch prevents the binding from authorizing the intended ServiceAccount, breaking metrics access.Fix
subjects: - kind: ServiceAccount name: controller-manager + namespace: workload-variant-autoscaler-system📝 Committable suggestion
🤖 Prompt for AI Agents