mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 17:09:37 +02:00
refactor file tree structure
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"log"
|
||||
"os"
|
||||
"os/signal"
|
||||
"sync"
|
||||
"syscall"
|
||||
|
||||
"github.bus.zalan.do/acid/postgres-operator/pkg/controller"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
var options controller.Options
|
||||
|
||||
func init() {
|
||||
pflag.StringVar(&options.KubeConfig, "kubeconfig", "", "Path to kubeconfig file with authorization and master location information.")
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Set logging output to standard console out
|
||||
log.SetOutput(os.Stdout)
|
||||
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
pflag.Parse()
|
||||
|
||||
sigs := make(chan os.Signal, 1)
|
||||
stop := make(chan struct{})
|
||||
signal.Notify(sigs, os.Interrupt, syscall.SIGTERM) // Push signals into channel
|
||||
|
||||
wg := &sync.WaitGroup{} // Goroutines can add themselves to this to be waited on
|
||||
|
||||
spiloOperator := controller.New(options)
|
||||
spiloOperator.Run(stop, wg)
|
||||
|
||||
sig := <-sigs // Wait for signals (this hangs until a signal arrives)
|
||||
log.Printf("Shutting down... %+v", sig)
|
||||
|
||||
close(stop) // Tell goroutines to stop themselves
|
||||
wg.Wait() // Wait for all to be stopped
|
||||
}
|
||||
Reference in New Issue
Block a user