mirror of https://github.com/kubevela/velad.git
Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
f91e8c93ee | |
|
232f6e6f57 | |
|
7451872fc0 |
|
@ -4,6 +4,7 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- release-*
|
||||||
workflow_dispatch: { }
|
workflow_dispatch: { }
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
@ -4,6 +4,7 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- release-*
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
|
|
@ -21,6 +21,7 @@ jobs:
|
||||||
TARGETS: [ linux/amd64, darwin/amd64, windows/amd64 ]
|
TARGETS: [ linux/amd64, darwin/amd64, windows/amd64 ]
|
||||||
env:
|
env:
|
||||||
VELA_VERSION_KEY: github.com/oam-dev/velad/version.VelaVersion
|
VELA_VERSION_KEY: github.com/oam-dev/velad/version.VelaVersion
|
||||||
|
VELAUX_VERSION_KEY: github.com/oam-dev/velad/version.VelaUXVersion
|
||||||
VELAD_VERSION_KEY: github.com/oam-dev/velad/version.VelaDVersion
|
VELAD_VERSION_KEY: github.com/oam-dev/velad/version.VelaDVersion
|
||||||
VELA_GITVERSION_KEY: github.com/oam-dev/velad/version.VelaGitRevision
|
VELA_GITVERSION_KEY: github.com/oam-dev/velad/version.VelaGitRevision
|
||||||
GO_BUILD_ENV: GO111MODULE=on CGO_ENABLED=0
|
GO_BUILD_ENV: GO111MODULE=on CGO_ENABLED=0
|
||||||
|
@ -54,7 +55,9 @@ jobs:
|
||||||
- name: Get ldflags
|
- name: Get ldflags
|
||||||
id: get_ldflags
|
id: get_ldflags
|
||||||
run: |
|
run: |
|
||||||
LDFLAGS="-s -w -X ${{ env.VELA_VERSION_KEY }}=${{ env.VELAD_VERSION }} -X ${{ env.VELAD_VERSION_KEY }}=${{ env.VELAD_VERSION }} -X ${{ env.VELA_GITVERSION_KEY }}=git-${{ env.VELA_SHA_SHORT }}"
|
VELAUX_VERSION=$(cat Makefile | grep "VELAUX_VERSION ?="|awk '{split($0,a," "); print a[3]}')
|
||||||
|
echo VELAUX_VERSION=$VELAUX_VERSION
|
||||||
|
LDFLAGS="-s -w -X ${{ env.VELA_VERSION_KEY }}=${{ env.VELAD_VERSION }} -X ${{ env.VELAUX_VERSION_KEY }}=$VELAUX_VERSION -X ${{ env.VELAD_VERSION_KEY }}=${{ env.VELAD_VERSION }} -X ${{ env.VELA_GITVERSION_KEY }}=git-${{ env.VELA_SHA_SHORT }}"
|
||||||
echo "LDFLAGS=${LDFLAGS}" >> $GITHUB_ENV
|
echo "LDFLAGS=${LDFLAGS}" >> $GITHUB_ENV
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
|
|
19
Makefile
19
Makefile
|
@ -3,19 +3,26 @@ include makefiles/dependency.mk
|
||||||
K3S_VERSION ?= v1.21.10+k3s1
|
K3S_VERSION ?= v1.21.10+k3s1
|
||||||
STATIC_DIR := pkg/resources/static
|
STATIC_DIR := pkg/resources/static
|
||||||
VELA_VERSION ?= v1.3.5
|
VELA_VERSION ?= v1.3.5
|
||||||
|
VELAUX_VERSION ?= v1.3.4
|
||||||
GOOS ?= linux
|
GOOS ?= linux
|
||||||
GOARCH ?= amd64
|
GOARCH ?= amd64
|
||||||
|
|
||||||
.DEFAULT_GOAL := linux-amd64
|
.DEFAULT_GOAL := linux-amd64
|
||||||
linux-amd64: download_vela_images_addons download_k3s pack_vela_chart
|
linux-amd64: download_vela_images_addons download_k3s pack_vela_chart
|
||||||
go build -o bin/velad github.com/oam-dev/velad/cmd/velad
|
go build -o bin/velad \
|
||||||
|
-ldflags="-X github.com/oam-dev/velad/version.VelaUXVersion=$VELAUX_VERSION -X github.com/oam-dev/velad/version.VelaVersion=$VELA_VERSION" \
|
||||||
|
github.com/oam-dev/velad/cmd/velad
|
||||||
|
|
||||||
|
|
||||||
darwin-amd64 windows-amd64: download_vela_images_addons download_k3d pack_vela_chart download_k3s_images
|
darwin-amd64 windows-amd64: download_vela_images_addons download_k3d pack_vela_chart download_k3s_images
|
||||||
GOOS=${GOOS} GOARCH=${GOARCH} go build -o bin/velad-${GOOS}-${GOARCH} github.com/oam-dev/velad/cmd/velad
|
GOOS=${GOOS} GOARCH=${GOARCH} \
|
||||||
|
go build -o bin/velad-${GOOS}-${GOARCH} \
|
||||||
|
-ldflags="-X github.com/oam-dev/velad/version.VelaUXVersion=$VELAUX_VERSION -X github.com/oam-dev/velad/version.VelaVersion=$VELA_VERSION" \
|
||||||
|
github.com/oam-dev/velad/cmd/velad
|
||||||
|
|
||||||
download_vela_images_addons:
|
download_vela_images_addons:
|
||||||
./hack/download_vela_images.sh ${VELA_VERSION}
|
./hack/download_vela_images.sh ${VELA_VERSION} ${VELAUX_VERSION}
|
||||||
./hack/download_addons.sh ${VELA_VERSION}
|
./hack/download_addons.sh ${VELAUX_VERSION}
|
||||||
|
|
||||||
download_k3d:
|
download_k3d:
|
||||||
./hack/download_k3d_images.sh
|
./hack/download_k3d_images.sh
|
||||||
|
@ -31,10 +38,6 @@ download_k3s_images:
|
||||||
|
|
||||||
CHART_DIR := ${STATIC_DIR}/vela/charts
|
CHART_DIR := ${STATIC_DIR}/vela/charts
|
||||||
pack_vela_chart:
|
pack_vela_chart:
|
||||||
#curl -Lo ${CHART_DIR}/vela-core-${VELA_VERSION}.tgz https://kubevelacharts.oss-cn-hangzhou.aliyuncs.com/core/vela-core-${VELA_VERSION}.tgz
|
|
||||||
#tar -xzf ${CHART_DIR}/vela-core-${VELA_VERSION}.tgz -C ${CHART_DIR}
|
|
||||||
#patch -s -p1 -t -D ${CHART_DIR}/vela-core-${VELA_VERSION} < ${CHART_DIR}/vela-core.patch
|
|
||||||
|
|
||||||
cp -r ${STATIC_DIR}/vela/charts/vela-core .
|
cp -r ${STATIC_DIR}/vela/charts/vela-core .
|
||||||
tar -czf ${STATIC_DIR}/vela/charts/vela-core.tgz vela-core
|
tar -czf ${STATIC_DIR}/vela/charts/vela-core.tgz vela-core
|
||||||
rm -r vela-core
|
rm -r vela-core
|
||||||
|
|
97
README.md
97
README.md
|
@ -30,51 +30,38 @@ If you are using Windows/macOS, docker is needed for run VelaD
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
- Linux/macOS
|
- **Linux/macOS**
|
||||||
```shell
|
|
||||||
```shell
|
```shell
|
||||||
curl -fsSl https://static.kubevela.net/script/install-velad.sh | bash -s 1.3.4
|
curl -fsSl https://static.kubevela.net/script/install-velad.sh | bash -s 1.3.4
|
||||||
```
|
```
|
||||||
|
|
||||||
- Windows
|
- **Windows**
|
||||||
|
> Only the official release version is supported.
|
||||||
```shell
|
```shell
|
||||||
powershell -Command "iwr -useb https://static.kubevela.net/script/install.ps1 | iex"
|
powershell -Command "iwr -useb https://static.kubevela.net/script/install-velad.ps1 | iex"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
|
|
||||||
Only one command to setup KubeVela
|
To set up KubeVela you only need run `velad install`
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
velad install
|
velad install
|
||||||
```
|
```
|
||||||
```shell
|
```text
|
||||||
Preparing cluster setup script...
|
INFO[0000] portmapping '8080:80' targets the loadbalancer: defaulting to [servers:*:proxy agents:*:proxy]
|
||||||
Preparing k3s binary...
|
Preparing K3s images...
|
||||||
Successfully place k3s binary to /usr/local/bin/k3s
|
...(omit for brevity)
|
||||||
Preparing k3s images
|
|
||||||
Successfully prepare k3s image
|
|
||||||
Setting up cluster...
|
|
||||||
...
|
|
||||||
|
|
||||||
Successfully install KubeVela control plane! Try: vela components
|
🚀 Successfully install KubeVela control plane
|
||||||
|
💻 When using gateway trait, you can access with 127.0.0.1:8080
|
||||||
|
🔭 See available commands with `vela help`
|
||||||
```
|
```
|
||||||
There you go! You have set up a KubeVela. See available components:
|
|
||||||
|
|
||||||
```shell
|
There you go! You have set up KubeVela. Behind the command, VelaD starts a K3d container(K3s when Linux), installs vela-core
|
||||||
vela comp
|
Helm chart and setup vela CLI for you.
|
||||||
```
|
|
||||||
```shell
|
After install, you can follow this [example](./docs/01.simple.md) to deliver your first application.
|
||||||
NAME DEFINITION
|
|
||||||
k8s-objects autodetects.core.oam.dev
|
|
||||||
my-stateful statefulsets.apps
|
|
||||||
raw autodetects.core.oam.dev
|
|
||||||
ref-objects autodetects.core.oam.dev
|
|
||||||
snstateful statefulsets.apps
|
|
||||||
task jobs.batch
|
|
||||||
webservice deployments.apps
|
|
||||||
worker deployments.apps
|
|
||||||
```
|
|
||||||
|
|
||||||
### uninstall
|
### uninstall
|
||||||
|
|
||||||
|
@ -82,54 +69,6 @@ worker deployments.apps
|
||||||
velad uninstall
|
velad uninstall
|
||||||
```
|
```
|
||||||
|
|
||||||
## More Options
|
### More example
|
||||||
|
|
||||||
### Setup with database
|
Please check [docs](./docs/) for more VelaD example
|
||||||
|
|
||||||
If you run `velad install`, all metadata will be lost when `velad uninstall`. You may need to keep the metadata for migration
|
|
||||||
This section describes how to setup a KubeVela control plane with an external database.
|
|
||||||
|
|
||||||
1. Prepare a database, MySQL/MariaDB, PostgreSQL, ETCD are both OK. Choose one as you like.
|
|
||||||
2. Run velad with database connection string.
|
|
||||||
|
|
||||||
> **Make sure you keep the token. It is required when restart KubeVela using this database**
|
|
||||||
```shell
|
|
||||||
velad install --database-endpoint="mysql://USER:PASSWORD@tcp(HOST:3306)/velad" --token="TOKEN"
|
|
||||||
```
|
|
||||||
|
|
||||||
You can find more database endpoint format in this [doc](docs/db-connect-format.md)
|
|
||||||
|
|
||||||
3. Now you have a KubeVela control plane which keeps all the data in database.
|
|
||||||
|
|
||||||
If this machine is shut down for some reason, or you run `velad uninstall`, you can restart it with `--start` flag and the same token.
|
|
||||||
|
|
||||||
```shell
|
|
||||||
velad install --database-endpoint="mysql://USER:PASSWORD@tcp(HOST:3306)/velad" --token="TOKEN" --start
|
|
||||||
```
|
|
||||||
|
|
||||||
### Access from remote
|
|
||||||
|
|
||||||
By default, you can only access this control plane on this node. Typically, you run `export KUBECONFIG=$(velad kubeconfig --internal)`
|
|
||||||
to access the control plane.
|
|
||||||
|
|
||||||
You can also make it accessible outside the machine.
|
|
||||||
1. add `--bind-ip=NODE_IP` when `velad install`, which helps to generate the kubeconfig that can be used outside. `NODE_IP`
|
|
||||||
is IP of machine where run the `velad`。
|
|
||||||
2. `velad kubeconfig` (note without `--internal`) will print the kubeconfig position.
|
|
||||||
3. copy this file to other machine, setup `KUBECONFIG`, and you can access KubeVela control plane remotely.
|
|
||||||
|
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
You could build velad yourself. This requires:
|
|
||||||
|
|
||||||
- docker
|
|
||||||
- go >= 1.17
|
|
||||||
|
|
||||||
```shell
|
|
||||||
git clone https://github.com/oam-dev/velad.git
|
|
||||||
cd velad
|
|
||||||
make
|
|
||||||
```
|
|
||||||
|
|
||||||
See more options [here](docs/build-from-local.md)
|
|
|
@ -15,10 +15,19 @@ else
|
||||||
vela_version=v$1
|
vela_version=v$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
echo "No VelaUX version specified, exiting"
|
||||||
|
exit 1
|
||||||
|
elif [[ $2 == v* ]]; then
|
||||||
|
velaux_version=$2
|
||||||
|
else
|
||||||
|
velaux_version=v$2
|
||||||
|
fi
|
||||||
|
|
||||||
vela_images=("oamdev/vela-core:${vela_version}"
|
vela_images=("oamdev/vela-core:${vela_version}"
|
||||||
"oamdev/cluster-gateway:v1.3.2"
|
"oamdev/cluster-gateway:v1.3.2"
|
||||||
"oamdev/kube-webhook-certgen:v2.3"
|
"oamdev/kube-webhook-certgen:v2.3"
|
||||||
"oamdev/velaux:${vela_version}"
|
"oamdev/velaux:${velaux_version}"
|
||||||
"oamdev/vela-apiserver:${vela_version}")
|
"oamdev/vela-apiserver:${vela_version}")
|
||||||
|
|
||||||
for IMG in ${vela_images[*]}; do
|
for IMG in ${vela_images[*]}; do
|
||||||
|
|
|
@ -132,7 +132,8 @@ installFile() {
|
||||||
runAsRoot cp "$tmp_root_velad" "$VELAD_INSTALL_DIR"
|
runAsRoot cp "$tmp_root_velad" "$VELAD_INSTALL_DIR"
|
||||||
|
|
||||||
if [ $? -eq 0 ] && [ -f "$VELAD_CLI_FILE" ]; then
|
if [ $? -eq 0 ] && [ -f "$VELAD_CLI_FILE" ]; then
|
||||||
echo "$VELAD_CLI_FILENAME installed into $VELAD_INSTALL_DIR successfully."
|
echo "VelaD installed into $VELAD_INSTALL_DIR/$VELAD_CLI_FILENAME successfully."
|
||||||
|
echo ""
|
||||||
$VELAD_CLI_FILE version
|
$VELAD_CLI_FILE version
|
||||||
else
|
else
|
||||||
echo "Failed to install $VELAD_CLI_FILENAME"
|
echo "Failed to install $VELAD_CLI_FILENAME"
|
||||||
|
@ -144,7 +145,7 @@ fail_trap() {
|
||||||
result=$?
|
result=$?
|
||||||
if [ "$result" != "0" ]; then
|
if [ "$result" != "0" ]; then
|
||||||
echo "Failed to install VelaD"
|
echo "Failed to install VelaD"
|
||||||
echo "For support, go to https://kubevela.io"
|
echo "Go to https://kubevela.io for more support."
|
||||||
fi
|
fi
|
||||||
cleanup
|
cleanup
|
||||||
exit $result
|
exit $result
|
||||||
|
@ -157,7 +158,8 @@ cleanup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
installCompleted() {
|
installCompleted() {
|
||||||
echo -e "\nTo get started with KubeVela, please visit https://kubevela.io"
|
echo -e "\nFor more information on how to started, please visit:"
|
||||||
|
echo -e " https://kubevela.io"
|
||||||
}
|
}
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
@ -180,8 +182,6 @@ else
|
||||||
ret_val=v$1
|
ret_val=v$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing $ret_val VelaD..."
|
|
||||||
|
|
||||||
downloadFile $ret_val
|
downloadFile $ret_val
|
||||||
installFile
|
installFile
|
||||||
cleanup
|
cleanup
|
||||||
|
|
|
@ -115,7 +115,7 @@ func PrepareVelaUX() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// extract velaux-vx.y.z.tgz to local
|
// extract velaux-vx.y.z.tgz to local
|
||||||
filename := fmt.Sprintf("velaux-%s.tgz", version.VelaVersion)
|
filename := fmt.Sprintf("velaux-%s.tgz", version.VelaUXVersion)
|
||||||
tar, err := resources.VelaAddons.Open(path.Join("static/vela/addons", filename))
|
tar, err := resources.VelaAddons.Open(path.Join("static/vela/addons", filename))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -4,6 +4,9 @@ package version
|
||||||
// Each version of velad is bind with specific version of vela-core
|
// Each version of velad is bind with specific version of vela-core
|
||||||
var VelaVersion = "UNKNOWN"
|
var VelaVersion = "UNKNOWN"
|
||||||
|
|
||||||
|
// VelaUXVersion is version of VelaUX
|
||||||
|
var VelaUXVersion = "UNKNOWN"
|
||||||
|
|
||||||
// VelaDVersion is version of VelaD
|
// VelaDVersion is version of VelaD
|
||||||
var VelaDVersion = "UNKNOWN"
|
var VelaDVersion = "UNKNOWN"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue