Skip to content

Commit

Permalink
Support ignoring preflight check on upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
Zempashi committed Jan 22, 2024
1 parent 02b2ad9 commit 305ac5e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions roles/common_vars/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
enable_kubeadm_patches: true
kubeadm_ignore_preflight_errors: []
kubeadm_patch_dir: /etc/kubernetes/patches
kube_cp_group: kube_control_plane
kube_worker_group: kube_workers
Expand Down
1 change: 0 additions & 1 deletion roles/init_cp/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
kubeadm_ignore_preflight_errors: []
kubeadm_api_advertise_cidr: ''
kubeadm_node_ip_cidr: ''
12 changes: 10 additions & 2 deletions roles/upgrade_cp/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
---
- name: 'Plan upgrade'
command: kubeadm upgrade plan {{ kubeadm_version.version.split( '-' )|first }}
command: >-
kubeadm upgrade plan {{ kubeadm_version.version.split( '-' )|first }}
{% for error in kubeadm_ignore_preflight_errors %}
--ignore-preflight-errors={{ error }}
{% endfor %}
environment:
KUBECONFIG: '/etc/kubernetes/admin.conf'
register: plan_upgrade
Expand All @@ -12,7 +16,11 @@
stdout=plan_upgrade.stdout_lines) }}
- name: 'Apply upgrade'
command: kubeadm upgrade apply {{ kubeadm_version.version.split( '-' )|first }} -y
command: >-
kubeadm upgrade apply {{ kubeadm_version.version.split( '-' )|first }} -y
{% for error in kubeadm_ignore_preflight_errors %}
--ignore-preflight-errors={{ error }}
{% endfor %}
register: apply_upgrade

- name: 'Display result of "kubectl upgrade apply"'
Expand Down
3 changes: 3 additions & 0 deletions roles/upgrade_nodes/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
{{ kubeadm_patch_dir }}
{%- endif %}
{%- endif -%}
{% for error in kubeadm_ignore_preflight_errors %}
--ignore-preflight-errors={{ error }}
{% endfor %}
register: upgrade_node

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

0 comments on commit 305ac5e

Please sign in to comment.