mirror of
https://github.com/containers/kubernetes-mcp-server.git
synced 2025-10-23 01:22:57 +03:00
fix: add timeout for IsOpenShift operation
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user