forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.go
40 lines (35 loc) · 1.97 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
37
38
39
40
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)
grbLegacy := newLegacyGRBCleaner(management)
rtLegacy := newLegacyRTCleaner(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)
management.Management.GlobalRoleBindings("").AddHandler(ctx, "legacy-grb-cleaner", grbLegacy.sync)
management.Management.RoleTemplates("").AddHandler(ctx, "legacy-rt-cleaner", rtLegacy.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)
}