fix: add timeout for IsOpenShift operation

This commit is contained in:
Marc Nuri
2025-04-10 14:54:18 +02:00
parent 7b9b59a7bc
commit e8722663b5

View File

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