c12s-kubespray/roles/kubernetes/master/tasks/pre-upgrade.yml

22 lines
781 B
YAML
Raw Normal View History

---
- name: "Pre-upgrade | Delete master manifests if etcd secrets changed"
2017-03-27 11:44:21 +00:00
file:
path: "/etc/kubernetes/manifests/{{ item }}.manifest"
2017-03-27 11:44:21 +00:00
state: absent
with_items:
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
register: kube_apiserver_manifest_replaced
when: etcd_secret_changed|default(false)
2020-08-05 14:56:28 +00:00
- name: "Pre-upgrade | Delete master containers forcefully" # noqa 503
shell: "set -o pipefail && docker ps -af name=k8s_{{ item }}* -q | xargs --no-run-if-empty docker rm -f"
args:
executable: /bin/bash
with_items:
2017-03-27 11:44:21 +00:00
- ["kube-apiserver", "kube-controller-manager", "kube-scheduler"]
when: kube_apiserver_manifest_replaced.changed
register: remove_master_container
retries: 10
until: remove_master_container.rc == 0
delay: 1