Documentation ¶
Index ¶
Constants ¶
const Cooldown = "pvc-autoscaler-operator.kubernetes.io/cooldown"
const IncreaseQuantity = "pvc-autoscaler-operator.kubernetes.io/increase-quantity"
const MaxSize = "pvc-autoscaler-operator.kubernetes.io/max-size"
const UsedSpacePercentage = "pvc-autoscaler-operator.kubernetes.io/used-space-percentage"
Variables ¶
var ErrNoPodsFound = errors.New("no pods found")
Functions ¶
func OverideSpec ¶
func OverideSpec(defaultSpec *v1alpha1.PVCScalingSpec, annotations map[string]string) *v1alpha1.PVCScalingSpec
Types ¶
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.