v2.0
v1.0
  1. Release Notes
    1. Release Notes - 2.0.2Latest
    1. Release Notes - 2.0.1
    1. Release Notes - 2.0.0
  1. Introduction
    1. Introduction
    1. Features
    1. Architecture
    1. Advantages
    1. Glossary
  1. Installation
    1. Intruction
      1. Intro
      2. Port Requirements
    1. Install on Linux
      1. All-in-One Installation
      2. Multi-Node Installation
      3. Installing HA Master and Etcd Cluster
      4. Storage Configuration Instruction
    1. Install on Kubernetes
      1. Prerequisites
      2. Online Installation
      3. Offline Installation
    1. Related Tools
      1. Integrating Harbor Registry
    1. Cluster Operation
      1. Adding New Nodes
      2. High Risk Operation
      3. Uninstalling KubeSphere
  1. Quick Start
    1. Getting Started with Multitenancy
    1. Exposing your APP using Ingress
    1. Deploying a MySQL Application
    1. Deploying a Wordpress Website
    1. Job to compute π to 2000 places
    1. Deploying Grafana using APP Template
    1. Creating Horizontal Pod Autoscaler
    1. S2i: Publish your app without Dockerfile
    1. Canary Release of Microservice APP
    1. CI/CD based on Spring Boot Project
    1. Building a Pipeline in a Graphical Panel
    1. CI/CD based on GitLab and Harbor
    1. Ingress-Nginx for Grayscale Release
  1. Cluster Admin Guide
    1. Multi-tenant Management
      1. Overview of Multi-tenant Management
      2. Overview of Role Management
    1. Platform Management
      1. Account Management
      2. Platform Roles Management
    1. Infrastructure
      1. Service Components
      2. Nodes
      3. Storage Classes
    1. Monitoring Center
      1. Physical Resources
      2. Application Resources
    1. Application Repository
    1. Jenkins System Settings
  1. User Guide
    1. Application Template
    1. Workloads
      1. Deployments
      2. StatefulSets
      3. DaemonSets
      4. Jobs
      5. CronJobs
    1. Storage
      1. Volumes
    1. Network & Services
      1. Services
      2. Routes
    1. Configuration Center
      1. Secret
      2. ConfigMap
      3. Image Registry
    1. Project Settings
      1. Basic Information
      2. Member Roles
      3. Project Members
      4. Internet Access
    1. DevOps Project
      1. DevOps Project Management
      2. DevOps Project Management
      3. DevOps Project Management
      4. DevOps Project Management
      5. DevOps Project Management
  1. Development Guide
    1. Preparing the Development Environment
    1. Development Workflow
  1. API Documentation
    1. API Guide
    1. How to invoke KubeSphere API
KubeSphere®️ 2020 All Rights Reserved.

Development Workflow - Build, Development and Test

Building KubeSphere on a local OS/shell environment

For Quick Taste Binary

mkdir ks-tmp
cd ks-tmp
echo 'module kubesphere' > go.mod
echo 'replace (
        github.com/Sirupsen/logrus v1.4.1 => github.com/sirupsen/logrus v1.4.1
      	github.com/kiali/kiali => github.com/kubesphere/kiali v0.15.1-0.20190407071308-6b5b818211c3
      	github.com/kubernetes-sigs/application => github.com/kubesphere/application v0.0.0-20190518133311-b9d9eb0b5cf7
      )' >> go.mod
      
GO111MODULE=on go get kubesphere.io/kubesphere@d649e3d0bbc64bfba18816c904819e4850d021e0
GO111MODULE=on go build -o ks-apiserver kubesphere.io/kubesphere/cmd/ks-apiserver # build ks-apiserver
GO111MODULE=on go build -o ks-apigateway kubesphere.io/kubesphere/cmd/ks-apigateway # build ks-apigateway
GO111MODULE=on go build -o ks-controller-manager kubesphere.io/kubesphere/cmd/controller-manager # build ks-controller-manager
GO111MODULE=on go build -o ks-iam kubesphere.io/kubesphere/cmd/ks-iam # build ks-iam

For Building KubeSphere Images

KubeSphere components are often deployed as a container in a kubernetes cluster, you may need to build a Docker image locally.

  1. Clone repo to local
git clone https://github.com/kubesphere/kubesphere.git
  1. Run Docker command to build image
# $REPO is the docker registry to push to
# $Tag is the tag name of the docker image
# The full go build process will be executed in the Dockerfile, so you may need to set GOPROXY in it.
docker build -f build/ks-apigateway/Dockerfile -t $REPO/ks-apigateway:$TAG .
docker build -f build/ks-apiserver/Dockerfile -t $REPO/ks-apiserver:$TAG .
docker build -f build/ks-iam/Dockerfile -t $REPO/ks-account:$TAG .
docker build -f build/ks-controller-manager/Dockerfile -t $REPO/ks-controller-manager:$TAG .
docker build -f ./pkg/db/Dockerfile -t $REPO/ks-devops:flyway-$TAG ./pkg/db/

Test

In the development process, it is recommended to use local Kubernetes clusters, such as minikube, or to install an single-node all-in-one environment (Kubernetes-based) for quick testing.

Tip: It also supports to use Docker for Desktop ships with Kubernetes as the test environment.

Development Workflow

1 - Fork in the cloud

  1. Visit KubeSphere GitHub - Backend

  2. Click Fork button to establish a cloud-based fork.

2 - Clone fork to local storage

Per Go's [workspace instructions][https://golang.org/doc/code.html#workspaces], place KubeSphere' code on your GOPATH using the following cloning procedure.

  1. Define a local working directory:
$ export working_dir=$GOPATH/src/kubesphere.io
$ export user={your github profile name}
  1. Create your clone locally:
$ mkdir -p $working_dir
$ cd $working_dir
$ git clone https://github.com/$user/kubesphere.git
$ cd $working_dir/kubesphere
$ git remote add upstream https://github.com/kubesphere/kubesphere.git

# Never push to upstream master
$ git remote set-url --push upstream no_push

# Confirm that your remotes make sense:
$ git remote -v

3 - Keep your branch in sync

git fetch upstream
git checkout master
git rebase upstream/master

4 - Add new features or fix issues

Branch from it:

$ git checkout -b myfeature

Then edit code on the myfeature branch.

Test and build

Currently, make rules only contain simple checks such as vet, unit test, will add e2e tests soon.

Using KubeBuilder

  • For Linux OS, you can download and execute this KubeBuilder script.
  • For MacOS, you can install KubeBuilder by following this guide.

Run and test

$ make all
# Run every unit test
$ make test

Run make help for additional information on these make targets.

5 - Development in new branch

Sync with upstream

After the test is completed, suggest you to keep your local in sync with upstream which can avoid conflicts.

# Rebase your the master branch of your local repo.
$ git checkout master
$ git rebase upstream/master

# Then make your development branch in sync with master branch
git checkout new_feature
git rebase -i master

Commit local changes

$ git add <file>
$ git commit -s -m "add your description"

6 - Push to your folk

When ready to review (or just to establish an offsite backup or your work), push your branch to your fork on github.com:

$ git push -f ${your_remote_name} myfeature

7 - Create a PR

CI/CD

KubeSphere uses Travis CI as a CI/CD tool.

The components of KubeSphere need to be compiled and build include following:

ks-apiserver, ks-controller-manager, ks-account, ks-apigateway, ks-devops

After your PR is merged,Travis CI will compile the entire project and build the image, and push the image kubespheredev/[component-name]:latest to Dockerhub (e.g. kubespheredev/ks-apiserver:latest)

Code conventions

Please reference Code conventions and follow with the rules.

Note:

  • All new packages and most new significant functionality must come with unit tests
  • Comment your code in English, see Go's commenting conventions