docker / app

Make your Docker Compose applications reusable, and share them on Docker Hub
Apache License 2.0
1.57k stars 176 forks source link

Subkeys render error - max_replicas_per_node #688

Closed johnbizokk closed 4 years ago

johnbizokk commented 4 years ago

Description

The latest version of the Docker CE distribution introduced the schema version (3.8) which supports the new key in the deploy section of the service declaration - max_replicas_per_node. In the meantime, this key doesn't have a related interpolation type in the - interpolate.go. Also, it looks similar to the following issue - https://github.com/docker/app/issues/559.

Steps to reproduce the issue:

  1. Create the docker-compose file with the following content - see the Annex №1 below
  2. Create the parameters.yml file with the following content - see the Annex №2 below
  3. Create the metadata.yml file with the following content - see the Annex №3 below
  4. Execute the following command - docker app render

Describe the results you received:

Unfortunately, we have received the following errors:

Describe the results you expected:

We are expecting from the docker app binary to render the values correctly.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Client: Docker Engine - Community
 Version:           19.03.3
 API version:       1.40
 Go version:        go1.12.10
 Git commit:        a872fc2f86
 Built:             Tue Oct  8 00:58:10 2019
 OS/Arch:           linux/amd64
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          19.03.3
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.12.10
  Git commit:       a872fc2f86
  Built:            Tue Oct  8 00:56:46 2019
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.2.10
  GitCommit:        b34a5c8af56e510852c35414db4c1f4fa6172339
 runc:
  Version:          1.0.0-rc8+dev
  GitCommit:        3e425f80a8c931f88e6d94a8c831b9d5aa481657
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683

Output of docker app version:


Version:               v0.8.0
Git commit:            7eea32b
Built:                 Tue Oct  8 01:00:29 2019
OS/Arch:               linux/amd64
Experimental:          off
Renderers:             none
Invocation Base Image: docker/cnab-app-base:v0.8.0

Output of docker info:


Client:
 Debug Mode: false
 Plugins:
  app: Docker Application (Docker Inc., v0.8.0)
  buildx: Build with BuildKit (Docker Inc., v0.3.1-tp-docker)

Server:
 Containers: XX
  Running: XX
  Paused: XX
  Stopped: XX
 Images: XX
 Server Version: 19.03.3
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: local
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: active
  NodeID: ID
  Is Manager: true
  ClusterID: ID
  Managers: X
  Nodes: X
  Default Address Pool: XX.XX.XX.XX/X
  SubnetSize: 24
  Data Path Port: XXXX
  Orchestration:
   Task History Retention Limit: 5
  Raft:
   Snapshot Interval: 10000
   Number of Old Snapshots to Retain: 0
   Heartbeat Tick: 1
   Election Tick: 10
  Dispatcher:
   Heartbeat Period: 5 seconds
  CA Configuration:
   Expiry Duration: 3 months
   Force Rotate: 0
  Autolock Managers: false
  Root Rotation In Progress: false
  Node Address: XX.XX.XX.XX
  Manager Addresses:
   XX.XX.XX.XX:XXXX
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.3.6-1.el7.elrepo.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: XX
 Total Memory: XX.XGiB
 Name: NAME
 ID: ID
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
  processor-cores=XX
 Experimental: true
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: bridge-nf-call-ip6tables is disabled

Additional environment details (AWS, VirtualBox, physical, etc.):

Annex №1 (docker-compose.yml)


version: '3.8'
x-preferences: &default-preferences
  preferences:
    - spread: "${placement.preferences.labels}"
x-constraints: &default-constraints
  constraints:
    - "node.hostname == ${placement.constraints.node.hostname}"
x-placement: &default-placement
  placement:
    max_replicas_per_node: ${placement.max_replicas}
    <<: [ *default-preferences, *default-constraints ]
services:
  php-fpm:
    image: 'php'
    deploy:
      *default-placement

Annex №2 (parameters.yml)


placement:
  preferences:
    labels: node.labels.guest-master
  constraints:
    node:
      hostname: docker.app.test
  max_replicas: 1

Annex №3 (metadata.yml)


version: 1.0.0
name: yet-another-project
description: "project description"
namespace: "domain.com/yap"
maintainers:
  - name: contributor
    email: "contributor@domain.com"
silvin-lubecki commented 4 years ago

Hello @johnbizokk thank you for catching that 👍 Do you feel confident enough to open a PR with a fix inspired by https://github.com/docker/cli/pull/1973 (I can assist you on it if needed) ? Otherwise I will of course fix it 😄

johnbizokk commented 4 years ago

@silvin-lubecki Thanks for the suggestion. I hope to send the PR in the next couple of days.

silvin-lubecki commented 4 years ago

Thanks a lot @johnbizokk 👍 Feel free to ask anything if you are blocked.

rumpl commented 4 years ago

I opened a PR on the cli for this

rumpl commented 4 years ago

Reopening this since we need to update our dependency to get this change.

thaJeztah commented 4 years ago

probably needs to be reopened again; sorry I didn't spot you included it in the commit message, otherwise I'd have warned you for this

rumpl commented 4 years ago

No problem :)