usage

package
Version: v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReportURLEnvName ...
	ReportURLEnvName = "REPORT_URL"
	// HeartbeatIntervalEnvName ...
	HeartbeatIntervalEnvName = "HEARTBEAT_INTERVAL"
	// NamespaceEnvName ...
	NamespaceEnvName = "NAMESPACE"

	// PVCWatcherLabelName ...
	PVCWatcherLabelName = "pod.cyclone.dev/name"
	// PVCWatcherLabelValue ...
	PVCWatcherLabelValue = "pvc-watcher"
)
View Source
const PVCWatcherName = "pvc-watchdog"

PVCWatcherName is name of the PVC watcher deployment and pod

Variables

This section is empty.

Functions

func DeletePVCUsageWatcher added in v0.9.6

func DeletePVCUsageWatcher(client kubernetes.Interface, namespace string) error

DeletePVCUsageWatcher delete the pvc usage watcher deployment

func GetPVCUsageWatcher added in v1.0.0

func GetPVCUsageWatcher(client kubernetes.Interface, namespace string) (*appsv1.Deployment, error)

GetPVCUsageWatcher gets the pvc watch dog deployment.

func LaunchPVCUsageWatcher

func LaunchPVCUsageWatcher(client kubernetes.Interface, tenant string, context v1alpha1.ExecutionContext) error

LaunchPVCUsageWatcher launches a pod in a given namespace to report PVC usage regularly.

func Parse

func Parse(value string) (float64, error)

Parse parses usage value from human readable string to float. For example, '8.0K' --> 8.0*1024 '32M' -> 32*1024*1024 Value should have format `\d+(\.\d)?[BKMGT]`.

Types

type PVCReporter

type PVCReporter interface {
	OverallUsedPercentage() float64
	UsedPercentage(folder string) (float64, error)
	ReadableUsage() PVCUsage
}

PVCReporter reports PVC usage information.

func NewPVCReporter

func NewPVCReporter(client k8s.Interface, tenant string) (PVCReporter, error)

NewPVCReporter creates a PVC usage reporter.

type PVCUsage

type PVCUsage struct {
	api.PVCUsage
}

PVCUsage represents PVC usages in a tenant, values are in human readable format, for example, '8K', '1.2G'.

func (*PVCUsage) ToFloat64

func (u *PVCUsage) ToFloat64() (*PVCUsageFloat64, error)

ToFloat64 converts usage values from string to float64.

type PVCUsageFloat64

type PVCUsageFloat64 struct {
	// Total is total space
	Total float64
	// Used is space used
	Used float64
	// Items are space used by each folder, for example, 'caches' -> '8096'
	Items map[string]float64
}

PVCUsageFloat64 is same to PVCUsage, but have all values in float64 type.

Jump to

Keyboard shortcuts

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