Skip to content

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

Merged
arkodg merged 21 commits into
envoyproxy:mainfrom
guanchzhou:redis-url-secret-ref-pr
Jul 20, 2026
Merged

feat: allow RateLimitRedisSettings.url to be sourced from a Secret#9143
arkodg merged 21 commits into
envoyproxy:mainfrom
guanchzhou:redis-url-secret-ref-pr

Conversation

@guanchzhou

Copy link
Copy Markdown
Contributor

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

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
@guanchzhou
guanchzhou requested a review from a team as a code owner June 2, 2026 11:52
@netlify

netlify Bot commented Jun 2, 2026

Copy link
Copy Markdown

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 54aa6a2
🔍 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e27bf30412

ℹ️ 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".

Comment thread internal/infrastructure/kubernetes/ratelimit/resource.go Outdated
@zhaohuabing

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1c060f8d5c

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread internal/infrastructure/kubernetes/ratelimit/resource.go
guanchzhou and others added 2 commits June 8, 2026 13:15
An optional Secret reference lets the rate limit container start even when
the referenced Secret/key is absent, leaving REDIS_URL unset and global rate
limiting nonfunctional instead of waiting for the externally provisioned
Secret. Reject optional=true in Go config validation (with a mirrored CEL
rule) so the Secret reference stays required.

Addresses Codex review feedback on envoyproxy#9143.

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
@zirain

zirain commented Jun 10, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ 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              

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

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

guanchzhou and others added 3 commits June 10, 2026 10:58
Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
Covers the patch-coverage gaps flagged by Codecov: nil redis settings,
non-NotFound Secret get errors, the TLS certificateRef path in
ratelimit.Validate, and ValidateRedisURL called directly.

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
zirain
zirain previously approved these changes Jun 12, 2026
@zirain

zirain commented Jun 14, 2026

Copy link
Copy Markdown
Member

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

@zirain zirain added this to the v1.9.0-rc.1 Release milestone Jul 14, 2026

@zirain zirain left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

// Mutually exclusive with URLRef.
//
// +optional
URL string `json:"url,omitempty"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be made a ptr

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @guanchzhou can you address this as a follow up

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely @arkodg, thank you.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #9538 — changed url to *string. Thanks @arkodg.

@arkodg
arkodg merged commit 6c72ce4 into envoyproxy:main Jul 20, 2026
62 of 68 checks passed
@guanchzhou
guanchzhou deleted the redis-url-secret-ref-pr branch July 21, 2026 08:01
kkk777-7 pushed a commit that referenced this pull request Jul 28, 2026
* api: make RateLimitRedisSettings.url a pointer

Follow-up to #9143. url became optional (mutually exclusive with
urlRef) but stayed a non-pointer string, so an unset value could not
be distinguished from an explicit empty string. Make it *string so
nil means unset, per review feedback.

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>

* api: use ptr.Deref for redis URL presence check

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>

---------

Signed-off-by: Andrey Maltsev <maltsev.andrey@gmail.com>
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.

Allow RateLimitRedisSettings.url to be sourced from a Secret or ConfigMap

4 participants