Skip to content

Commit

Permalink
fix: handle exception in InitK8s
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed May 8, 2023
1 parent 37141fb commit 8194f0b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/GZCTF/Services/K8sService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,14 @@ public K8sService(IOptions<RegistryConfig> _registry, IOptions<ContainerProvider
AuthSecretName = $"{registry.UserName}-{padding}";
}

InitK8s(withAuth, registry);
try
{
InitK8s(withAuth, registry);
}
catch
{
Program.ExitWithFatalMessage($"K8s 初始化失败,请检查相关配置是否正确 ({config.Host})");
}

logger.SystemLog($"K8s 服务已启动 ({config.Host})", TaskStatus.Success, LogLevel.Debug);
}
Expand Down

0 comments on commit 8194f0b

Please sign in to comment.