Change file used to check kubeadm upgrade method (#1784)
* Change file used to check kubeadm upgrade method Test for ca.crt instead of admin.conf because admin.conf is created during normal deployment. * more fixes for upgrade
This commit is contained in:
parent
92d038062e
commit
7e4668859b
1 changed files with 11 additions and 5 deletions
|
@ -15,8 +15,14 @@
|
|||
|
||||
- name: kubeadm | Check if kubeadm has already run
|
||||
stat:
|
||||
path: "{{ kube_cert_dir }}/ca.key"
|
||||
register: kubeadm_ca
|
||||
|
||||
- name: kubeadm | Delete old admin.conf
|
||||
file:
|
||||
path: "{{ kube_config_dir }}/admin.conf"
|
||||
register: admin_conf
|
||||
state: absent
|
||||
when: not kubeadm_ca.stat.exists
|
||||
|
||||
- name: kubeadm | Delete old static pods
|
||||
file:
|
||||
|
@ -66,7 +72,7 @@
|
|||
register: kubeadm_init
|
||||
# Retry is because upload config sometimes fails
|
||||
retries: 3
|
||||
when: inventory_hostname == groups['kube-master']|first and not admin_conf.stat.exists
|
||||
when: inventory_hostname == groups['kube-master']|first and not kubeadm_ca.stat.exists
|
||||
failed_when: kubeadm_init.rc != 0 and "field is immutable" not in kubeadm_init.stderr
|
||||
notify: Master | restart kubelet
|
||||
|
||||
|
@ -82,7 +88,7 @@
|
|||
register: kubeadm_upgrade
|
||||
# Retry is because upload config sometimes fails
|
||||
retries: 3
|
||||
when: inventory_hostname == groups['kube-master']|first and (kubeadm_config.changed and admin_conf.stat.exists)
|
||||
when: inventory_hostname == groups['kube-master']|first and (kubeadm_config.changed and kubeadm_ca.stat.exists)
|
||||
failed_when: kubeadm_upgrade.rc != 0 and "field is immutable" not in kubeadm_upgrade.stderr
|
||||
notify: Master | restart kubelet
|
||||
|
||||
|
@ -127,7 +133,7 @@
|
|||
- name: kubeadm | Init other uninitialized masters
|
||||
command: timeout -k 240s 240s {{ bin_dir }}/kubeadm init --config={{ kube_config_dir }}/kubeadm-config.yaml --skip-preflight-checks
|
||||
register: kubeadm_init
|
||||
when: inventory_hostname != groups['kube-master']|first and not admin_conf.stat.exists
|
||||
when: inventory_hostname != groups['kube-master']|first and not kubeadm_ca.stat.exists
|
||||
failed_when: kubeadm_init.rc != 0 and "field is immutable" not in kubeadm_init.stderr
|
||||
notify: Master | restart kubelet
|
||||
|
||||
|
@ -141,7 +147,7 @@
|
|||
--allow-experimental-upgrades
|
||||
--allow-release-candidate-upgrades
|
||||
register: kubeadm_upgrade
|
||||
when: inventory_hostname != groups['kube-master']|first and (kubeadm_config.changed and admin_conf.stat.exists)
|
||||
when: inventory_hostname != groups['kube-master']|first and (kubeadm_config.changed and kubeadm_ca.stat.exists)
|
||||
failed_when: kubeadm_upgrade.rc != 0 and "field is immutable" not in kubeadm_upgrade.stderr
|
||||
notify: Master | restart kubelet
|
||||
|
||||
|
|
Loading…
Reference in a new issue