TestStatefulSetScaleDownRespectsMinReadySeconds and
TestStatefulSetOnDeleteStrategyIgnoresMinReadySeconds are testing
.spec.minReadySeconds. This resulted in tests spinning sufficiently long
to reach the desired value. In both cases it was set to 30s.
This change modifies scaleUpStatefulSetControl allowing to inject
fakeClock which allows faster time changes, thus speeding the tests.
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
* Fix format-string argument order in object metric error messages
The error format strings in GetObjectMetricReplicas and
GetObjectPerPodMetricReplicas had the arguments in the wrong order,
causing objectRef.Kind to be printed where the error should appear
and vice versa.
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
* Use %w for error wrapping in fmt.Errorf calls in podautoscaler
Replace %v with %w for error arguments in fmt.Errorf throughout the
HPA controller, replica calculator, and metrics client. This enables
proper error wrapping so that callers can use errors.Is and errors.As
to inspect underlying errors.
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
---------
Signed-off-by: Mikhail Fedosin <mfedosin@redhat.com>
The endpoint-mappings.yaml file specifies which components use which
metrics. The case some, but not all core components (kube-controller-manager
and kube-scheduler in this case) sharing the same metrics was not
supported. This gets fixed by not returning early once the first file path
matches.
Not all metrics in pkg/controller/resourceclaim/metrics are shared. To make the
sharing clearer and fit into the file-path based component support in
endpoint-mappings.yaml, the shared metric gets moved to a new
pkg/resourceclaim/metrics package.
Both kube-controller-manager and kube-scheduler create ResourceClaims. Using
the same metric (sub-system: "dynamic_resource_allocation", name:
"resourceclaim_creates_total") in both components simplifies aggregation across
the entire cluster.
In our defaulting code we ensure that PodReplacementPolicy is set, its
value will depend on PodFailurePolicy being set or not, but we can
safely assume it's set. Thus the method onlyReplaceFailedPods is
sufficient to only verify PodReplacementPolicy and its value.
Signed-off-by: Maciej Szulik <soltysh@gmail.com>
Accessing svc.Spec.IPFamilies[0] without a bounds check panics when a
service reaches the controller with an empty IPFamilies field. This can
happen via watch events: the apiserver's defaultOnRead decorator populates
IPFamilies on GET/LIST but not on watch (cachingObject wrapping bypasses
the type assertion).
Restore the inference logic removed in #130101: fall back to ClusterIP
for headful services and pod IP for headless services.
Signed-off-by: Rahul <rahulbabu95@gmail.com>