fix(k8s): add HostToContainer mount propagation to kind-mount-root

The kind-mount-root extraMount entry used kind's default propagation
(None), so new bind mounts under the root on the host (e.g. zvols
mounted under /srv/kind) were not visible inside the kind node until
restart. Setting propagation to HostToContainer makes host-side mount
changes propagate into the kind node automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pull/740/head
A. F. Dudley 2026-03-07 12:58:04 +00:00
parent b6d6ad8145
commit 929bdab8a4
1 changed files with 10 additions and 4 deletions

View File

@ -440,8 +440,11 @@ def named_volumes_from_pod_files(parsed_pod_files):
return named_volumes return named_volumes
def get_kind_pv_bind_mount_path(volume_name: str, kind_mount_root: Optional[str] = None, def get_kind_pv_bind_mount_path(
host_path: Optional[str] = None): volume_name: str,
kind_mount_root: Optional[str] = None,
host_path: Optional[str] = None,
):
if kind_mount_root and host_path and host_path.startswith(kind_mount_root): if kind_mount_root and host_path and host_path.startswith(kind_mount_root):
rel = os.path.relpath(host_path, kind_mount_root) rel = os.path.relpath(host_path, kind_mount_root)
return f"/mnt/{rel}" return f"/mnt/{rel}"
@ -596,6 +599,7 @@ def _generate_kind_mounts(parsed_pod_files, deployment_dir, deployment_context):
volume_definitions.append( volume_definitions.append(
f" - hostPath: {kind_mount_root}\n" f" - hostPath: {kind_mount_root}\n"
f" containerPath: /mnt\n" f" containerPath: /mnt\n"
f" propagation: HostToContainer\n"
) )
mount_root_emitted = True mount_root_emitted = True
@ -658,8 +662,10 @@ def _generate_kind_mounts(parsed_pod_files, deployment_dir, deployment_context):
volume_host_path_map[volume_name], volume_host_path_map[volume_name],
deployment_dir, deployment_dir,
) )
# Skip individual extraMount if covered by mount root # Skip if covered by mount root
if mount_root_emitted and str(host_path).startswith(kind_mount_root): if mount_root_emitted and str(host_path).startswith(
kind_mount_root
):
continue continue
container_path = get_kind_pv_bind_mount_path( container_path = get_kind_pv_bind_mount_path(
volume_name volume_name