gateway icon indicating copy to clipboard operation
gateway copied to clipboard

feat: allow RateLimitRedisSettings.url to be sourced from a Secret

Open guanchzhou opened this issue 6 months ago â€ĸ 6 comments

What type of PR is this?

feat

What this PR does / why we need it:

Adds an optional urlRef field to RateLimitRedisSettings, mutually exclusive with url, that sources the global rate limit Redis URL from a Kubernetes Secret key:

rateLimit:
  backend:
    type: Redis
    redis:
      urlRef:
        secretKeyRef:
          name: ratelimit-redis-redisstd
          key: REDIS_ENDPOINT

This unblocks GitOps workflows where the Redis endpoint is provisioned dynamically by an external controller (e.g. Crossplane writes a connection Secret) rather than baked into the EnvoyGateway config as a literal string.

Design notes:

  • The rate-limit Deployment renders REDIS_URL via valueFrom.secretKeyRef, so the control plane never reads the secret value (mirrors how the Redis password is already injected). The referenced Secret must exist in the Envoy Gateway namespace.
  • Secret-only for now: a Redis URL can embed credentials in userinfo, and this matches the existing tls.certificateRef (Secret-only) precedent. configMapKeyRef can be added later as a non-breaking addition.
  • Exactly-one-of url/urlRef is enforced by a struct-level CEL rule (has(self.url) != has(self.urlRef)) and mirrored in Go config validation. url becomes optional but remains fully backward-compatible.
  • Includes the Validate() Secret/key existence check, unit + golden deployment tests, regenerated API reference, a docs example, and a release note.

Which issue(s) this PR fixes:

Fixes #9022

Release Notes: Yes

guanchzhou avatar Jun 02 '26 11:06 guanchzhou

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
Latest commit 54aa6a22ab83f66623227593ef07a021c9ff358d
Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6a560807882d0d000862ce1b
Deploy Preview https://deploy-preview-9143--cerulean-figolla-1f9435.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify avatar Jun 02 '26 11:06 netlify

@codex review

zhaohuabing avatar Jun 08 '26 08:06 zhaohuabing

@codex review

zirain avatar Jun 10 '26 01:06 zirain

Codex Review: Didn't find any major issues. Nice work!

â„šī¸ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 75.44%. Comparing base (c9e6a44) to head (54aa6a2).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9143      +/-   ##
==========================================
+ Coverage   75.41%   75.44%   +0.03%     
==========================================
  Files         252      252              
  Lines       41660    41691      +31     
==========================================
+ Hits        31416    31454      +38     
+ Misses       8115     8108       -7     
  Partials     2129     2129              

:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 10 '26 01:06 codecov[bot]

you didn't need to rebase frequently, the maintainer will do that if needed before merging.

zirain avatar Jun 14 '26 13:06 zirain