Add mount propagation mode for hostpath mounts on kubernetes
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you can request access to GitLab Duo.
What does this MR do?
Adds ability to set mount propagation mode for hostpath mounts on kubernetes executors. Also adds documentation for it
Why was this MR needed?
Currently it's not possible to set the mount propagation property for hostPath volumes, so for example mounting an autofs mounted volume from the host will not work from containers.
To achieve this currently we have to use a mutation policy with an annotation on the runners to inject the volumes.
What's the best way to test this MR?
The following configuration can be used to test this change:
[[runners.kubernetes.volumes.hostpath]]
name = "volume-name"
mount_path = "/volume-path"
mount_propagation = "HostToContainer"
read_only = true
host_path = "/path/on/host"
What are the relevant issue numbers?
closes #4767 (closed)
Edited by Hannes Hörl