Skip to content

[k8s] updating a stack with secrets should detect that the secret didn't change #777

@thaJeztah

Description

@thaJeztah

This came up in review of #721 (comment)

When re-deploying a stack that's deployed on kubernetes, deploy fails if the stack uses a secret (or config)

Secrets are immutable, but when using swarmkit, docker detects if the content didn't change, and in that case skips creating/updating the secret (and only produces an error if the secret/config changed);

To reproduce;

echo hello world > my_secret.txt

Deploy a stack that uses the secret;

version: '3.4'
services:
  db:
    image: nginx:alpine
    secrets:
      - source: mysecret
        target: /some/other/path/bladiebla

secrets:
  mysecret:
    file: ./my_secret.txt
docker stack deploy -c docker-compose.yml stack1
Stack stack1 was created
Waiting for the stack to be stable and running...
 - Service db has one container running
 - Service web has one container running
Stack stack1 is stable and running

And re-deploy the stack;

$ docker stack deploy -c docker-compose.yml stack1
secrets "mysecret" already exists

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions