Revert min/max replicas to the default values when the SLOHorizontalScale policy defines the min as greater than the max.
Background
Older versions of Kubernetes do not support the new x-kubernetes-validations validation rules that all use to ensure that the minReplicas are less than or equal to the the maxReplicas on the SLOHorizontalScale CR. For those older versions, we will revert to the default values (as if the user had not specified them on the CR) and log a warning.
Testing
Debugged kubeturbo locally against appliance.
Deployed the following SLOHorizontalScale CR to test the updated logic:
Verified that the logs warn that the values were "invalid" and it is reverting to the defaults:
Verified that the policy displayed in the UI also displays the defaults:
Added unit tests for updated methods.
Checklist
These are the items that must be done by the developer and by reviewers before the change is ready to merge. Please strikeout any items that are not applicable, but don't delete them
[ ] Developer Checks
[x] Full build with unit tests and fmt and vet checks
[x] Unit tests added / updated
[ ] No unlicensed images, no third-party code (such as from StackOverflow)
[ ] Integration tests added / updated
[x] Manual testing done (and described)
[ ] Product sweep run and passed
[ ] Developer wiki updated (and linked to this description)
[ ] Reviewer Checks
[ ] Merge request description clear and understandable
[ ] Developer checklist items complete
[ ] Functional code review (how is the code written)
[ ] Architectural review (does the code try to do the right thing, in the right way)
Intent
Revert min/max replicas to the default values when the SLOHorizontalScale policy defines the min as greater than the max.
Background
Older versions of Kubernetes do not support the new
x-kubernetes-validations
validation rules that all use to ensure that theminReplicas
are less than or equal to the themaxReplicas
on theSLOHorizontalScale
CR. For those older versions, we will revert to the default values (as if the user had not specified them on the CR) and log a warning.Testing
Debugged kubeturbo locally against appliance.
Deployed the following SLOHorizontalScale CR to test the updated logic:
Verified that the logs warn that the values were "invalid" and it is reverting to the defaults:
Verified that the policy displayed in the UI also displays the defaults:
Added unit tests for updated methods.
Checklist
These are the items that must be done by the developer and by reviewers before the change is ready to merge. Please
strikeoutany items that are not applicable, but don't delete themAudience
@libai98 @ading1977 @KevinWang0204