Skip to content

Commit

Permalink
tweak: align algorithm definition order with field order
Browse files Browse the repository at this point in the history
Signed-off-by: Zach Zhu <zzqshu@126.com>
  • Loading branch information
zqzten committed Dec 13, 2023
1 parent 18e31dc commit e29051a
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions apis/autoscaling/v1alpha1/horizontalportrait_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,6 @@ const (
KubeHPAPortraitAlgorithmType PortraitAlgorithmType = "KubeHPA"
)

// KubeHPAPortraitAlgorithm defines parameters of KubeHPA algorithm.
type KubeHPAPortraitAlgorithm struct {
// SyncPeriod is the period for syncing the portrait.
// +optional
// +kubebuilder:default="15s"
SyncPeriod metav1.Duration `json:"syncPeriod"`

// Tolerance is the tolerance for when resource usage suggests upscaling/downscaling.
// Should be a string formatted float64 number.
// +optional
// +kubebuilder:default="0.1"
Tolerance string `json:"tolerance"`

// CPUInitializationPeriod is the period after pod start when CPU samples might be skipped.
// +optional
// +kubebuilder:default="5m"
CPUInitializationPeriod metav1.Duration `json:"cpuInitializationPeriod"`

// InitialReadinessDelay is period after pod start during which readiness changes
// are treated as readiness being set for the first time. The only effect of this is that
// HPA will disregard CPU samples from unready pods that had last readiness change during that period.
// +optional
// +kubebuilder:default="30s"
InitialReadinessDelay metav1.Duration `json:"initialReadinessDelay"`
}

// ExternalJobPortraitAlgorithm defines configurations of ExternalJob algorithm.
type ExternalJobPortraitAlgorithm struct {
// Job is the external job that runs the algorithm.
Expand Down Expand Up @@ -234,6 +208,32 @@ const (
// ConfigMapPortraitAlgorithmResultSource defines configurations of ConfigMap result source.
type ConfigMapPortraitAlgorithmResultSource struct{}

// KubeHPAPortraitAlgorithm defines parameters of KubeHPA algorithm.
type KubeHPAPortraitAlgorithm struct {
// SyncPeriod is the period for syncing the portrait.
// +optional
// +kubebuilder:default="15s"
SyncPeriod metav1.Duration `json:"syncPeriod"`

// Tolerance is the tolerance for when resource usage suggests upscaling/downscaling.
// Should be a string formatted float64 number.
// +optional
// +kubebuilder:default="0.1"
Tolerance string `json:"tolerance"`

// CPUInitializationPeriod is the period after pod start when CPU samples might be skipped.
// +optional
// +kubebuilder:default="5m"
CPUInitializationPeriod metav1.Duration `json:"cpuInitializationPeriod"`

// InitialReadinessDelay is period after pod start during which readiness changes
// are treated as readiness being set for the first time. The only effect of this is that
// HPA will disregard CPU samples from unready pods that had last readiness change during that period.
// +optional
// +kubebuilder:default="30s"
InitialReadinessDelay metav1.Duration `json:"initialReadinessDelay"`
}

// HorizontalPortraitStatus defines the observed state of HorizontalPortrait.
type HorizontalPortraitStatus struct {
// PortraitData is the data of generated portrait.
Expand Down

0 comments on commit e29051a

Please sign in to comment.