feat(discovery): add endpoint for plugins to check their registration #1425
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.
Welcome to Cryostat! 👋
Before contributing, make sure you have:
main
branch[chore, ci, docs, feat, fix, test]
git commit --amend --signoff
Related to cryostatio/cryostat-agent#85
Description of the change:
This adds a
GET
endpoint that plugins can use with their existing registration ID and token to check their registration status. The API response is 200 if the plugin is registered and the token is still valid, 401 if the token is invalid, and 404 if the token is somehow valid but the plugin is not registered (this should be impossible - if the plugin is not registered then any token it still has should be invalid).Motivation for the change:
This is used by the
-agent
to perform its own periodic heartbeat checks on the Cryostat server at a slower cadence. If the plugin notices that it cannot reach Cryostat, or that Cryostat no longer recognizes it as a registered plugin, then the-agent
re-enters its original unregistered state and begins trying to more quickly re-register itself with the Cryostat server it is configured for.How to manually test:
Patch
shometest.sh
like so:to make one of the sample agent applications perform this check more frequently so it's easier to catch.
GET
requests to the new endpoint, which should succeed.