Skip to content

A sample external plugin for kubebuilder in JavaScript.

Notifications You must be signed in to change notification settings

Eileen-Yu/kb-js-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An External Plugin for Kubebuilder

A sample external plugin written in Javascript.

Quick Start

  1. Build the js plugin into an executable
# Install Dependencies
npm ci

# Build an executable into dist/kb-js-plugin/v1/kb-js-plugin
npm run build
  1. Load the plugin and run kb command
# 1. Display help info for `init` / `create api` / `create webhook` / `edit` subcommand
EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder init --plugins=kb-js-plugin/v1 --help

EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder create api --plugins=kb-js-plugin/v1 --help

EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder create webhook --plugins=kb-js-plugin/v1 --help

EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder edit --plugins=kb-js-plugin/v1 --help


# 2. scaffold the project by `init` subcommand with valid flag `--domain`
EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder init --plugins=kb-js-plugin/v1 --domain eileen.io


# 3. create an api for the project by `create api` subcommand with GVK
EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder create api --plugins=kb-js-plugin/v1 --group webapp --version v1 --kind Guestbook


# 4. create a webhook for the project by `create webhook` subcommand with GVK
EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder create webhook --plugins=kb-js-plugin/v1 --group webapp --version v1 --kind Guestbook

# 5. update the api for the project by `edit` subcommand
EXTERNAL_PLUGINS_PATH=/Users/eileen/programming/kb-js-plugin/dist/ \
  kubebuilder edit --plugins=kb-js-plugin/v1
  1. Check the output

The plugin triggered by init will generate the PROJECT file, and another file initFile with the domain you specified.

The plugin triggered by create api will generate a file apiFile with the GVK you specified.

The plugin triggered by create webhook will generate a file webhookFile with the GVK you specified.

The plugin triggered by edit will update the apiFile.

Showcase

output

More info

About

A sample external plugin for kubebuilder in JavaScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published