Browse Source

Fix install etcd by host service (#2297)

Fix bug issues #2289
pull/2321/head
RongZhang 6 years ago
committed by Matthew Mosesohn
parent
commit
c0aad0a6d5
5 changed files with 23 additions and 11 deletions
  1. 9
      roles/etcd/tasks/configure.yml
  2. 10
      roles/etcd/tasks/install_docker.yml
  3. 12
      roles/etcd/tasks/install_host.yml
  4. 2
      roles/etcd/templates/etcd-host.service.j2
  5. 1
      tests/files/centos7-flannel-addons.yml

9
roles/etcd/tasks/configure.yml

@ -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"

10
roles/etcd/tasks/install_docker.yml

@ -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
roles/etcd/tasks/install_host.yml

@ -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
roles/etcd/templates/etcd-host.service.j2

@ -4,7 +4,7 @@ After=network.target
[Service]
Type=notify
User=etcd
User=root
EnvironmentFile=/etc/etcd.env
ExecStart={{ bin_dir }}/etcd
NotifyAccess=all

1
tests/files/centos7-flannel-addons.yml

@ -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
Loading…
Cancel
Save