Documentation
¶
Overview ¶
Package podlogs provides generic pod log fetching utilities.
Index ¶
Constants ¶
const DefaultMaxLogBytes int64 = 8 * 1024 * 1024
DefaultMaxLogBytes caps a single log fetch at 8 MB. Sized well above a normal sampling window (a chatty trainer emits a few hundred KB per minute) while staying far below the controller's memory limit.
const DefaultStreamTimeout = 2 * time.Minute
DefaultStreamTimeout bounds the complete lifecycle of a pod log request, including opening the stream and consuming its response body.
Variables ¶
This section is empty.
Functions ¶
func OpenStream ¶
OpenStream opens a pod log request bounded by DefaultStreamTimeout or the parent context's deadline, whichever is earlier. The returned stream keeps that deadline active until it is closed, so stalled response-body reads are bounded as well as the initial request.
Types ¶
type LogOptions ¶
type LogOptions struct {
Container string
SinceTime *metav1.Time
// LimitBytes caps how many bytes the API server returns for this fetch.
// Zero means DefaultMaxLogBytes; reads are never unbounded.
LimitBytes int64
}
LogOptions configures log reading.
type PodLogFetcher ¶
type PodLogFetcher interface {
FetchLogs(ctx context.Context, namespace, podName string, opts LogOptions) ([]string, error)
}
PodLogFetcher abstracts fetching raw log lines from a pod.
func NewKubernetesLogFetcher ¶
func NewKubernetesLogFetcher(clientset *kubernetes.Clientset) PodLogFetcher
NewKubernetesLogFetcher creates a PodLogFetcher backed by a Kubernetes clientset.