k8s

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the kubernetes clientset

func NewClient

func NewClient(namespace string) (*Client, error)

NewClient creates a new k8s client using the default kubeconfig

func (*Client) FindPodsAllNamespaces added in v0.6.0

func (c *Client) FindPodsAllNamespaces(ctx context.Context, labelSelector string) ([]corev1.Pod, error)

FindPodsAllNamespaces searches all namespaces for pods matching a label selector

func (*Client) FindServicesAllNamespaces added in v0.6.0

func (c *Client) FindServicesAllNamespaces(ctx context.Context, labelSelector string) ([]corev1.Service, error)

FindServicesAllNamespaces searches all namespaces for services matching a label selector

func (*Client) GetPod

func (c *Client) GetPod(ctx context.Context, name string) (*corev1.Pod, error)

GetPod returns a single pod by name

func (*Client) GetPodLogs

func (c *Client) GetPodLogs(ctx context.Context, name string, opts PodLogsOptions) (io.ReadCloser, error)

GetPodLogs returns a stream of logs from a pod

func (*Client) GetService

func (c *Client) GetService(ctx context.Context, name string) (*corev1.Service, error)

GetService returns a single service by name

func (*Client) ListNamespaces

func (c *Client) ListNamespaces(ctx context.Context) ([]corev1.Namespace, error)

ListNamespaces returns all namespaces in the cluster

func (*Client) ListPods

func (c *Client) ListPods(ctx context.Context, allNamespaces bool) ([]corev1.Pod, error)

ListPods returns pods in the specified namespace (or all namespaces if allNamespaces is true)

func (*Client) ListServices

func (c *Client) ListServices(ctx context.Context, allNamespaces bool) ([]corev1.Service, error)

ListServices returns services in the specified namespace (or all namespaces if allNamespaces is true)

func (*Client) Namespace

func (c *Client) Namespace() string

Namespace returns the effective namespace for this client

func (*Client) TestConnection added in v0.3.0

func (c *Client) TestConnection(ctx context.Context) (string, error)

TestConnection attempts to connect and returns server version

type ContextInfo

type ContextInfo struct {
	Name      string
	Cluster   string
	Namespace string
	User      string
	Current   bool
}

ContextInfo holds information about a kubeconfig context

func ListContexts

func ListContexts() ([]ContextInfo, error)

ListContexts returns all contexts from kubeconfig

type PodLogsOptions

type PodLogsOptions struct {
	Container    string
	Follow       bool
	TailLines    int64
	Previous     bool
	SinceSeconds int64
}

PodLogsOptions configures the log stream

Jump to

Keyboard shortcuts

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