/
pvcscaling_types.go
45 lines (38 loc) · 1.6 KB
/
pvcscaling_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package v1alpha1
import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// PVCScalingController is the canonical controller name.
const PVCScalingController = "PVCScaling"
// PVCScalingSpec is part of the PodDiskInspectorSpec.
type PVCScalingSpec struct {
// The percentage of used disk space required to trigger scaling.
// Example, if set to 80, autoscaling will not trigger until used space reaches >=80% of capacity.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:MaxSize=100
UsedSpacePercentage int32 `json:"usedSpacePercentage"`
// How much to increase the PVC's capacity.
// Either a percentage (e.g. 20%) or a resource storage quantity (e.g. 100Gi).
//
// If a percentage, the existing capacity increases by the percentage.
// E.g. PVC of 100Gi capacity + IncreaseQuantity of 20% increases disk to 120Gi.
//
// If a storage quantity (e.g. 100Gi), increases by that amount.
IncreaseQuantity string `json:"increaseQuantity"`
// How long to wait before scaling again.
// For AWS EBS, this is 6 hours.
// +optional
Cooldown metav1.Duration `json:"cooldown"`
// A resource storage quantity (e.g. 2000Gi).
// When increasing PVC capacity reaches >= MaxSize, autoscaling ceases.
// Safeguards against storage quotas and costs.
// +optional
MaxSize resource.Quantity `json:"maxSize"`
}
type ScalingStatus struct {
// The PVC size requested by the PVCScaling controller.
RequestedSize resource.Quantity `json:"requestedSize"`
// The timestamp the PVCScaling controller requested a PVC increase.
RequestedAt metav1.Time `json:"requestedAt"`
}