k8s

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 12 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(kubeconfigPath, context string) (*Client, error)

NewClient creates a new Kubernetes client

func (*Client) DeleteJobs

func (c *Client) DeleteJobs(ctx context.Context, jobs []JobInfo) (int, error)

DeleteJobs deletes the specified jobs

func (*Client) DeletePods

func (c *Client) DeletePods(ctx context.Context, pods []PodInfo) (int, error)

DeletePods deletes the specified pods

func (*Client) DeleteReplicaSets

func (c *Client) DeleteReplicaSets(ctx context.Context, replicaSets []ReplicaSetInfo) (int, error)

DeleteReplicaSets deletes the specified ReplicaSets

func (*Client) FindCompletedJobs

func (c *Client) FindCompletedJobs(ctx context.Context, namespace string) ([]JobInfo, error)

FindCompletedJobs finds completed jobs

func (*Client) FindCompletedPods

func (c *Client) FindCompletedPods(ctx context.Context, namespace string) ([]PodInfo, error)

FindCompletedPods finds completed pods

func (*Client) FindEvictedPods

func (c *Client) FindEvictedPods(ctx context.Context, namespace string) ([]PodInfo, error)

FindEvictedPods finds evicted pods

func (*Client) FindFailedPods

func (c *Client) FindFailedPods(ctx context.Context, namespace string) ([]PodInfo, error)

FindFailedPods finds failed pods

func (*Client) FindOrphanedReplicaSets

func (c *Client) FindOrphanedReplicaSets(ctx context.Context, namespace string) ([]ReplicaSetInfo, error)

FindOrphanedReplicaSets finds orphaned ReplicaSets

func (*Client) GetClusterInfo

func (c *Client) GetClusterInfo(ctx context.Context) (*ClusterInfo, error)

GetClusterInfo returns cluster information

func (*Client) GetClusterResources

func (c *Client) GetClusterResources(ctx context.Context) (*ClusterResources, error)

GetClusterResources returns cluster resource information

func (*Client) GetDeploymentHealth

func (c *Client) GetDeploymentHealth(ctx context.Context, namespace string) (*DeploymentHealth, error)

GetDeploymentHealth returns deployment health status

func (*Client) GetNamespaceResources

func (c *Client) GetNamespaceResources(ctx context.Context) ([]NamespaceResources, error)

GetNamespaceResources returns resource usage by namespace

func (*Client) GetNodeHealth

func (c *Client) GetNodeHealth(ctx context.Context) (*NodeHealth, error)

GetNodeHealth returns node health status

func (*Client) GetPVCHealth

func (c *Client) GetPVCHealth(ctx context.Context, namespace string) (*PVCHealth, error)

GetPVCHealth returns PVC health status

func (*Client) GetPodHealth

func (c *Client) GetPodHealth(ctx context.Context, namespace string) (*PodHealth, error)

GetPodHealth returns pod health status

func (*Client) GetResourceUtilization

func (c *Client) GetResourceUtilization(ctx context.Context) (*ResourceUtilization, error)

GetResourceUtilization returns resource utilization

func (*Client) GetServiceHealth

func (c *Client) GetServiceHealth(ctx context.Context, namespace string) (*ServiceHealth, error)

GetServiceHealth returns service health status

func (*Client) GetTopPods

func (c *Client) GetTopPods(ctx context.Context, namespace string, limit int) (*TopPods, error)

GetTopPods returns top resource consuming pods

func (*Client) GetWarningEvents

func (c *Client) GetWarningEvents(ctx context.Context, namespace string, limit int) ([]EventInfo, error)

GetWarningEvents returns recent warning events

func (*Client) ListEvents

func (c *Client) ListEvents(ctx context.Context, namespace string, filter EventFilter) ([]EventInfo, error)

ListEvents lists events with filters

func (*Client) ListNodes

func (c *Client) ListNodes(ctx context.Context) ([]NodeInfo, error)

ListNodes lists cluster nodes with enhanced information

func (*Client) ListPods

func (c *Client) ListPods(ctx context.Context, namespace, labelSelector string) ([]PodInfo, error)

ListPods lists pods with enhanced information

type ClusterInfo

type ClusterInfo struct {
	Name       string
	Server     string
	K8sVersion string
}

ClusterInfo contains cluster information

type ClusterResources

type ClusterResources struct {
	CPURequests       int64
	CPULimits         int64
	CPUAllocatable    int64
	MemoryRequests    int64
	MemoryLimits      int64
	MemoryAllocatable int64
	PodCount          int
	PodCapacity       int
}

ClusterResources contains cluster resource information

type DeploymentHealth

type DeploymentHealth struct {
	Total       int
	Ready       int
	Unavailable int
}

DeploymentHealth contains deployment health information

type EventFilter

type EventFilter struct {
	Type   string
	Reason string
	Object string
	Limit  int
}

EventFilter contains event filter options

type EventInfo

type EventInfo struct {
	Type          string
	Reason        string
	Object        string
	Kind          string
	Message       string
	Count         int32
	LastTimestamp time.Time
}

EventInfo contains event information

type JobInfo

type JobInfo struct {
	Name      string
	Namespace string
}

JobInfo contains job information

type NamespaceResources

type NamespaceResources struct {
	Namespace      string
	PodCount       int
	CPURequests    int64
	MemoryRequests int64
}

NamespaceResources contains namespace resource information

type NodeHealth

type NodeHealth struct {
	Total   int
	Ready   int
	Healthy bool
}

NodeHealth contains node health information

type NodeInfo

type NodeInfo struct {
	Name               string
	Ready              bool
	Roles              string
	KubeletVersion     string
	InternalIP         string
	ExternalIP         string
	OSImage            string
	KernelVersion      string
	ContainerRuntime   string
	CPUCapacity        int64
	MemoryCapacity     int64
	CPUUsagePercent    float64
	MemoryUsagePercent float64
	MemoryPressure     bool
	DiskPressure       bool
	PIDPressure        bool
	CreationTime       time.Time
}

NodeInfo contains node information

type PVCHealth

type PVCHealth struct {
	Bound   int
	Pending int
	Total   int
}

PVCHealth contains PVC health information

type PodHealth

type PodHealth struct {
	Running int
	Pending int
	Failed  int
	Total   int
}

PodHealth contains pod health information

type PodInfo

type PodInfo struct {
	Name            string
	Namespace       string
	Status          string
	ReadyContainers int
	TotalContainers int
	Restarts        int32
	Node            string
	IP              string
	CreationTime    time.Time
}

PodInfo contains pod information

type PodResourceUsage

type PodResourceUsage struct {
	Name          string
	Namespace     string
	CPUUsage      int64
	CPURequest    int64
	MemoryUsage   int64
	MemoryRequest int64
}

PodResourceUsage contains pod resource usage

type ReplicaSetInfo

type ReplicaSetInfo struct {
	Name      string
	Namespace string
}

ReplicaSetInfo contains ReplicaSet information

type ResourceUtilization

type ResourceUtilization struct {
	CPUUsed        int64
	CPUCapacity    int64
	MemoryUsed     int64
	MemoryCapacity int64
}

ResourceUtilization contains resource utilization information

type ServiceHealth

type ServiceHealth struct {
	ClusterIP    int
	LoadBalancer int
	NodePort     int
	Total        int
}

ServiceHealth contains service health information

type TopPods

type TopPods struct {
	ByCPU    []PodResourceUsage
	ByMemory []PodResourceUsage
}

TopPods contains top resource consuming pods

Jump to

Keyboard shortcuts

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