forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.go
36 lines (31 loc) · 1.69 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
32
33
34
35
36
package auth
import (
"context"
"github.com/rancher/rancher/pkg/clustermanager"
"github.com/rancher/types/config"
)
func RegisterEarly(ctx context.Context, management *config.ManagementContext, clusterManager *clustermanager.Manager) {
prtb, crtb := newRTBLifecycles(management)
gr := newGlobalRoleLifecycle(management)
grb := newGlobalRoleBindingLifecycle(management)
p, c := newPandCLifecycles(management)
u := newUserLifecycle(management, clusterManager)
n := newTokenController(management)
ua := newUserAttributeController(management)
s := newAuthSettingController(management)
management.Management.ProjectRoleTemplateBindings("").AddLifecycle(ctx, ptrbMGMTController, prtb)
management.Management.ClusterRoleTemplateBindings("").AddLifecycle(ctx, ctrbMGMTController, crtb)
management.Management.GlobalRoles("").AddLifecycle(ctx, grController, gr)
management.Management.GlobalRoleBindings("").AddLifecycle(ctx, grbController, grb)
management.Management.Projects("").AddHandler(ctx, projectCreateController, p.sync)
management.Management.Clusters("").AddHandler(ctx, clusterCreateController, c.sync)
management.Management.Users("").AddLifecycle(ctx, userController, u)
management.Management.Tokens("").AddHandler(ctx, tokenController, n.sync)
management.Management.UserAttributes("").AddHandler(ctx, userAttributeController, ua.sync)
management.Management.Settings("").AddHandler(ctx, authSettingController, s.sync)
}
func RegisterLate(ctx context.Context, management *config.ManagementContext) {
p, c := newPandCLifecycles(management)
management.Management.Projects("").AddLifecycle(ctx, projectRemoveController, p)
management.Management.Clusters("").AddLifecycle(ctx, clusterRemoveController, c)
}