Files
cozystack/packages/apps/foundationdb/tests/dashboard-resourcemap_test.yaml
T
Yan Bondarenko e3ae8033e6 fix(foundationdb): let tenants read the dashboard resource map
The resource map is the only object that names the connection ConfigMap
for a client such as the dashboard. It was rendered only with monitoring
enabled, and the tenant role could not read it, so a tenant session had
no way to find the ConfigMap it is allowed to read.

Assisted-by: LLM
Signed-off-by: Yan Bondarenko <202671653+yankawai@users.noreply.github.com>
2026-09-30 17:29:49 +03:00

86 lines
2.6 KiB
YAML

suite: foundationdb tenant configuration access
templates:
- templates/dashboard-resourcemap.yaml
release:
name: foundationdb-example
namespace: tenant-example
tests:
- it: grants read access only to this cluster configuration and resource map
documentSelector: &role
path: kind
value: Role
asserts: &configAccess
- equal:
path: rules
value:
- apiGroups: [""]
resources: [configmaps]
resourceNames: [foundationdb-example-config, foundationdb-example-resourcemap]
verbs: [get, list, watch]
- it: keeps configuration accessible with monitoring disabled
set:
monitoring.enabled: false
documentSelector: *role
asserts: *configAccess
- it: binds the configuration role to tenant users and administrators
documentSelector:
path: kind
value: RoleBinding
asserts:
- equal:
path: roleRef
value:
kind: Role
name: foundationdb-example-dashboard-resources
apiGroup: rbac.authorization.k8s.io
- equal:
path: subjects
value:
- kind: ServiceAccount
name: tenant-example
namespace: tenant-example
- kind: Group
name: tenant-example-admin
apiGroup: rbac.authorization.k8s.io
- kind: Group
name: tenant-example-super-admin
apiGroup: rbac.authorization.k8s.io
- kind: Group
name: tenant-example-use
apiGroup: rbac.authorization.k8s.io
- kind: ServiceAccount
name: tenant-root
namespace: tenant-root
- kind: Group
name: tenant-root-admin
apiGroup: rbac.authorization.k8s.io
- kind: Group
name: tenant-root-super-admin
apiGroup: rbac.authorization.k8s.io
- kind: Group
name: tenant-root-use
apiGroup: rbac.authorization.k8s.io
- it: includes the configuration in the existing resource map
documentSelector:
path: kind
value: ConfigMap
asserts:
- matchRegex:
path: data.resources
pattern: "apiVersion: v1\n kind: ConfigMap\n name: foundationdb-example-config"
- it: renders only the existing map and the two access objects
asserts:
- hasDocuments:
count: 3
- it: keeps the resource map available with monitoring disabled
set:
monitoring.enabled: false
asserts:
- hasDocuments:
count: 3