Skip to content

Commit

Permalink
Added restart always policy to api, controller, dock, authchecker and…
Browse files Browse the repository at this point in the history
… etcd containers to improve the reliability of SODA services when deployed as containers (sodafoundation#450)

* Added restart always policy to api, controller, dock and auth containers

* Added restart policy always for the etcd container

* Added stop and remove etcd container and volume based on configuration. Updated the container config for etcd with volume information.

* Added missing logical operator from condiional check of etcd db removal
  • Loading branch information
anvithks authored Apr 28, 2021
1 parent 95f9e8d commit 7d6853b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
17 changes: 16 additions & 1 deletion ansible/roles/cleaner/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,28 @@
when: install_from == "container"
tags: hotpot

- name: kill etcd containerized service
docker_container:
name: soda-etcd
image: "{{ etcd_docker_image }}"
state: absent
when: install_from == "container"
tags: hotpot

- name: remove etcd volume when installed as containerized service
docker_volume:
name: etcd_data
state: absent
when: install_from == "container" and database_purge is undefined or database_purge == true
tags: hotpot

- name: clean etcd db resource
file:
path: "{{ etcd_dir }}"
state: absent
force: yes
ignore_errors: yes
when: database_purge is undefined or database_purge == true
when: install_from != "container" and database_purge is undefined or database_purge == true
tags: hotpot

- name: stop all gelato services
Expand Down
2 changes: 2 additions & 0 deletions ansible/roles/hotpot-installer/scenarios/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
image: "{{ controller_docker_image }}"
state: started
network_mode: host
restart_policy: always
volumes:
- "/etc/opensds/:/etc/opensds"

Expand All @@ -32,5 +33,6 @@
image: "{{ apiserver_docker_image }}"
state: started
network_mode: host
restart_policy: always
volumes:
- "/etc/opensds/:/etc/opensds"
10 changes: 8 additions & 2 deletions ansible/roles/osdsdb/scenarios/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@
name: docker-py
- name: run etcd containerized service
docker_container:
name: myetcd
name: soda-etcd
image: "{{ etcd_docker_image }}"
command: /usr/local/bin/etcd --advertise-client-urls http://{{ etcd_host }}:{{ etcd_port }} --listen-client-urls http://{{ etcd_host }}:{{ etcd_port }} --listen-peer-urls http://{{ etcd_host }}:{{ etcd_peer_port }}
state: started
restart_policy: always
network_mode: host
volumes:
- "/usr/share/ca-certificates/:/etc/ssl/certs"
- "etcd_data:/var/lib/etcd/"
env:
ETCD_LISTEN_CLIENT_URLS: http://{{ etcd_host }}:{{ etcd_port }}
ETCD_LISTEN_PEER_URLS: http://{{ etcd_host }}:{{ etcd_peer_port }}
ETCD_ADVERTISE_CLIENT_URLS: http://{{ etcd_host }}:{{ etcd_port }}
ETCD_DATA_DIR: /var/lib/etcd
1 change: 1 addition & 0 deletions ansible/roles/osdsdock/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
image: "{{ dock_docker_image }}"
state: started
network_mode: host
restart_policy: always
privileged: true
volumes:
- "/etc/opensds:/etc/opensds"
Expand Down
2 changes: 1 addition & 1 deletion ansible/script/keystone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ install(){
if [ "docker" == "$1" ]
then
docker pull opensdsio/opensds-authchecker:latest
docker run -d --privileged=true --net=host --name=opensds-authchecker opensdsio/opensds-authchecker:latest
docker run -d --privileged=true --restart=always --net=host --name=opensds-authchecker opensdsio/opensds-authchecker:latest
docker cp "$TOP_DIR/../../conf/keystone.policy.json" opensds-authchecker:/etc/keystone/policy.json
keystone_credentials
wait_for_keystone
Expand Down

0 comments on commit 7d6853b

Please sign in to comment.