Skip to content

Commit e872266

Browse files
committed
fix: add timeout for IsOpenShift operation
1 parent 7b9b59a commit e872266

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/kubernetes/openshift.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import (
77
)
88

99
func (k *Kubernetes) IsOpenShift(ctx context.Context) bool {
10+
// This method should be fast and not block (it's called at startup)
11+
timeoutSeconds := int64(5)
1012
if _, err := k.dynamicClient.Resource(schema.GroupVersionResource{
1113
Group: "project.openshift.io",
1214
Version: "v1",
1315
Resource: "projects",
14-
}).List(ctx, metav1.ListOptions{Limit: 1}); err == nil {
16+
}).List(ctx, metav1.ListOptions{Limit: 1, TimeoutSeconds: &timeoutSeconds}); err == nil {
1517
return true
1618
}
1719
return false

0 commit comments

Comments
 (0)