Documentation
¶
Index ¶
- Constants
- func GetNodeAllocatedResource(ctx context.Context, client k8sClient.Interface, node v1.Node) (NodeAllocatedResources, NodeUtilization, error)
- func PodRequestsAndLimits(pod *v1.Pod) (reqs, limits v1.ResourceList, err error)
- type ClusterWorkloadReport
- type ContainerResult
- type ControllerResult
- type Ingress
- type NodeAllocatedResources
- type NodeSummary
- type NodeUtilization
- type ResourceResult
- type ResourcesInfo
Constants ¶
const KindIngress = "Ingress"
Variables ¶
This section is empty.
Functions ¶
func GetNodeAllocatedResource ¶
func GetNodeAllocatedResource(ctx context.Context, client k8sClient.Interface, node v1.Node) (NodeAllocatedResources, NodeUtilization, error)
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 ClusterWorkloadReport ¶
type ClusterWorkloadReport struct { ServerVersion string CreationTime time.Time SourceName string SourceType string Nodes []NodeSummary Namespaces []corev1.Namespace Controllers []ControllerResult Ingresses []Ingress }
ClusterWorkloadReport contains k8s workload resources report structure
func CreateResourceProviderFromAPI ¶
func CreateResourceProviderFromAPI(ctx context.Context, dynamicClient dynamic.Interface, restMapper meta.RESTMapper, kube kubernetes.Interface, clusterName string) (*ClusterWorkloadReport, error)
CreateResourceProviderFromAPI creates a new ResourceProvider from an existing k8s interface
type ContainerResult ¶
type ContainerResult struct { Name string Image string ImageID string CreationTime time.Time Resource ResourceResult }
ContainerResult provides a list of validation messages for each container.
type ControllerResult ¶
type ControllerResult struct { Kind string Name string Namespace string Annotations map[string]string Labels map[string]string PodLabels map[string]string PodAnnotations map[string]string UID string ParentUID string PodCount float64 Containers []ContainerResult }
ControllerResult provides a wrapper around a PodResult
type NodeAllocatedResources ¶
type NodeAllocatedResources struct { // Requests is the total requested resources of all pods in the node Requests v1.ResourceList // Requests is the total resource limits of all pods in the node Limits v1.ResourceList }
NodeAllocatedResources describes node allocated resources.
type NodeSummary ¶
type NodeSummary struct { Name string Labels map[string]string Annotations map[string]string CreationTimestamp time.Time Capacity corev1.ResourceList Allocatable corev1.ResourceList AllocatedLimits corev1.ResourceList AllocatedRequests corev1.ResourceList Utilization NodeUtilization KubeletVersion string KubeProxyVersion string IsControlPlaneNode bool }
NodeSummary gives highlevel overview of node informations
type NodeUtilization ¶
type NodeUtilization struct { // CPURequestsFraction is a fraction of CPU, that is allocated. CPURequestsFraction float64 `json:"cpuRequestsFraction"` // CPULimitsFraction is a fraction of defined CPU limit, can be over 100%, i.e. // overcommitted. CPULimitsFraction float64 `json:"cpuLimitsFraction"` // MemoryRequestsFraction is a fraction of memory, that is allocated. MemoryRequestsFraction float64 `json:"memoryRequestsFraction"` // MemoryLimitsFraction is a fraction of defined memory limit, can be over 100%, i.e. // overcommitted. MemoryLimitsFraction float64 `json:"memoryLimitsFraction"` }
type ResourceResult ¶
type ResourceResult struct { Requests ResourcesInfo Limits ResourcesInfo }
ResourceResult provides resources information.
type ResourcesInfo ¶
ResourcesInfo provides a request/limit item information.