From ece174da7c0032ae21746143a1e6f8d0f8c4e9b0 Mon Sep 17 00:00:00 2001
From: Samuel Liu <liupeng0518@gmail.com>
Date: Mon, 10 Apr 2023 10:51:15 +0800
Subject: [PATCH] fix resatrt k8s components (#9962)

---
 roles/kubernetes/preinstall/handlers/main.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/roles/kubernetes/preinstall/handlers/main.yml b/roles/kubernetes/preinstall/handlers/main.yml
index 4c24b83a2..631ea743e 100644
--- a/roles/kubernetes/preinstall/handlers/main.yml
+++ b/roles/kubernetes/preinstall/handlers/main.yml
@@ -50,7 +50,7 @@
 # FIXME(mattymo): Also restart for kubeadm mode
 - name: Preinstall | kube-apiserver configured
   stat:
-    path: "{{ kube_manifest_dir }}/kube-apiserver.manifest"
+    path: "{{ kube_manifest_dir }}/kube-apiserver.yaml"
     get_attributes: no
     get_checksum: no
     get_mime: no
@@ -60,7 +60,7 @@
 # FIXME(mattymo): Also restart for kubeadm mode
 - name: Preinstall | kube-controller configured
   stat:
-    path: "{{ kube_manifest_dir }}/kube-controller-manager.manifest"
+    path: "{{ kube_manifest_dir }}/kube-controller-manager.yaml"
     get_attributes: no
     get_checksum: no
     get_mime: no
@@ -92,6 +92,7 @@
     - inventory_hostname in groups['kube_control_plane']
     - dns_mode != 'none'
     - resolvconf_mode == 'host_resolvconf'
+    - kube_apiserver_set.stat.exists
 
 - name: Preinstall | restart kube-apiserver crio/containerd
   shell: "{{ bin_dir }}/crictl pods --name kube-apiserver* -q | xargs -I% --no-run-if-empty bash -c '{{ bin_dir }}/crictl stopp % && {{ bin_dir }}/crictl rmp %'"
@@ -104,6 +105,7 @@
     - inventory_hostname in groups['kube_control_plane']
     - dns_mode != 'none'
     - resolvconf_mode == 'host_resolvconf'
+    - kube_apiserver_set.stat.exists
 
 # When running this as the last phase ensure we wait for kube-apiserver to come up
 - name: Preinstall | wait for the apiserver to be running
-- 
GitLab