Documentation ¶
Index ¶
- func ExceedsCompare(a string) string
- func FieldString(str string) float64
- func NodeCapacity(node *v1.Node) v1.ResourceList
- func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList, err error)
- type CPUResources
- type CpuResource
- type KubeClient
- func (k *KubeClient) GetActivePodByNodename(node corev1.Node) (*corev1.PodList, error)
- func (k *KubeClient) GetNodeMetricsFromMetricsAPI(resourceName string, selector labels.Selector) (*metricsapi.NodeMetricsList, error)
- func (k *KubeClient) GetNodeResources(resourceName string, resourceType string, sortBy string, ...) ([][]string, error)
- func (k *KubeClient) GetNodes(resourceName string, selector labels.Selector) (map[string]corev1.Node, error)
- func (k *KubeClient) GetPodByPodname(podName string, namespace string) (*corev1.Pod, error)
- func (k *KubeClient) GetPodMetricsFromMetricsAPI(namespace, resourceName string, allNamespaces bool, ...) (*metricsapi.PodMetricsList, error)
- func (k *KubeClient) GetPodResources(podmetrics []metricsapi.PodMetrics, namespace string, resourceName string, ...) ([][]string, error)
- func (k *KubeClient) PodMetricses() (*metricsV1beta1api.PodMetricsList, error)
- type MemoryResource
- type MemoryResources
- type NodeAllocatedResources
- type PodAllocatedResources
- type PodResources
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PodRequestsAndLimits ¶
func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList, err error)
PodRequestsAndLimits returns a dictionary of all defined resources summed up for all containers of the pod. If pod overhead is non-nil, the pod overhead is added to the total container resource requests and to the total container limits which have a non-zero quantity.
Types ¶
type CPUResources ¶
type CPUResources struct { // CPUUsages is number of allocated milicores. CPUUsages *CpuResource // CPURequests is number of allocated milicores. CPURequests *CpuResource // CPURequestsFraction is a fraction of CPU, that is allocated. CPURequestsFraction float64 `json:"cpuRequestsFraction"` // CPULimits is defined CPU limit. CPULimits *CpuResource // CPULimitsFraction is a fraction of defined CPU limit, can be over 100%, i.e. // overcommitted. CPULimitsFraction float64 `json:"cpuLimitsFraction"` // CPUCapacity is specified node CPU capacity in milicores. CPUCapacity *CpuResource }
CPUResources describes node allocated resources.
type CpuResource ¶
type KubeClient ¶
type KubeClient struct {
// contains filtered or unexported fields
}
KubeClient provides methods to get all required metrics from Kubernetes
func NewClient ¶
func NewClient(config *rest.Config) (*KubeClient, error)
NewClient creates a new client to get data from kubernetes masters
func (*KubeClient) GetActivePodByNodename ¶
GetActivePodByNodename
func (*KubeClient) GetNodeMetricsFromMetricsAPI ¶
func (k *KubeClient) GetNodeMetricsFromMetricsAPI(resourceName string, selector labels.Selector) (*metricsapi.NodeMetricsList, error)
GetNodeMetricsFromMetricsAPI
func (*KubeClient) GetNodeResources ¶
func (k *KubeClient) GetNodeResources(resourceName string, resourceType string, sortBy string, selector labels.Selector) ([][]string, error)
NodeResources
func (*KubeClient) GetNodes ¶
func (k *KubeClient) GetNodes(resourceName string, selector labels.Selector) (map[string]corev1.Node, error)
GetNodes
func (*KubeClient) GetPodByPodname ¶
GetActivePodByPodname
func (*KubeClient) GetPodMetricsFromMetricsAPI ¶
func (k *KubeClient) GetPodMetricsFromMetricsAPI(namespace, resourceName string, allNamespaces bool, labelSelector labels.Selector, fieldSelector fields.Selector) (*metricsapi.PodMetricsList, error)
GetPodMetricsFromMetricsAPI
func (*KubeClient) GetPodResources ¶
func (k *KubeClient) GetPodResources(podmetrics []metricsapi.PodMetrics, namespace string, resourceName string, allNamespaces bool, resourceType string, sortBy string, labelSelector labels.Selector, fieldSelector fields.Selector) ([][]string, error)
func (*KubeClient) PodMetricses ¶
func (k *KubeClient) PodMetricses() (*metricsV1beta1api.PodMetricsList, error)
PodMetricses returns all pods' usage metrics
type MemoryResource ¶
func (*MemoryResource) String ¶
func (r *MemoryResource) String() string
func (*MemoryResource) ToQuantity ¶
func (r *MemoryResource) ToQuantity() *resource.Quantity
ToQuantity
type MemoryResources ¶
type MemoryResources struct { // MemoryUsages is a fraction of memory, that is allocated. MemoryUsages *MemoryResource // MemoryRequests is a fraction of memory, that is allocated. MemoryRequests *MemoryResource // MemoryRequestsFraction is a fraction of memory, that is allocated. MemoryRequestsFraction float64 `json:"memoryRequestsFraction"` // MemoryLimits is defined memory limit. MemoryLimits *MemoryResource // MemoryLimitsFraction is a fraction of defined memory limit, can be over 100%, i.e. // overcommitted. MemoryLimitsFraction float64 `json:"memoryLimitsFraction"` // MemoryCapacity is specified node memory capacity in bytes. MemoryCapacity *MemoryResource }
MemoryResources describes node allocated resources.
type NodeAllocatedResources ¶
type NodeAllocatedResources struct { CPUResources MemoryResources PodResources }
NodeAllocatedResources describes node allocated resources.
type PodAllocatedResources ¶
type PodAllocatedResources struct { // CPUUsages is number of allocated milicores. CPUUsages *CpuResource // CPURequestsFraction is a fraction of CPU, that is allocated. CPUUsagesFraction float64 `json:"cpuUsagesFraction"` // CPURequests is number of allocated milicores. CPURequests *CpuResource // CPULimits is defined CPU limit. CPULimits *CpuResource // MemoryUsages is a fraction of memory, that is allocated. MemoryUsages *MemoryResource // MemoryRequestsFraction is a fraction of memory, that is allocated. MemoryUsagesFraction float64 `json:"memoryUsagesFraction"` // MemoryRequests is a fraction of memory, that is allocated. MemoryRequests *MemoryResource // MemoryLimits is defined memory limit. MemoryLimits *MemoryResource }
PodAllocatedResources describes node allocated resources.
type PodResources ¶
type PodResources struct { // AllocatedPods in number of currently allocated pods on the node. AllocatedPods int `json:"allocatedPods"` // PodCapacity is maximum number of pods, that can be allocated on the node. PodCapacity int64 `json:"podCapacity"` // PodFraction is a fraction of pods, that can be allocated on given node. PodFraction float64 `json:"podFraction"` }
MemoryResources describes node allocated resources.