TritonDataCenter / sdc-docker

Docker Engine for Triton
Mozilla Public License 2.0
182 stars 49 forks source link

New compose spec breaks volume labels #156

Open teutat3s opened 3 years ago

teutat3s commented 3 years ago

I'm not sure if this is the right place to report this - I'd like to share the following findings though.

Docker Compose v1.27+ introduced a new unified compose spec that seems to cause some breakage with the triton docker API

PI: 20200716T142843Z

sdc-docker version: release-20210128-20210128T003947Z-ge75d796
docker-compose --version
docker-compose version 1.28.5, build c4eb3a1f
triton-compose --version
docker-compose version 1.26.2, build eefe0d31

docker-compose.yml example similar to https://apidocs.joyent.com/docker/features/volumes

version: '2.2'
services:
  es01:
    image: busybox
    command: sleep 8640000
    container_name: volconsumer1
    volumes:
      - data01:/data
    networks:
      - fabric
    labels:
      - "com.docker.swarm.affinities=[\"volumename==data01\"]"

  es02:
    image: busybox
    command: sleep 8640000
    container_name: volconsumer2
    volumes:
      - data02:/data
    networks:
      - fabric
    labels:
      - "com.docker.swarm.affinities=[\"volumename==data02\"]"

volumes:
  data01:
    driver: tritonnfs
    labels:
      - role=volume
      - volumename=data01
      - "com.docker.swarm.affinities=[\"role!=volume\"]"

  data02:
    driver: tritonnfs
    labels:
      - role=volume
      - volumename=data02
      - "com.docker.swarm.affinities=[\"role!=volume\"]"

networks:
  fabric:
    driver: bridge
    external: true
    name: My-Fabric-Network

VOLAPI payload before compose v1.27.0 (tested with v1.26.2)

[2021-03-24T19:59:05.950Z] DEBUG: docker/79870 on 88e4c263-658f-4b02-a698-d5637a256f81: Sending req
uest to VOLAPI for volume creation (req_id=9e3d19f9-1f54-4b74-9220-db197c06e6f2, account=aab0f485-6
9e7-467f-a86e-9b4d4a4875ad, login=test)
    payload: {
      "labels": {
        "role": "volume",
        "volumename": "test-volume",
        "com.docker.swarm.affinities": "[\"role!=volume\"]",
        "com.docker.compose.project": "blue",
        "com.docker.compose.volume": "test-volume",
        "com.docker.compose.version": "1.26.2"
      },
      "name": "test-volume",
      "network": "test-network",
      "type": "tritonnfs"
    }

VOLAPI payload after v1.27.0 (tested with v1.28.5)

(labels missing)

[2021-03-24T19:51:33.043Z] DEBUG: docker/79870 on 88e4c263-658f-4b02-a698-d5637a256f81: Sending req
uest to VOLAPI for volume creation (req_id=ce1feb6b-cdb4-49cc-86a4-a1106ea89708, account=aab0f485-6
9e7-467f-a86e-9b4d4a4875ad, login=test)
   payload: {
      "name": "test-volume",
      "network": "test-network",
      "type": "tritonnfs"
    }
bahamat commented 3 years ago

@teutat3s Can you provide an example log from sdc-docker showing the differences in the requests it's receiving from docker-compose?