-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add prefix restrictions on caches #1861
Add prefix restrictions on caches #1861
Conversation
This PR does not implement a mechanism for inputting values for prefixes that certain caches should be allowed to serve. The idea is for an admin to configure this through the UI, which will be implemented in a future PR. For now, to test this feature, the SQLite database itself needs to be modified. Use the following SQLite command to add custom fields:
With this added, the cache with hostname |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we discussed a few other things offline that might generate more work (like the fact that we won't have a way to configure this via our pelican.yaml if we rely solely on the web UI), but I decided to finish the review so you can incorporate feedback in the next round.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Description
This PR introduces a mechanism to define restrictions on the prefixes a cache is allowed to serve. The list of allowed prefixes can now be configured in the
custom_fields
column of the registry database as a JSON list, for example:AllowedPrefixes
list.AllowedPrefixes
key is absent incustom_fields
, the default behavior remains unchanged (i.e., the cache will serve all prefixes)./ns1
is inAllowedPrefixes
, it does not imply that the cache is allowed to serve/ns1/ns2
.Implementation Details
New Registry Endpoint:
/caches/allowedPrefixes
, is added to the registry.In-Memory Data Management:
Director.RegistryQueryInterval
).Prefix Filtering in Server Ads:
Additional Information
This implementation introduces a backward compatibility issue between central services. The new director with this mechanism will not work with an older registry that does not include the
/caches/allowedPrefixes
endpoint.A new endpoint,
/caches/allowedPrefixes
, has been created in the registry. The top-level endpoint in the registry is defined as/*wildcard
, which is used to retrieve information about namespaces. Due to this change, if a cache in the federation is namedallowedPrefixes
, it would not work. While this is not seen as a significant issue, middleware can be implemented to address it if necessary.After merging this PR, I will create a new issue to enable users to update the caches data in the registry through its UI, allowing them to add the list of allowed prefixes for a cache to the database.