We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e2a8260 commit 6ae80feCopy full SHA for 6ae80fe
main.go
@@ -151,7 +151,10 @@ func main() {
151
152
// checkCluster tries to list nodes in the cluster to verify if the context is working
153
func checkCluster(clientset *kubernetes.Clientset) error {
154
- _, err := clientset.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{})
+ ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
155
+ defer cancel()
156
+
157
+ _, err := clientset.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
158
if err != nil {
159
return fmt.Errorf("failed to connect to cluster: %v", err)
160
}
0 commit comments