Dennis-Mircea opened a new pull request, #1129:
URL: https://github.com/apache/flink-kubernetes-operator/pull/1129
## What is the purpose of the change
Strengthen autoscaler configuration validation so invalid values are
rejected at resource submission time instead of silently degrading or disabling
autoscaling. Two related gaps are addressed:
- Several ratio-style autoscaler options had no range validation, so
out-of-range values were accepted and only surfaced as confusing runtime
behavior.
- The metric window could be configured smaller than the operator
reconcile interval, which silently prevents autoscaling because fewer than two
metric samples are ever retained.
## Brief change log
- Add [0, 1] range validation for `memory.gc-pressure.threshold` and
`memory.heap-usage.threshold` (always evaluated when the autoscaler is enabled).
- Validate `scaling.effectiveness.threshold`, `memory.tuning.overhead`,
and `observed-scalability.coefficient-min` only when their respective feature
is enabled, via a new `validateNumberIfEnabled` helper.
`observed-scalability.coefficient-min` was previously validated unconditionally.
- Reference all options through the qualified `AutoScalerOptions.` form to
match the convention used across the module, and replace the deprecated
`getBoolean` call with `get`.
- Add `AutoscalerValidatorTest` covering bounds, boundary values, feature
gating, and the disabled-autoscaler short-circuit.
- In `DefaultValidator`, reject configurations where
`job.autoscaler.metrics.window` is smaller than
`kubernetes.operator.reconcile.interval` when the autoscaler is enabled, since
the metric window is then trimmed to a single sample per loop and the
autoscaler never gathers the two samples it needs to evaluate scaling.
- Add `DefaultValidatorTest` cases for the rejection, the accepted case,
and the disabled-autoscaler short-circuit.
## Verifying this change
This change added tests and can be verified as follows:
- `AutoscalerValidatorTest` (new) covers the numeric bounds and the
feature-gating behavior of `AutoscalerValidator`.
- `DefaultValidatorTest` adds cases for the metric-window vs
reconcile-interval check and for the now feature-gated
`observed-scalability.coefficient-min`.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changes to the `CustomResourceDescriptors`:
no
- Core observer or reconciler logic that is regularly executed: yes
(resource validation runs as part of reconciliation, though this change only
adds lightweight config checks)
## Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
## Notes for reviewers
- Behavior change: `observed-scalability.coefficient-min` was validated
unconditionally before and is now validated only when
`observed-scalability.enabled` is true. A test covers the disabled case to make
this explicit.
- Scope: the metric-window check lives in the operator's
`DefaultValidator` because it needs both the autoscaler `metrics.window` and
the operator `reconcile.interval`. The standalone autoscaler uses a different
loop-interval option and is not covered by this check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]