Skip to content

Commit

Permalink
added support for redis auth
Browse files Browse the repository at this point in the history
Signed-off-by: egor.lyutov <egor.lyutov@instamart.ru>
  • Loading branch information
egor.lyutov committed Dec 8, 2021
1 parent e3101d3 commit 3a528a2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/v1alpha1/ratelimitservice_types.go
Expand Up @@ -45,6 +45,7 @@ type RateLimitServiceSpec_Backend struct {
type RateLimitService_RedisBackend struct {
Type string `json:"type,omitempty"`
URL string `json:"url,omitempty"`
Auth string `json:"auth,omitempty"`
}

type RateLimitServiceStatus struct {
Expand Down
Expand Up @@ -40,6 +40,8 @@ spec:
properties:
redis:
properties:
auth:
type: string
type:
type: string
url:
Expand Down
1 change: 1 addition & 0 deletions examples/global/README.md
Expand Up @@ -51,6 +51,7 @@ spec:
redis:
type: "single"
url: "172.30.0.13:6379"
auth: "password"
```

It's support single, sentinel, or clustered Redis. `spec.backend.redis.url` is very depends on `spec.backend.redis.type`. You can check official [Envoy ratelimit service](https://github.com/envoyproxy/ratelimit#redis-type) service for Sentinel and Clustered Redis.
Expand Down
1 change: 1 addition & 0 deletions pkg/service/configmap_env_builder.go
Expand Up @@ -58,6 +58,7 @@ func (n *EnvBuilder) buildRedisEnv() (map[string]string, error) {
data["USE_STATSD"] = "false"
data["REDIS_TYPE"] = n.RateLimitService.Spec.Backend.Redis.Type
data["REDIS_URL"] = n.RateLimitService.Spec.Backend.Redis.URL
data["REDIS_AUTH"] = n.RateLimitService.Spec.Backend.Redis.Auth

return data, nil
}

0 comments on commit 3a528a2

Please sign in to comment.