
This commit addresses a few shortcomings in the etcd service: * Adding or removing etcd nodes required manual intervention. * The etcd service would have brief outages during upgrades or reconfigures because restarts weren't always serialised. This makes the etcd service follow a similar pattern to mariadb: * There is now a distiction between bootstrapping the cluster and adding / removing another member. * This more closely follows etcd's upstream bootstrapping guidelines. * The etcd role now serialises restarts internally so the kolla_serial pattern is no longer appropriate (or necessary). This does not remove the need for manual intervention in all failure modes: the documentation has been updated to address the most common issues. Note that there's repetition in the container specifications: this is somewhat deliberate. In a future cleanup, it's intended to reduce the duplication. Change-Id: I39829ba0c5894f8e549f9b83b416e6db4fafd96f
56 lines
2.6 KiB
YAML
56 lines
2.6 KiB
YAML
---
|
|
- name: Add new member to etcd cluster
|
|
vars:
|
|
service_name: "etcd"
|
|
service: "{{ etcd_services[service_name] }}"
|
|
become: true
|
|
command: >-
|
|
{{ kolla_container_engine }} exec {{ service.container_name }}
|
|
etcdctl member add {{ ansible_facts.hostname }}
|
|
--peer-urls={{ etcd_protocol }}://{{ 'api' | kolla_address(inventory_hostname) | put_address_in_context('url') }}:{{ etcd_peer_port }}
|
|
delegate_to: "{{ etcd_cluster_leader | default(groups[service.group][0]) }}"
|
|
|
|
- name: Bootstrapping etcd containers
|
|
vars:
|
|
service_name: "etcd"
|
|
service: "{{ etcd_services[service_name] }}"
|
|
become: true
|
|
kolla_container:
|
|
action: "start_container"
|
|
common_options: "{{ docker_common_options }}"
|
|
environment:
|
|
KOLLA_BOOTSTRAP_STATUS: "bootstrap service"
|
|
ETCD_INITIAL_CLUSTER_STATE: "existing"
|
|
ETCD_INITIAL_ADVERTISE_PEER_URLS: "{{ etcd_peer_internal_endpoint }}"
|
|
ETCD_INITIAL_CLUSTER_TOKEN: "{{ etcd_cluster_token }}"
|
|
ETCD_INITIAL_CLUSTER: "{% for host in groups['etcd_had_volume_True'] %}{{ hostvars[host].ansible_facts.hostname }}={{ etcd_protocol }}://{{ 'api' | kolla_address(host) | put_address_in_context('url') }}:{{ etcd_peer_port }},{% endfor %}{{ ansible_facts.hostname }}={{ etcd_protocol }}://{{ 'api' | kolla_address(inventory_hostname) | put_address_in_context('url') }}:{{ etcd_peer_port }}"
|
|
ETCDCTL_API: "3"
|
|
ETCDCTL_ENDPOINTS: "{{ etcd_client_internal_endpoint }}"
|
|
ETCDCTL_WRITE_OUT: "json"
|
|
ETCD_DATA_DIR: "/var/lib/etcd"
|
|
ETCD_NAME: "{{ ansible_facts.hostname }}"
|
|
ETCD_ADVERTISE_CLIENT_URLS: "{{ etcd_client_internal_endpoint }}"
|
|
ETCD_LISTEN_CLIENT_URLS: "{{ etcd_client_internal_endpoint }}"
|
|
ETCD_LISTEN_PEER_URLS: "{{ etcd_peer_internal_endpoint }}"
|
|
ETCD_OUT_FILE: "/var/log/kolla/etcd/etcd.log"
|
|
KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}"
|
|
ETCD_CERT_FILE: "{% if etcd_enable_tls | bool %}/etc/etcd/certs/etcd-cert.pem{% endif %}"
|
|
ETCD_KEY_FILE: "{% if etcd_enable_tls | bool %}/etc/etcd/certs/etcd-key.pem{% endif %}"
|
|
ETCD_PEER_CERT_FILE: "{% if etcd_enable_tls | bool %}/etc/etcd/certs/etcd-cert.pem{% endif %}"
|
|
ETCD_PEER_KEY_FILE: "{% if etcd_enable_tls | bool %}/etc/etcd/certs/etcd-key.pem{% endif %}"
|
|
image: "{{ service.image }}"
|
|
name: "{{ service.container_name }}"
|
|
volumes: "{{ service.volumes }}"
|
|
dimensions: "{{ service.dimensions }}"
|
|
|
|
- name: Wait for etcd service port liveness
|
|
wait_for:
|
|
host: "{{ api_interface_address }}"
|
|
port: "{{ etcd_client_port }}"
|
|
connect_timeout: 1
|
|
timeout: 60
|
|
register: check_etcd_client_port
|
|
until: check_etcd_client_port is success
|
|
retries: 10
|
|
delay: 6
|