util

package
v0.0.0-...-833298b Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultColor

func DefaultColor(s *string)

DefaultColor set default color

func GetBinUnit

func GetBinUnit(b, k, m, g bool) (int64, string)

GetBinUnit defines unit for usage (Binary prefix) If multiple options are selected, returns a biggest unit

func GetContainerCount

func GetContainerCount(pods v1.PodList) int

GetContainerCount returns count of containers

func GetContainerMetrics

func GetContainerMetrics(metrics *metricsapiv1beta1.PodMetricsList, podName, containerName string) (cpu *resource.Quantity, mem *resource.Quantity)

GetContainerMetrics returns container metrics usage

func GetNodeStatus

func GetNodeStatus(node v1.Node, emoji bool) (string, error)

GetNodeStatus returns node status

func GetNodes

func GetNodes(ctx context.Context, c clientv1.NodeInterface, args []string, label string) ([]v1.Node, error)

GetNodes returns node objects

func GetPercentage

func GetPercentage(a, b int64) int64

GetPercentage returns (a*100)/b

func GetPodCount

func GetPodCount(pods v1.PodList) int

GetPodCount returns count of pods

func GetPodResources

func GetPodResources(pods v1.PodList) (int64, int64, int64, int64)

GetPodResources returns sum of requested/limit resources

func GetPodStatus

func GetPodStatus(status string, nocolor, emoji bool) string

GetPodStatus defined pod status with color

func GetPods

func GetPods(ctx context.Context, c clientv1.PodInterface, nodeName string) (*v1.PodList, error)

GetPods returns node objects

func GetSiUnit

func GetSiUnit(b, k, m, g bool) (int64, string)

GetSiUnit defines unit for usage (SI prefix) If multiple options are selected, returns a biggest unit

func Green

func Green(s *string)

Green is coloring string to green

func JoinTab

func JoinTab(s []string) string

JoinTab joins string slice with tab

func Red

func Red(s *string)

Red is coloring string to red

func SetNodeStatusColor

func SetNodeStatusColor(status *string, nocolor bool)

SetNodeStatusColor defined color of node status

func SetPercentageColor

func SetPercentageColor(s *string, p, warn, crit int64)

SetPercentageColor returns colored string

percentage < warn : Green

warn < percentage < crit : Yellow crit < percentage : Red

func ValidateThreshold

func ValidateThreshold(w, c int64) error

func Yellow

func Yellow(s *string)

Yellow is coloring string to yellow

Types

This section is empty.

Jump to

Keyboard shortcuts

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