MCPcopy
hub / github.com/1Panel-dev/KubePi / WaitForLoggingStream

Function WaitForLoggingStream

pkg/logging/logging.go:108–119  ·  view source on GitHub ↗
(k8sClient kubernetes.Interface, namespace string, pod string, container string, tailLines int, follow bool, previous bool , timestamps bool,sessionId string)

Source from the content-addressed store, hash-verified

106}
107
108func WaitForLoggingStream(k8sClient kubernetes.Interface, namespace string, pod string, container string, tailLines int, follow bool, previous bool , timestamps bool,sessionId string) {
109 select {
110 case <-LogSessions.Get(sessionId).Bound:
111 close(LogSessions.Get(sessionId).Bound)
112 err := startLogProcess(k8sClient, namespace, pod, container, int64(tailLines), follow, previous,timestamps, LogSessions.Get(sessionId))
113 if err != nil {
114 LogSessions.Close(sessionId, err.Error(), 2)
115 return
116 }
117 LogSessions.Close(sessionId, "Process exited", 1)
118 }
119}
120
121func startLogProcess(k8sClient kubernetes.Interface, namespace string, pod string, container string, tailLines int64, follow bool, previous bool,timestamps bool,session LogSession) error {
122 reader, err := k8sClient.CoreV1().

Callers 1

LoggingHandlerMethod · 0.92

Calls 4

startLogProcessFunction · 0.85
ErrorMethod · 0.80
GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected