forked from rancher/rancher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
register.go
29 lines (25 loc) · 1001 Bytes
/
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
package systemimage
import (
"context"
"github.com/rancher/types/config"
)
func Register(ctx context.Context, cluster *config.UserContext) {
projClient := cluster.Management.Management.Projects("")
catalogClient := cluster.Management.Management.Catalogs("")
systemServices := getSystemService()
for _, v := range systemServices {
v.Init(cluster)
}
syncer := Syncer{
clusterName: cluster.ClusterName,
projects: projClient,
projectLister: projClient.Controller().Lister(),
daemonsets: cluster.Apps.DaemonSets(""),
daemonsetLister: cluster.Apps.DaemonSets("").Controller().Lister(),
deployments: cluster.Apps.Deployments(""),
deploymentLister: cluster.Apps.Deployments("").Controller().Lister(),
systemSercices: systemServices,
}
projClient.AddClusterScopedHandler(ctx, "system-image-upgrade-controller", cluster.ClusterName, syncer.SyncProject)
catalogClient.AddHandler(ctx, "system-image-upgrade-catalog-controller", syncer.SyncCatalog)
}