Skip to content

Commit

Permalink
Merge pull request #66 from enix/restart_kubelet_on_upgrade
Browse files Browse the repository at this point in the history
Restart kubelet for upgrade not installing package
  • Loading branch information
Zempashi authored Jan 22, 2024
2 parents 02b2ad9 + 56ad6f4 commit 33fc67a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions playbooks/01_site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
- include_role:
name: hooks_call
vars:
kubeadm_hook_list: ['pre_cp_upgrade', 'pre_nodes_upgrade']
kubeadm_hook_list: ['early_cp_upgrade', 'early_nodes_upgrade']
roles:
- role: packages
vars:
Expand All @@ -153,7 +153,7 @@
- include_role:
name: hooks_call
vars:
kubeadm_hook_list: ['pre_workers_upgrade', 'pre_nodes_upgrade']
kubeadm_hook_list: ['early_workers_upgrade', 'early_nodes_upgrade']
roles:
- role: packages
vars:
Expand Down
6 changes: 6 additions & 0 deletions roles/drain_nodes/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
pause:
when: pause_after_drain_and_node_upgrade|bool

- name: 'Restart kubelet'
service:
name: kubelet
state: restarted
when: not reboot_node|bool

- name: 'Reboot node'
reboot:
when: reboot_node|bool
Expand Down
6 changes: 6 additions & 0 deletions roles/drain_nodes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
when: drain_node|bool
notify:
- Pause after upgrade
- Restart kubelet
- Reboot node
- Wait for node
- Uncordon node

- include_role:
name: hooks_call
vars:
kubeadm_hook_list: ['pre_nodes_upgrade']
10 changes: 0 additions & 10 deletions roles/packages/tasks/pkg_Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,5 @@
apt:
name: "{{ kube_package_dict.keys() }}"
state: "latest"
allow_change_held_packages: "{{ ansible_check_mode if ansible_version.string is version('2.13', '>=') else omit }}"
when: not(_kube_repo_just_added is changed and ansible_check_mode)
register: _kube_pkg_installed

- name: 'Restart kubelet'
service:
name: 'kubelet'
state: restarted
when:
- _kube_pkg_installed is changed
- '"kubelet" in kube_package_dict'
- not ansible_check_mode
2 changes: 2 additions & 0 deletions roles/upgrade_nodes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
{%- endif %}
{%- endif -%}
register: upgrade_node
notify:
- Restart kubelet

- name: 'Display result of "kubeadm upgrade node"'
debug:
Expand Down

0 comments on commit 33fc67a

Please sign in to comment.