drone / drone-runtime

[DEPRECATED] migrated to https://github.com/drone-runners
Other
62 stars 43 forks source link

Kubernetes temporary volumes use all same hostpath #41

Closed everflux closed 5 years ago

everflux commented 5 years ago

I am using the Kubenetes executor for drone. This is a snipped from the drone.yml

services:
- name: foo
  image: bar
  ...
  volumes:
  - name: foo
    path: /var/lib/foo
  - name: bar
    path: /data
  - name: baz
    path: /tmp/cache

volumes:
- name: foo
  temp: {}
- name: bar
  temp: {}
- name: baz
  temp: {}

The resulting kubernetes pod spec

 "spec": {
    "volumes": [
      {
        "name": "b9t3ruvez9zrvw828y46jyydk90ety93",
        "hostPath": {
          "path": "/tmp/drone/k4xzoklmyt0rbsrsiw2ec2wluxkyfycx/k4xzoklmyt0rbsrsiw2ec2wluxkyfycx",
          "type": "DirectoryOrCreate"
        }
      },
      {
        "name": "odbfsvn0obxbar794eko88hzkljw6k2n",
        "hostPath": {
          "path": "/tmp/drone/k4xzoklmyt0rbsrsiw2ec2wluxkyfycx/k4xzoklmyt0rbsrsiw2ec2wluxkyfycx",
          "type": "DirectoryOrCreate"
        }
      },
      {
        "name": "gr3hctwvm4kjettjsm0evx10mk5vqf5l",
        "hostPath": {
          "path": "/tmp/drone/k4xzoklmyt0rbsrsiw2ec2wluxkyfycx/k4xzoklmyt0rbsrsiw2ec2wluxkyfycx",
          "type": "DirectoryOrCreate"
        }
      }
    ],
...
"volumeMounts": [
          {
            "name": "b9t3ruvez9zrvw828y46jyydk90ety93",
            "mountPath": "/var/lib/foo"
          },
          {
            "name": "odbfsvn0obxbar794eko88hzkljw6k2n",
            "mountPath": "/data"
          },
          {
            "name": "gr3hctwvm4kjettjsm0evx10mk5vqf5l",
            "mountPath": "/tmp/cache"
          }
        ],

This leads to the problem that the data is all mixed in the same directory.

bradrydzewski commented 5 years ago

EDITED: sorry, I misread the issue. This was an actual bug, however, it has already been resolved in head, so I am going to leave the issue closed.