Adds methods for streaming container log
This commit is contained in:
parent
b96751cd2c
commit
cec6d787de
|
@ -36,6 +36,12 @@ namespace Core
|
|||
return logHandler.DownloadLog();
|
||||
}
|
||||
|
||||
public Stream MonitorLog(RunningContainer container)
|
||||
{
|
||||
var workflow = entryPoint.Tools.CreateWorkflow();
|
||||
return workflow.MonitorContainerLog(container);
|
||||
}
|
||||
|
||||
public string ExecuteContainerCommand(IHasContainer containerSource, string command, params string[] args)
|
||||
{
|
||||
return ExecuteContainerCommand(containerSource.Container, command, args);
|
||||
|
|
|
@ -57,6 +57,12 @@ namespace KubernetesWorkflow
|
|||
logHandler.Log(stream);
|
||||
}
|
||||
|
||||
public Stream MonitorContainerLog(RunningContainer container)
|
||||
{
|
||||
log.Debug();
|
||||
return client.Run(c => c.ReadNamespacedPodLog(container.Pod.PodInfo.Name, K8sNamespace, container.Recipe.Name, follow: true));
|
||||
}
|
||||
|
||||
public string ExecuteCommand(RunningPod pod, string containerName, string command, params string[] args)
|
||||
{
|
||||
var cmdAndArgs = $"{containerName}: {command} ({string.Join(",", args)})";
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace KubernetesWorkflow
|
|||
CrashWatcher CreateCrashWatcher(RunningContainer container);
|
||||
void Stop(RunningContainers runningContainers);
|
||||
void DownloadContainerLog(RunningContainer container, ILogHandler logHandler, int? tailLines = null);
|
||||
Stream MonitorContainerLog(RunningContainer container);
|
||||
string ExecuteCommand(RunningContainer container, string command, params string[] args);
|
||||
void DeleteNamespace();
|
||||
void DeleteNamespacesStartingWith(string namespacePrefix);
|
||||
|
@ -83,6 +84,14 @@ namespace KubernetesWorkflow
|
|||
});
|
||||
}
|
||||
|
||||
public Stream MonitorContainerLog(RunningContainer container)
|
||||
{
|
||||
return K8s(controller =>
|
||||
{
|
||||
return controller.MonitorContainerLog(container);
|
||||
});
|
||||
}
|
||||
|
||||
public string ExecuteCommand(RunningContainer container, string command, params string[] args)
|
||||
{
|
||||
return K8s(controller =>
|
||||
|
|
Loading…
Reference in New Issue