Continuing the work of @jon-walton, to support Kubernetes volumes.
What does this MR do?
This MR adds basic volume support to the Kubernetes runner. Kubernetes volumes work differently to docker such that it's possible to mount many different types of storage into the container. To reflect this and to make it easy to implement other sources into the runner in the future, I've implemented the source and the container mount as separate config items (the structure is very similar to a kubernetes config file).
For now, only
HostPathVolumeSource is supported
An example config.toml would be:
concurrent = 2 [[runners]] name = "Kubernetes Runner" url = "https://gitlab.com/ci" token = "TOKEN" executor = "kubernetes" [runners.kubernetes] namespace = "gitlab" privileged = true [[runners.kubernetes.mounts]] name = "docker" mount_path = "/var/run/docker.sock" [[runners.kubernetes.volumes.host_paths]] name = "docker" path = "/var/run/docker.sock" [[runners.kubernetes.mounts]] name = "cache" mount_path = "/cache/" [[runners.kubernetes.volumes.host_paths]] name = "cache" path = "/tmp/gitlab-ci-cache/" [runners.cache] Insecure = false
mounts configured must have a matching
Why was this MR needed?
I have a requirement to bind the docker socket into the build pods because I do not want to use docker:dind. Binding the socket gains me local image caching and no risk of name conflicts because kubernetes appends a random string to each pod's name
Are there points in the code the reviewer needs to double check?
This is my first look into golang, so please let me know if I've done anything wrong. If the general direction is sound, I will go ahead and add documentation.
Does this MR meet the acceptance criteria?
Added for this feature/bug
All builds are passing
Branch has no merge conflicts with
master(if you do - rebase it please)