From 86a5c8cb79e9a006696012efd4f0f6bbea25cd16 Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Mon, 24 Oct 2016 15:15:23 +0200 Subject: [PATCH] Add chrony docker image Partially-implements: blueprint add-chrony-service Change-Id: If8045c62656ffc0090d0c02ca0fbe58ab8c5f29f --- docker/chrony/Dockerfile.j2 | 23 +++++++++++++++++++++++ docker/chrony/extend_start.sh | 10 ++++++++++ kolla/common/config.py | 12 ++++++------ 3 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 docker/chrony/Dockerfile.j2 create mode 100644 docker/chrony/extend_start.sh diff --git a/docker/chrony/Dockerfile.j2 b/docker/chrony/Dockerfile.j2 new file mode 100644 index 0000000000..8443bcc4e8 --- /dev/null +++ b/docker/chrony/Dockerfile.j2 @@ -0,0 +1,23 @@ +FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }} +MAINTAINER {{ maintainer }} + +{% block chrony_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% set chrony_packages = ['chrony'] %} + +{% if base_distro in ['ubuntu', 'debian'] %} +# Ubuntu use _chrony username to use unified running user with RHEL system +RUN useradd --user-group --create-home --home-dir /var/lib/chrony chrony +{% endif %} + +{{ macros.install_packages(chrony_packages | customizable("packages")) }} + +COPY extend_start.sh /usr/local/bin/kolla_extend_start +RUN chmod 755 /usr/local/bin/kolla_extend_start \ + && usermod -a -G kolla chrony + +{% block chrony_footer %}{% endblock %} +{% block footer %}{% endblock %} +{{ include_footer }} diff --git a/docker/chrony/extend_start.sh b/docker/chrony/extend_start.sh new file mode 100644 index 0000000000..80af48dba9 --- /dev/null +++ b/docker/chrony/extend_start.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +rm -f /var/run/chronyd.pid + +if [[ ! -d "/var/log/kolla/chrony" ]]; then + mkdir -p /var/log/kolla/chrony +fi +if [[ $(stat -c %a /var/log/kolla/chrony) != "755" ]]; then + chmod 755 /var/log/kolla/chrony +fi diff --git a/kolla/common/config.py b/kolla/common/config.py index 5c00f68375..2a990f5123 100644 --- a/kolla/common/config.py +++ b/kolla/common/config.py @@ -52,15 +52,15 @@ _PROFILE_OPTS = [ 'zaqar'], help='Aux Images'), cfg.ListOpt('default', - default=['cron', 'kolla-toolbox', 'glance', 'haproxy', - 'heat', 'horizon', 'keepalived', 'keystone', - 'memcached', 'mariadb', 'neutron', 'nova', + default=['chrony', 'cron', 'kolla-toolbox', 'glance', + 'haproxy', 'heat', 'horizon', 'keepalived', + 'keystone', 'memcached', 'mariadb', 'neutron', 'nova', 'openvswitch', 'rabbitmq', 'heka'], help='Default images'), cfg.ListOpt('gate', - default=['cron', 'glance', 'haproxy', 'keepalived', 'keystone', - 'kolla-toolbox', 'mariadb', 'memcached', 'neutron', - 'nova', 'openvswitch', 'rabbitmq', 'heka'], + default=['chrony', 'cron', 'glance', 'haproxy', 'keepalived', + 'keystone', 'kolla-toolbox', 'mariadb', 'memcached', + 'neutron', 'nova', 'openvswitch', 'rabbitmq', 'heka'], help='Gate images') ]