usage

package
v0.9.5-beta Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 License: Apache-2.0 Imports: 13 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.Clientset, namespace string) error

DeletePVCUsageWatcher delete the pvc usage watcher deployment

func LaunchPVCUsageWatcher

func LaunchPVCUsageWatcher(client *kubernetes.Clientset, 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)
}

PVCReporter reports PVC usage information.

func NewPVCReporter

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

NewPVCReporter creates a PVC usage reporter.

type PVCUsage

type PVCUsage struct {
	// Total is total space
	Total string `json:"total"`
	// Used is space used
	Used string `json:"used"`
	// Items are space used by each folder, for example, 'caches' -> '1.2G'
	Items map[string]string `json:"items"`
}

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