Documentation ¶
Index ¶
- func AddLimits(ctx context.Context, cfg *scout.Config, pod *corev1.Pod, ...) error
- func GetPod(podName string, pods []corev1.Pod) (corev1.Pod, error)
- func GetPodMetrics(ctx context.Context, cfg *scout.Config, pod corev1.Pod) (*metav1beta1.PodMetrics, error)
- func GetPods(ctx context.Context, cfg *scout.Config) ([]corev1.Pod, error)
- func GetPvcCapacity(ctx context.Context, cfg *scout.Config, container corev1.Container, ...) (*resource.Quantity, error)
- func GetRawUsage(usages corev1.ResourceList, targetKey string) (float64, error)
- func GetStorageUsage(ctx context.Context, cfg *scout.Config, podName string, containerName string) (float64, float64, error)
- func GetUsage(ctx context.Context, cfg *scout.Config, metrics scout.ContainerMetrics, ...) (scout.UsageStats, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddLimits ¶
func AddLimits(ctx context.Context, cfg *scout.Config, pod *corev1.Pod, containerMetrics *scout.ContainerMetrics) error
GetLimits generates resource limits for containers in a pod.
It accepts: - ctx: The context for the request - cfg: The scout config containing Kubernetes clientsets - pod: The pod specification - containerMetrics: A pointer to a ContainerMetrics struct to populate
It populates the containerMetrics.Limits field with a map of container names to resource limits (CPU, memory, storage) for each container in the pod.
It returns: - Any error that occurred while fetching resource limits
func GetPodMetrics ¶
func GetPodMetrics(ctx context.Context, cfg *scout.Config, pod corev1.Pod) (*metav1beta1.PodMetrics, error)
GetPodMetrics fetches metrics for a given pod from the Kubernetes Metrics API. It accepts: - ctx: The context for the request - cfg: The scout config containing Kubernetes clientsets - pod: The pod specification
It returns: - podMetrics: The PodMetrics object containing metrics for the pod - Any error that occurred while fetching the metrics
func GetPvcCapacity ¶
func GetPvcCapacity(ctx context.Context, cfg *scout.Config, container corev1.Container, pod *corev1.Pod) (*resource.Quantity, error)
GetPvcCapacity returns the storage capacity of a PersistentVolumeClaim mounted to a container.
It accepts: - ctx: The context for the request - cfg: The scout config containing Kubernetes clientsets - container: The container specification - pod: The pod specification
It returns: - The storage capacity of the PVC in bytes - Any error that occurred while fetching the PVC
If no PVC is mounted to the container, nil is returned for the capacity and no error.
func GetRawUsage ¶
func GetRawUsage(usages corev1.ResourceList, targetKey string) (float64, error)
GetRawUsage returns the raw usage value for a given resource type from a Kubernetes ResourceList.
It accepts: - usages: A Kubernetes ResourceList containing usage values - targetKey: The resource type to get the usage for (e.g. "cpu" or "memory")
It returns: - The raw usage value for the target resource type - Any error that occurred while parsing the usage value
func GetStorageUsage ¶
func GetStorageUsage( ctx context.Context, cfg *scout.Config, podName string, containerName string, ) (float64, float64, error)
GetStorageUsage returns the storage capacity and usage for a given pod and container.
It accepts: - ctx: The context for the request - cfg: The scout config containing Kubernetes clientsets - podName: The name of the pod - containerName: The name of the container
It returns: - storageCapacity: The total storage capacity for the container in bytes - storageUsage: The used storage for the container in bytes - Any error that occurred while fetching the storage usage
func GetUsage ¶
func GetUsage( ctx context.Context, cfg *scout.Config, metrics scout.ContainerMetrics, pod corev1.Pod, container metav1beta1.ContainerMetrics, ) (scout.UsageStats, error)
GetUsage generates resource usage statistics for a Kubernetes container.
It accepts: - ctx: The context for the request - cfg: The scout config containing Kubernetes clientsets - metrics: Container resource limits - pod: The pod specification - container: Container metrics from the Metrics API
It returns: - usageStats: A UsageStats struct containing the resource usage info - Any error that occurred while generating the usage stats
Types ¶
This section is empty.