Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type/Provider docker_stack should support passing flags to docker stack deploy #536

Closed
jacksgt opened this issue Oct 11, 2019 · 1 comment · Fixed by #537
Closed

Type/Provider docker_stack should support passing flags to docker stack deploy #536

jacksgt opened this issue Oct 11, 2019 · 1 comment · Fixed by #537

Comments

@jacksgt
Copy link
Contributor

jacksgt commented Oct 11, 2019

Use Case

The type/provider docker_stack does not support various flags for docker stack deploy, unlike the now deprecated define docker::stack:

define docker::stack(
  Optional[Pattern[/^present$|^absent$/]] $ensure                = 'present',
  Optional[String] $stack_name                                   = undef,
  Optional[String] $bundle_file                                  = undef,
  Optional[Array] $compose_files                                 = undef,
  Optional[Boolean] $prune                                       = false,
  Optional[Boolean] $with_registry_auth                          = false,
  Optional[Pattern[/^always$|^changed$|^never$/]] $resolve_image = undef,
)

Flags such as --with-registry-auth therefore not be passed to docker.

Here is the full list of Flags supported by Docker:

Usage:  docker stack deploy [OPTIONS] STACK

Deploy a new stack or update an existing stack

Aliases:
  deploy, up

Options:
      --bundle-file string     Path to a Distributed Application Bundle file
  -c, --compose-file strings   Path to a Compose file, or "-" to read from stdin
      --orchestrator string    Orchestrator to use (swarm|kubernetes|all)
      --prune                  Prune services that are no longer referenced
      --resolve-image string   Query the registry to resolve image digest and supported platforms ("always"|"changed"|"never") (default "always")
      --with-registry-auth     Send registry authentication details to Swarm agents

Describe the Solution You Would Like

These flags should be implemented as parameters in https://github.com/puppetlabs/puppetlabs-docker/blob/master/lib/puppet/provider/docker_stack/ruby.rb

Alternatively, just taking an arbitrary parameter such as extra_flags which then gets appended to the generated flags is also a possibility.

@jacksgt
Copy link
Contributor Author

jacksgt commented Oct 11, 2019

I'm sorry, after checking the source code (and trying to implement the above mentioned solution), I realized that the functionality is actually present, just the documentation a bit lacking.

docker_stack { 'test':
  compose_files => ['/tmp/docker-compose.yml'],
  ensure  => present,
  up_args => '--with-registry-auth',
}

I have therefore submitted a PR clarifying the usage of the docker stack type as well as fixing the link in the README: https://github.com/puppetlabs/puppetlabs-docker/pull/537/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant