diff options
| author | Sam Yaple <sam@yaple.net> | 2015-09-30 11:23:39 +0000 |
|---|---|---|
| committer | Sam Yaple <sam@yaple.net> | 2015-10-06 03:30:26 +0000 |
| commit | cb4e875ae1e1ec2e6ddf8a6b37f42283697fd50c (patch) | |
| tree | da1028203186b45f869828dc5b4d17c13fadea94 /docker/neutron | |
| parent | 3a56ce182662bcc9cf753024275034907ea36032 (diff) | |
| download | kolla-cb4e875ae1e1ec2e6ddf8a6b37f42283697fd50c.tar.gz kolla-cb4e875ae1e1ec2e6ddf8a6b37f42283697fd50c.zip | |
Common start.sh
The majority of the start.sh code is identical. This removes that
duplicate code while still maintaining the ability to call code in a
specific container.
The start.sh is moved into /usr/local/bin/kolla_start in the container
The extend_start.sh script is called by the kolla_start script at the
location /usr/local/bin/kolla_extend_start . It always exists because
we create a noop kolla_extend_start in the base directory. We override
it with extend_start.sh in a specific image should we need to.
Of note, the neutron-agents container is exempt from this new
structure due to it being a fat container.
Additionally, we fix the inconsistent permissions throughout. 644 for
repo files and the scripts are set to 755 via a Docker RUN command to
ensure someones local perm change won't break upstream containers.
Change-Id: I7da8d19965463ad30ee522a71183e3f092e0d6ad
Closes-Bug: #1501295
Diffstat (limited to 'docker/neutron')
| -rw-r--r-- | docker/neutron/neutron-agents/Dockerfile.j2 | 1 | ||||
| -rw-r--r-- | docker/neutron/neutron-agents/config-sudoers.sh (renamed from docker/neutron/neutron-base/config-sudoers.sh) | 0 | ||||
| -rwxr-xr-x | docker/neutron/neutron-agents/start.sh | 4 | ||||
| -rw-r--r-- | docker/neutron/neutron-base/Dockerfile.j2 | 3 | ||||
| -rw-r--r-- | docker/neutron/neutron-base/extend_start.sh | 11 | ||||
| -rw-r--r--[-rwxr-xr-x] | docker/neutron/neutron-base/ip_wrapper.py | 4 | ||||
| -rw-r--r-- | docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 | 7 | ||||
| -rwxr-xr-x | docker/neutron/neutron-linuxbridge-agent/start.sh | 8 | ||||
| -rw-r--r-- | docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 | 7 | ||||
| -rwxr-xr-x | docker/neutron/neutron-openvswitch-agent/start.sh | 8 | ||||
| -rw-r--r-- | docker/neutron/neutron-server/Dockerfile.j2 | 5 | ||||
| -rw-r--r--[-rwxr-xr-x] | docker/neutron/neutron-server/extend_start.sh (renamed from docker/neutron/neutron-server/start.sh) | 14 |
12 files changed, 33 insertions, 39 deletions
diff --git a/docker/neutron/neutron-agents/Dockerfile.j2 b/docker/neutron/neutron-agents/Dockerfile.j2 index 3fb1ffe30..2967222f4 100644 --- a/docker/neutron/neutron-agents/Dockerfile.j2 +++ b/docker/neutron/neutron-agents/Dockerfile.j2 @@ -31,6 +31,7 @@ COPY fwaas_driver.ini /etc/neutron/ COPY neutron-dhcp-agent/ /opt/kolla/neutron-dhcp-agent COPY neutron-l3-agent/ /opt/kolla/neutron-l3-agent COPY neutron-metadata-agent/ /opt/kolla/neutron-metadata-agent +COPY config-sudoers.sh /opt/kolla/ COPY start.sh / diff --git a/docker/neutron/neutron-base/config-sudoers.sh b/docker/neutron/neutron-agents/config-sudoers.sh index 82cf0d624..82cf0d624 100644 --- a/docker/neutron/neutron-base/config-sudoers.sh +++ b/docker/neutron/neutron-agents/config-sudoers.sh diff --git a/docker/neutron/neutron-agents/start.sh b/docker/neutron/neutron-agents/start.sh index 8b5f302cf..baf3d2a8e 100755 --- a/docker/neutron/neutron-agents/start.sh +++ b/docker/neutron/neutron-agents/start.sh @@ -1,7 +1,7 @@ #!/bin/bash set -o errexit -# Loading common functions. -source /opt/kolla/kolla-common.sh +# Processing /opt/kolla/config_files/config.json +python /opt/kolla/set_configs.py exec /usr/bin/supervisord diff --git a/docker/neutron/neutron-base/Dockerfile.j2 b/docker/neutron/neutron-base/Dockerfile.j2 index 8560d72d5..fe073d8cf 100644 --- a/docker/neutron/neutron-base/Dockerfile.j2 +++ b/docker/neutron/neutron-base/Dockerfile.j2 @@ -40,4 +40,5 @@ RUN ln -s neutron-base-source/* neutron \ {% endif %} -COPY config-sudoers.sh /opt/kolla/ +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start diff --git a/docker/neutron/neutron-base/extend_start.sh b/docker/neutron/neutron-base/extend_start.sh new file mode 100644 index 000000000..07212efce --- /dev/null +++ b/docker/neutron/neutron-base/extend_start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Neutron uses rootwrap which requires a tty for sudo. +# Since the container is running in daemon mode, a tty +# is not present and requiretty must be commented out. +if [ ! -f /sudo-modified ]; then + chmod 0640 /etc/sudoers + sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers + chmod 0440 /etc/sudoers + touch /sudo-modified +fi diff --git a/docker/neutron/neutron-base/ip_wrapper.py b/docker/neutron/neutron-base/ip_wrapper.py index 591fca6f4..871c615ab 100755..100644 --- a/docker/neutron/neutron-base/ip_wrapper.py +++ b/docker/neutron/neutron-base/ip_wrapper.py @@ -19,7 +19,9 @@ # access all of the neutron network namespaces as well as all # containers that bind mount /run/netns from the host. -# This is required for "thin" neutron containers to function properly +# This is required for "thin" neutron containers to function properly. However, +# due to a missing feature/bug in Docker it is not possible to use this script +# at this time. Once Docker updates with this feature we will usre this again. import nsenter import subprocess diff --git a/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 b/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 index 360afc4d1..179890b46 100644 --- a/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-linuxbridge-agent/Dockerfile.j2 @@ -15,13 +15,10 @@ RUN yum install -y \ {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} # Install required packages -RUN yum install -y ebtables && yum clean all +RUN yum install -y ebtables \ + && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/neutron/neutron-linuxbridge-agent/start.sh b/docker/neutron/neutron-linuxbridge-agent/start.sh deleted file mode 100755 index 6c4b09679..000000000 --- a/docker/neutron/neutron-linuxbridge-agent/start.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh -source /opt/kolla/config-sudoers.sh - -exec $CMD diff --git a/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 b/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 index b6e797b0c..5e659f5a0 100644 --- a/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 +++ b/docker/neutron/neutron-openvswitch-agent/Dockerfile.j2 @@ -15,15 +15,10 @@ RUN yum install -y \ {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %} # Install required packages -RUN yum install -y \ - openvswitch \ +RUN yum install -y openvswitch \ && yum clean all {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] - {{ include_footer }} diff --git a/docker/neutron/neutron-openvswitch-agent/start.sh b/docker/neutron/neutron-openvswitch-agent/start.sh deleted file mode 100755 index 6c4b09679..000000000 --- a/docker/neutron/neutron-openvswitch-agent/start.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh -source /opt/kolla/config-sudoers.sh - -exec $CMD diff --git a/docker/neutron/neutron-server/Dockerfile.j2 b/docker/neutron/neutron-server/Dockerfile.j2 index 12a9b2df7..5fcf47a78 100644 --- a/docker/neutron/neutron-server/Dockerfile.j2 +++ b/docker/neutron/neutron-server/Dockerfile.j2 @@ -23,8 +23,7 @@ RUN yum install -y which \ {% endif %} {% endif %} -COPY start.sh / - -CMD ["/start.sh"] +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start {{ include_footer }} diff --git a/docker/neutron/neutron-server/start.sh b/docker/neutron/neutron-server/extend_start.sh index cf30a7f0a..c832d586d 100755..100644 --- a/docker/neutron/neutron-server/start.sh +++ b/docker/neutron/neutron-server/extend_start.sh @@ -1,8 +1,4 @@ #!/bin/bash -set -o errexit - -# Loading common functions. -source /opt/kolla/kolla-common.sh # Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases # of the KOLLA_BOOTSTRAP variable being set, including empty. @@ -11,4 +7,12 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then exit 0 fi -exec $CMD +# Neutron uses rootwrap which requires a tty for sudo. +# Since the container is running in daemon mode, a tty +# is not present and requiretty must be commented out. +if [ ! -f /sudo-modified ]; then + chmod 0640 /etc/sudoers + sed -i '/Defaults requiretty/s/^/#/' /etc/sudoers + chmod 0440 /etc/sudoers + touch /sudo-modified +fi |
