implemented api handlers

This commit is contained in:
ston1th 2021-04-08 00:34:54 +02:00
commit 372915e24d
15 changed files with 302 additions and 73 deletions

View file

@ -51,16 +51,22 @@ func NewLBController(cfg *config.Config, srv *api.Server, log logr.Logger) (call
continue
}
addIPs(cc, n, ips)
// TODO
//cfg, err := cc.Get("config")
//if err != nil {
// cc.Error(err, "error getting config key")
// <-t.C
// continue
//}
var lbs haproxy.Config
err = ha.UpdateConfig(ctx, lbs)
// deleted LB IPs need to be removed
lbs, err := db.GetLBs("")
if err != nil && err != cluster.ErrPrefixNotFound {
cc.Error(err, "error reading lb list")
<-t.C
continue
}
lbcfg, err := haproxy.NewConfig(lbs)
if err != nil {
cc.Error(err, "error reading haproxy config")
<-t.C
continue
}
err = ha.UpdateConfig(ctx, lbcfg)
if err != nil {
cc.Error(err, "error updating haproxy config")
<-t.C