34 lines
1.3 KiB
YAML
34 lines
1.3 KiB
YAML
---
|
|
- name: "Pre-upgrade | etcd3 upgrade | see if old config exists"
|
|
command: "{{ bin_dir }}/etcdctl --peers={{ etcd_access_addresses }} ls /registry/minions"
|
|
environment:
|
|
ETCDCTL_API: 2
|
|
register: old_data_exists
|
|
delegate_to: "{{groups['etcd'][0]}}"
|
|
when: kube_apiserver_storage_backend == "etcd3"
|
|
failed_when: false
|
|
|
|
- name: "Pre-upgrade | etcd3 upgrade | use etcd2 unless forced to etcd3"
|
|
set_fact:
|
|
kube_apiserver_storage_backend: "etcd2"
|
|
when: old_data_exists.rc == 0 and not force_etcd3|bool
|
|
|
|
- name: "Pre-upgrade | Delete master manifests on all kube-masters"
|
|
file:
|
|
path: "/etc/kubernetes/manifests/{{item[1]}}.manifest"
|
|
state: absent
|
|
delegate_to: "{{item[0]}}"
|
|
with_nested:
|
|
- "{{groups['kube-master']}}"
|
|
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
|
register: kube_apiserver_manifest_replaced
|
|
when: (secret_changed|default(false) or etcd_secret_changed|default(false))
|
|
|
|
- name: "Pre-upgrade | Delete master containers forcefully on all kube-masters"
|
|
shell: "docker ps -f name=k8s-{{item}}* -q | xargs --no-run-if-empty docker rm -f"
|
|
delegate_to: "{{item[0]}}"
|
|
with_nested:
|
|
- "{{groups['kube-master']}}"
|
|
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
|
|
when: kube_apiserver_manifest_replaced.changed
|
|
run_once: true
|