Fix: upgrade cluster discovery kubeconfig not found

When installing or upgrading in the past, there was no validation
config. Check if the file exists first to prevent subsequent validation
errors.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
This commit is contained in:
ChengHao Yang
2025-05-15 18:02:52 +08:00
parent e618d71f2a
commit ac0b0e7d6e

View File

@@ -58,6 +58,11 @@
delegate_to: "{{ groups['kube_control_plane'] | first }}"
when: kubeadm_use_file_discovery
- name: Check if discovery kubeconfig exists
stat:
path: "{{ kube_config_dir }}/cluster-info-discovery-kubeconfig.yaml"
register: cluster_info_discovery_kubeconfig
- name: Copy discovery kubeconfig
copy:
dest: "{{ kube_config_dir }}/cluster-info-discovery-kubeconfig.yaml"
@@ -66,7 +71,7 @@
mode: "0644"
when:
- ('kube_control_plane' not in group_names)
- not kubelet_conf.stat.exists
- not kubelet_conf.stat.exists or not cluster_info_discovery_kubeconfig.stat.exists
- kubeadm_use_file_discovery
- name: Create kubeadm client config