Skip to content

performance: use cached kube client for the infra runner#8764

Merged
jukie merged 23 commits intoenvoyproxy:mainfrom
zhaohuabing:kub-infra-provider-cache-client
Apr 25, 2026
Merged

performance: use cached kube client for the infra runner#8764
jukie merged 23 commits intoenvoyproxy:mainfrom
zhaohuabing:kub-infra-provider-cache-client

Conversation

@zhaohuabing
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing commented Apr 15, 2026

This PR reuses the cached controller-runtime client from the controller manager for infrastructure reconciliation to reduce Kubernetes API server calls.

Please note that the rate limit server is now created only after the first Gateway is created. This is because the cached Kubernetes client in the kube provider is initialized asynchronously and may not be ready when the server starts.
The infra runner waits for the kube client to finish cache sync before creating the rate limit server.

The changed behavior of the Infra runner are covered by existing e2e tests test/e2e/tests/envoyproxy.go.

Release note: yes.

@zhaohuabing zhaohuabing requested a review from a team as a code owner April 15, 2026 14:09
@zhaohuabing zhaohuabing marked this pull request as draft April 15, 2026 14:09
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 15, 2026

Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 321f125
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/69eb3821aa730b00083016fd
😎 Deploy Preview https://deploy-preview-8764--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.

Copy link
Copy Markdown

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

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: a105d0adde

ℹ️ 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/provider/kubernetes/kubernetes.go Outdated
@zhaohuabing
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

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

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: 88c09aedc4

ℹ️ 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/provider/kubernetes/kubernetes.go Outdated
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 59.84848% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.33%. Comparing base (cab6837) to head (321f125).

Files with missing lines Patch % Lines
internal/provider/kubernetes/kubernetes.go 64.06% 19 Missing and 4 partials ⚠️
internal/infrastructure/runner/runner.go 27.77% 10 Missing and 3 partials ⚠️
internal/envoygateway/config/config.go 36.36% 7 Missing ⚠️
...ternal/infrastructure/kubernetes/infra_resource.go 87.50% 0 Missing and 4 partials ⚠️
internal/infrastructure/manager.go 0.00% 4 Missing ⚠️
internal/provider/runner/runner.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8764      +/-   ##
==========================================
- Coverage   74.39%   74.33%   -0.07%     
==========================================
  Files         246      246              
  Lines       39221    39287      +66     
==========================================
+ Hits        29180    29205      +25     
- Misses       8017     8048      +31     
- Partials     2024     2034      +10     

☔ 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.

@zhaohuabing zhaohuabing force-pushed the kub-infra-provider-cache-client branch from b61799a to 97c2e50 Compare April 16, 2026 03:12
@zhaohuabing
Copy link
Copy Markdown
Member Author

@codex

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@zhaohuabing zhaohuabing force-pushed the kub-infra-provider-cache-client branch 5 times, most recently from cdb0581 to 4025657 Compare April 16, 2026 07:57
@zhaohuabing zhaohuabing added this to the v1.8.0-rc.1 Release milestone Apr 16, 2026
@zhaohuabing zhaohuabing force-pushed the kub-infra-provider-cache-client branch from 4025657 to b8db1ff Compare April 16, 2026 08:21
@zhaohuabing zhaohuabing marked this pull request as ready for review April 16, 2026 08:55
@zhaohuabing zhaohuabing marked this pull request as draft April 16, 2026 08:56
Copy link
Copy Markdown

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

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: b8db1ff9a4

ℹ️ 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/provider/kubernetes/kubernetes.go Outdated
Comment thread internal/infrastructure/runner/runner.go Outdated
@cnvergence
Copy link
Copy Markdown
Member

nice :)

Comment thread internal/infrastructure/runner/runner.go
@zhaohuabing zhaohuabing force-pushed the kub-infra-provider-cache-client branch 8 times, most recently from 5f162ef to 8821341 Compare April 17, 2026 16:49
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing force-pushed the kub-infra-provider-cache-client branch from b93adac to cc3962c Compare April 22, 2026 13:02
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing force-pushed the kub-infra-provider-cache-client branch from dda036c to 1b75784 Compare April 24, 2026 07:57
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing requested review from a team and zirain April 24, 2026 08:09
@zhaohuabing
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

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

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: 6b7f968d16

ℹ️ 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 charts/gateway-helm/templates/_rbac.tpl
Comment thread internal/infrastructure/manager.go
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
@kkk777-7
Copy link
Copy Markdown
Member

LGTM, thanks!

@jukie jukie merged commit 30cdc61 into envoyproxy:main Apr 25, 2026
39 checks passed
go func() {
errChan <- p.manager.Start(ctx)
}()
go signalProviderReady(ctx, p.manager.GetCache().WaitForCacheSync, p.providerReady)
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.

why is this needed ? dont we already perform something similar in health check and readiness checks ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This ensures the controller client is ready before initializing the rate limit server in the infra manager.

skos-ninja pushed a commit to skos-ninja/envoy-gateway that referenced this pull request May 1, 2026
…8764)

* use cached client from the controller manager

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix rbac

Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>

* address comments

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* inject provider kube client to infra runner

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* add retries for rate limit server

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* watch only EG owned resources

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* add release note

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* use context to pass the kube client

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* update release note

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* use config.server to pass the kube client

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix lint

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* address comments

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* update release note

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* minor wording

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix test

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* wait for the cached client and start ratlimit server first

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix gen

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* remove unnecessary change

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix rbac

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

* fix gen

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>

---------

Signed-off-by: Huabing (Robin) Zhao <zhaohuabing@gmail.com>
Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
Signed-off-by: Jake Oliver <jake@truelayer.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.

7 participants