Skip to content

Commit eb275f1

Browse files
committed
fix(cozystack-api): grant the option apiserver read on plans and backups
The plan and backup option providers list namespaced plans and backups in the backups.cozystack.io group, but the cozystack-api ClusterRole only granted backupclasses there. The apiserver's privileged client runs as this ServiceAccount, so both providers got forbidden — List silently dropped the sources and Get returned 500, leaving the plan/backup dropdowns in the backup forms empty. Add plans and backups to the backups.cozystack.io rule and cover the grant with a chart test. Assisted-By: Claude <[email protected]> Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 46b759c commit eb275f1

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

‎packages/system/cozystack-api/templates/rbac.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ rules:
4444
resources: ["storageclasses"]
4545
verbs: ["get", "watch", "list"]
4646
- apiGroups: ["backups.cozystack.io"]
47-
resources: ["backupclasses"]
47+
resources: ["backupclasses", "plans", "backups"]
4848
verbs: ["get", "watch", "list"]
4949
- apiGroups: ["apps.cozystack.io"]
5050
resources: ["vmdisks"]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
suite: cozystack-api ClusterRole grants Option provider sources
2+
templates:
3+
- templates/rbac.yaml
4+
5+
release:
6+
name: cozystack-api
7+
namespace: cozy-system
8+
9+
# The Option (dropdown) providers run with the cozystack-api ServiceAccount's
10+
# privileged client, so every GVR a provider lists must be granted on this
11+
# ClusterRole. The plan/backup providers list namespaced plans/backups in the
12+
# backups.cozystack.io group; without read access there the apiserver returns
13+
# forbidden and List silently drops those dropdowns (Get returns 500). The
14+
# bare cozystack.io grant does NOT cover backups.cozystack.io — RBAC matches
15+
# the API group string exactly.
16+
17+
tests:
18+
- it: grants read on backups.cozystack.io plans and backups for the plan/backup providers
19+
asserts:
20+
- contains:
21+
path: rules
22+
content:
23+
apiGroups: ["backups.cozystack.io"]
24+
resources: ["backupclasses", "plans", "backups"]
25+
verbs: ["get", "watch", "list"]

0 commit comments

Comments
 (0)