Skip to content

[v18] feat: Add bot instance cache#56163

Merged
nicholasmarais1158 merged 4 commits intobranch/v18from
nicholasmarais1158/backport-55807-branch/v18
Jul 14, 2025
Merged

[v18] feat: Add bot instance cache#56163
nicholasmarais1158 merged 4 commits intobranch/v18from
nicholasmarais1158/backport-55807-branch/v18

Conversation

@nicholasmarais1158
Copy link
Copy Markdown
Contributor

Backport #55807 to branch/v18

* feat: Add bot instance cache

* Finalise cache implementation and add tests

* Appease the linter

* Return early in paging logic

* Fix import ordering/grouping

* Fix test cache setup

* Revert BotCache rename

* Clean-up commented code

* Revert imports order change

* Refactor to use generic getter and lister
# Conflicts:
#	lib/auth/authclient/api.go
#	lib/cache/cache.go
#	lib/cache/cache_test.go
#	lib/cache/collections.go
@nicholasmarais1158 nicholasmarais1158 self-assigned this Jun 27, 2025
@nicholasmarais1158 nicholasmarais1158 added machine-id no-changelog Indicates that a PR does not require a changelog entry labels Jun 27, 2025
Comment thread lib/cache/bot_instance.go
Comment on lines +65 to +75
var out []*machineidv1.BotInstance
clientutils.IterateResources(ctx,
func(ctx context.Context, limit int, start string) ([]*machineidv1.BotInstance, string, error) {
return upstream.ListBotInstances(ctx, "", limit, start, "")
},
func(hcc *machineidv1.BotInstance) error {
out = append(out, hcc)
return nil
},
)
return out, nil
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.

https://github.com/gravitational/teleport/blob/master/lib/cache/bot_instance.go#L86-L91

Suggested change
var out []*machineidv1.BotInstance
clientutils.IterateResources(ctx,
func(ctx context.Context, limit int, start string) ([]*machineidv1.BotInstance, string, error) {
return upstream.ListBotInstances(ctx, "", limit, start, "")
},
func(hcc *machineidv1.BotInstance) error {
out = append(out, hcc)
return nil
},
)
return out, nil
out, err := stream.Collect(clientutils.Resources(ctx,
func(ctx context.Context, limit int, start string) ([]*machineidv1.BotInstance, string, error) {
return upstream.ListBotInstances(ctx, "", limit, start, "", nil)
},
))
return out, trace.Wrap(err)

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from strideynet July 10, 2025 14:59
@nicholasmarais1158 nicholasmarais1158 added this pull request to the merge queue Jul 14, 2025
Merged via the queue into branch/v18 with commit 2edabef Jul 14, 2025
40 checks passed
@nicholasmarais1158 nicholasmarais1158 deleted the nicholasmarais1158/backport-55807-branch/v18 branch July 14, 2025 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport machine-id no-changelog Indicates that a PR does not require a changelog entry size/md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants