@@ -16,6 +16,7 @@ import (
16
16
aggregatorapiserver "k8s.io/kube-aggregator/pkg/apiserver"
17
17
kubeapiserver "k8s.io/kubernetes/pkg/master"
18
18
kcorestorage "k8s.io/kubernetes/pkg/registry/core/rest"
19
+ rbacrest "k8s.io/kubernetes/pkg/registry/rbac/rest"
19
20
20
21
"github.com/openshift/origin/pkg/cmd/server/bootstrappolicy"
21
22
kubernetes "github.com/openshift/origin/pkg/cmd/server/kubernetes/master"
@@ -265,7 +266,7 @@ func (c *MasterConfig) Run(stopCh <-chan struct{}) error {
265
266
}
266
267
267
268
// add post-start hooks
268
- aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("authorization.openshift.io-bootstrapclusterroles" , bootstrappolicy .Policy ().EnsureRBACPolicy ())
269
+ aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("authorization.openshift.io-bootstrapclusterroles" , bootstrapData ( bootstrappolicy .Policy () ).EnsureRBACPolicy ())
269
270
aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("authorization.openshift.io-ensureopenshift-infra" , ensureOpenShiftInfraNamespace )
270
271
aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("quota.openshift.io-clusterquotamapping" , c .startClusterQuotaMapping )
271
272
for name , fn := range c .additionalPostStartHooks {
@@ -323,7 +324,7 @@ func (c *MasterConfig) RunKubeAPIServer(stopCh <-chan struct{}) error {
323
324
}
324
325
}
325
326
326
- aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("authorization.openshift.io-bootstrapclusterroles" , bootstrappolicy .Policy ().EnsureRBACPolicy ())
327
+ aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("authorization.openshift.io-bootstrapclusterroles" , bootstrapData ( bootstrappolicy .Policy () ).EnsureRBACPolicy ())
327
328
aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("authorization.openshift.io-ensureopenshift-infra" , ensureOpenShiftInfraNamespace )
328
329
aggregatedAPIServer .GenericAPIServer .AddPostStartHookOrDie ("quota.openshift.io-clusterquotamapping" , c .startClusterQuotaMapping )
329
330
// add post-start hooks
@@ -471,3 +472,15 @@ func (c *MasterConfig) startClusterQuotaMapping(context apiserver.PostStartHookC
471
472
go c .ClusterQuotaMappingController .Run (5 , context .StopCh )
472
473
return nil
473
474
}
475
+
476
+ // bootstrapData casts our policy data to the rbacrest helper that can
477
+ // materialize the policy.
478
+ func bootstrapData (data * bootstrappolicy.PolicyData ) * rbacrest.PolicyData {
479
+ return & rbacrest.PolicyData {
480
+ ClusterRoles : data .ClusterRoles ,
481
+ ClusterRoleBindings : data .ClusterRoleBindings ,
482
+ Roles : data .Roles ,
483
+ RoleBindings : data .RoleBindings ,
484
+ ClusterRolesToAggregate : data .ClusterRolesToAggregate ,
485
+ }
486
+ }
0 commit comments