mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-21 12:39:48 +08:00
pod logging
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package manager
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
@@ -134,6 +135,23 @@ func (r *ResourceManager) WatchWorkflow(namespace, name string) (<-chan *model.W
|
||||
return workflowWatcher, nil
|
||||
}
|
||||
|
||||
func (r *ResourceManager) GetWorkflowLogs(namespace, name, podName, containerName string) (<-chan *model.LogEntry, error) {
|
||||
stream, err := r.kubeClient.GetPodLogs(namespace, podName, containerName)
|
||||
|
||||
logWatcher := make(chan *model.LogEntry)
|
||||
if err != nil {
|
||||
go func() {
|
||||
scanner := bufio.NewScanner(stream)
|
||||
for scanner.Scan() {
|
||||
logWatcher <- &model.LogEntry{Content: scanner.Text()}
|
||||
}
|
||||
close(logWatcher)
|
||||
}()
|
||||
}
|
||||
|
||||
return logWatcher, nil
|
||||
}
|
||||
|
||||
func (r *ResourceManager) ListWorkflows(namespace, workflowTemplateUID string) (workflows []*model.Workflow, err error) {
|
||||
opts := &kube.WorkflowOptions{}
|
||||
if workflowTemplateUID != "" {
|
||||
|
Reference in New Issue
Block a user