Merge pull request #365 from kubespray/etcddockerdefault

Set default etcd deployment to docker
This commit is contained in:
Antoine Legrand 2016-07-21 10:59:49 +02:00 committed by GitHub
commit 0f246bfba4
6 changed files with 31 additions and 35 deletions

View file

@ -3,7 +3,7 @@ etcd_version: v3.0.1
etcd_bin_dir: "{{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64/"
# Possible values: host, docker
etcd_deployment_type: "host"
etcd_deployment_type: "docker"
etcd_image_repo: "quay.io/coreos/etcd"

View file

@ -3,42 +3,35 @@
command: /bin/true
notify:
- reload systemd
- start etcd
- reload etcd
- wait for etcd up
- name: restart etcd-proxy
command: /bin/true
notify:
- reload systemd
- start etcd-proxy
- reload etcd-proxy
- wait for etcd up
- name: reload systemd
command: systemctl daemon-reload
when: ansible_service_mgr == "systemd"
- name: start etcd
service:
name: etcd
enabled: yes
state: started
when: is_etcd_master
- name: start etcd-proxy
service:
name: etcd-proxy
enabled: yes
state: started
when: is_etcd_proxy
- name: wait for etcd up
uri: url=http://localhost:2379/health
register: result
until: result.status == 200
retries: 10
delay: 5
- name: reload etcd
service:
name: etcd
state: "{{ 'restarted' if etcd_deployment_type == 'host' else 'reloaded' }}"
state: restarted
when: is_etcd_master
- name: reload etcd-proxy
service:
name: etcd-proxy
state: "{{ 'restarted' if etcd_deployment_type == 'host' else 'reloaded' }}"
state: restarted
when: is_etcd_proxy

View file

@ -4,19 +4,6 @@
- include: configure.yml
- include: refresh_config.yml
- name: Restart etcd if binary changed
command: /bin/true
notify: restart etcd
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_master
- name: Restart etcd-proxy if binary changed
command: /bin/true
notify: restart etcd-proxy
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_proxy
# Reload systemd before starting service
- meta: flush_handlers
- name: Ensure etcd is running
service:
name: etcd
@ -31,6 +18,19 @@
enabled: yes
when: is_etcd_proxy
- name: Restart etcd if binary changed
command: /bin/true
notify: restart etcd
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_master
- name: Restart etcd-proxy if binary changed
command: /bin/true
notify: restart etcd-proxy
when: etcd_deployment_type == "host" and etcd_copy.stdout_lines and is_etcd_proxy
# Reload systemd before starting service
- meta: flush_handlers
# After etcd cluster is assembled, make sure that
# initial state of the cluster is in `existing`
# state insted of `new`.

View file

@ -22,7 +22,7 @@ ExecStartPre=-{{ docker_bin_dir | default("/usr/bin") }}/docker rm -f {{ etcd_me
ExecReload={{ docker_bin_dir | default("/usr/bin") }}/docker restart {{ etcd_member_name | default("etcd-proxy") }}
ExecStop={{ docker_bin_dir | default("/usr/bin") }}/docker stop {{ etcd_member_name | default("etcd-proxy") }}
Restart=always
RestartSec=10s
RestartSec=15s
[Install]
WantedBy=multi-user.target

View file

@ -22,7 +22,7 @@ ExecStartPre=-{{ docker_bin_dir | default("/usr/bin") }}/docker rm -f {{ etcd_pr
ExecReload={{ docker_bin_dir | default("/usr/bin") }}/docker restart {{ etcd_proxy_member_name | default("etcd-proxy") }}
ExecStop={{ docker_bin_dir | default("/usr/bin") }}/docker stop {{ etcd_proxy_member_name | default("etcd-proxy") }}
Restart=always
RestartSec=10s
RestartSec=15s
[Install]
WantedBy=multi-user.target

View file

@ -38,8 +38,11 @@
changed_when: false
- name: Calico | wait for etcd
wait_for:
port: 2379
uri: url=http://localhost:2379/health
register: result
until: result.status == 200
retries: 10
delay: 5
when: inventory_hostname in groups['kube-master']
- name: Calico | Check if calico network pool has already been configured