mirror of https://github.com/status-im/consul.git
consul: Gossip the build using Serf
This commit is contained in:
parent
42e3729a7c
commit
b144633815
|
@ -175,6 +175,14 @@ func (a *Agent) consulConfig() *consul.Config {
|
||||||
base.ProtocolVersion = uint8(a.config.Protocol)
|
base.ProtocolVersion = uint8(a.config.Protocol)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Format the build string
|
||||||
|
revision := a.config.Revision
|
||||||
|
if len(revision) > 8 {
|
||||||
|
revision = revision[:8]
|
||||||
|
}
|
||||||
|
base.Build = fmt.Sprintf("%s%s:%s",
|
||||||
|
a.config.Version, a.config.VersionPrerelease, revision)
|
||||||
|
|
||||||
// Copy the TLS configuration
|
// Copy the TLS configuration
|
||||||
base.VerifyIncoming = a.config.VerifyIncoming
|
base.VerifyIncoming = a.config.VerifyIncoming
|
||||||
base.VerifyOutgoing = a.config.VerifyOutgoing
|
base.VerifyOutgoing = a.config.VerifyOutgoing
|
||||||
|
|
|
@ -128,6 +128,7 @@ func (c *Client) setupSerf(conf *serf.Config, ch chan serf.Event, path string) (
|
||||||
conf.Tags["vsn"] = fmt.Sprintf("%d", c.config.ProtocolVersion)
|
conf.Tags["vsn"] = fmt.Sprintf("%d", c.config.ProtocolVersion)
|
||||||
conf.Tags["vsn_min"] = fmt.Sprintf("%d", ProtocolVersionMin)
|
conf.Tags["vsn_min"] = fmt.Sprintf("%d", ProtocolVersionMin)
|
||||||
conf.Tags["vsn_max"] = fmt.Sprintf("%d", ProtocolVersionMax)
|
conf.Tags["vsn_max"] = fmt.Sprintf("%d", ProtocolVersionMax)
|
||||||
|
conf.Tags["build"] = c.config.Build
|
||||||
conf.MemberlistConfig.LogOutput = c.config.LogOutput
|
conf.MemberlistConfig.LogOutput = c.config.LogOutput
|
||||||
conf.LogOutput = c.config.LogOutput
|
conf.LogOutput = c.config.LogOutput
|
||||||
conf.EventCh = ch
|
conf.EventCh = ch
|
||||||
|
|
|
@ -115,6 +115,10 @@ type Config struct {
|
||||||
// true, we ignore the leave, and rejoin the cluster on start.
|
// true, we ignore the leave, and rejoin the cluster on start.
|
||||||
RejoinAfterLeave bool
|
RejoinAfterLeave bool
|
||||||
|
|
||||||
|
// Build is a string that is gossiped around, and can be used to help
|
||||||
|
// operators track which versions are actively deployed
|
||||||
|
Build string
|
||||||
|
|
||||||
// ServerUp callback can be used to trigger a notification that
|
// ServerUp callback can be used to trigger a notification that
|
||||||
// a Consul server is now up and known about.
|
// a Consul server is now up and known about.
|
||||||
ServerUp func()
|
ServerUp func()
|
||||||
|
|
|
@ -224,6 +224,7 @@ func (s *Server) setupSerf(conf *serf.Config, ch chan serf.Event, path string, w
|
||||||
conf.Tags["vsn"] = fmt.Sprintf("%d", s.config.ProtocolVersion)
|
conf.Tags["vsn"] = fmt.Sprintf("%d", s.config.ProtocolVersion)
|
||||||
conf.Tags["vsn_min"] = fmt.Sprintf("%d", ProtocolVersionMin)
|
conf.Tags["vsn_min"] = fmt.Sprintf("%d", ProtocolVersionMin)
|
||||||
conf.Tags["vsn_max"] = fmt.Sprintf("%d", ProtocolVersionMax)
|
conf.Tags["vsn_max"] = fmt.Sprintf("%d", ProtocolVersionMax)
|
||||||
|
conf.Tags["build"] = s.config.Build
|
||||||
conf.Tags["port"] = fmt.Sprintf("%d", addr.Port)
|
conf.Tags["port"] = fmt.Sprintf("%d", addr.Port)
|
||||||
if s.config.Bootstrap {
|
if s.config.Bootstrap {
|
||||||
conf.Tags["bootstrap"] = "1"
|
conf.Tags["bootstrap"] = "1"
|
||||||
|
|
Loading…
Reference in New Issue