models

package
v0.0.0-...-6651d10 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StorageInfo

type StorageInfo struct {
	// contains filtered or unexported fields
}

StorageInfo holds persistentVolumeClains and the total capacity of PVCs for each Pod.

func NewStorageInfoFromCluster

func NewStorageInfoFromCluster(client *controller.Client) (s *StorageInfo, err error)

NewStorageInfoFromCluster fetches PersistentVolumeClaim resources from in-cluster, and includes them in the newly-constructed returned StorageInfo type.

func NewStorageInfoFromUnstructuredPVCs

func NewStorageInfoFromUnstructuredPVCs(unstructuredPVCs []unstructured.Unstructured) *StorageInfo

NewStorageInfoFromUnstructuredVPCs accepts PersistentVolumeClaim resources as a slice of the unstructured.Unstructured type, and returns them in a new StorageInfo type.

func (*StorageInfo) AddPVCRef

func (s *StorageInfo) AddPVCRef(PVCName, podKey string)

AddPVCRef associates the specified Pod name, with the specified persistentVolumeClaim, and adds the PVC capacity to the total capacity for the Pod. The persistenvVolumeClaim name is expected to exist in-cluster, as discovered by NewStorageInfo(). The Pod name is of the form {namespace name}/{pod name}.

func (*StorageInfo) ManufactureMetrics

func (s *StorageInfo) ManufactureMetrics(r prometheusV1.Range) model.Matrix

manufactureMetrics spreads the capacity of PersistentVolumeClaims across Pods that share that Claim. The same value is used to fill metric values for the range of time specified in the prometheusV1.Range.

func (StorageInfo) NumPVCs

func (s StorageInfo) NumPVCs() int

NumPVCs returns the number of PersistentVolumeClains fetched from in-cluster by NewStorageInfo().

func (StorageInfo) PVCByName

func (s StorageInfo) PVCByName(name string) *persistentVolumeClaim

PVCByName returns a persistentVolumeClaim matching the specified name. IF no PVC is found, nil is returned.

func (StorageInfo) PVCsAsString

func (s StorageInfo) PVCsAsString() string

PVCsAsString facilitates printing a slice of persistentVolumeClaim types for debugging.

Jump to

Keyboard shortcuts

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