-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b62862d
commit 56b39bb
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
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,77 @@ | ||
# Storage | ||
|
||
The default storage for _**Limitador**_ _limits counter_ is in memory, which there's no configuration needed. | ||
In order to configure a Redis data structure store, currently there are 2 alternatives: | ||
|
||
* Redis | ||
* Redis Cached | ||
|
||
For any of those, one should store the URL of the Redis service, inside a K8s opaque | ||
[Secret](https://kubernetes.io/docs/concepts/configuration/secret/). | ||
|
||
```yaml | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: redisconfig | ||
stringData: | ||
URL: redis://127.0.0.1/a # Redis URL of its running instance | ||
type: Opaque | ||
``` | ||
It's also required to setup `Spec.Storage` | ||
|
||
## Redis | ||
|
||
```yaml | ||
apiVersion: limitador.kuadrant.io/v1alpha1 | ||
kind: Limitador | ||
metadata: | ||
name: limitador-sample | ||
spec: | ||
storage: | ||
redis: | ||
configSecretRef: # The secret reference storing the URL for Redis | ||
name: redisconfig | ||
namespace: default # optional | ||
limits: | ||
- conditions: ["get-toy == yes"] | ||
max_value: 2 | ||
namespace: toystore-app | ||
seconds: 30 | ||
variables: [] | ||
``` | ||
|
||
## Redis Cached | ||
|
||
### Options | ||
|
||
| Option | Description | | ||
|--------------|-------------------------------------------------------------------| | ||
| ttl | TTL for cached counters in milliseconds [default: 5000] | | ||
| ratio | Ratio to apply to the TTL from Redis on cached counters [default: | | ||
| flush-period | Flushing period for counters in milliseconds [default: 1000] | | ||
| max-cached | Maximum amount of counters cached [default: 10000] | | ||
|
||
|
||
```yaml | ||
apiVersion: limitador.kuadrant.io/v1alpha1 | ||
kind: Limitador | ||
metadata: | ||
name: limitador-sample | ||
spec: | ||
storage: | ||
redis-cached: | ||
configSecretRef: # The secret reference storing the URL for Redis | ||
name: redisconfig | ||
namespace: default # optional | ||
options: # Every option is optional | ||
ttl: 1000 | ||
limits: | ||
- conditions: ["get-toy == yes"] | ||
max_value: 2 | ||
namespace: toystore-app | ||
seconds: 30 | ||
variables: [] | ||
``` |