Skip to content

Commit eeba1b1

Browse files
committed
refactor: namespaces.yaml, namespace-defaults.yaml
namespaces.yaml is meant for describing the overall structure of what you want with specific overrides for specific users as needed. the "default" roles should be defined in namespace-defaults.yaml so that they are automatically applied by default for each user in each namespace. at a lower level, defaults that should be applied by default for *any* namespaces deployment should be defined in values.yaml. namespace-defaults.yaml is meant to override values.yaml in the event for a particular namespaces deployment the admin wants to create tailor made roles and permisssions. otherwise, this can stay empty and whatever is in values.yaml will be applied. update example prefix to wargames, to illustrate this is not relying on a default namespace of warnet. this probably needs some more thought, but I think its best to address how to pipe through the name in a followup rather than slow this PR down.
1 parent 46ad555 commit eeba1b1

File tree

2 files changed

+15
-83
lines changed

2 files changed

+15
-83
lines changed

resources/namespaces/two_namespaces_two_users/namespace-defaults.yaml

+13-11
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ users:
33
roles:
44
- pod-viewer
55
- pod-manager
6-
roles:
7-
- name: pod-viewer
8-
rules:
9-
- apiGroups: [""]
10-
resources: ["pods"]
11-
verbs: ["get", "list", "watch"]
12-
- name: pod-manager
13-
rules:
14-
- apiGroups: [""]
15-
resources: ["pods", "configmaps"]
16-
verbs: ["get", "list", "watch", "create", "update", "delete"]
6+
# the pod-viewer and pod-manager roles are the default
7+
# roles defined in values.yaml for the namespaces charts
8+
#
9+
# if you need a different set of roles for a particular namespaces
10+
# deployment, you can override values.yaml by providing your own
11+
# role definitions below
12+
#
13+
# roles:
14+
# - name: my-custom-role
15+
# rules:
16+
# - apiGroups: ""
17+
# resources: ""
18+
# verbs: ""
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
namespaces:
2-
- name: warnet-red-team
2+
- name: wargames-red-team
33
users:
44
- name: alice
55
roles:
@@ -8,42 +8,7 @@ namespaces:
88
roles:
99
- pod-viewer
1010
- pod-manager
11-
roles:
12-
- name: pod-viewer
13-
rules:
14-
- apiGroups: [""]
15-
resources: ["pods"]
16-
verbs: ["get", "list", "watch"]
17-
- apiGroups: [""]
18-
resources: ["pods/log", "pods/exec", "pods/attach", "pods/portforward"]
19-
verbs: ["get"]
20-
- apiGroups: [""]
21-
resources: ["configmaps", "secrets"]
22-
verbs: ["get"]
23-
- apiGroups: [""]
24-
resources: ["persistentvolumeclaims"]
25-
verbs: ["get", "list"]
26-
- apiGroups: [""]
27-
resources: ["events"]
28-
verbs: ["get"]
29-
- name: pod-manager
30-
rules:
31-
- apiGroups: [""]
32-
resources: ["pods"]
33-
verbs: ["get", "list", "watch", "create", "delete", "update"]
34-
- apiGroups: [""]
35-
resources: ["pods/log", "pods/exec", "pods/attach", "pods/portforward"]
36-
verbs: ["get", "create"]
37-
- apiGroups: [""]
38-
resources: ["configmaps", "secrets"]
39-
verbs: ["get", "create"]
40-
- apiGroups: [""]
41-
resources: ["persistentvolumeclaims"]
42-
verbs: ["get", "list"]
43-
- apiGroups: [""]
44-
resources: ["events"]
45-
verbs: ["get"]
46-
- name: warnet-blue-team
11+
- name: wargames-blue-team
4712
users:
4813
- name: mallory
4914
roles:
@@ -52,38 +17,3 @@ namespaces:
5217
roles:
5318
- pod-viewer
5419
- pod-manager
55-
roles:
56-
- name: pod-viewer
57-
rules:
58-
- apiGroups: [""]
59-
resources: ["pods"]
60-
verbs: ["get", "list", "watch"]
61-
- apiGroups: [""]
62-
resources: ["pods/log", "pods/exec", "pods/attach", "pods/portforward"]
63-
verbs: ["get"]
64-
- apiGroups: [""]
65-
resources: ["configmaps", "secrets"]
66-
verbs: ["get"]
67-
- apiGroups: [""]
68-
resources: ["persistentvolumeclaims"]
69-
verbs: ["get", "list"]
70-
- apiGroups: [""]
71-
resources: ["events"]
72-
verbs: ["get"]
73-
- name: pod-manager
74-
rules:
75-
- apiGroups: [""]
76-
resources: ["pods"]
77-
verbs: ["get", "list", "watch", "create", "delete", "update"]
78-
- apiGroups: [""]
79-
resources: ["pods/log", "pods/exec", "pods/attach", "pods/portforward"]
80-
verbs: ["get", "create"]
81-
- apiGroups: [""]
82-
resources: ["configmaps", "secrets"]
83-
verbs: ["get", "create"]
84-
- apiGroups: [""]
85-
resources: ["persistentvolumeclaims"]
86-
verbs: ["get", "list"]
87-
- apiGroups: [""]
88-
resources: ["events"]
89-
verbs: ["get"]

0 commit comments

Comments
 (0)