Isol. CPU plugin on startup: wait for kubelet.sock to be ready

Change-Id: I9645af7609cab8703fe22e05125fbf2fcfb2d20c
Signed-off-by: Kaustubh Dhokte <kaustubh.dhokte@windriver.com>
This commit is contained in:
Kaustubh Dhokte 2024-05-03 21:07:34 +00:00
parent 0ce84f0495
commit 67df801466
1 changed files with 7 additions and 0 deletions

View File

@ -211,6 +211,13 @@ func (srv *server) setupAndServe(namespace string, devicePluginPath string, kube
pluginEndpoint := pluginPrefix + ".sock"
pluginSocket := path.Join(devicePluginPath, pluginEndpoint)
//Wait for the kubelet RPC server to start
if err := waitForServer(kubeletSocket, 60*time.Second); err != nil {
return err
}
fmt.Println("Connection test successful with the kubelet socket at", kubeletSocket)
if err := waitForServer(pluginSocket, time.Second); err == nil {
return errors.Errorf("Socket %s is already in use", pluginSocket)
}