Skip to content

Commit 2f809e3

Browse files
committed
etcdserver: clear error on DNS resolution fail on advertise URLs
Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
1 parent 8025082 commit 2f809e3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

etcdserver/config.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,16 @@ func (c *ServerConfig) advertiseMatchesCluster() error {
156156
missing = append(missing, url)
157157
}
158158
}
159-
mstr := strings.Join(missing, ",")
159+
if len(missing) > 0 {
160+
mstr := strings.Join(missing, ",")
161+
umap := types.URLsMap(map[string]types.URLs{c.Name: c.PeerURLs})
162+
return fmt.Errorf("--initial-advertise-peer-urls has %s but missing from --initial-cluster=%s", mstr, umap.String())
163+
}
164+
165+
// resolved URLs from "--initial-advertise-peer-urls" and "--initial-cluster" did not match or failed
166+
apStr := strings.Join(apurls, ",")
160167
umap := types.URLsMap(map[string]types.URLs{c.Name: c.PeerURLs})
161-
return fmt.Errorf("--initial-advertise-peer-urls has %s but missing from --initial-cluster=%s", mstr, umap.String())
168+
return fmt.Errorf("failed to resolve %s to match --initial-cluster=%s", apStr, umap.String())
162169
}
163170

164171
func (c *ServerConfig) MemberDir() string { return filepath.Join(c.DataDir, "member") }

0 commit comments

Comments
 (0)