forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 1
/
register.go
31 lines (26 loc) · 1.28 KB
/
register.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package auth
import (
"context"
"github.com/rancher/types/config"
)
func RegisterEarly(ctx context.Context, management *config.ManagementContext) {
prtb, crtb := newRTBLifecycles(management)
gr := newGlobalRoleLifecycle(management)
grb := newGlobalRoleBindingLifecycle(management)
p, c := newPandCLifecycles(management)
u := newUserLifecycle(management)
n := newTokenController(management)
management.Management.ProjectRoleTemplateBindings("").AddLifecycle(ptrbMGMTController, prtb)
management.Management.ClusterRoleTemplateBindings("").AddLifecycle(ctrbMGMTController, crtb)
management.Management.GlobalRoles("").AddLifecycle(grController, gr)
management.Management.GlobalRoleBindings("").AddLifecycle(grbController, grb)
management.Management.Projects("").AddHandler(projectCreateController, p.sync)
management.Management.Clusters("").AddHandler(clusterCreateController, c.sync)
management.Management.Users("").AddLifecycle(userController, u)
management.Management.Tokens("").AddHandler(tokenController, n.sync)
}
func RegisterLate(ctx context.Context, management *config.ManagementContext) {
p, c := newPandCLifecycles(management)
management.Management.Projects("").AddLifecycle(projectRemoveController, p)
management.Management.Clusters("").AddLifecycle(clusterRemoveController, c)
}