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/" etcd_bin_dir: "{{ local_release_dir }}/etcd/etcd-{{ etcd_version }}-linux-amd64/"
# Possible values: host, docker # Possible values: host, docker
etcd_deployment_type: "host" etcd_deployment_type: "docker"
etcd_image_repo: "quay.io/coreos/etcd" etcd_image_repo: "quay.io/coreos/etcd"

View file

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

View file

@ -4,19 +4,6 @@
- include: configure.yml - include: configure.yml
- include: refresh_config.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 - name: Ensure etcd is running
service: service:
name: etcd name: etcd
@ -31,6 +18,19 @@
enabled: yes enabled: yes
when: is_etcd_proxy 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 # After etcd cluster is assembled, make sure that
# initial state of the cluster is in `existing` # initial state of the cluster is in `existing`
# state insted of `new`. # 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") }} 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") }} ExecStop={{ docker_bin_dir | default("/usr/bin") }}/docker stop {{ etcd_member_name | default("etcd-proxy") }}
Restart=always Restart=always
RestartSec=10s RestartSec=15s
[Install] [Install]
WantedBy=multi-user.target 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") }} 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") }} ExecStop={{ docker_bin_dir | default("/usr/bin") }}/docker stop {{ etcd_proxy_member_name | default("etcd-proxy") }}
Restart=always Restart=always
RestartSec=10s RestartSec=15s
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

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