pods

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pods watches kubelet's local PodsAPI and publishes fail-closed snapshots.

Index

Constants

View Source
const DefaultSocket = "unix:///var/lib/kubelet/pods-api/pods-api.sock"

DefaultSocket is the kubelet PodsAPI Unix socket.

Variables

This section is empty.

Functions

func Dial

func Dial(socket string) (*grpc.ClientConn, error)

Dial connects to the kubelet PodsAPI Unix socket with plaintext credentials.

Types

type Client

type Client interface {
	Watch(context.Context) (Stream, error)
}

Client is the injectable subset of the kubelet PodsAPI client.

type GRPCClient

type GRPCClient struct{ Client podsv1alpha1.PodsClient }

GRPCClient adapts the generated kubelet client.

func (GRPCClient) Watch

func (c GRPCClient) Watch(ctx context.Context) (Stream, error)

Watch starts a kubelet PodsAPI watch.

type Pod

type Pod struct {
	UID       string
	Namespace string
	Labels    map[string]string
	Address   netip.Addr
	Eligible  bool
}

Pod is the selector and readiness information owned by the watcher.

type Snapshot

type Snapshot map[string]Pod

Snapshot is an atomic, complete view keyed by Pod UID.

type Stream

type Stream interface {
	Recv() (*podsv1alpha1.WatchPodsEvent, error)
}

Stream is the injectable subset of a PodsAPI watch stream.

type Watcher

type Watcher struct {
	Client  Client
	Publish func(Snapshot)
	Delay   time.Duration
}

Watcher reconnects to PodsAPI and publishes complete snapshots.

func (*Watcher) Run

func (w *Watcher) Run(ctx context.Context) error

Run watches until context cancellation, publishing empty state on every disconnect.

Jump to

Keyboard shortcuts

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