diff --git a/Framework/Core/CoreInterface.cs b/Framework/Core/CoreInterface.cs index 21b9491..6e8e6ef 100644 --- a/Framework/Core/CoreInterface.cs +++ b/Framework/Core/CoreInterface.cs @@ -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); diff --git a/Framework/KubernetesWorkflow/K8sController.cs b/Framework/KubernetesWorkflow/K8sController.cs index 3f5504f..5168f27 100644 --- a/Framework/KubernetesWorkflow/K8sController.cs +++ b/Framework/KubernetesWorkflow/K8sController.cs @@ -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)})"; diff --git a/Framework/KubernetesWorkflow/StartupWorkflow.cs b/Framework/KubernetesWorkflow/StartupWorkflow.cs index bda8a9b..d5e40d9 100644 --- a/Framework/KubernetesWorkflow/StartupWorkflow.cs +++ b/Framework/KubernetesWorkflow/StartupWorkflow.cs @@ -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 =>