feat: Add resource provider allowlist #481
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request makes the following changes:
SERVER_ENABLE_RESOURCE_PROVIDER_ALLOWLIST
config to enable/disable allowlist (defaults tofalse
)POST /resource_offers
handler when allowlist enabledWe are adding a resource provider allowlist to gate resource offers during our beta program.
Task/Issue reference
Closes: #479
Test plan
We have added a new set of tests for the memory and database implementations of the new allowed resource provider store methods.
To test the allowlist disabled configuration, start the base services, solver, and resource provider.
The resource provider should be able to post it's resource offer. Stop the solver and resource provider.
To test the allowlist enabled configuration, start the solver with the allowlist enabled:
Start the resource provider:
They will attempt to post their resource offer with retries and eventually fail with an error message:
Connect to the database with
psql
:Once in
psql
, insert your resource provider into theallowed_resource_providers
table:Start the resource provider again and it should be able to post its resource offer.
Details
Configuration
The allowlist is enabled or disabled with a environment variable or CLI option:
The config name got crazy long, so open to suggestions for something shorter. 😄
Related issues or PRs
Epic: https://github.com/Lilypad-Tech/internal/issues/367