Skip to content

Commit

Permalink
Restart kubelet for upgrade not installing package
Browse files Browse the repository at this point in the history
  • Loading branch information
Zempashi committed Jan 18, 2024
1 parent 02b2ad9 commit 56ad6f4
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 56ad6f4

Please sign in to comment.