Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix conflicting Serverless scaling options (#15576)
* Fix conflicting scaling options * fix tests * change title * bump images * update proposal based on review comments * update the implementation * update tests * fix integration tests go.mod * integration tests * bump images * remove extra step in tests * Update components/function-controller/internal/controllers/serverless/scaling.go Co-authored-by: Damian Badura <45110612+dbadura@users.noreply.github.com> * review comments * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> * Update components/function-controller/design/scaling_functions.md Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com> Co-authored-by: Damian Badura <45110612+dbadura@users.noreply.github.com> Co-authored-by: Grzegorz Karaluch <grzegorz.karaluch@sap.com>
- Loading branch information
1 parent
adfb3a0
commit f3e30e3
Showing
18 changed files
with
122 additions
and
112 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
components/function-controller/design/scaling_functions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Serverless Functions Scaling Modes | ||
|
||
## Summary | ||
Initially, the Serverless API supported the `spec.ScaleConfig` field only. The workflow was as follows: | ||
- Function resources were defaulted to min/max replicas = 1 | ||
- If you set a different scaling config, Function Controller created HPA resources with the user-defined min/max values. | ||
- The HPA resource target ref was the Function runtime deployment. | ||
- The Function Controller did not enforce the runtime deployment `spec.Replicas` anymore and it was handled by the HPA resources. | ||
|
||
|
||
Later, the Serverless API was extended by the `Scale` subresource, which allows for direct scaling of the Function resources through the Kubernetes API. | ||
|
||
However, there are some implementation conflicts between the two features. This is a design and an implementation plan to unify the UX while using Functions as scaled resources. | ||
|
||
### Goals | ||
- Support Function scale subresource and `spec.ScaleConfig` without conflicts. | ||
- Provide frictionless UX for the feature. | ||
|
||
## Proposal | ||
Describe and implement two different scaling configuration. Both configurations already work to some extent. The point here is have an ergonomic UX and flow. | ||
|
||
### External scaling configuration | ||
This is managed and configured using `spec.Replicas`. It describes the scale subresource use case. It supports: | ||
- Manual scaling of the Function up and down through the API. | ||
- Configuring an HPA resource with the Function resources as a target. | ||
- Using an external scaler like [KEDA](https://keda.sh/). | ||
|
||
### Built-in scaling configuration | ||
This is managed and enabled by setting `spec.ScaleConfig`. It is configurable using Busola and it provides the most basic scaling configuration for the Function. | ||
|
||
This configuration is disabled by removing `spec.ScaleConfig`. The Busola UI can be extended to allow you to add or remove `spec.ScaleConfig` to manage built-in scaling with minimal effort. | ||
|
||
## Implementation details | ||
|
||
- The controller should support and accept both `spec.Replicas` and `spec.ScaleConfig`. Current validation rule to block this will be removed. | ||
- `spec.Replicas` is the only source of truth for scaling the Function/runtime deployment. | ||
- `spec.ScaleConfig` is only used to configure the controller internal HPA. | ||
- The internal HPA is removed if `spec.ScaleConfig == nil` | ||
- The HPA resource created by the controller still targets the Function resources. | ||
- The current Function status update logic must be fixed to reflect the Function's current scale. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.