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

add support for dns nameservers and search domains in stack files #32059

Merged
merged 1 commit into from Apr 11, 2017

Conversation

@seriousben
Contributor

seriousben commented Mar 24, 2017

- What I did

Added support for dns config flags in stack files. (only nameservers and search domain)

version: '3'

services:
  busybox:
    image: busybox:latest
    dns:
      ### 8.8.8.8 is an example
      - 8.8.8.8

- How I did it

docker service create --dns x.x.x.x ... is supported right now but stack files do not support it.
I just simply hooked the ServiceConfig with the ContainerSpec used in ServiceSpec

- How to verify it

  1. docker swarm init

  2. stack deploy behaviour before this PR

$ docker stack deploy -c docker-compose.yml test
Ignoring unsupported options: dns

Creating network testing_default
Creating service testing_busybox
  1. stack inspect
$ docker service inspect testing_busybox
[
    {
        "ID": "lp97yfpg5mnljpaqn67eu8sys",
        "Version": {
            "Index": 1311
        },
        "CreatedAt": "2017-03-23T23:56:10.907936203Z",
        "UpdatedAt": "2017-03-23T23:56:10.921987465Z",
        "Spec": {
            "Name": "testing_busybox",
            "Labels": {
                "com.docker.stack.namespace": "testing"
            },
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f",
                    "Labels": {
                        "com.docker.stack.namespace": "testing"
                    }
                },
                ...
            },
            ...
        }
    }
]
  1. stack deploy behaviour with this PR
$ docker stack deploy -c docker-compose-test.yml testing
Creating network testing_default
Creating service testing_busybox
  1. stack inspect

Notice the DNSConfig is passed in correctly.

$ docker service inspect testing_busybox
[
    {
        "ID": "93mp786llsintm6i8ua6eix0w",
        "Spec": {
            "Name": "testing_busybox",
            "Labels": {
                "com.docker.stack.namespace": "testing"
            },
            "TaskTemplate": {
                "ContainerSpec": {
                    "Image": "busybox:latest@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f",
                    "Labels": {
                        "com.docker.stack.namespace": "testing"
                    },
                    #
                    # DNSConfig are created correctly
                    #
                    "DNSConfig": {
                        "Nameservers": [
                            "8.8.8.8"
                        ]
                    }
                    #
                    #
                },
                ...
              },
           ...
        }
    }
]

- Description for the changelog

add support for dns nameservers and search domains in stack files

- A picture of a cute animal (not mandatory but encouraged)

landseer

Fixes #29685

@seriousben seriousben changed the title from adds support for dns in stack files to add support for dns in stack files Mar 24, 2017

@GordonTheTurtle GordonTheTurtle removed the dco/no label Mar 24, 2017

@seriousben seriousben changed the title from add support for dns in stack files to add support for dns nameservers and search domains in stack files Mar 24, 2017

@vdemeester

@dnephin I don't remember if there was a reason for not supporting it (other than not available in the service/create endpoint at that time 👼

Design SGTM otherwise 👍

@seriousben

This comment has been minimized.

Show comment
Hide comment
@seriousben

seriousben Mar 27, 2017

Contributor

Cool. I will go forward with a test and also not sending an empty DNSConfig if no dns options are passed in.

Contributor

seriousben commented Mar 27, 2017

Cool. I will go forward with a test and also not sending an empty DNSConfig if no dns options are passed in.

@dnephin

This comment has been minimized.

Show comment
Hide comment
@dnephin

dnephin Apr 7, 2017

Member

Design LGTM

Member

dnephin commented Apr 7, 2017

Design LGTM

@dnephin

This comment has been minimized.

Show comment
Hide comment
@dnephin

dnephin Apr 7, 2017

Member

I guess they are already in the jsonschema

Member

dnephin commented Apr 7, 2017

I guess they are already in the jsonschema

@seriousben

This comment has been minimized.

Show comment
Hide comment
@seriousben

seriousben Apr 7, 2017

Contributor

I will add a test for the conversion and will ping you when done.

Contributor

seriousben commented Apr 7, 2017

I will add a test for the conversion and will ping you when done.

Adding support for dns in stack files
Signed-off-by: Benjamin Boudreau <boudreau.benjamin@gmail.com>
@seriousben

This comment has been minimized.

Show comment
Hide comment
@seriousben

seriousben Apr 11, 2017

Contributor

@dnephin Just added some tests. I believe this PR is ready to go.

Contributor

seriousben commented Apr 11, 2017

@dnephin Just added some tests. I believe this PR is ready to go.

@vdemeester

LGTM 🐯

@dnephin

LGTM

@vdemeester vdemeester merged commit 8a8c196 into moby:master Apr 11, 2017

6 checks passed

dco-signed All commits are signed
experimental Jenkins build Docker-PRs-experimental 32809 has succeeded
Details
janky Jenkins build Docker-PRs 41419 has succeeded
Details
powerpc Jenkins build Docker-PRs-powerpc 1607 has succeeded
Details
windowsRS1 Jenkins build Docker-PRs-WoW-RS1 12550 has succeeded
Details
z Jenkins build Docker-PRs-s390x 1487 has succeeded
Details

@seriousben seriousben deleted the seriousben:support-dns-stack-file branch Apr 11, 2017

@thaJeztah thaJeztah added this to the 17.06 milestone Apr 15, 2017

dnephin pushed a commit to dnephin/docker that referenced this pull request Apr 17, 2017

Merge pull request moby#32059 from seriousben/support-dns-stack-file
add support for dns nameservers and search domains in stack files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment