mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-13 16:46:55 +00:00
fix(ecstore): keep local path startup fail-fast under Kubernetes (#4640)
The startup topology convergence auto-detection (added in #4631) checked Kubernetes before endpoint style, so a local path deployment (single or multi-drive, non-distributed) running inside Kubernetes was classified as orchestrated with an effectively unbounded wait window. Path-style endpoints have no hostnames to resolve, so the wait never actually triggers and runtime behavior is unchanged, but the startup log then advertised mode=orchestrated / wait_timeout=MAX for a purely local deployment, which is misleading and contradicts the documented policy (local path endpoints -> fail-fast). Order the auto-detection by endpoint style first: only distributed URL endpoints, which resolve hostnames, pick orchestrated (Kubernetes) or bounded (otherwise); local path endpoints stay fail-fast regardless of the platform. Update the doc comment to match and add a policy case locking Kubernetes + local path to fail-fast. Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
@@ -768,13 +768,16 @@ impl StartupTopologyPolicy {
|
||||
Some("bounded") => StartupTopologyWaitMode::Bounded,
|
||||
Some("fail-fast") | Some("failfast") | Some("strict") => StartupTopologyWaitMode::FailFast,
|
||||
// "auto", unset, or unrecognized: derive from the environment.
|
||||
// Only URL-style (distributed) endpoints resolve hostnames and need
|
||||
// to wait for DNS/topology convergence; local path endpoints never
|
||||
// do, so they fail fast regardless of the platform.
|
||||
_ => {
|
||||
if kubernetes {
|
||||
StartupTopologyWaitMode::Orchestrated
|
||||
} else if distributed {
|
||||
StartupTopologyWaitMode::Bounded
|
||||
} else {
|
||||
if !distributed {
|
||||
StartupTopologyWaitMode::FailFast
|
||||
} else if kubernetes {
|
||||
StartupTopologyWaitMode::Orchestrated
|
||||
} else {
|
||||
StartupTopologyWaitMode::Bounded
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1351,6 +1354,12 @@ mod test {
|
||||
let local = StartupTopologyPolicy::resolve_from(None, false, false, None, None);
|
||||
assert_eq!(local.mode, StartupTopologyWaitMode::FailFast);
|
||||
assert_eq!(local.wait_timeout, Duration::ZERO);
|
||||
|
||||
// Local path endpoints stay fail-fast even under Kubernetes: they have
|
||||
// no hostnames to resolve, so there is nothing to wait for.
|
||||
let k8s_local = StartupTopologyPolicy::resolve_from(None, true, false, None, None);
|
||||
assert_eq!(k8s_local.mode, StartupTopologyWaitMode::FailFast);
|
||||
assert_eq!(k8s_local.wait_timeout, Duration::ZERO);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user