util

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultHTTPTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func ContainsKillingStoppingContainerEvents added in v0.4.0

func ContainsKillingStoppingContainerEvents(
	c kubernetes.Interface,
	name,
	namespace string) bool

ContainsKillingStoppingContainerEvents checks if the events contain an event with "Killing Stopping container" which indicates that a container could not be gracefully shutdown

func GetDefaultClient added in v0.10.5

func GetDefaultClient() *http.Client

func GetNamespace added in v0.10.5

func GetNamespace() string

GetNamespace returns the namespace where kwatch is running. It reads from POD_NAMESPACE environment variable and falls back to "kwatch".

func GetNodeSummary added in v0.8.0

func GetNodeSummary(c kubernetes.Interface, name string) ([]byte, error)

GetNodeSummary gets a list of nodes

func GetNodes added in v0.8.0

func GetNodes(c kubernetes.Interface) (*v1.NodeList, error)

GetNodes gets a list of nodes

func GetPVNameFromPVC added in v0.8.0

func GetPVNameFromPVC(
	c kubernetes.Interface,
	namespace, pvcName string) (string, error)

GetPVNameFromPVC returns the name of persistent volume given a namespace and persistent volume claim name

func GetPodContainerLogs

func GetPodContainerLogs(
	c kubernetes.Interface, name, container, namespace string,
	previous bool,
	maxRecentLogLines int64) string

GetPodContainerLogs returns logs for specified container in pod

func GetPodEvents added in v0.9.0

func GetPodEvents(
	c kubernetes.Interface,
	name,
	namespace string) (*v1.EventList, error)

GetPodEvents retrieves the events for a specific pod

func GetPodEventsStr added in v0.0.2

func GetPodEventsStr(events *[]v1.Event) string

GetPodEventsStr returns formatted events as a string for specified pod

func JsonEscape added in v0.7.0

func JsonEscape(i string) string

JsonEscape escapes the json special characters in a string

func NewHTTPClient added in v0.10.5

func NewHTTPClient(timeout time.Duration) *http.Client

func RandomString added in v0.7.0

func RandomString(n int) string

RandomString generates random string with provided n size

func SetLogFormatter added in v0.10.5

func SetLogFormatter(formatter string)

SetLogFormatter sets the log formatter based on the provided format string

Types

This section is empty.

Jump to

Keyboard shortcuts

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