Skip to content

Commit

Permalink
Fix install etcd by host service (#2297)
Browse files Browse the repository at this point in the history
Fix bug issues #2289
  • Loading branch information
riverzhang authored and mattymo committed Feb 12, 2018
1 parent 5903aea commit c0aad0a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 11 deletions.
9 changes: 0 additions & 9 deletions roles/etcd/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@
ETCDCTL_CERT_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}.pem"
ETCDCTL_KEY_FILE: "{{ etcd_cert_dir }}/node-{{ inventory_hostname }}-key.pem"

- name: Install etcd launch script
template:
src: etcd.j2
dest: "{{ bin_dir }}/etcd"
owner: 'root'
mode: 0755
backup: yes
notify: restart etcd

- name: Configure | Copy etcd.service systemd file
template:
src: "etcd-{{ etcd_deployment_type }}.service.j2"
Expand Down
10 changes: 9 additions & 1 deletion roles/etcd/tasks/install_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
{{ docker_bin_dir }}/docker create --name etcdctl-binarycopy {{ etcd_image_repo }}:{{ etcd_image_tag }} &&
{{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcdctl {{ bin_dir }}/etcdctl &&
{{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy"
when: etcd_deployment_type == "docker"
register: etcd_task_result
until: etcd_task_result.rc == 0
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false

- name: Install etcd launch script
template:
src: etcd.j2
dest: "{{ bin_dir }}/etcd"
owner: 'root'
mode: 0755
backup: yes
notify: restart etcd
12 changes: 12 additions & 0 deletions roles/etcd/tasks/install_host.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Install | Copy etcdctl and etcd binary from docker container
command: sh -c "{{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy;
{{ docker_bin_dir }}/docker create --name etcdctl-binarycopy {{ etcd_image_repo }}:{{ etcd_image_tag }} &&
{{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcdctl {{ bin_dir }}/etcdctl &&
{{ docker_bin_dir }}/docker cp etcdctl-binarycopy:/usr/local/bin/etcd {{ bin_dir }}/etcd &&
{{ docker_bin_dir }}/docker rm -f etcdctl-binarycopy"
register: etcd_task_result
until: etcd_task_result.rc == 0
retries: 4
delay: "{{ retry_stagger | random + 3 }}"
changed_when: false
2 changes: 1 addition & 1 deletion roles/etcd/templates/etcd-host.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ After=network.target

[Service]
Type=notify
User=etcd
User=root
EnvironmentFile=/etc/etcd.env
ExecStart={{ bin_dir }}/etcd
NotifyAccess=all
Expand Down
1 change: 1 addition & 0 deletions tests/files/centos7-flannel-addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ helm_enabled: true
istio_enabled: true
efk_enabled: true
local_volume_provisioner_enabled: true
etcd_deployment_type: host
deploy_netchecker: true
kubedns_min_replicas: 1
cloud_provider: gce

0 comments on commit c0aad0a

Please sign in to comment.