Skip to content

Commit c5495b0

Browse files
committed
update API for consistency
1 parent a18fee3 commit c5495b0

File tree

1 file changed

+19
-13
lines changed
  • vertical-pod-autoscaler/enhancements/8515-support-custom-request-to-limit-ratio

1 file changed

+19
-13
lines changed

vertical-pod-autoscaler/enhancements/8515-support-custom-request-to-limit-ratio/README.md

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,23 @@ Some examples of the VPA CRD using the new `RequestToLimitRatio` field are provi
6262

6363
A new `RequestToLimitRatio` field will be added, with the following sub-fields:
6464

65-
* `RequestToLimitRatio.CPU.Type` or `RequestToLimitRatio.Memory.Type` (type: `string`, required): Specifies how to apply limits proportionally to the requests. `Type` can have the following values:
65+
* [Optional] `RequestToLimitRatio.CPU.Type` or `RequestToLimitRatio.Memory.Type` (type `string`): Specifies how to apply limits proportionally to the requests. `Type` can have the following values:
6666
* `Factor` (type: `floating-point number`): Interpreted as a multiplier for the recommended request.
6767
* Example: a value of `2` will double the limits.
6868
* `Quantity` (type: `string`): Adds an absolute value on top of the requests to determine the new limit.
69-
* Example: for memory, a value of `100Mi` means the new limit will be: calculated memory request + `100Mi`.
69+
* Example: for memory, a value of `100Mi` means the new limit will be: calculated memory request + `100Mi`.
70+
* If `RequestToLimitRatio.CPU.Type` or `RequestToLimitRatio.Memory.Type` is not specified, the default value is `Factor`.
7071

71-
* `RequestToLimitRatio.CPU.Value` (type: `string`, required): Specifies the magnitude of the ratio between request and limit, interpreted according to `RequestToLimitRatio.CPU.Type`:
72-
* If `Type` is `Factor`: a value of `3` will triple the CPU limits.
73-
* If `Type` is `Quantity`: if the value is set to 200m, then the CPU limit will be set to the CPU request plus 200 millicores.
72+
* [Optional] `RequestToLimitRatio.CPU.Factor` (type `float`): The factor to apply to the CPU request.
73+
* If `Type` is `Factor` a value of `3` will triple the CPU limits.
74+
* If `Type` is `Quantity`, this field is not allowed.
7475

75-
* `RequestToLimitRatio.Memory.Value` (type: `string`, required): Similar to `CPU.Value`, except that for `Quantity` the units are memory-based (e.g., `Mi`, `Gi`) rather than CPU millicores (`m`).
76+
* [Optional] `RequestToLimitRatio.CPU.Quantity` (type `Quantity`): The value specified in this field is added to the request to calculate the new limit.
77+
* If `Type` is `Factor`, this field is not allowed.
78+
* If `Type` is `Quantity` a CPU resource quantity added. For example, if the value is `200m`, the CPU limit will be calculated as the CPU request plus 200 millicores.
79+
80+
* [Optional] `RequestToLimitRatio.Memory.Factor` (type `float`): Same as `CPU.Factor`.
81+
* [Optional] `RequestToLimitRatio.Memory.Quantity` (type `Quantity`): Similar to `CPU.Quantity` except that for `Quantity` the units are memory-based (e.g., `Mi`, `Gi`) rather than CPU millicores (`m`).
7682

7783
### Behavior
7884

@@ -115,7 +121,7 @@ The behavior after implementing this feature is as follows:
115121

116122
* When using the new `RequestToLimitRatio` field, the `controlledValues` field must be set to `RequestsAndLimits`. It does not make sense to specify `RequestToLimitRatio` if VPA is not allowed to update limits. This requirement is enforced by the admission controller.
117123
* Explicitly prohibit the use of `RequestToLimitRatio` for any resource not listed in `controlledResources`. For example, if the intention is to set a custom ratio for CPU, then the value of the `controlledResources` field must include `cpu`.
118-
* If `Type` is set to `Quantity`, then its `Value` will be validated using the [ParseQuantity](https://github.com/kubernetes/apimachinery/blob/v0.34.1/pkg/api/resource/quantity.go#L277) function from `apimachinery`.
124+
* If `Type` is set to `Quantity`, then its value will be validated using the [ParseQuantity](https://github.com/kubernetes/apimachinery/blob/v0.34.1/pkg/api/resource/quantity.go#L277) function from `apimachinery`.
119125

120126

121127
### Feature Enablement and Rollback
@@ -186,11 +192,11 @@ spec:
186192
controlledValues: RequestsAndLimits
187193
RequestToLimitRatio:
188194
cpu:
189-
Type: Factor
190-
Value: 2
195+
type: Factor # this field is optional, if omitted it defaults to "Factor"
196+
factor: 2
191197
memory:
192-
Type: Quantity
193-
Value: 200Mi
198+
type: Quantity
199+
quantity: 200Mi
194200
```
195201
196202
In the manifest below, we configure VPA to control only the CPU resource's requests and limits for the container named `app`. The CPU limit is calculated by increasing the recommended CPU request by 20% (i.e. `recommended request × 1.2`).
@@ -214,8 +220,8 @@ spec:
214220
controlledValues: RequestsAndLimits
215221
RequestToLimitRatio:
216222
cpu:
217-
Type: Factor
218-
Value: 1.2
223+
type: Factor # this field is optional, if omitted it defaults to "Factor"
224+
factor: 1.2
219225
```
220226

221227
## Implementation History

0 commit comments

Comments
 (0)