Skip to content

fix: add ownerReferences to ratelimit ConfigMap and HPA#8358

Merged
arkodg merged 2 commits intoenvoyproxy:mainfrom
Teja079:fix/ratelimit-ownerreferences
Mar 7, 2026
Merged

fix: add ownerReferences to ratelimit ConfigMap and HPA#8358
arkodg merged 2 commits intoenvoyproxy:mainfrom
Teja079:fix/ratelimit-ownerreferences

Conversation

@Teja079
Copy link
Copy Markdown
Contributor

@Teja079 Teja079 commented Feb 27, 2026

What type of PR is this?
fix

What this PR does / why we need it:

The ratelimit ConfigMap (statsd-exporter-config) and HorizontalPodAutoscaler were missing ownerReferences, even though every other ratelimit resource Service, ServiceAccount, Deployment and PodDisruptionBudget already has them. Without these, Kubernetes won't automatically clean up the ConfigMap and HPA when the parent envoy-gateway Deployment is deleted, leaving orphaned resources behind.

The fix is straightforward both resources now call the existing ownerReferences() helper that PodDisruptionBudget was already using.

Which issue(s) this PR fixes:
Fixes #8209

Release Notes: Yes

Added ownerReferences to ratelimit ConfigMap and HorizontalPodAutoscaler so they are properly garbage-collected when the envoy-gateway Deployment is removed.

Copilot AI review requested due to automatic review settings February 27, 2026 00:14
@Teja079 Teja079 requested a review from a team as a code owner February 27, 2026 00:14
@netlify
Copy link
Copy Markdown

netlify bot commented Feb 27, 2026

Deploy Preview for cerulean-figolla-1f9435 canceled.

Name Link
🔨 Latest commit f9504b6
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69a6deec39946e000818e910

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds ownerReferences to the ratelimit ConfigMap (statsd-exporter-config) and HorizontalPodAutoscaler resources to ensure proper garbage collection when the parent envoy-gateway Deployment is deleted. This fixes an inconsistency where other ratelimit resources (Service, ServiceAccount, Deployment, and PodDisruptionBudget) already had ownerReferences, but ConfigMap and HPA were missing them.

Changes:

  • Added ownerReferences to ratelimit ConfigMap by calling r.ownerReferences() helper method
  • Added ownerReferences to ratelimit HorizontalPodAutoscaler by calling r.ownerReferences() helper method
  • Updated test data files to reflect the new ownerReferences in generated resources

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/infrastructure/kubernetes/ratelimit/resource_provider.go Added OwnerReferences field to ConfigMap and HPA ObjectMeta using the existing ownerReferences() helper method
internal/infrastructure/kubernetes/ratelimit/testdata/envoy-ratelimit-configmap.yaml Updated test data to include ownerReferences for validation
internal/infrastructure/kubernetes/ratelimit/testdata/hpa/default.yaml Updated test data to include ownerReferences for validation
internal/infrastructure/kubernetes/ratelimit/testdata/hpa/custom.yaml Updated test data to include ownerReferences for validation
internal/infrastructure/kubernetes/ratelimit/testdata/hpa/with-deployment-name.yaml Updated test data to include ownerReferences for validation
internal/infrastructure/kubernetes/ratelimit/testdata/hpa/with-name.yaml Updated test data to include ownerReferences for validation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.19%. Comparing base (80eb3f9) to head (f9504b6).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8358      +/-   ##
==========================================
+ Coverage   74.18%   74.19%   +0.01%     
==========================================
  Files         242      242              
  Lines       37310    37312       +2     
==========================================
+ Hits        27678    27684       +6     
+ Misses       7698     7696       -2     
+ Partials     1934     1932       -2     

☔ View full report in Codecov by Sentry.
📢 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.

@zirain
Copy link
Copy Markdown
Member

zirain commented Feb 27, 2026

can you add release notes for this?

Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@zirain zirain force-pushed the fix/ratelimit-ownerreferences branch from 634f2af to f83ab75 Compare March 2, 2026 12:25
@jukie
Copy link
Copy Markdown
Contributor

jukie commented Mar 6, 2026

/retest

@arkodg arkodg merged commit 870770a into envoyproxy:main Mar 7, 2026
51 of 60 checks passed
@rouke-broersma
Copy link
Copy Markdown

@arkodg did this reference the correct issue? The description does not match imo.

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Mar 8, 2026

yeah good point, i'll reopen #8209

cnvergence added a commit to cnvergence/gateway that referenced this pull request Mar 11, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
cnvergence added a commit to cnvergence/gateway that referenced this pull request Mar 11, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>
cnvergence added a commit to cnvergence/gateway that referenced this pull request Mar 11, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>
cnvergence added a commit to cnvergence/gateway that referenced this pull request Mar 11, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>
jukie pushed a commit that referenced this pull request Mar 12, 2026
* api: make ConnectionLimit.Value optional (#8478)

* api: make ConnectionLimit.Value optional

Signed-off-by: Felipe Sabadini Facina <[email protected]>

* release-notes: add entry for ConnectionLimit.Value optional

Signed-off-by: Felipe Sabadini Facina <[email protected]>

* fix: add CEL rule to require value when closeDelay is set

Signed-off-by: Felipe Sabadini Facina <[email protected]>

---------

Signed-off-by: Felipe Sabadini Facina <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix up release notes

Signed-off-by: Karol Szwaj <[email protected]>

* fix: aggregate xRoute/xPolicy statuses across GWCs in gateway-api runner (#8387)

* fix: aggregate xRoute/xPolicy statuses across GWCs in gateway-api runner

Signed-off-by: y-rabie <[email protected]>

* polish

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* add e2e test

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* release note

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* truncate policy status & add tests

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* update

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* update

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: y-rabie <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: y-rabie <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: active health check respect endpoint hostname (#8452)

revert unrelated changes

Signed-off-by: zirain <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: exclude unmanaged route parents from xPolicy status ancestors (#8321)

* add test for mixed managed and unmanaged Gateway parents

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix the policy status when the targeting routes have managed and unmanged Gateway parents

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix test

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: add ownerReferences to ratelimit ConfigMap and HPA (#8358)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: computeHosts doesn't work when listener and route both wildcard  (#8186)

* fix: computeHosts doesn't work when listener and route both wildcard

Signed-off-by: zirain <[email protected]>

* remove skipped tests

Signed-off-by: zirain <[email protected]>

* Update internal/gatewayapi/helpers.go

Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: fixed local object reference resolution from parent in merged BackendTrafficPolicies (#8210)

Signed-off-by: Rudrakh Panigrahi <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: XListenerSet allows route from same namespace (#8226)

Previously, using allowedRoutes/Same for an XListenerSet with an xRoute
in the same namespace would return an error. Now it properly allows
xRoutes from the same namespace.

Signed-off-by: Kris Hicks <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix: API key auth (#8267)

* add test for multiple keys

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* revert secret transform

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>

* fix gen-check

Signed-off-by: Karol Szwaj <[email protected]>

* add release notes

Signed-off-by: Karol Szwaj <[email protected]>

* add release notes for envoy proxy image

Signed-off-by: Karol Szwaj <[email protected]>

---------

Signed-off-by: Felipe Sabadini Facina <[email protected]>
Signed-off-by: Karol Szwaj <[email protected]>
Signed-off-by: y-rabie <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: zirain <[email protected]>
Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>
Signed-off-by: Kris Hicks <[email protected]>
Co-authored-by: Felipe Sabadini Facina <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: y-rabie <[email protected]>
Co-authored-by: zirain <[email protected]>
Co-authored-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Rudrakh Panigrahi <[email protected]>
Co-authored-by: Kris Hicks <[email protected]>
rudrakhp pushed a commit to rudrakhp/gateway that referenced this pull request Mar 12, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
rudrakhp pushed a commit to rudrakhp/gateway that referenced this pull request Mar 12, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
rudrakhp pushed a commit to rudrakhp/gateway that referenced this pull request Mar 12, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
rudrakhp pushed a commit to rudrakhp/gateway that referenced this pull request Mar 12, 2026
)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>
rudrakhp added a commit that referenced this pull request Mar 12, 2026
* fix: fixed local object reference resolution from parent in merged BackendTrafficPolicies (#8210)

Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: exclude unmanaged route parents from xPolicy status ancestors (#8321)

* add test for mixed managed and unmanaged Gateway parents

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix the policy status when the targeting routes have managed and unmanged Gateway parents

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix test

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: computeHosts doesn't work when listener and route both wildcard  (#8186)

* fix: computeHosts doesn't work when listener and route both wildcard

Signed-off-by: zirain <[email protected]>

* remove skipped tests

Signed-off-by: zirain <[email protected]>

* Update internal/gatewayapi/helpers.go

Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: aggregate xRoute/xPolicy statuses across GWCs in gateway-api runner (#8387)

* fix: aggregate xRoute/xPolicy statuses across GWCs in gateway-api runner

Signed-off-by: y-rabie <[email protected]>

* polish

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* add e2e test

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* release note

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* truncate policy status & add tests

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* update

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* update

Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: y-rabie <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: y-rabie <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix: add ownerReferences to ratelimit ConfigMap and HPA (#8358)

Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* api: make ConnectionLimit.Value optional (#8478)

* api: make ConnectionLimit.Value optional

Signed-off-by: Felipe Sabadini Facina <[email protected]>

* release-notes: add entry for ConnectionLimit.Value optional

Signed-off-by: Felipe Sabadini Facina <[email protected]>

* fix: add CEL rule to require value when closeDelay is set

Signed-off-by: Felipe Sabadini Facina <[email protected]>

---------

Signed-off-by: Felipe Sabadini Facina <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix test race (#8180)

* fix test race

Signed-off-by: zirain <[email protected]>

* use io.Discard

Signed-off-by: zirain <[email protected]>

* use sync.WaitGroup

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
Signed-off-by: Isaac Wilson <[email protected]>
Co-authored-by: Isaac Wilson <[email protected]>
Signed-off-by: Rudrakh Panigrahi <[email protected]>

* fix gen check

Signed-off-by: Rudrakh Panigrahi <[email protected]>

---------

Signed-off-by: Rudrakh Panigrahi <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: zirain <[email protected]>
Signed-off-by: y-rabie <[email protected]>
Signed-off-by: Tejasriram Parvathaneni <[email protected]>
Signed-off-by: Felipe Sabadini Facina <[email protected]>
Signed-off-by: Isaac Wilson <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: zirain <[email protected]>
Co-authored-by: y-rabie <[email protected]>
Co-authored-by: Teja079 <[email protected]>
Co-authored-by: Karol Szwaj <[email protected]>
Co-authored-by: Felipe Sabadini <[email protected]>
Co-authored-by: Isaac Wilson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deployments created by gateways don't have an ownerReference

8 participants