first working version

This commit is contained in:
ston1th 2021-04-09 22:38:03 +02:00
commit 6da132106f
18 changed files with 519 additions and 96 deletions

View file

@ -19,6 +19,7 @@ const (
EtcdLogLevel = "error"
EtcdPrefix = "/haproxy-lb"
HAProxyService = "haproxy"
HAProxyConfigFile = "/etc/haproxy/haproxy.cfg"
)
@ -44,6 +45,9 @@ func Validate(c *Config) error {
if c.HAProxyConfig == "" {
c.HAProxyConfig = HAProxyConfigFile
}
if c.HAProxyService == "" {
c.HAProxyService = HAProxyService
}
if len(c.VIP.VirtualIPs) == 0 {
return errors.New("missing server.virtualIPs config")
}
@ -134,12 +138,13 @@ func Validate(c *Config) error {
}
type Config struct {
LeaderHook string `yaml:"leaderHook,omitempty"`
FollowerHook string `yaml:"followerHook,omitempty"`
HAProxyConfig string `yaml:"haproxyConfig,omitempty"`
VIP VIP `yaml:"vip"`
Cluster Cluster `yaml:"cluster"`
Server Server `yaml:"server"`
LeaderHook string `yaml:"leaderHook,omitempty"`
FollowerHook string `yaml:"followerHook,omitempty"`
HAProxyConfig string `yaml:"haproxyConfig,omitempty"`
HAProxyService string `yaml:"haproxyService,omitempty"`
VIP VIP `yaml:"vip"`
Cluster Cluster `yaml:"cluster"`
Server Server `yaml:"server"`
}
type Server struct {