kube

package
v0.0.0-...-06147c6 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportCSV

func ExportCSV(prefix string, rows [][]string) string

func FormatContainerMetrics

func FormatContainerMetrics(containerMetrics []*ContainerMetrics, metric_type v1.ResourceName, duration time.Duration, field string, reverse bool) (rows [][]string, total int64)

func FormatResourceUsage

func FormatResourceUsage(capacity v1.ResourceList, resources []*ContainerResources, field string, reverse bool) (rows [][]string)

func GetField

func GetField(r interface{}, field string) interface{}

func GetFields

func GetFields(r interface{}) []string

func MinMax_float64

func MinMax_float64(array []float64) (float64, float64)

func MinMax_int64

func MinMax_int64(array []int64) (int64, int64)

func NodeCapacity

func NodeCapacity(node *api_v1.Node) api_v1.ResourceList

func PrintContainerMetrics

func PrintContainerMetrics(rows [][]string, duration time.Duration, total int64)

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
}

func (ContainerResources) Validate

func (r ContainerResources) Validate(field string) bool

type CpuResource

type CpuResource struct {
	*resource.Quantity
}

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 {
	// contains filtered or unexported fields
}

func NewKubeClient

func NewKubeClient(
	clientset *kubernetes.Clientset,
) *KubeClient

func (*KubeClient) ActivePods

func (k *KubeClient) ActivePods(namespace, nodeName string) ([]api_v1.Pod, error)

func (*KubeClient) ClusterCapacity

func (k *KubeClient) ClusterCapacity() (capacity api_v1.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

func (k *KubeClient) ResourceUsage(namespace, sort string, reverse bool, csv bool)

type MemoryResource

type MemoryResource struct {
	*resource.Quantity
}

func NewMemoryResource

func NewMemoryResource(value int64) *MemoryResource

func (*MemoryResource) String

func (r *MemoryResource) String() string

func (*MemoryResource) ToQuantity

func (r *MemoryResource) ToQuantity() *resource.Quantity

Jump to

Keyboard shortcuts

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