utils

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NA Not available.
	NA = "N/A"
)
View Source
const UnknownTime = "UNKNOWN"

UnknownTime represent the time can't successfully be formatted

Variables

This section is empty.

Functions

func PodMetric

func PodMetric(cfg *rest.Config, name, namespace string) (*v1beta1.PodMetrics, error)

PodMetric return the pod metric

func TimeFormat

func TimeFormat(t time.Duration) string

TimeFormat format time data of `time.Duration` type to string type

func ToPercentage

func ToPercentage(v1, v2 int64) int

ToPercentage computes percentage as string otherwise n/aa.

func ToPercentageStr

func ToPercentageStr(v1, v2 int64) string

ToPercentageStr computes percentage, but if v2 is 0, it will return NAValue instead of 0.

Types

type Metric

type Metric struct {
	CPU, Mem   int64
	Lcpu, Lmem int64
}

Metric including requests and limits metrics

func GatherPodMX

func GatherPodMX(pod *v1.Pod, mx *v1beta1.PodMetrics) (c, r Metric)

GatherPodMX return the usage metrics of a pod and specified metric including requests and limits metrics

Jump to

Keyboard shortcuts

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