Skip to content
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

feat: asynchronous providers #2055

Merged
merged 8 commits into from
Jul 12, 2024
Merged

feat: asynchronous providers #2055

merged 8 commits into from
Jul 12, 2024

Conversation

matt2e
Copy link
Collaborator

@matt2e matt2e commented Jul 12, 2024

closes #1949

Changes:

  • Splits Provider interface into:
    • SynchronousProvider: same as old interface, can load values from the data source on-demand
    • AsynchronousProvider: used by providers that prefer to sync with their data source
  • Manager owns a cache which syncs asynchronous providers
    • When Manager is getting values from an asynchronous provider, it now accesses it via cache
    • When Manager is setting values for an asynchronous provider, it directly sets it with the provider and then notifies the cache
  • OnePasswordProvider is now an AsynchronousProvider so that we don't cause multiple annoying authorization prompts
  • ASM is now an AsynchronousProvider with it's previous secretsCache now being repurposed to work more generally.

@matt2e matt2e requested a review from alecthomas as a code owner July 12, 2024 01:57
@matt2e matt2e requested review from a team and wesbillman and removed request for a team July 12, 2024 01:57
@ftl-robot ftl-robot mentioned this pull request Jul 12, 2024
c.lastSyncAttempt = optional.Some(clock.Now())
err := c.provider.Sync(ctx, c.values)
if err != nil {
logger.Errorf(err, "Error syncing %s", c.provider.Key())
Copy link
Contributor

Choose a reason for hiding this comment

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

This happens when a provider fails? eg asm timeout? Does the backoff time out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This happens when a provider fails to sync (such as ASM timing out, or 1Password not getting authorized).
The backoff schedules the sync to try again in a future round of async provider syncs, starting at 1s later, exponentially growing and then maxing out at a 2 min maximum (syncMaxBackoff).
Does that answer your question @gak?

@matt2e matt2e force-pushed the matt2e/cache-secrets branch from e82705f to 40cc1df Compare July 12, 2024 02:58
@matt2e matt2e force-pushed the matt2e/cache-secrets branch from 0975745 to 32a0eaf Compare July 12, 2024 03:15
@matt2e matt2e enabled auto-merge (squash) July 12, 2024 03:15
@matt2e matt2e merged commit 6508d57 into main Jul 12, 2024
48 of 50 checks passed
@matt2e matt2e deleted the matt2e/cache-secrets branch July 12, 2024 03:20
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.

Cache secrets at router
2 participants