fix public ip selfcheck logic
This commit is contained in:
1 parent
a6f9646da5
commit
67adc6670e
18 files changed
+209
-90
No files matched your search
@@ -175,8 +175,18 @@ type ValidatorAgent struct {
|
||||
Checks AgentChecks `yaml:"checks"`
|
||||
}
|
||||
|
||||
// SelfCheckCfg configures how the agent confirms its egress actually flows
|
||||
// through the newly assigned floating IP. This must query a resource
|
||||
// genuinely outside the cloud project: OpenStack only applies floating-IP
|
||||
// SNAT to traffic leaving via the external/provider network, so any
|
||||
// in-project resource (including control-api, if it's reachable over the
|
||||
// project's internal network) would see the validator's private address
|
||||
// instead — a false negative that never changes. IPEchoURLs are tried in
|
||||
// order (falling through to the next on error/timeout, not on a genuine
|
||||
// mismatch) until one returns a parseable IP.
|
||||
type SelfCheckCfg struct {
|
||||
TimeoutSeconds int `yaml:"timeout_seconds"`
|
||||
TimeoutSeconds int `yaml:"timeout_seconds"`
|
||||
IPEchoURLs []string `yaml:"ip_echo_urls"`
|
||||
}
|
||||
|
||||
type AgentChecks struct {
|
||||
@@ -202,6 +212,9 @@ func LoadValidatorAgent(path string) (*ValidatorAgent, error) {
|
||||
if c.SelfCheck.TimeoutSeconds == 0 {
|
||||
c.SelfCheck.TimeoutSeconds = 10
|
||||
}
|
||||
if len(c.SelfCheck.IPEchoURLs) == 0 {
|
||||
c.SelfCheck.IPEchoURLs = []string{"https://api.ipify.org", "https://ifconfig.me/ip"}
|
||||
}
|
||||
if c.Checks.HTTPSTimeoutSeconds == 0 {
|
||||
c.Checks.HTTPSTimeoutSeconds = 10
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user