()
| 66 | } |
| 67 | |
| 68 | func main() { |
| 69 | var err error |
| 70 | |
| 71 | if config.EnableJsonLogging { |
| 72 | log.SetFormatter(&log.JSONFormatter{}) |
| 73 | } |
| 74 | log.SetOutput(os.Stdout) |
| 75 | log.Printf("Spilo operator %s\n", version) |
| 76 | |
| 77 | sigs := make(chan os.Signal, 1) |
| 78 | stop := make(chan struct{}) |
| 79 | signal.Notify(sigs, os.Interrupt, syscall.SIGTERM) // Push signals into channel |
| 80 | |
| 81 | wg := &sync.WaitGroup{} // Goroutines can add themselves to this to be waited on |
| 82 | |
| 83 | config.RestConfig, err = k8sutil.RestConfig(kubeConfigFile, outOfCluster) |
| 84 | if err != nil { |
| 85 | log.Fatalf("couldn't get REST config: %v", err) |
| 86 | } |
| 87 | |
| 88 | config.RestConfig.QPS = float32(config.KubeQPS) |
| 89 | config.RestConfig.Burst = config.KubeBurst |
| 90 | |
| 91 | c := controller.NewController(&config, "") |
| 92 | |
| 93 | c.Run(stop, wg) |
| 94 | |
| 95 | sig := <-sigs |
| 96 | log.Printf("Shutting down... %+v", sig) |
| 97 | |
| 98 | close(stop) // Tell goroutines to stop themselves |
| 99 | wg.Wait() // Wait for all to be stopped |
| 100 | } |
nothing calls this directly
no test coverage detected