Documentation ¶
Index ¶
- func ExportCSV(prefix string, rows [][]string) string
- func FormatContainerMetrics(containerMetrics []*ContainerMetrics, metric_type v1.ResourceName, ...) (rows [][]string, total int64)
- func FormatResourceUsage(metricsclient *versioned.Clientset, nodes *v1.NodeList, ...) (rows [][]string)
- func GetConfig() *rest.Config
- func GetField(r interface{}, field string) interface{}
- func GetFields(r interface{}) []string
- func GetNodesByUsage(nodes *v1.NodeList, metricsclient *versioned.Clientset) map[string]NodeStatus
- func GetNodesListAndMetrics(config *rest.Config) (*v1.NodeList, *versioned.Clientset)
- func GetPodsByNode(d clientset.Clientset, name string, namespace string) (*v1.PodList, error)
- func GetPodsTotalMemRequestsAndLimits(podList []corev1.Pod) (int64, int64)
- func GetWorkerNode(nodes map[string]NodeStatus) (string, error)
- func MinMax_float64(array []float64) (float64, float64)
- func MinMax_int64(array []int64) (int64, int64)
- func NodeCapacity(node *corev1.Node) corev1.ResourceList
- func PrintContainerMetrics(rows [][]string, duration time.Duration, total int64)
- func PrintResourceUsage(rows [][]string)
- type ContainerMetrics
- type ContainerResources
- type CpuResource
- type KubeClient
- func (k *KubeClient) ActivePods(namespace, nodeName string) ([]corev1.Pod, error)
- func (k *KubeClient) ClusterCapacity() (capacity corev1.ResourceList, err error)
- func (k *KubeClient) ContainerResources(namespace string) (resources []*ContainerResources, err error)
- func (c *KubeClient) NodeList() (*corev1.NodeList, error)
- func (k *KubeClient) NodeResources(namespace, nodeName string) (resources []*ContainerResources, err error)
- func (k *KubeClient) ResourceUsage(metricsclient *versioned.Clientset, namespace, sort string, reverse bool, ...)
- type MemoryResource
- type NodeStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatContainerMetrics ¶
func FormatContainerMetrics(containerMetrics []*ContainerMetrics, metric_type v1.ResourceName, duration time.Duration, field string, reverse bool) (rows [][]string, total int64)
func FormatResourceUsage ¶
func GetNodesByUsage ¶
TODO check sort NOT WORKING FOR Memory
func GetNodesListAndMetrics ¶
func GetPodsByNode ¶
func GetWorkerNode ¶
func GetWorkerNode(nodes map[string]NodeStatus) (string, error)
func MinMax_float64 ¶
func MinMax_int64 ¶
func NodeCapacity ¶
func NodeCapacity(node *corev1.Node) corev1.ResourceList
func PrintContainerMetrics ¶
func PrintResourceUsage ¶
func PrintResourceUsage(rows [][]string)
Types ¶
type ContainerMetrics ¶
type ContainerMetrics struct { ContainerName string PodName string NodeName string MetricType v1.ResourceName MemoryMin *MemoryResource MemoryMax *MemoryResource MemoryMode *MemoryResource MemoryLast *MemoryResource CpuMin *CpuResource CpuMax *CpuResource CpuAvg *CpuResource CpuLast *CpuResource DataPoints int64 }
func (ContainerMetrics) Validate ¶
func (m ContainerMetrics) Validate(field string) bool
type ContainerResources ¶
type ContainerResources struct { NodeName string Name string Namespace string CpuReq *CpuResource CpuLimit *CpuResource PercentCpuReq int64 PercentCpuLimit int64 MemReq *MemoryResource MemLimit *MemoryResource PercentMemoryReq int64 PercentMemoryLimit int64 PodAge time.Duration }
func GetPodsByUsage ¶
func GetPodsByUsage(nodeName string, resources []*ContainerResources) []*ContainerResources
func (ContainerResources) Validate ¶
func (r ContainerResources) Validate(field string) bool
type CpuResource ¶
func NewCpuResource ¶
func NewCpuResource(value int64) *CpuResource
func (*CpuResource) String ¶
func (r *CpuResource) String() string
func (*CpuResource) ToQuantity ¶
func (r *CpuResource) ToQuantity() *resource.Quantity
type KubeClient ¶
type KubeClient struct {
Clientset *kubernetes.Clientset
}
func GetClient ¶
func GetClient(config *rest.Config) *KubeClient
func NewKubeClient ¶
func NewKubeClient(clientset *kubernetes.Clientset) *KubeClient
func (*KubeClient) ActivePods ¶
func (k *KubeClient) ActivePods(namespace, nodeName string) ([]corev1.Pod, error)
func (*KubeClient) ClusterCapacity ¶
func (k *KubeClient) ClusterCapacity() (capacity corev1.ResourceList, err error)
func (*KubeClient) ContainerResources ¶
func (k *KubeClient) ContainerResources(namespace string) (resources []*ContainerResources, err error)
func (*KubeClient) NodeResources ¶
func (k *KubeClient) NodeResources(namespace, nodeName string) (resources []*ContainerResources, err error)
func (*KubeClient) ResourceUsage ¶
type MemoryResource ¶
func NewMemoryResource ¶
func NewMemoryResource(value int64) *MemoryResource
func (*MemoryResource) String ¶
func (r *MemoryResource) String() string
func (*MemoryResource) ToQuantity ¶
func (r *MemoryResource) ToQuantity() *resource.Quantity
type NodeStatus ¶
type NodeStatus struct { MemAlloc int64 // contains filtered or unexported fields }
mem usage in Gi
func FilterNodesByUsage ¶
func FilterNodesByUsage(nodes map[string]NodeStatus, memThreshold int64) []NodeStatus
Source Files ¶
Click to show internal directories.
Click to hide internal directories.