mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-19 20:46:37 +00:00
Update REAMDE and add DEVELOPMENT documentation
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# Development
|
||||
|
||||
This doc explains how to set up a development environment, so you can get started
|
||||
contributing to `RudrX` or build a PoC (Proof of Concept).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. Golang version 1.12+
|
||||
2. Kubernetes version v1.15+ with `~/.kube/config` configured.
|
||||
3. OAM Kubernetes Runtime installed.
|
||||
|
||||
## Build
|
||||
* Clone this project
|
||||
|
||||
```shell script
|
||||
git clone git@github.com:cloud-native-application/RudrX.git
|
||||
```
|
||||
|
||||
* Install Template CRD into your cluster
|
||||
|
||||
```shell script
|
||||
make install
|
||||
```
|
||||
|
||||
* Install template object
|
||||
|
||||
```shell script
|
||||
kubectl apply -f config/samples/
|
||||
```
|
||||
|
||||
## Develop & Debug
|
||||
If you change Template CRD, remember to rerun `make install`.
|
||||
|
||||
Use the following command to develop and debug.
|
||||
|
||||
```shell script
|
||||
$ cd cmd/rudrx
|
||||
$ go run main.go COMMAND [FLAG]
|
||||
```
|
||||
|
||||
For example, use the following command to create and run an application.
|
||||
```shell script
|
||||
$ go run main.go run containerized app2057 nginx:1.9.4
|
||||
Creating AppConfig app2057
|
||||
SUCCEED
|
||||
|
||||
$ kubectl get oam
|
||||
NAME WORKLOAD-KIND
|
||||
component.core.oam.dev/app2057 ContainerizedWorkload
|
||||
|
||||
NAME AGE
|
||||
containerizedworkload.core.oam.dev/poc 53m
|
||||
|
||||
NAME AGE
|
||||
applicationconfiguration.core.oam.dev/app2057 69s
|
||||
|
||||
NAME DEFINITION-NAME
|
||||
traitdefinition.core.oam.dev/simplerollouttraits.extend.oam.dev simplerollouttraits.extend.oam.dev
|
||||
|
||||
NAME DEFINITION-NAME
|
||||
workloaddefinition.core.oam.dev/containerizedworkloads.core.oam.dev containerizedworkloads.core.oam.dev
|
||||
workloaddefinition.core.oam.dev/deployments.apps deployments.apps
|
||||
workloaddefinition.core.oam.dev/statefulsets.apps statefulsets.apps
|
||||
```
|
||||
|
||||
## Make a pull request
|
||||
Remember to write unit-test and e2e test before making a pull request.
|
||||
@@ -2,21 +2,90 @@
|
||||
|
||||
RudrX is a command-line tool to use OAM based micro-app engine.
|
||||
|
||||
## Develop
|
||||
Check out [DEVELOPMENT.md](./DEVELOPMENT.md) to see how to develop with RudrX
|
||||
|
||||
## Use with command-line
|
||||
|
||||
1. Install Template CRD into your cluster
|
||||
### Build `rudr` binary
|
||||
```shell script
|
||||
make install
|
||||
$ cd cmd/rudrx
|
||||
$ go build -o rudr
|
||||
$ cp ./rudr /usr/local/bin
|
||||
```
|
||||
|
||||
2. Install template object
|
||||
### RudrX commands
|
||||
|
||||
- rudr help/prompts
|
||||
```shell script
|
||||
kubectl apply -f config/samples/
|
||||
$ rudr -h
|
||||
rudr is a command-line tool to use OAM based micro-app engine.
|
||||
|
||||
Usage:
|
||||
rudr [flags]
|
||||
rudr [command]
|
||||
|
||||
Available Commands:
|
||||
bind Attach a trait to a component
|
||||
help Help about any command
|
||||
run Run OAM workloads
|
||||
traits List traits
|
||||
```
|
||||
|
||||
3. rudrx run
|
||||
- create and run an appliction
|
||||
```shell script
|
||||
$ rudr run -h
|
||||
Create and Run one component one AppConfig OAM APP
|
||||
|
||||
Usage:
|
||||
rudr run [WORKLOAD_KIND] [args]
|
||||
rudr run [command]
|
||||
|
||||
Examples:
|
||||
|
||||
rudr run containerized frontend -p 80 oam-dev/demo:v1
|
||||
|
||||
|
||||
Available Commands:
|
||||
containerized Run containerized workloads
|
||||
|
||||
Flags:
|
||||
-h, --help help for run
|
||||
-p, --port string
|
||||
|
||||
```bash
|
||||
rudrx run containerized frontend -p 80 -i oam-dev/demo:v1
|
||||
$ rudr run
|
||||
You must specify a workload, like containerized, deployments.apps, statefulsets.apps
|
||||
|
||||
$ rudr run containerized
|
||||
must specify name for workload
|
||||
|
||||
$ go run main.go run containerized poc nginx:1.9.4
|
||||
Creating AppConfig poc
|
||||
SUCCEED
|
||||
```
|
||||
|
||||
- list traits
|
||||
```shell script
|
||||
$ rudr traits -h
|
||||
List traits
|
||||
|
||||
Usage:
|
||||
rudr traits [-workload WORKLOADNAME]
|
||||
|
||||
Examples:
|
||||
rudr traits
|
||||
|
||||
Flags:
|
||||
-h, --help help for traits
|
||||
-w, --workload string Workload name
|
||||
|
||||
$ rudr traits
|
||||
NAME SHORT DEFINITION APPLIES TO STATUS
|
||||
simplerollouttraits.extend.oam.dev SimpleRollout simplerollouttraits.extend.oam.dev core.oam.dev/v1alpha2.ContainerizedWorkload, deployments.... -
|
||||
```
|
||||
|
||||
- apply a trait to the workload
|
||||
```shell script
|
||||
$ rudr bind poc simplerollout --replica 6 --maxUnavailable 2 --batch 2
|
||||
Applying trait for component poc
|
||||
Succeeded!
|
||||
```
|
||||
Reference in New Issue
Block a user