-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (35 loc) · 1.13 KB
/
main.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
41
42
43
44
package main
import (
"os"
"github.com/ishankhare07/image-cloner/pkg/controllers"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
)
func init() {
log.SetLogger(zap.New())
}
func main() {
entryLog := log.Log.WithName("entrypoint")
entryLog.Info("setting up manager")
mgr, err := manager.New(config.GetConfigOrDie(), manager.Options{})
if err != nil {
entryLog.Error(err, "unable to setup the controller manager")
os.Exit(1)
}
if err = (&controllers.DeploymentReconciler{}).RegisterWithManager(mgr); err != nil {
entryLog.Error(err, "unable to create controller", "controllers", "deployment")
os.Exit(1)
}
if err = (&controllers.DaemonSetReconciler{}).RegisterWithManager(mgr); err != nil {
entryLog.Error(err, "unable to create controller", "controllers", "daemonset")
os.Exit(1)
}
entryLog.Info("Starting manager")
if err = mgr.Start(ctrl.SetupSignalHandler()); err != nil {
entryLog.Error(err, "problem starting manager")
os.Exit(1)
}
}