ac2135e450
* Fix recover-control-plane to work with etcd 3.3.x and add CI * Set default values for testcase * Add actual test jobs * Attempt to satisty gitlab ci linter * Fix ansible targets * Set etcd_member_name as stated in the docs... * Recovering from 0 masters is not supported yet * Add other master to broken_kube-master group as well * Increase number of retries to see if etcd needs more time to heal * Make number of retries for ETCD loops configurable, increase it for recovery CI and document it
51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
---
|
|
- name: Save etcd snapshot
|
|
shell: "{{ bin_dir }}/etcdctl --cacert {{ etcd_cert_dir }}/ca.pem --cert {{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem --key {{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem snapshot save /tmp/snapshot.db"
|
|
environment:
|
|
- ETCDCTL_API: 3
|
|
when: etcd_snapshot is not defined
|
|
|
|
- name: Transfer etcd snapshot to host
|
|
copy:
|
|
src: "{{ etcd_snapshot }}"
|
|
dest: /tmp/snapshot.db
|
|
when: etcd_snapshot is defined
|
|
|
|
- name: Stop etcd
|
|
systemd:
|
|
name: etcd
|
|
state: stopped
|
|
|
|
- name: Remove etcd data-dir
|
|
file:
|
|
path: "{{ etcd_data_dir }}"
|
|
state: absent
|
|
|
|
- name: Restore etcd snapshot
|
|
shell: "{{ bin_dir }}/etcdctl --cacert {{ etcd_cert_dir }}/ca.pem --cert {{ etcd_cert_dir }}/admin-{{ inventory_hostname }}.pem --key {{ etcd_cert_dir }}/admin-{{ inventory_hostname }}-key.pem snapshot restore /tmp/snapshot.db --name {{ etcd_member_name }} --initial-cluster {{ etcd_member_name }}={{ etcd_peer_url }} --initial-cluster-token k8s_etcd --initial-advertise-peer-urls {{ etcd_peer_url }} --data-dir {{ etcd_data_dir }}"
|
|
environment:
|
|
- ETCDCTL_API: 3
|
|
|
|
- name: Remove etcd snapshot
|
|
file:
|
|
path: /tmp/snapshot.db
|
|
state: absent
|
|
|
|
- name: Change etcd data-dir owner
|
|
file:
|
|
path: "{{ etcd_data_dir }}"
|
|
owner: etcd
|
|
group: etcd
|
|
recurse: true
|
|
|
|
- name: Reconfigure etcd
|
|
replace:
|
|
path: /etc/etcd.env
|
|
regexp: "^(ETCD_INITIAL_CLUSTER=).*"
|
|
replace: '\1{{ etcd_member_name }}={{ etcd_peer_url }}'
|
|
|
|
- name: Start etcd
|
|
systemd:
|
|
name: etcd
|
|
state: started
|