feat(KONFLUX-14449): Add serviceaccount-loadtest SA with RBAC to tenant namespaces#12656
feat(KONFLUX-14449): Add serviceaccount-loadtest SA with RBAC to tenant namespaces#12656jhutar wants to merge 1 commit into
Conversation
Define serviceaccount-loadtest in konflux-perfscale-{1,2,3,4}-tenant
namespaces for dev and staging, replacing konflux-bot-0 as the subject
in the event-reader bindings. Each tenant gets:
- ServiceAccount with rhtap-perf-test-oci-storage-robot-pull-secret ref
- RoleBinding to konflux-admin-user-actions ClusterRole
- serviceaccounttoken-manager Role + RoleBinding for konflux-performance
group to generate tokens
- Dummy Opaque secret in development/ (real secret only exists in
staging/prod)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generated-by: Claude
Assisted-by: Claude Code
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhutar The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Kustomize Render DiffComparing
Total: 2 components, +428 -8 lines 📋 Full diff available in the workflow summary and as a downloadable artifact. |
PR Summary by QodoAdd loadtest ServiceAccount + token RBAC to perfscale tenant namespaces Description
Diagram
High-Level Assessment
Files changed (18)
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
4 rules 1. Overbroad token creation
|
| secrets: | ||
| - name: rhtap-perf-test-oci-storage-robot-pull-secret |
There was a problem hiding this comment.
1. Missing imagepullsecrets 🐞 Bug ≡ Correctness
serviceaccount-loadtest only references rhtap-perf-test-oci-storage-robot-pull-secret under .secrets, so workloads using this ServiceAccount will not use it for registry authentication and private image pulls can fail. In this repo, image-pull credentials are wired via .imagePullSecrets, not .secrets alone.
Agent Prompt
### Issue description
`serviceaccount-loadtest` references a `*-pull-secret` only in `spec.secrets`, which does not configure pods to use it for image pulls. Pods needing private registry auth must have the secret referenced via `imagePullSecrets`.
### Issue Context
Other ServiceAccounts in this repo set `imagePullSecrets` explicitly when a pull secret is required.
### Fix Focus Areas
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-1-tenant/serviceaccount-loadtest.yaml[1-9]
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-2-tenant/serviceaccount-loadtest.yaml[1-9]
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-3-tenant/serviceaccount-loadtest.yaml[1-9]
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-4-tenant/serviceaccount-loadtest.yaml[1-9]
### Implementation notes
Add:
```yaml
imagePullSecrets:
- name: rhtap-perf-test-oci-storage-robot-pull-secret
```
Optionally keep/remove `.secrets` depending on whether pods need it mounted; for image pulls, `imagePullSecrets` is the required field.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: serviceaccounttoken-manager | ||
| namespace: konflux-perfscale-1-tenant | ||
| rules: | ||
| - apiGroups: | ||
| - "" | ||
| resources: | ||
| - serviceaccounts/token | ||
| verbs: | ||
| - create |
There was a problem hiding this comment.
3. Overbroad token creation 🐞 Bug ⛨ Security
The new serviceaccounttoken-manager Role allows konflux-performance to create serviceaccounts/token for any ServiceAccount in the tenant namespace, enabling minting tokens for higher-privileged ServiceAccounts if present. This is broader than the repo’s pattern that restricts TokenRequests via resourceNames.
Agent Prompt
### Issue description
`konflux-performance` is granted `create` on `serviceaccounts/token` without `resourceNames`, which permits requesting tokens for *any* ServiceAccount in the namespace.
### Issue Context
In other parts of this repo, TokenRequest permissions are limited to specific ServiceAccounts using `resourceNames`.
### Fix Focus Areas
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-1-tenant/serviceaccount-loadtest.yaml[24-49]
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-2-tenant/serviceaccount-loadtest.yaml[24-49]
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-3-tenant/serviceaccount-loadtest.yaml[24-49]
- components/perf-team-prometheus-reader/base/tenants-rbac/konflux-perfscale-4-tenant/serviceaccount-loadtest.yaml[24-49]
### Implementation notes
Restrict the Role rule to only the intended SA(s), e.g.:
```yaml
rules:
- apiGroups: [""]
resources: ["serviceaccounts/token"]
verbs: ["create"]
resourceNames:
- serviceaccount-loadtest
```
If multiple SAs are intended, list them explicitly.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12656 +/- ##
=======================================
Coverage 53.32% 53.32%
=======================================
Files 20 20
Lines 1309 1309
=======================================
Hits 698 698
Misses 539 539
Partials 72 72
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Define
serviceaccount-loadtestinkonflux-perfscale-{1,2,3,4}-tenantnamespaces for dev and staging, replacingkonflux-bot-0as the subject in the event-reader bindings. Each tenant gets:rhtap-perf-test-oci-storage-robot-pull-secretrefkonflux-admin-user-actionsClusterRoleserviceaccounttoken-managerRole + RoleBinding forkonflux-performancegroup to generate tokensGenerated-by: Claude