Skip to content

Commit 2195841

Browse files
author
Matt Rogers
committed
Update bootstrap tests for aggregated cluster-reader
1 parent 726079c commit 2195841

File tree

3 files changed

+50
-211
lines changed

3 files changed

+50
-211
lines changed

pkg/cmd/server/bootstrappolicy/all_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ const osClusterRoleAggregationPrefix = "system:openshift:"
1616
// this map must be manually kept up to date as we make changes to aggregation
1717
// we hard code this data with no constants because we cannot change the underlying values
1818
var expectedAggregationMap = map[string]sets.String{
19-
"admin": sets.NewString("system:openshift:aggregate-to-admin", "system:aggregate-to-admin"),
20-
"edit": sets.NewString("system:openshift:aggregate-to-edit", "system:aggregate-to-edit"),
21-
"view": sets.NewString("system:openshift:aggregate-to-view", "system:aggregate-to-view"),
19+
"admin": sets.NewString("system:openshift:aggregate-to-admin", "system:aggregate-to-admin"),
20+
"edit": sets.NewString("system:openshift:aggregate-to-edit", "system:aggregate-to-edit"),
21+
"view": sets.NewString("system:openshift:aggregate-to-view", "system:aggregate-to-view"),
22+
"cluster-reader": sets.NewString("system:openshift:aggregate-to-view", "system:aggregate-to-view", "system:openshift:aggregate-to-cluster-reader"),
2223
}
2324

2425
func TestPolicyAggregation(t *testing.T) {

test/testdata/bootstrappolicy/bootstrap_cluster_roles.yaml

Lines changed: 23 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -66,46 +66,45 @@ items:
6666
- userextras/scopes.authorization.openshift.io
6767
verbs:
6868
- impersonate
69-
- apiVersion: rbac.authorization.k8s.io/v1
69+
- aggregationRule:
70+
clusterRoleSelectors:
71+
- matchLabels:
72+
rbac.authorization.k8s.io/aggregate-to-cluster-reader: "true"
73+
- matchLabels:
74+
rbac.authorization.k8s.io/aggregate-to-view: "true"
75+
apiVersion: rbac.authorization.k8s.io/v1
7076
kind: ClusterRole
7177
metadata:
7278
annotations:
7379
authorization.openshift.io/system-only: "true"
7480
rbac.authorization.kubernetes.io/autoupdate: "true"
7581
creationTimestamp: null
7682
name: cluster-reader
83+
rules: null
84+
- apiVersion: rbac.authorization.k8s.io/v1
85+
kind: ClusterRole
86+
metadata:
87+
annotations:
88+
authorization.openshift.io/system-only: "true"
89+
rbac.authorization.kubernetes.io/autoupdate: "true"
90+
creationTimestamp: null
91+
labels:
92+
rbac.authorization.k8s.io/aggregate-to-cluster-reader: "true"
93+
name: system:openshift:aggregate-to-cluster-reader
7794
rules:
7895
- apiGroups:
7996
- ""
8097
resources:
81-
- bindings
8298
- componentstatuses
83-
- configmaps
84-
- endpoints
85-
- events
86-
- limitranges
87-
- namespaces
88-
- namespaces/status
8999
- nodes
90100
- nodes/status
91-
- persistentvolumeclaims
92101
- persistentvolumeclaims/status
93102
- persistentvolumes
94103
- persistentvolumes/status
95-
- pods
96104
- pods/binding
97105
- pods/eviction
98-
- pods/log
99-
- pods/status
100106
- podtemplates
101-
- replicationcontrollers
102-
- replicationcontrollers/scale
103-
- replicationcontrollers/status
104-
- resourcequotas
105-
- resourcequotas/status
106107
- securitycontextconstraints
107-
- serviceaccounts
108-
- services
109108
- services/status
110109
verbs:
111110
- get
@@ -124,16 +123,9 @@ items:
124123
- apps
125124
resources:
126125
- controllerrevisions
127-
- daemonsets
128126
- daemonsets/status
129-
- deployments
130-
- deployments/scale
131127
- deployments/status
132-
- replicasets
133-
- replicasets/scale
134128
- replicasets/status
135-
- statefulsets
136-
- statefulsets/scale
137129
- statefulsets/status
138130
verbs:
139131
- get
@@ -160,7 +152,6 @@ items:
160152
- apiGroups:
161153
- autoscaling
162154
resources:
163-
- horizontalpodautoscalers
164155
- horizontalpodautoscalers/status
165156
verbs:
166157
- get
@@ -169,9 +160,7 @@ items:
169160
- apiGroups:
170161
- batch
171162
resources:
172-
- cronjobs
173163
- cronjobs/status
174-
- jobs
175164
- jobs/status
176165
verbs:
177166
- get
@@ -180,24 +169,16 @@ items:
180169
- apiGroups:
181170
- extensions
182171
resources:
183-
- daemonsets
184172
- daemonsets/status
185-
- deployments
186-
- deployments/scale
187173
- deployments/status
188174
- horizontalpodautoscalers
189175
- horizontalpodautoscalers/status
190-
- ingresses
191176
- ingresses/status
192177
- jobs
193178
- jobs/status
194-
- networkpolicies
195179
- podsecuritypolicies
196-
- replicasets
197-
- replicasets/scale
198180
- replicasets/status
199181
- replicationcontrollers
200-
- replicationcontrollers/scale
201182
- storageclasses
202183
- thirdpartyresources
203184
verbs:
@@ -212,18 +193,9 @@ items:
212193
- get
213194
- list
214195
- watch
215-
- apiGroups:
216-
- networking.k8s.io
217-
resources:
218-
- networkpolicies
219-
verbs:
220-
- get
221-
- list
222-
- watch
223196
- apiGroups:
224197
- policy
225198
resources:
226-
- poddisruptionbudgets
227199
- poddisruptionbudgets/status
228200
- podsecuritypolicies
229201
verbs:
@@ -293,23 +265,7 @@ items:
293265
- ""
294266
- build.openshift.io
295267
resources:
296-
- buildconfigs
297-
- buildconfigs/webhooks
298-
- builds
299268
- builds/details
300-
- builds/log
301-
verbs:
302-
- get
303-
- list
304-
- watch
305-
- apiGroups:
306-
- ""
307-
- apps.openshift.io
308-
resources:
309-
- deploymentconfigs
310-
- deploymentconfigs/log
311-
- deploymentconfigs/scale
312-
- deploymentconfigs/status
313269
verbs:
314270
- get
315271
- list
@@ -320,10 +276,6 @@ items:
320276
resources:
321277
- images
322278
- imagesignatures
323-
- imagestreamimages
324-
- imagestreams
325-
- imagestreams/status
326-
- imagestreamtags
327279
verbs:
328280
- get
329281
- list
@@ -348,29 +300,25 @@ items:
348300
- ""
349301
- project.openshift.io
350302
resources:
351-
- projectrequests
352303
- projects
353304
verbs:
354-
- get
355305
- list
356306
- watch
357307
- apiGroups:
358308
- ""
359-
- quota.openshift.io
309+
- project.openshift.io
360310
resources:
361-
- appliedclusterresourcequotas
362-
- clusterresourcequotas
363-
- clusterresourcequotas/status
311+
- projectrequests
364312
verbs:
365313
- get
366314
- list
367315
- watch
368316
- apiGroups:
369317
- ""
370-
- route.openshift.io
318+
- quota.openshift.io
371319
resources:
372-
- routes
373-
- routes/status
320+
- clusterresourcequotas
321+
- clusterresourcequotas/status
374322
verbs:
375323
- get
376324
- list
@@ -404,18 +352,6 @@ items:
404352
- get
405353
- list
406354
- watch
407-
- apiGroups:
408-
- ""
409-
- template.openshift.io
410-
resources:
411-
- processedtemplates
412-
- templateconfigs
413-
- templateinstances
414-
- templates
415-
verbs:
416-
- get
417-
- list
418-
- watch
419355
- apiGroups:
420356
- ""
421357
- template.openshift.io
@@ -492,23 +428,6 @@ items:
492428
- '*'
493429
verbs:
494430
- get
495-
- apiGroups:
496-
- ""
497-
- build.openshift.io
498-
resources:
499-
- buildlogs
500-
verbs:
501-
- get
502-
- list
503-
- watch
504-
- apiGroups:
505-
- ""
506-
resources:
507-
- resourcequotausages
508-
verbs:
509-
- get
510-
- list
511-
- watch
512431
- apiVersion: rbac.authorization.k8s.io/v1
513432
kind: ClusterRole
514433
metadata:

0 commit comments

Comments
 (0)