Добавлен модуль Kubernetes MCP с DI и диагностикой ошибок
This commit is contained in:
23
LazyBear.MCP/Services/Kubernetes/K8sClientProvider.cs
Normal file
23
LazyBear.MCP/Services/Kubernetes/K8sClientProvider.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using k8s;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace LazyBear.MCP.Services.Kubernetes;
|
||||
|
||||
public sealed class K8sClientProvider
|
||||
{
|
||||
public IKubernetes? Client { get; }
|
||||
|
||||
public string? InitializationError { get; }
|
||||
|
||||
public K8sClientProvider(IConfiguration configuration)
|
||||
{
|
||||
try
|
||||
{
|
||||
Client = K8sClientFactory.CreateClient(configuration);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
InitializationError = $"{ex.GetType().Name}: {ex.Message}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user