Skip to content

Cache the result of TeleportProcess.GetRotation#50235

Merged
espadolini merged 1 commit intomasterfrom
espadolini/getrotation-fncache
Dec 13, 2024
Merged

Cache the result of TeleportProcess.GetRotation#50235
espadolini merged 1 commit intomasterfrom
espadolini/getrotation-fncache

Conversation

@espadolini
Copy link
Copy Markdown
Contributor

Each "full" resource heartbeat (i.e. an "announce" or a fallback using the UpsertFooServer rpc directly) includes the rotation state of the agent, which is read from process storage every time. When Teleport is running in Kubernetes, as part of the teleport-kube-agent, the state in process storage is actually in a Kubernetes secret, which is read from the cluster's API server with a concurrency limit of 1. This causes severe slowdowns, to the point of making the agent unusable (and reporting unhealthy and unready), when a large amount of dynamic resources, such as apps, are changed - potentially as a result of changes in the automatic discovery settings, for example. This PR adds a TTL cache for the GetRotation call, making sure the cache is invalidated whenever the process writes a new state as part of a CA rotation.

changelog: improved the performance of Teleport agents serving a large number of resources in Kubernetes

@espadolini espadolini added this pull request to the merge queue Dec 13, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 13, 2024
@espadolini espadolini added this pull request to the merge queue Dec 13, 2024
Merged via the queue into master with commit e53815b Dec 13, 2024
@espadolini espadolini deleted the espadolini/getrotation-fncache branch December 13, 2024 23:31
@public-teleport-github-review-bot
Copy link
Copy Markdown

@espadolini See the table below for backport results.

Branch Result
branch/v15 Create PR
branch/v16 Create PR
branch/v17 Create PR

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.

4 participants