k8s

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfigFromFlags added in v0.2.0

func BuildConfigFromFlags(masterUrl, kubeconfigPath string) (*restclient.Config, error)

BuildConfigFromFlags is a helper function that builds configs from a master url or a kubeconfig filepath. These are passed in as command line flags for cluster components. Warnings should reflect this usage. If neither masterUrl or kubeconfigPath are passed in we fallback to inClusterConfig. If inClusterConfig fails, we fallback to the default config.

Copied from upstream and just removed the "using in-cluster config" warning. see: https://github.com/kubernetes/client-go/blob/master/tools/clientcmd/client_config.go

Types

type KubeletInformerOptions added in v0.2.0

type KubeletInformerOptions struct {
	NodeName string

	PollInterval        time.Duration
	RequestTimeout      time.Duration
	DialTimeout         time.Duration
	TLSHandshakeTimeout time.Duration
	KubeletHost         string
	KubeletPort         int
	TokenPath           string
	CAPath              string
	ClientFactory       func() (podListClient, error)
	Clock               clock.WithTicker // Optional, defaults to clock.RealClock{}
}

KubeletInformerOptions describes configuration for the kubelet-backed pod informer.

type KubeletPodInformer added in v0.2.0

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

KubeletPodInformer implements the informer contract used by the collector by polling the kubelet pods endpoint.

func NewKubeletPodInformer added in v0.2.0

func NewKubeletPodInformer(opts KubeletInformerOptions) (*KubeletPodInformer, error)

NewKubeletPodInformer creates a new informer that sources pod events from the local kubelet.

func (*KubeletPodInformer) Add added in v0.2.0

Add registers a handler for pod events. The handler receives add, update, and delete notifications. The informer must be started with Open() before calling Add().

func (*KubeletPodInformer) Close added in v0.2.0

func (k *KubeletPodInformer) Close() error

Close stops the kubelet polling loop and cleans up resources.

func (*KubeletPodInformer) Open added in v0.2.0

func (k *KubeletPodInformer) Open(ctx context.Context) error

Open starts the kubelet polling loop. This must be called before adding any handlers.

func (*KubeletPodInformer) Remove added in v0.2.0

Remove unregisters the handler.

type Metadata

type Metadata struct {
	Namespace, Pod, Container string
}
var (
	// Instance is the singleton instance of the identity.  This is goroutine safe.
	Instance Metadata
)

func LoadIdentity

func LoadIdentity(path string) (Metadata, error)

LoadIdentity loads the identity from the specified path.

type PodInformer

type PodInformer struct {
	K8sClient kubernetes.Interface
	NodeName  string
	// contains filtered or unexported fields
}

func NewPodInformer

func NewPodInformer(k8sClient kubernetes.Interface, nodeName string) *PodInformer

func (*PodInformer) Add

Add adds a handler to the informer. The handler will be called when a pod is added, updated, or deleted. Lazily creates and starts the informer if it does not already exist.

func (*PodInformer) Remove

Remove removes a handler from the informer. Lazily shuts down the informer if there are no more handlers.

type PodInformerInterface added in v0.2.0

type PodInformerInterface interface {
	Add(ctx context.Context, handler cache.ResourceEventHandler) (cache.ResourceEventHandlerRegistration, error)
	Remove(reg cache.ResourceEventHandlerRegistration) error
}

PodInformerInterface defines the common interface for pod informers

type WarningLogger added in v0.2.0

type WarningLogger struct{}

func (WarningLogger) HandleWarningHeader added in v0.2.0

func (WarningLogger) HandleWarningHeader(code int, agent string, message string)

func (WarningLogger) HandleWarningHeaderWithContext added in v0.2.0

func (WarningLogger) HandleWarningHeaderWithContext(_ context.Context, code int, agent string, message string)

Jump to

Keyboard shortcuts

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