Skip to content

Commit

Permalink
fix: adjust validation for Code Engine application `scale_concurrency…
Browse files Browse the repository at this point in the history
…_target` (#5792)

* fix: adjust ce app concurrency target validation

* fix markup indentation
  • Loading branch information
michael-magrian authored Nov 26, 2024
1 parent 332f9f5 commit 9695d12
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "go.mod|go.sum|.*.map|^.secrets.baseline$",
"lines": null
},
"generated_at": "2024-11-07T15:32:37Z",
"generated_at": "2024-11-15T07:40:53Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down Expand Up @@ -1902,15 +1902,15 @@
"hashed_secret": "b732fb611fd46a38e8667f9972e0cde777fbe37f",
"is_secret": false,
"is_verified": false,
"line_number": 727,
"line_number": 737,
"type": "Secret Keyword",
"verified_result": null
},
{
"hashed_secret": "3c956707ac29b4a200e47fceffa923341eed7e4f",
"is_secret": false,
"is_verified": false,
"line_number": 962,
"line_number": 972,
"type": "Secret Keyword",
"verified_result": null
}
Expand Down Expand Up @@ -5024,7 +5024,7 @@
}
]
},
"version": "0.13.1+ibm.62.dss",
"version": "0.13.1+ibm.61.dss",
"word_list": {
"file": null,
"hash": null
Expand Down
16 changes: 13 additions & 3 deletions ibm/service/codeengine/resource_ibm_code_engine_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,11 @@ func ResourceIbmCodeEngineApp() *schema.Resource {
Description: "Optional maximum number of requests that can be processed concurrently per instance.",
},
"scale_concurrency_target": {
Type: schema.TypeInt,
Optional: true,
Description: "Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified.",
Type: schema.TypeInt,
Optional: true,
Default: 100,
ValidateFunc: validate.InvokeValidator("ibm_code_engine_app", "scale_concurrency_target"),
Description: "Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified.",
},
"scale_cpu_limit": {
Type: schema.TypeString,
Expand Down Expand Up @@ -467,6 +469,14 @@ func ResourceIbmCodeEngineAppValidator() *validate.ResourceValidator {
Regexp: `^(manager|reader|writer|none|default)$`,
MinValueLength: 0,
},
validate.ValidateSchema{
Identifier: "scale_concurrency_target",
ValidateFunctionIdentifier: validate.IntBetween,
Type: validate.TypeInt,
Optional: true,
MinValue: "1",
MaxValue: "1000",
},
validate.ValidateSchema{
Identifier: "scale_cpu_limit",
ValidateFunctionIdentifier: validate.ValidateRegexpLen,
Expand Down
2 changes: 1 addition & 1 deletion website/docs/d/code_engine_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ Nested schema for **run_volume_mounts**:
* Constraints: The default value is `100`.

* `scale_concurrency_target` - (Integer) Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified.

* Constraints: The default value is `100`. The maximum value is `1000`. The minimum value is `1`.
* `scale_cpu_limit` - (String) Optional number of CPU set for the instance of the app. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo).
* Constraints: The default value is `1`. The maximum length is `10` characters. The minimum length is `0` characters. The value must match regular expression `/^([0-9.]+)([eEinumkKMGTPB]*)$/`.

Expand Down
1 change: 1 addition & 0 deletions website/docs/r/code_engine_app.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Nested schema for **run_volume_mounts**:
* `scale_concurrency` - (Optional, Integer) Optional maximum number of requests that can be processed concurrently per instance.
* Constraints: The default value is `100`.
* `scale_concurrency_target` - (Optional, Integer) Optional threshold of concurrent requests per instance at which one or more additional instances are created. Use this value to scale up instances based on concurrent number of requests. This option defaults to the value of the `scale_concurrency` option, if not specified.
* Constraints: The default value is `100`. The maximum value is `1000`. The minimum value is `1`.
* `scale_cpu_limit` - (Optional, String) Optional number of CPU set for the instance of the app. For valid values see [Supported memory and CPU combinations](https://cloud.ibm.com/docs/codeengine?topic=codeengine-mem-cpu-combo).
* Constraints: The default value is `1`. The maximum length is `10` characters. The minimum length is `0` characters. The value must match regular expression `/^([0-9.]+)([eEinumkKMGTPB]*)$/`.
* `scale_down_delay` - (Optional, Integer) Optional amount of time in seconds that delays the scale-down behavior for an app instance.
Expand Down

0 comments on commit 9695d12

Please sign in to comment.