Skip to content

Do less Kubernetes API requests #2699

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

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

Conversation

g7r
Copy link

@g7r g7r commented Mar 8, 2025

Description

The first reason why provider does so many requests is because its caches aren't goroutine-safe. For example, Terraform invokes provider concurrently and every individual goroutine starts its own getOAPIv2Foundry() invocation. Every getOAPIv2Foundry() starts its own Kubernetes API request and these requests consume Kubernetes client Burst leading eventually to a stall.

The second reason is that CRDs should also be cached because production Kubernetes clusters may have lots and lots of CRDs and getting them all is not cheap. Furthermore, getting them over and over consumes Kubernetes client Burst leading to a major stall.

Release Note

Release note for CHANGELOG:

Do less Kubernetes API invocations
Make `RawProviderServer` caches goroutine-safe

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

The first reason why provider does so many requests is because its
caches aren't goroutine-safe. For example, Terraform invokes provider
concurrently and every individual goroutine starts its own
getOAPIv2Foundry() invocation. Every getOAPIv2Foundry() starts its own
Kubernetes API request and these requests consume Kubernetes client
Burst leading eventually to a stall.

The second reason is that CRDs should also be cached because production
Kubernetes clusters may have lots and lots of CRDs and getting them all
is not cheap. Furthermore, getting them over and over consumes
Kubernetes client Burst leading to a major stall.
@g7r g7r requested a review from a team as a code owner March 8, 2025 17:33
Copy link

hashicorp-cla-app bot commented Mar 8, 2025

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the size/L label Mar 8, 2025
@g7r
Copy link
Author

g7r commented Apr 10, 2025

Hello @alexsomesan, @jrhouston, and @arybolovlev,

Hope you're having a good week.

I submitted this PR about a month ago and just wanted to gently follow up to make sure the notification came through and it landed on your radar.

This PR has two main benefits: it addresses a significant performance issue (reducing terraform plan time from ~3 minutes back down to ~15 seconds) and also helps make the provider's behavior more correct in this context.

I'd be grateful if you could take a look when you have a moment.

Thank you for your consideration and all your work on this provider!

@alexsomesan
Copy link
Member

Hello @alexsomesan, @jrhouston, and @arybolovlev,

Hope you're having a good week.

I submitted this PR about a month ago and just wanted to gently follow up to make sure the notification came through and it landed on your radar.

This PR has two main benefits: it addresses a significant performance issue (reducing terraform plan time from ~3 minutes back down to ~15 seconds) and also helps make the provider's behavior more correct in this context.

I'd be grateful if you could take a look when you have a moment.

Thank you for your consideration and all your work on this provider!

Hello @g7r
Thanks for taking the time to look into these performance issues.

Our whole team is away this week, taking part in a company event. I will have a look at your PR first thing next week, when I'm back to a regular schedule.

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

Successfully merging this pull request may close these issues.

3 participants