Documentation
¶
Index ¶
- type Client
- func (c *Client) CheckConnection(ctx context.Context) error
- func (c *Client) Clientset() *kubernetes.Clientset
- func (c *Client) CurrentContext() string
- func (c *Client) CurrentNamespace() string
- func (c *Client) DeleteDeployment(ctx context.Context, namespace, name string) error
- func (c *Client) DeletePod(ctx context.Context, namespace, name string) error
- func (c *Client) GetAllNamespaceEvents(ctx context.Context, opts EventFilterOptions) ([]domain.Event, error)
- func (c *Client) GetClusterInfo(ctx context.Context) (*domain.ClusterInfo, error)
- func (c *Client) GetDeployment(ctx context.Context, namespace, name string) (*domain.Deployment, error)
- func (c *Client) GetDeployments(ctx context.Context, namespace string) ([]domain.Deployment, error)
- func (c *Client) GetEvents(ctx context.Context, namespace string) ([]domain.Event, error)
- func (c *Client) GetEventsFiltered(ctx context.Context, namespace string, opts EventFilterOptions) ([]domain.Event, error)
- func (c *Client) GetNamespaces(ctx context.Context) ([]domain.Namespace, error)
- func (c *Client) GetPod(ctx context.Context, namespace, name string) (*domain.Pod, error)
- func (c *Client) GetPodContainers(ctx context.Context, namespace, podName string) ([]string, error)
- func (c *Client) GetPodEvents(ctx context.Context, namespace, podName string) ([]domain.PodEvent, error)
- func (c *Client) GetPodLogs(ctx context.Context, namespace, podName string, opts LogOptions) (string, error)
- func (c *Client) GetPods(ctx context.Context, namespace string) ([]domain.Pod, error)
- func (c *Client) GetService(ctx context.Context, namespace, name string) (*domain.Service, error)
- func (c *Client) GetServices(ctx context.Context, namespace string) ([]domain.Service, error)
- func (c *Client) ListNamespaces(ctx context.Context) ([]string, error)
- func (c *Client) RestartDeployment(ctx context.Context, namespace, name string) error
- func (c *Client) ScaleDeployment(ctx context.Context, namespace, name string, replicas int32) error
- func (c *Client) SetNamespace(ns string)
- func (c *Client) StreamPodLogs(ctx context.Context, namespace, podName string, opts LogOptions, ...) error
- type EventFilterOptions
- type LogOptions
- type MetricsClient
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 (*Client) CheckConnection ¶
CheckConnection verifies the connection to the cluster
func (*Client) Clientset ¶
func (c *Client) Clientset() *kubernetes.Clientset
Clientset returns the underlying Kubernetes clientset
func (*Client) CurrentContext ¶
CurrentContext returns the current context name
func (*Client) CurrentNamespace ¶
CurrentNamespace returns the current namespace
func (*Client) DeleteDeployment ¶ added in v0.2.0
DeleteDeployment deletes a deployment by name
func (*Client) GetAllNamespaceEvents ¶ added in v0.2.0
func (c *Client) GetAllNamespaceEvents(ctx context.Context, opts EventFilterOptions) ([]domain.Event, error)
GetAllNamespaceEvents returns events from all namespaces
func (*Client) GetClusterInfo ¶
GetClusterInfo returns information about the connected cluster
func (*Client) GetDeployment ¶ added in v0.2.0
func (c *Client) GetDeployment(ctx context.Context, namespace, name string) (*domain.Deployment, error)
GetDeployment returns a single deployment with full details
func (*Client) GetDeployments ¶ added in v0.2.0
GetDeployments returns all deployments in the specified namespace
func (*Client) GetEventsFiltered ¶ added in v0.2.0
func (c *Client) GetEventsFiltered(ctx context.Context, namespace string, opts EventFilterOptions) ([]domain.Event, error)
GetEventsFiltered returns events with optional filtering
func (*Client) GetNamespaces ¶
GetNamespaces returns all namespaces with their status
func (*Client) GetPodContainers ¶
GetPodContainers returns the list of container names for a pod
func (*Client) GetPodEvents ¶
func (c *Client) GetPodEvents(ctx context.Context, namespace, podName string) ([]domain.PodEvent, error)
GetPodEvents returns events for a specific pod
func (*Client) GetPodLogs ¶
func (c *Client) GetPodLogs(ctx context.Context, namespace, podName string, opts LogOptions) (string, error)
GetPodLogs retrieves logs for a pod container
func (*Client) GetService ¶ added in v0.2.0
GetService returns a single service with full details
func (*Client) GetServices ¶ added in v0.2.0
GetServices returns all services in the specified namespace
func (*Client) ListNamespaces ¶
ListNamespaces returns all namespaces in the cluster
func (*Client) RestartDeployment ¶ added in v0.2.0
RestartDeployment triggers a rolling restart by patching the deployment's annotations
func (*Client) ScaleDeployment ¶ added in v0.2.0
ScaleDeployment scales a deployment to the specified number of replicas
func (*Client) SetNamespace ¶
SetNamespace sets the current namespace
func (*Client) StreamPodLogs ¶
func (c *Client) StreamPodLogs(ctx context.Context, namespace, podName string, opts LogOptions, lineChan chan<- string) error
StreamPodLogs streams logs for a pod container, sending each line to the provided channel The function returns when the context is cancelled or an error occurs
type EventFilterOptions ¶ added in v0.2.0
type EventFilterOptions struct {
Type string // "Normal", "Warning", or "" for all
ObjectKind string // "Pod", "Deployment", etc. or "" for all
Limit int64 // Maximum number of events (0 = no limit)
}
EventFilterOptions specifies filters for event retrieval
type LogOptions ¶
type LogOptions struct {
Container string
Follow bool
TailLines int64
Timestamps bool
Previous bool
}
LogOptions configures log retrieval
func DefaultLogOptions ¶
func DefaultLogOptions() LogOptions
DefaultLogOptions returns sensible default log options
type MetricsClient ¶ added in v0.2.0
type MetricsClient struct {
// contains filtered or unexported fields
}
MetricsClient wraps the Kubernetes metrics API client
func NewMetricsClient ¶ added in v0.2.0
func NewMetricsClient(kubeconfigPath string) (*MetricsClient, error)
NewMetricsClient creates a new metrics client from the kubeconfig path
func (*MetricsClient) CheckMetricsAvailable ¶ added in v0.2.0
func (m *MetricsClient) CheckMetricsAvailable(ctx context.Context) bool
CheckMetricsAvailable tests if the metrics server is available
func (*MetricsClient) GetPodMetric ¶ added in v0.2.0
func (m *MetricsClient) GetPodMetric(ctx context.Context, namespace, name string) (*domain.PodMetrics, error)
GetPodMetric returns metrics for a single pod
func (*MetricsClient) GetPodMetrics ¶ added in v0.2.0
func (m *MetricsClient) GetPodMetrics(ctx context.Context, namespace string) (map[string]domain.PodMetrics, error)
GetPodMetrics returns metrics for all pods in the namespace