-
Notifications
You must be signed in to change notification settings - Fork 0
Comp 679 container registry pull access metrics via distribution events #43
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
base: master
Are you sure you want to change the base?
Comp 679 container registry pull access metrics via distribution events #43
Conversation
Add POST /api/cache/invalidate endpoint to clear both HTTP response cache and registry data cache. This allows manual cache invalidation when the registry content has been updated, providing immediate cache clearing without waiting for the automatic refresh interval. Changes: - Add ClearCache() method to async registry for clearing all cached data - Add CacheManager to coordinate cache clearing operations - Add cache invalidate handler and route at POST /api/cache/invalidate - Update server constructor to accept async registry for cache management 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Replace manual cache invalidation with automatic webhook-based cache clearing.
This commit adds:
- Docker Distribution webhook endpoint at POST /api/webhook/registry
- Selective repository cache invalidation (vs full cache clear)
- Event filtering to only process manifest push events
- Support for Docker Distribution event envelope format
- Detailed logging and response metrics
The webhook endpoint processes Docker Distribution events and automatically
invalidates cache for repositories when new containers are pushed, eliminating
the need for manual cache management or waiting for refresh intervals.
Event Filtering:
- Only processes "push" actions with manifest media types
- Ignores layer pushes, pulls, and other registry events
- Supports both Docker v2 and OCI manifest formats
- Deduplicates multiple events for the same repository in a batch
Configuration:
Configure Docker Distribution registry.yml:
```yaml
notifications:
endpoints:
- name: staticreg-webhook
url: http://your-staticreg-host/api/webhook/registry
timeout: 5s
threshold: 3
backoff: 1s
```
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
|
@pditommaso @fntlnz since the webhook is coupled with cache manager Please let me know the decision for the following:
Example db data: |
|
@munishchouhan the event is stored into a bson column type right? can you dump here a full json object? Thinking more about this pushes are rare, but pull events will be a LOT. therefore we need to plan carefully for this case, the event handling fully async and tracking only essential data |
|
@pditommaso db schema has been added in the PR |
Summary
This PR adds Docker Distribution webhook integration to enable container registry pull metrics tracking and cache invalidation. The implementation consists of:
Key Changes
Webhook Integration (pkg/webhook/)
Cache Management (pkg/server/)
Database Layer (pkg/db/)
Infrastructure
Test Plan