@@ -171,12 +171,18 @@ const (
171
171
DisabledPolicySelect ScalingPolicySelect = "Disabled"
172
172
)
173
173
174
- // HPAScalingRules configures the scaling behavior for one direction.
175
- // These Rules are applied after calculating DesiredReplicas from metrics for the HPA.
174
+ // HPAScalingRules configures the scaling behavior for one direction via
175
+ // scaling Policy Rules and a configurable metric tolerance.
176
+ //
177
+ // Scaling Policy Rules are applied after calculating DesiredReplicas from metrics for the HPA.
176
178
// They can limit the scaling velocity by specifying scaling policies.
177
179
// They can prevent flapping by specifying the stabilization window, so that the
178
180
// number of replicas is not set instantly, instead, the safest value from the stabilization
179
181
// window is chosen.
182
+ //
183
+ // The tolerance is applied to the metric values and prevents scaling too
184
+ // eagerly for small metric variations. (Note that setting a tolerance requires
185
+ // enabling the alpha HPAConfigurableTolerance feature gate.)
180
186
type HPAScalingRules struct {
181
187
// stabilizationWindowSeconds is the number of seconds for which past recommendations should be
182
188
// considered while scaling up or scaling down.
@@ -193,10 +199,24 @@ type HPAScalingRules struct {
193
199
SelectPolicy * ScalingPolicySelect `json:"selectPolicy,omitempty" protobuf:"bytes,1,opt,name=selectPolicy"`
194
200
195
201
// policies is a list of potential scaling polices which can be used during scaling.
196
- // At least one policy must be specified, otherwise the HPAScalingRules will be discarded as invalid
202
+ // If not set, use the default values:
203
+ // - For scale up: allow doubling the number of pods, or an absolute change of 4 pods in a 15s window.
204
+ // - For scale down: allow all pods to be removed in a 15s window.
197
205
// +listType=atomic
198
206
// +optional
199
207
Policies []HPAScalingPolicy `json:"policies,omitempty" listType:"atomic" protobuf:"bytes,2,rep,name=policies"`
208
+
209
+ // tolerance is the tolerance on the ratio between the current and desired
210
+ // metric value under which no updates are made to the desired number of
211
+ // replicas (e.g. 0.01 for 1%). Must be greater than or equal to zero. If not
212
+ // set, the default cluster-wide tolerance is applied (by default 10%).
213
+ //
214
+ // This is an alpha field and requires enabling the HPAConfigurableTolerance
215
+ // feature gate.
216
+ //
217
+ // +featureGate=HPAConfigurableTolerance
218
+ // +optional
219
+ Tolerance * resource.Quantity `json:"tolerance,omitempty" protobuf:"bytes,4,opt,name=tolerance"`
200
220
}
201
221
202
222
// HPAScalingPolicyType is the type of the policy which could be used while making scaling decisions.
0 commit comments