logreader

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package logreader streams logs from a Kubernetes pod container.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoPodsForJob = errors.New("no pods found for job")

ErrNoPodsForJob is returned when a job has no associated pods at all.

View Source
var ErrPodsNotReady = errors.New("pods not ready for job")

ErrPodsNotReady is returned when a job's pods exist but none have reached a phase (Running/Succeeded/Failed) that can serve logs.

Functions

This section is empty.

Types

type KubernetesReader

type KubernetesReader struct {
	// contains filtered or unexported fields
}

KubernetesReader implements Reader using the Kubernetes API.

func NewKubernetesReader

func NewKubernetesReader(clientset kubernetes.Interface) *KubernetesReader

NewKubernetesReader returns a Reader backed by the given clientset.

func (*KubernetesReader) ReadJobLogs

func (r *KubernetesReader) ReadJobLogs(
	ctx context.Context, namespace, jobName, container string, tailLines int64,
) (io.ReadCloser, error)

ReadJobLogs resolves the pod for the given job and streams its container logs. It prefers a Succeeded pod; if none exist, it falls back to the most recent non-pending pod. Pods in the Pending phase are skipped because reading their logs would either fail or return no useful content.

A positive tailLines asks the kubelet to return only the last N lines (server-side filter, no wasted transfer). A value <= 0 returns the full retained log.

type Reader

type Reader interface {
	ReadJobLogs(ctx context.Context, namespace, jobName, container string, tailLines int64) (io.ReadCloser, error)
}

Reader streams logs from a job's latest pod. Implementations return the full retained log for the named container. The returned ReadCloser must be closed by the caller.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL