GithubHelp home page GithubHelp logo

addono / container-registry-proxy-custom-plugin-example Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 268 KB

A simple example of a custom plugin implementation for the container-registry-proxy.

Home Page: https://github.com/Addono/container-registry-proxy

License: MIT License

TypeScript 100.00%
container-registry-proxy plugin typescript node

container-registry-proxy-custom-plugin-example's Introduction

Container Registry Proxy - Custom Plugin Example

License Project Status: Active โ€“ The project has reached a stable, usable state and is being actively developed. GitHub Workflow Status All Contributors

๐Ÿ“ Table of Contents

๐Ÿง About

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.

๐Ÿ Getting Started

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.

Prerequisites

You need to have Yarn installed to use this repository.

Installing

First we need to install all dependencies, run:

yarn install

Running Locally

The following command will continuously compile the code of the plugin to plain JavaScript.

yarn build --watch

Editing

To 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.

๐ŸŽˆ Usage

First, build the plugin:

yarn build

Then you can attach it to the container-regsitry-proxy by running:

container-registry-proxy --customPlugin dist/plugin.js

โœจ Contributors

Thanks goes to these wonderful people (emoji key):


Adriaan Knapen

๐Ÿ’ป ๐Ÿ“–

This project follows the all-contributors specification. Contributions of any kind welcome!

container-registry-proxy-custom-plugin-example's People

Contributors

addono avatar dependabot[bot] avatar depfu[bot] avatar

Watchers

 avatar  avatar  avatar

Forkers

pallavi-akhare

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.