Skip to content

[k8s] stacks should have their own namespace #776

@thaJeztah

Description

@thaJeztah

When using stacks with docker-compose or docker stack deploy (on SwarmKit), services are prefixed with the name of the stack. This came up in the review of #721 (comment)

When deploying a stack to Kubernetes, no prefix is added, which prevents multiple stacks with a service having the same name to be deployed.

For example:

version: '3.4'
services:
  web:
    image: nginx:alpine
$ docker stack deploy -c docker-compose.yml stack1
Stack stack1 was created
Waiting for the stack to be stable and running...
 - Service web has one container running
Stack stack1 is stable and running

Deploying the same stack again but with a different name;

$  docker stack deploy -c docker-compose.yml stack2
service web already present in stack named stack1

We should either prefix service names (as we do in swarmkit/docker-compose), or automatically use a namespace for each stack, similar to;

$ docker stack deploy --namespace com.docker.stacks.stack2 -c docker-compose.yml stack2

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions