The Container Registry Proxy (CRP) is a small proxy for communicating with a container registry. This proxy can monitor and modify traffic in-transit, as to facilitate additional logging and chaos engineering.
Monitoring and modifying the traffic is delegated to a plugin system. This allows the proxy to be generally reusable and allow anyone to tune it to their needs without having to dive into the source code of the proxy.
This repository is here to give you an example and starting point for creating custom plugins for the CRP. Custom plugins are plugins which are loaded from the file system by the CRP at runtime.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See usage for notes on how to use the plugin in production.
You need to have Yarn installed to use this repository.
First we need to install all dependencies, run:
yarn installThe following command will continuously compile the code of the plugin to plain JavaScript.
yarn build --watchTo modify the plugin, open ./plugin.ts and modify the plugin by adding your logic to the requestPipe method of the by default exported object.
The requestPipe is function, which takes a Request object as it's only argument. Its return type is a promise of a (if desired modified) Request object, or otherwise undefined if the connection should be dropped.
type Request = {
host: string
https: boolean
version: string
parameters?: {
repository: string
method: Method
tag: string
}
}
interface Plugin {
name: string
description?: string
requestPipe: RequestPipe
}Up to date type definitions can be inferred by your IDE or found here.
First, build the plugin:
yarn buildThen you can attach it to the container-regsitry-proxy by running:
container-registry-proxy --customPlugin dist/plugin.jsThanks goes to these wonderful people (emoji key):
Adriaan Knapen 💻 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!