pvc

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const Cooldown = "pvc-autoscaler-operator.kubernetes.io/cooldown"
View Source
const IncreaseQuantity = "pvc-autoscaler-operator.kubernetes.io/increase-quantity"
View Source
const MaxSize = "pvc-autoscaler-operator.kubernetes.io/max-size"
View Source
const UsedSpacePercentage = "pvc-autoscaler-operator.kubernetes.io/used-space-percentage"

Variables

View Source
var ErrNoPodsFound = errors.New("no pods found")

Functions

func OverideSpec

func OverideSpec(defaultSpec *v1alpha1.PVCScalingSpec, annotations map[string]string) *v1alpha1.PVCScalingSpec

Types

type Client

type Client interface {
	client.Reader
	client.Writer
	client.StatusClient
}

Client is a controller client. It is a subset of client.Client.

type DiskUsageCollector

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

func NewDiskUsageCollector

func NewDiskUsageCollector(diskClient DiskUsager, lister client.Reader) *DiskUsageCollector

func (DiskUsageCollector) CollectDiskUsage

func (c DiskUsageCollector) CollectDiskUsage(ctx context.Context, crd *v1alpha1.PodDiskInspector) ([]PVCDiskUsage, error)

CollectDiskUsage retrieves the disk usage information for all pods has "pvc-autoscaler-operator.kubernetes.io/enabled" annotation set to "true", "pvc-autoscaler-operator.kubernetes.io/operator-name" annotation set to the name of the operator and "pvc-autoscaler-operator.kubernetes.io/operator-namespace" annotation set to the namespace of the operator.= It returns a slice of PVCDiskUsage objects representing the disk usage information for each PVC or an error if fetching disk usage via all pods was unsuccessful.

type DiskUsager

type DiskUsager interface {
	DiskUsage(ctx context.Context, host string) ([]healthcheck.DiskUsageResponse, error)
}

DiskUsager fetches disk usage statistics

type PVCAutoScaler

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

func NewPVCAutoScaler

func NewPVCAutoScaler(client Client) *PVCAutoScaler

func (PVCAutoScaler) ProcessPVCResize

func (scaler PVCAutoScaler) ProcessPVCResize(ctx context.Context, crd *v1alpha1.PodDiskInspector, results []PVCDiskUsage, reporter kube.Reporter) error

ProcessPVCResize patches the PVC request storage size and update annotation for resize time

Returns true if the status was patched.

Returns false and does not patch if: 1. The PVCs do not need resizing 2. The status already has >= calculated size. 3. The maximum size has been reached. It will patch up to the maximum size.

Returns an error if patching unsuccessful.

type PVCDiskUsage

type PVCDiskUsage struct {
	Name           string // pvc name
	Namespace      string // pvc namespace
	PercentUsed    int
	Capacity       resource.Quantity
	PVCScalingSpec *v1alpha1.PVCScalingSpec
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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