markusthoemmes closed pull request #3622: make containers' timezone sync with
the docker host
URL: https://github.com/apache/incubator-openwhisk/pull/3622
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/ansible/group_vars/all b/ansible/group_vars/all
index 286b8e4051..6c539e2c28 100644
--- a/ansible/group_vars/all
+++ b/ansible/group_vars/all
@@ -246,6 +246,7 @@ docker:
pull:
retries: 10
delay: 10
+ tz_path: "{% if ansible_system == 'Darwin' %}/tmp/localtime{% else
%}/etc/localtime{% endif %}"
sdk:
dir:
diff --git a/ansible/roles/apigateway/tasks/deploy.yml
b/ansible/roles/apigateway/tasks/deploy.yml
index 69a116ad97..abf3680e8e 100644
--- a/ansible/roles/apigateway/tasks/deploy.yml
+++ b/ansible/roles/apigateway/tasks/deploy.yml
@@ -3,6 +3,14 @@
---
# This role will install apigateway
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: (re)start apigateway
docker_container:
name: apigateway
@@ -19,6 +27,8 @@
ports:
- "{{ apigateway.port.mgmt }}:8080"
- "{{ apigateway.port.api }}:9000"
+ volumes:
+ - "{{ docker.tz_path }}:/etc/localtime"
pull: "{{ apigateway_local_build is undefined }}"
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"
diff --git a/ansible/roles/controller/tasks/deploy.yml
b/ansible/roles/controller/tasks/deploy.yml
index a86f0ee1e2..bdb8aacbdc 100644
--- a/ansible/roles/controller/tasks/deploy.yml
+++ b/ansible/roles/controller/tasks/deploy.yml
@@ -240,6 +240,14 @@
include_tasks: "{{ item }}.yml"
with_items: "{{ controller_plugins | default([]) }}"
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: (re)start controller
docker_container:
name: "{{ controller_name }}"
@@ -253,6 +261,7 @@
volumes:
- "{{ whisk_logs_dir }}/{{ controller_name }}:/logs"
- "{{ controller.confdir }}/{{ controller_name }}:/conf"
+ - "{{ docker.tz_path }}:/etc/localtime"
ports: "{{ ports_to_expose }}"
command:
/bin/sh -c
diff --git a/ansible/roles/couchdb/tasks/deploy.yml
b/ansible/roles/couchdb/tasks/deploy.yml
index b59c23d044..0981f8dea4 100644
--- a/ansible/roles/couchdb/tasks/deploy.yml
+++ b/ansible/roles/couchdb/tasks/deploy.yml
@@ -23,6 +23,14 @@
volume_dir: "{{ instance.volume.fsmount | default( '/mnt/' +
group_names|first, true ) }}:/usr/local/var/lib/couchdb"
when: (block_device is defined) and (block_device in disk_status.stdout)
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: "(re)start CouchDB from '{{ couchdb_image }} ' "
vars:
couchdb_image: "{{ couchdb.docker_image | default('apache/couchdb:' ~
couchdb.version ) }}"
@@ -32,7 +40,7 @@
state: started
recreate: true
restart_policy: "{{ docker.restart.policy }}"
- volumes: "{{volume_dir | default([])}}"
+ volumes: "{{volume_dir | default([])}} + [ '{{ docker.tz_path
}}:/etc/localtime' ]"
ports:
- "{{ db_port }}:5984"
- "4369:4369"
diff --git a/ansible/roles/invoker/tasks/deploy.yml
b/ansible/roles/invoker/tasks/deploy.yml
index 1d50e84bc2..203042338d 100644
--- a/ansible/roles/invoker/tasks/deploy.yml
+++ b/ansible/roles/invoker/tasks/deploy.yml
@@ -218,6 +218,7 @@
- name: set invoker volumes
set_fact:
volumes: "/sys/fs/cgroup:/sys/fs/cgroup,/run/runc:/run/runc,\
+ {{ docker.tz_path }}:/etc/localtime,\
{{ whisk_logs_dir }}/invoker{{
groups['invokers'].index(inventory_hostname) }}:/logs,\
{{ invoker.confdir }}/invoker{{
groups['invokers'].index(inventory_hostname) }}:/conf,\
{{ dockerInfo['DockerRootDir'] }}/containers/:/containers,\
@@ -228,6 +229,14 @@
volumes: "{{ volumes|default('')
}},/usr/lib/x86_64-linux-gnu/libapparmor.so.1:/usr/lib/x86_64-linux-gnu/libapparmor.so.1"
when: ansible_distribution == "Ubuntu"
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: start invoker using docker cli
docker_container:
userns_mode: "host"
diff --git a/ansible/roles/kafka/tasks/deploy.yml
b/ansible/roles/kafka/tasks/deploy.yml
index 9dca8c3f58..70a8e32681 100644
--- a/ansible/roles/kafka/tasks/deploy.yml
+++ b/ansible/roles/kafka/tasks/deploy.yml
@@ -67,6 +67,14 @@
set_fact:
kafka_env_vars: "{{ kafka_env_vars | combine(kafka_non_ssl_vars) }}"
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: "(re)start kafka using '{{ kafka_image }}' "
vars:
zookeeper_idx: "{{ groups['kafkas'].index(inventory_hostname) %
(groups['zookeepers'] | length) }}"
@@ -83,6 +91,7 @@
- "{{ kafka.advertisedPort + groups['kafkas'].index(inventory_hostname)
}}:{{ kafka.advertisedPort + groups['kafkas'].index(inventory_hostname) }}"
volumes:
- "{{ config_root_dir }}/kafka/certs:/config"
+ - "{{ docker.tz_path }}:/etc/localtime"
pull: true
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"
diff --git a/ansible/roles/nginx/tasks/deploy.yml
b/ansible/roles/nginx/tasks/deploy.yml
index c0d73992e8..1c6237920f 100644
--- a/ansible/roles/nginx/tasks/deploy.yml
+++ b/ansible/roles/nginx/tasks/deploy.yml
@@ -50,6 +50,14 @@
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: (re)start nginx
docker_container:
name: nginx
@@ -61,6 +69,7 @@
volumes:
- "{{ whisk_logs_dir }}/nginx:/logs"
- "{{ nginx.confdir }}:/etc/nginx"
+ - "{{ docker.tz_path }}:/etc/localtime"
expose:
- 8443
ports:
diff --git a/ansible/roles/redis/tasks/deploy.yml
b/ansible/roles/redis/tasks/deploy.yml
index e48c92cf60..8c2eb1cca3 100644
--- a/ansible/roles/redis/tasks/deploy.yml
+++ b/ansible/roles/redis/tasks/deploy.yml
@@ -8,6 +8,14 @@
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: (re)start redis
docker_container:
name: redis
@@ -17,6 +25,8 @@
restart_policy: "{{ docker.restart.policy }}"
ports:
- "{{ redis.port }}:6379"
+ volumes:
+ - "{{ docker.tz_path }}:/etc/localtime"
- name: wait until redis is up and running
action: shell (echo PING; sleep 1) | nc {{ ansible_host }} {{ redis.port }}
diff --git a/ansible/roles/registry/tasks/deploy.yml
b/ansible/roles/registry/tasks/deploy.yml
index ba016b2a4b..f01f3cc609 100644
--- a/ansible/roles/registry/tasks/deploy.yml
+++ b/ansible/roles/registry/tasks/deploy.yml
@@ -26,6 +26,14 @@
dest: "{{ registry.confdir }}/certs"
when: registry.gencert
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: (re)start registry with ssl enabled
docker_container:
name: whisk_docker_registry
@@ -40,6 +48,7 @@
- "{{ registry.port }}:5000"
volumes:
- "{{ registry.confdir }}/certs:/certs"
+ - "{{ docker.tz_path }}:/etc/localtime"
when: registry.gencert
- name: (re)start registry with insecure ssl
@@ -51,6 +60,8 @@
hostname: registry
ports:
- "{{ registry.port }}:5000"
+ volumes:
+ - "{{ docker.tz_path }}:/etc/localtime"
when: not registry.gencert
- name: wait until registry in this host is up and running
diff --git a/ansible/roles/zookeeper/tasks/deploy.yml
b/ansible/roles/zookeeper/tasks/deploy.yml
index ea8de824b5..4e3a91dc9b 100644
--- a/ansible/roles/zookeeper/tasks/deploy.yml
+++ b/ansible/roles/zookeeper/tasks/deploy.yml
@@ -8,6 +8,14 @@
retries: "{{ docker.pull.retries }}"
delay: "{{ docker.pull.delay }}"
+- name: copy the /etc/localtime to {{ docker.tz_path }}
+ copy:
+ src: /etc/localtime
+ dest: "{{ docker.tz_path }}"
+ remote_src: yes
+ force: no
+ when: ansible_system == 'Darwin'
+
- name: (re)start zookeeper
docker_container:
name: zookeeper{{ groups['zookeepers'].index(inventory_hostname) }}
@@ -30,6 +38,8 @@
- "{{ zookeeper.port + groups['zookeepers'].index(inventory_hostname)
}}:2181"
- "{{ 2888 + groups['zookeepers'].index(inventory_hostname) }}:2888"
- "{{ 3888 + groups['zookeepers'].index(inventory_hostname) }}:3888"
+ volumes:
+ - "{{ docker.tz_path }}:/etc/localtime"
- name: wait until the Zookeeper in this host is up and running
action: shell (echo ruok; sleep 1) | nc {{ ansible_host }} {{ zookeeper.port
+ groups['zookeepers'].index(inventory_hostname) }}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services