mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
feat(cozystack-basics): let every authenticated user read GPUClass
The GPU catalog is what a tenant picks a class from, from a portal or from kubectl and GitOps without one, so every authenticated user reads it. GPUClass is cluster-scoped and tenant roles are bound per namespace, so the read goes through its own ClusterRole bound to system:authenticated. Nothing grants a write: classes are the hoster's. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <f@lex.la>
This commit is contained in:
2 files changed
+71
No files matched your search
@@ -382,3 +382,27 @@ rules:
|
||||
- '*'
|
||||
verbs:
|
||||
- '*'
|
||||
---
|
||||
# GPUClass is the hoster's catalog and is cluster-scoped, so tenant roles,
|
||||
# bound per namespace, cannot grant its read.
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cozy:gpuclasses:view
|
||||
rules:
|
||||
- apiGroups: ["cozystack.io"]
|
||||
resources: ["gpuclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cozy:gpuclasses:view:authenticated
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cozy:gpuclasses:view
|
||||
subjects:
|
||||
- apiGroup: rbac.authorization.k8s.io
|
||||
kind: Group
|
||||
name: system:authenticated
|
||||
@@ -0,0 +1,47 @@
|
||||
suite: cozystack-basics GPUClass catalog read
|
||||
|
||||
templates:
|
||||
- templates/clusterroles.yaml
|
||||
|
||||
release:
|
||||
name: cozystack-basics
|
||||
namespace: cozy-system
|
||||
|
||||
# GPUClass is the hoster's catalog: every authenticated user reads it, from
|
||||
# a portal or from kubectl, and nobody but the hoster writes it. It is
|
||||
# cluster-scoped, so tenant roles, which are bound per namespace, could not
|
||||
# grant it even if they named it.
|
||||
tests:
|
||||
- it: renders a read-only GPUClass role
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: cozy:gpuclasses:view
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ClusterRole
|
||||
- equal:
|
||||
path: rules
|
||||
value:
|
||||
- apiGroups: ["cozystack.io"]
|
||||
resources: ["gpuclasses"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
|
||||
- it: binds the GPUClass role to every authenticated user
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: cozy:gpuclasses:view:authenticated
|
||||
asserts:
|
||||
- isKind:
|
||||
of: ClusterRoleBinding
|
||||
- equal:
|
||||
path: roleRef
|
||||
value:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cozy:gpuclasses:view
|
||||
- equal:
|
||||
path: subjects
|
||||
value:
|
||||
- apiGroup: rbac.authorization.k8s.io
|
||||
kind: Group
|
||||
name: system:authenticated
|
||||
Reference in new issue
Block a user