iawia002 / ksbuilder

A CLI tool helps you to manage the development of kubesphere extensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

ksbuilder is a CLI tool to initialize, create, and publish KubeSphere extensions.

Install

Download the latest ksbuilder release and then install it to /usr/local/bin:

tar xvzf ksbuilder_<version>_<arch>.tar.gz -C /usr/local/bin/

Initialize a KubeSphere extension project

You can initialize a KubeSphere extension project as below:

// init a project
ksbuilder init <project-directory>

Create your first KubeSphere extension

You can use ksbuilder create to create a KubeSphere extension interactively.

cd <project-directory>
ksbuilder create <extension-name>

The extension directory created looks like below:

.
├── Chart.yaml
├── charts
│     ├── backend
│     │     ├── Chart.yaml
│     │     ├── templates
│     │     │     ├── NOTES.txt
│     │     │     ├── deployment.yaml
│     │     │     ├── extensions.yaml
│     │     │     ├── helps.tpl
│     │     │     ├── service.yaml
│     │     │     └── tests
│     │     │         └── test-connection.yaml
│     │     └── values.yaml
│     └── frontend
│         ├── Chart.yaml
│         ├── templates
│         │     ├── NOTES.txt
│         │     ├── deployment.yaml
│         │     ├── extensions.yaml
│         │     ├── helps.tpl
│         │     ├── service.yaml
│         │     └── tests
│         │         └── test-connection.yaml
│         └── values.yaml
└── values.yaml

Then you can customize your extension like below:

  • Specify the default backend and frontend images
frontend:
  enabled: true
  image:
repository:  <YOUR_REPO>/<extension-name>
    tag: latest

backend:
  enabled: true
  image:
    repository: <YOUR_REPO>/<extension-name>
    tag: latest
  • Add APIService definition to the backend extensions.yaml
apiVersion: extensions.kubesphere.io/v1alpha1
kind: APIService
metadata:
  name: v1alpha1.<extension-name>.kubesphere.io
spec:
  group: <extension-name>.kubesphere.io
  version: v1alpha1                                      
  url: http://<extension-name>-backend.default.svc:8080
status:
  state: Available
  • Add JSBundle definition to the frontend extensions.yaml
apiVersion: extensions.kubesphere.io/v1alpha1
kind: JSBundle
metadata:
  name: v1alpha1.<extension-name>.kubesphere.io
spec:
  rawFrom:
    url: http://<extension-name>-frontend.default.svc/dist/<extension-name>-frontend/index.js
status:
  state: Available
  link: /dist/<extension-name>-frontend/index.js

Please refer to KubeSphere extension development guide for more details on extension development.

Install or upgrade your KubeSphere extension

You can use the following command to install a KubeSphere extension.

ksbuilder install <extension-name>

You can use the following command to upgrade a KubeSphere extension.

ksbuilder update <extension-name>

Publish your KubeSphere extension

You can publish KubeSphere extension to KubeSphere Cloud once it's ready:

ksbuilder publish <extension-name>

About

A CLI tool helps you to manage the development of kubesphere extensions

License:MIT License


Languages

Language:Go 82.3%Language:Smarty 11.3%Language:Makefile 4.7%Language:Shell 1.2%Language:Dockerfile 0.5%