gitlab-runner merge requestshttps://staging.gitlab.com/gitlab-org/gitlab-runner/-/merge_requests2017-07-05T15:33:23Zhttps://staging.gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/516Kubernetes volumes2017-07-05T15:33:23ZZeger-Jan van de Wegzegerjan@gitlab.comKubernetes volumesContinuing 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 ma...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:
```toml
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
```
Any `mounts` configured must have a matching `volumes`
## 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?
- [ ] Documentation created/updated
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
## What are the relevant issue numbers?
Closes #1876, #1759, !3319.3Kamil TrzcińśkiKamil Trzcińśki