From 896d67092706d01b6fb9d7f4856750819f8898cf Mon Sep 17 00:00:00 2001 From: Jonathan Rosser Date: Sat, 20 Apr 2024 17:14:22 +0100 Subject: [PATCH] fix: Check that resources are in kubeadm-config configmap before using them (#102) In some conditions the k8s_info module can succeed but return and empty list of resources. This can happen when the api server is running but the kubeadm-config cm is missing, then the next tasks fail with undefined variables. This patch extends the condition on the kubernetes version check to ensure that resources from kubeadm-config are present. Co-authored-by: Jonathan Rosser --- roles/kubernetes_upgrade_check/tasks/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/kubernetes_upgrade_check/tasks/main.yml b/roles/kubernetes_upgrade_check/tasks/main.yml index f69dd24a..640e7782 100644 --- a/roles/kubernetes_upgrade_check/tasks/main.yml +++ b/roles/kubernetes_upgrade_check/tasks/main.yml @@ -23,7 +23,9 @@ register: kubernetes_upgrade_check_kubeadm_config - name: Determine if we are jumping multiple versions - when: kubernetes_upgrade_check_kubeadm_config is not failed + when: + - kubernetes_upgrade_check_kubeadm_config is not failed + - kubernetes_upgrade_check_kubeadm_config.resources | length > 0 block: - name: Parse the ClusterConfiguration run_once: true