migrated to external IP allocator
This commit is contained in:
parent
8672452033
commit
e2449b425e
15 changed files with 478 additions and 194 deletions
|
|
@ -1,10 +1,12 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"git.giftfish.de/ston1th/haproxy-lb/pkg/api"
|
||||
"git.giftfish.de/ston1th/haproxy-lb/pkg/cluster"
|
||||
|
|
@ -69,17 +71,26 @@ func main() {
|
|||
}
|
||||
}()
|
||||
go func() {
|
||||
sig := make(chan os.Signal)
|
||||
sig := make(chan os.Signal, 1)
|
||||
signal.Notify(sig, syscall.SIGHUP)
|
||||
for {
|
||||
<-sig
|
||||
c.Stepdown()
|
||||
}
|
||||
}()
|
||||
sigs := make(chan os.Signal)
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
s := <-sigs
|
||||
log.Info("haproxy-lb shutdown", "signal", s.String())
|
||||
go func() {
|
||||
select {
|
||||
case <-time.After(time.Second * 10):
|
||||
log.Error(errors.New("shutdown took longer than 10 seconds"), "shutdown forced")
|
||||
case <-sigs:
|
||||
log.Error(errors.New("force shutdown triggerd"), "shutdown forced")
|
||||
}
|
||||
os.Exit(1)
|
||||
}()
|
||||
c.Stop()
|
||||
log.Info("haproxy-lb stopped")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue