Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internal/agent/bootstrap/sentinel/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,16 @@ func GenerateConfig() error {
cfg.Append("sentinel myid", sentinelID)
}

// If resolveHostnames is set to yes, then we need to announce the hostnames
if announceHostnames == "yes" && resolveHostnames == "yes" {
// When announceHostnames=yes + resolveHostnames=yes, peer
// discovery is expected to go through DNS, not IP. The
// previous behaviour here wrote `sentinel announce-ip <ip>`
// with whatever IP env var happened to hold - in practice the
// operator never sets IP, so the default "0.0.0.0" wound up
// in sentinel.conf and Sentinels could not find each other
// (#1748). Emit an announce-ip only when we actually have a
// concrete IP to announce (i.e. the operator has set IP), and
// rely on announce-hostnames + resolve-hostnames otherwise.
if announceHostnames == "yes" && resolveHostnames == "yes" && ip != "" && ip != "0.0.0.0" {
cfg.Append("sentinel announce-ip", ip)
}
}
Expand Down