fix(k8s): tailor mount-mismatch error to cluster's umbrella state
The original error always prescribed cluster recreate. When the running cluster already has an umbrella at /mnt, that's misleading — the right fix is to align the new deployment to the existing umbrella (set kind-mount-root to the cluster's umbrella source and move host paths under it). Recreate is only correct when no umbrella exists. Branch the error message on whether the cluster has a /mnt bind. With umbrella: show its host source and tell the user to set kind-mount-root to that value. Without: keep the recreate guidance. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>pull/748/head
parent
1e274610d6
commit
f1250a3da1
|
|
@ -309,7 +309,7 @@ def check_mounts_compatible(cluster_name: str, config_file: str) -> None:
|
||||||
if not mismatches:
|
if not mismatches:
|
||||||
return
|
return
|
||||||
lines = [
|
lines = [
|
||||||
f"This deployment declares extraMounts that are not active on the "
|
f"This deployment declares extraMounts incompatible with the "
|
||||||
f"running cluster '{cluster_name}':",
|
f"running cluster '{cluster_name}':",
|
||||||
]
|
]
|
||||||
for dest, want, have in mismatches:
|
for dest, want, have in mismatches:
|
||||||
|
|
@ -317,21 +317,44 @@ def check_mounts_compatible(cluster_name: str, config_file: str) -> None:
|
||||||
f" - {dest}: expected host path '{want}', "
|
f" - {dest}: expected host path '{want}', "
|
||||||
f"actual '{have or 'NOT MOUNTED'}'"
|
f"actual '{have or 'NOT MOUNTED'}'"
|
||||||
)
|
)
|
||||||
lines.extend(
|
lines.append("")
|
||||||
[
|
|
||||||
"",
|
cluster_umbrella = live.get("/mnt")
|
||||||
"Kind applies extraMounts only at cluster creation — neither "
|
if cluster_umbrella:
|
||||||
"kind nor Docker supports adding bind mounts to a running "
|
lines.extend(
|
||||||
"container. Without a recreate, any PV backed by one of the "
|
[
|
||||||
"missing mounts will silently fall through to the node's "
|
f"The running cluster has an umbrella mount: "
|
||||||
"overlay filesystem and lose data on cluster destroy.",
|
f"'{cluster_umbrella}' -> /mnt.",
|
||||||
"",
|
"",
|
||||||
"Fix: destroy and recreate the cluster with a kind-config that "
|
f"Fix: set 'kind-mount-root: {cluster_umbrella}' in this "
|
||||||
"includes an umbrella mount via 'kind-mount-root'. All stacks "
|
"deployment's spec and place host paths for its volumes "
|
||||||
"sharing the cluster must agree on 'kind-mount-root' and place "
|
f"under '{cluster_umbrella}/'. Kind applies extraMounts "
|
||||||
"their host paths under it. See docs/deployment_patterns.md.",
|
"only at cluster creation, so new bind mounts cannot be "
|
||||||
]
|
"added to the running cluster without a recreate — but "
|
||||||
)
|
"the existing umbrella already covers any subdirectory "
|
||||||
|
"you create on the host.",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
lines.extend(
|
||||||
|
[
|
||||||
|
"The running cluster has no umbrella mount "
|
||||||
|
"(no extraMount with containerPath=/mnt).",
|
||||||
|
"",
|
||||||
|
"Kind applies extraMounts only at cluster creation — "
|
||||||
|
"neither kind nor Docker supports adding bind mounts to "
|
||||||
|
"a running container. Without a recreate, any PV backed "
|
||||||
|
"by one of the missing mounts will silently fall through "
|
||||||
|
"to the node's overlay filesystem and lose data on "
|
||||||
|
"cluster destroy.",
|
||||||
|
"",
|
||||||
|
"Fix: destroy and recreate the cluster with a kind-config "
|
||||||
|
"that sets 'kind-mount-root' so future stacks can share "
|
||||||
|
"an umbrella without recreating.",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
lines.append("")
|
||||||
|
lines.append("See docs/deployment_patterns.md.")
|
||||||
raise DeployerException("\n".join(lines))
|
raise DeployerException("\n".join(lines))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue