Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ratelimiter): prevent REDIS_URL being overwritten if set #4722

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ryanhristovski
Copy link

What type of PR is this?
fix(ratelimiter): prevent REDIS_URL from being overwritten if already set

What this PR does / why we need it:
This PR updates the logic to ensure that the REDIS_URL environment variable is only set if it isn’t already defined in the environment. This is especially important for when this issue is solved and proper Redis authentication is setup.

Example: I want to be able to set the REDIS_URL to a secret, which isn't possible in a configmap.

gateway-helm:
  config:
    envoyGateway:
      gateway:
        controllerName: gateway.envoyproxy.io/gatewayclass-controller
      provider:
        type: Kubernetes
        kubernetes:
          rateLimitDeployment:
            replicas: 1
            container:
              image: envoyproxy/ratelimit:master
            patch:
              type: StrategicMerge
              value:
                spec:
                  template:
                    spec:
                      containers:
                      - name: envoy-ratelimit
                        env:
                          - name: LOG_LEVEL
                            value: debug
                          - name: REDIS_URL
                            valueFrom:
                              secretKeyRef:
                                name: ratelimit-secret
                                key: redis_url
      rateLimit:
        backend:
          type: Redis

As of currently, not setting the url while having rateLimit set is putting Gateway in a crashloop.

Which issue(s) this PR fixes:
Fixes #

Release Notes: No

… set

Signed-off-by: Ryan Hristovski <ryan.hristovski@docker.com>
@ryanhristovski ryanhristovski requested a review from a team as a code owner November 15, 2024 01:06
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.62%. Comparing base (5068698) to head (6d55586).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4722      +/-   ##
==========================================
+ Coverage   65.60%   65.62%   +0.01%     
==========================================
  Files         211      211              
  Lines       31995    31996       +1     
==========================================
+ Hits        20989    20996       +7     
+ Misses       9764     9761       -3     
+ Partials     1242     1239       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant