Documentation
¶
Overview ¶
Package cluster reads Kubernetes pod logs for investigation (read-only) via the client-go CoreV1 GetLogs API. It backs the controller_logs tool, which surfaces why a Flux controller failed to reconcile a source/object.
Index ¶
- type Reader
- func (r *Reader) Events(ctx context.Context, namespace, objectName string, warnOnly bool) ([]providers.KubeEvent, error)
- func (r *Reader) PodLogs(ctx context.Context, q providers.PodLogQuery) (providers.LogResult, error)
- func (r *Reader) PodStatuses(ctx context.Context, namespace, labelSelector string) ([]providers.PodStatus, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader reads pod logs via a client-go clientset (read-only).
func (*Reader) Events ¶
func (r *Reader) Events(ctx context.Context, namespace, objectName string, warnOnly bool) ([]providers.KubeEvent, error)
Events returns recent Events in a namespace (optionally for one object, optionally Warning-only), most-recent first.
func (*Reader) PodLogs ¶
PodLogs returns recent log lines from up to maxPods pods selected by q, bounded to the last q.SinceMinutes. When q.Previous is true it reads each pod's last-terminated container (the crash output of a CrashLoopBackOff) instead of the running one. Each line is prefixed with its pod name. Best-effort: a pod whose log stream fails is skipped, not fatal.
func (*Reader) PodStatuses ¶
func (r *Reader) PodStatuses(ctx context.Context, namespace, labelSelector string) ([]providers.PodStatus, error)
PodStatuses returns pod health in a namespace (optional label selector), with per-container waiting/terminated reasons — surfacing pod-level failures (CreateContainerConfigError, ImagePullBackOff, CrashLoopBackOff) that never reach logs because the container never started. Unhealthy pods sort first.