advise

package
v0.0.0-...-efd12d5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNDER_PROVISIONED = "%s %s: %s is under-provisioned (%.2f%% usage). Add resources."
	WELL_PROVISIONED  = "%s %s: %s is well-provisioned (%.2f%% usage). No action needed."
	OVER_PROVISIONED  = "%s %s: %s is over-provisioned (%.2f%% usage). Trim resources."
)

Variables

This section is empty.

Functions

func Advise

func Advise(ctx context.Context, cfg *scout.Config, pod v1.Pod) error

Advise generates resource allocation advice for a Kubernetes pod. The function fetches usage metrics for each container in the pod. It then checks the usage percentages against thresholds to determine if more or less of a resource is needed. Advice is generated and either printed to the console or output to a file depending on the cfg.Output field.

func CheckUsage

func CheckUsage(usage float64, resourceType string, container string) scout.Advice

func K8s

func K8s(
	ctx context.Context,
	k8sClient *kubernetes.Clientset,
	metricsClient *metricsv.Clientset,
	restConfig *rest.Config,
	opts ...Option,
) error

func OutputToFile

func OutputToFile(ctx context.Context, cfg *scout.Config, name string, advice []scout.Advice) error

outputToFile writes resource allocation advice for a Kubernetes pod to a file.

Types

type Option

type Option = func(config *scout.Config)

func WithNamespace

func WithNamespace(namespace string) Option

func WithOutput

func WithOutput(pathToFile string) Option

func WithPod

func WithPod(podname string) Option

func WithWarnings

func WithWarnings(includeWarnings bool) Option

Jump to

Keyboard shortcuts

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