Compare commits

..

38 Commits

Author SHA1 Message Date
wyike
89d8e37c7c disable rollout and deploy docs (#1860) 2021-07-01 13:38:05 +08:00
yangsoon
446f682f6c fix invalid metadata.labels error when specify the version of the trait in the app (#1855) (#1857)
* fix trait name
* add test
2021-06-29 19:36:53 +08:00
yangsoon
44e8352d1e [FIX]incorrect pod-disruptive defalut configuration in label of traits (#1837) (#1844)
[FIX]incorrect pod-disruptive defalut configuration in sidecar of traits (#1839)

Fix incorrect pod disruptive annotation traits (#1838)

* [FIX]incorrect pod-disruptive defalut configuration in label of traits

* [FIX]incorrect pod-disruptive defalut configuration in annotation of traits

* [FIX]incorrect pod-disruptive defalut configuration in annotation of traits

Co-authored-by: Scaat Feng <scaat.feng@gmail.com>
2021-06-25 10:24:46 +08:00
Jianbo Sun
5d9b3fbce6 Merge pull request #1776 from yangsoon/rfc-log-system
Cherry pick the feature(refactor the log system) to release-1.0 branch
2021-06-08 19:35:13 +08:00
yangsoon
6c0364453f add options (#1775)
1. add ConcurrentReconciles for setting the concurrent reconcile number of the controller
2. add DependCheckWait for setting the time to wait for ApplicationConfiguration's dependent-resource ready
2021-06-08 15:20:55 +08:00
Kinso
2aa5b47e45 fix(log): debug level flag (#1768)
Co-authored-by: kinsolee <lijingzhao@forchange.tech>
2021-06-08 14:40:31 +08:00
yangsoon
efa60a67a1 Add Logging Convention in CONTRIBUTING.md (#1762)
* add logging convention in contributing

* fix log
2021-06-08 14:32:26 +08:00
yangsoon
89b479e1bc improve log system in appconfig (#1758) 2021-06-08 14:32:17 +08:00
yangsoon
d591d6ad64 Improve the logging system (#1735)
* change to klog/v2

* add logfilepath opt in helm chart

* replace klog.InfoF with klog.InfoS and improve messages

Remove string formatting from log message, improve messages in klog.InfoS and use lowerCamelCase to fmt Name arguments in klog.InfoS

* fix klog.Error

for expected errors (errors that can happen during routine operations) use klog.InfoS and pass error in err key instead.

* use klog.KObj and klog.KRef for Kubernetes objects

ensure that kubernetes objects references are consistent within the codebase

* enable set logdebug level

* add log-file-max-size
2021-06-08 14:31:53 +08:00
Jianbo Sun
916b3b52de remove restful API from website docs (#1772) 2021-06-08 10:38:43 +08:00
Zheng Xi Zhou
df0eaaa74a Generate OpenAPI JSON schema for Terraform Component (#1738) (#1753)
Fix #1736
2021-06-04 13:12:44 +08:00
yangsoon
2740067eb5 fix bug: When the Component contains multiple traits of the same type, the status of the trait in the Application is reported incorrectly (#1731) (#1743)
* fix status

* add test

* fix webhook

* add paramter context for customStatus
2021-06-02 10:31:06 +08:00
Jianbo Sun
53b49aca53 Merge pull request #1676 from yangsoon/cherry-pick-doc
cherry-pick some docs from master to 1.0
2021-05-18 15:11:36 +08:00
yangsoon
b75de8aa94 Explain vela next (#1671)
* Explain vela next

* fix def

Co-authored-by: Lei Zhang <resouer@gmail.com>
2021-05-18 12:24:05 +08:00
Jianbo Sun
2fc6971261 Merge pull request #1669 from yangsoon/cherrypick-1.0
cherry-pick master into 1.0 for fix bugs and add necessary features
2021-05-17 22:36:38 +08:00
yangsoon
27a5630652 Enable Dynamic Admission Control for Application (#1619)
* add webhook

* fix test

* fix validating_handler
2021-05-17 15:00:25 +08:00
Yue Wang
14334dd954 make ResourceTracker to own cluster-scope resource (#1634)
add e2e tests and unit tests

Signed-off-by: roy wang <seiwy2010@gmail.com>
2021-05-17 12:14:39 +08:00
Yue Wang
8948518d9f fix staticcheck lint (#1657)
make CI work consistently with Makefile/staticcheck

Signed-off-by: roy wang <seiwy2010@gmail.com>
2021-05-17 12:14:19 +08:00
Zheng Xi Zhou
368dd687c2 Fix Terraform application status issue (#1611)
* Fix Terraform application status issue

Fix #1599

* add unit tests

* fix import issue
2021-05-17 12:12:36 +08:00
yangsoon
34bee10bc3 fix bug: Use stricter syntax check for CUE (#1643)
* fix cue render

* fix e2e-api-test

* add test
2021-05-17 12:12:26 +08:00
Lei Zhang (Harry)
d6aadacc9b Update introduction (#1651) 2021-05-17 12:12:15 +08:00
Lei Zhang (Harry)
ea738c119a update the revision doc (#1650) 2021-05-17 12:12:02 +08:00
wyike
7cf425969a fix empty rolloutBatch will panic whole controller bug (#1646)
* add webhook for app and avoid controller panic

neat imports

* add test for rollout verify
2021-05-17 12:11:37 +08:00
yangsoon
b5cd647876 fix docs (#1636) 2021-05-17 12:10:53 +08:00
wyike
d2a28cbb8e fix application rollout annotation false issue (#1633)
* fix annotation false issue

neat imports

* rewrite judge logic

* add webhook

* add webhook verify annotation

* fix test

fix bug

* modify error message
2021-05-17 12:10:33 +08:00
wyike
a350a44982 add app embed rollout pause test (#1626)
* add pause test

* verify update plan shouldn't generate new revision

fix error test
2021-05-17 11:04:27 +08:00
Zheng Xi Zhou
e01ff21d30 Update samples for "vela show xxx --web" (#1616)
* Update samples for "vela show xxx --web"

Also stop generating components/traits docs under
docs/en/end-user and remove the command from Makefile

Fix #1602

* fix doc build issue

* Update references/plugins/references.go

Co-authored-by: Jianbo Sun <wonderflow.sun@gmail.com>

* Enhance --web feature for "vela show"

- Find the capability in "vela-system" if notfound in the current ns
- Don't depend on local capabilities

* add ut for GetCapabilityByName in references/plugins/cluster.go

* add ut for GetNamespacedCapabilitiesFromCluster in references/plugins/cluster.go

* add ut for GenerateTerraformCapabilityProperties in references/plugins/references.go

* fix import issue

Co-authored-by: Jianbo Sun <wonderflow.sun@gmail.com>
2021-05-17 11:04:06 +08:00
Zheng Xi Zhou
2fdd33a80a Renaming the name of function "SyncDefinitionToLocal" (#1607)
As we don't need to sync the defintiion .yaml and .cue to local and
then extract it, besides, there is a simliar function "SyncDefinitionsToLocal"
just besides it, rename function "SyncDefinitionToLocal" in order
not to cause confustions
2021-05-17 11:03:21 +08:00
wyike
7cee9cef98 fix error test and add middle state test (#1622) 2021-05-17 10:55:15 +08:00
yangsoon
01dfedfac2 applicaiton supports specifying different versions of Definition (#1597)
* app support specify the version of definition

* add e2e-test

* add docs

* add helm related test

* fix doc

* add more test

* fix docs
2021-05-17 10:53:31 +08:00
Zheng Xi Zhou
a05a983a9a Rename file name for trait "cpusclaer" and "scaler" (#1617)
As the file name (.cue/.yaml) of trait "cpusclaer" and "scaler"
are "cpuhpa" and "manaualscale" respectively, renmae them in
order to avoid confustions
2021-05-17 10:53:17 +08:00
yangsoon
53b28d61a9 fix ci (#1610) 2021-05-17 10:52:55 +08:00
Zheng Xi Zhou
a8605a02f9 Fix unstability of ApplicationContext UT (#1609)
* Fix unstablity of ApplicationContext UT

* fix import order

* fix compatibility issue
2021-05-17 10:52:26 +08:00
Lei Zhang
acb6f3ba04 Fix docs 2021-05-17 10:52:14 +08:00
Jianbo Sun
0d264c16f7 Merge pull request #1589 from oam-dev/master
merge master into 1.0 as they all patches
2021-04-30 19:55:29 +08:00
Jianbo Sun
4be93ad8b8 update github token (#1527) 2021-04-19 13:04:00 +08:00
Jianbo Sun
290b6c0815 Merge pull request #1506 from oam-dev/master
Merge master into release-1.0 as patches
2021-04-16 23:51:28 +08:00
Jianbo Sun
b3fd25cae1 Merge pull request #1489 from oam-dev/master
merge commits from master into release-1.0
2021-04-14 16:52:25 +08:00
401 changed files with 6642 additions and 20709 deletions

View File

@@ -15,9 +15,9 @@ A clear and concise description of what the bug is.
**To Reproduce**
<!--
Steps to reproduce the behavior:
1. The YAML files of Component/Trait I used.
2. The YAML file of Application I applied.
3. Other operations I have done.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
-->
@@ -31,12 +31,6 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
-->
**KubeVela Version**
<!--
Describe your KubeVela controller or CLI version information.
-->
**Cluster information**
<!--
Describe your kubernetes cluster information.

View File

@@ -1,36 +0,0 @@
<!--
Thank you for sending a pull request! Here are some tips:
1. If this is your first time, please read our contribution guide at https://github.com/oam-dev/kubevela/blob/master/CONTRIBUTING.md
2. Ensure you include and run the appropriate tests as part of your Pull Request.
3. In a new feature or configuration option, an update to the documentation is necessary. Everything related to the documentation is under the docs folder in the root of the repository.
4. If the Pull Request is a work in progress, make use of GitHub's "Draft PR" feature and mark it as such.
5. If you can not merge your Pull Request due to a merge conflict, Rebase it. This gets it in sync with the master branch.
6. Name your PR as "<FeatureArea>: Describe your change", e.g. Application: Add health check for application.
If it's a fix or feature relevant for the changelog describe the user impact in the title.
The PR title is used to auto-generate the changelog for issues marked with the "add to changelog" label.
-->
**What this PR does / why we need it**:
**Which issue(s) this PR fixes**:
<!--
- Automatically closes linked issue when the Pull Request is merged.
Usage: "Fixes #<issue number>", or "Fixes (paste link of issue)"
-->
Fixes #
**Special notes for your reviewer**:

View File

@@ -18,7 +18,7 @@ jobs:
with:
python-version: '3.7'
- name: Clean md files
run: python ./hack/website/format.py markdown ./docs/en
run: python ./hack/website/clean-md.py ./docs/en
- name: Test Build
env:
VERSION: ${{ github.ref }}

View File

@@ -1,109 +0,0 @@
name: E2E Test
on:
push:
branches:
- master
- release-*
workflow_dispatch: {}
pull_request:
branches:
- master
- release-*
env:
# Common versions
GO_VERSION: '1.16'
GOLANGCI_VERSION: 'v1.38'
KIND_VERSION: 'v0.7.0'
jobs:
detect-noop:
runs-on: ubuntu-20.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
- name: Detect No-op Changes
id: noop
uses: fkirc/skip-duplicate-actions@v3.3.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
concurrent_skipping: false
e2e-tests:
runs-on: aliyun
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Setup Kind
uses: engineerd/setup-kind@v0.5.0
with:
version: ${{ env.KIND_VERSION }}
skipClusterCreation: true
- name: Setup Kind Cluster
run: |
kind delete cluster
kind create cluster --image kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
kubectl version
kubectl cluster-info
- name: Load Image to kind cluster
run: make kind-load
- name: Run Make
run: make
- name: Run Make Manager
run: make manager
- name: Prepare for e2e tests
run: |
make e2e-cleanup
make e2e-setup
helm lint ./charts/vela-core
helm test -n vela-system kubevela --timeout 5m
- name: Wait for e2e preparation ready
run: |
timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:38081/api/components)" != "200" ]]; do sleep 5; done' || false
- name: Run api e2e tests
run: make e2e-api-test
- name: Run e2e tests
run: make e2e-test
- name: Stop kubevela, get profile
run: make end-e2e
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: /tmp/e2e-profile.out
flags: e2etests
name: codecov-umbrella
- name: Clean e2e profile
run: rm /tmp/e2e-profile.out
- name: Cleanup image
if: ${{ always() }}
run: make image-cleanup

View File

@@ -13,7 +13,7 @@ on:
env:
# Common versions
GO_VERSION: '1.16'
GO_VERSION: '1.14'
GOLANGCI_VERSION: 'v1.38'
KIND_VERSION: 'v0.7.0'
@@ -33,13 +33,60 @@ jobs:
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
concurrent_skipping: false
unit-tests:
runs-on: ubuntu-20.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
submodules: true
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Install ginkgo
run: |
sudo apt-get install -y golang-ginkgo-dev
- name: Setup Kind Cluster
uses: engineerd/setup-kind@v0.5.0
with:
version: ${{ env.KIND_VERSION }}
- name: install Kubebuilder
uses: wonderflow/kubebuilder-action@v1.1
- name: Run Make test
run: make test
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
name: codecov-umbrella
compatibility-test:
runs-on: ubuntu-20.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Set up Go
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
@@ -75,6 +122,81 @@ jobs:
- name: Clean up testdata
run: make compatibility-testdata-cleanup
e2e-tests:
runs-on: aliyun
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Setup Kind
uses: engineerd/setup-kind@v0.5.0
with:
version: ${{ env.KIND_VERSION }}
skipClusterCreation: true
- name: Setup Kind Cluster
run: |
kind delete cluster
kind create cluster --image kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
kubectl version
kubectl cluster-info
- name: Load Image to kind cluster
run: make kind-load
- name: Run Make
run: make
- name: Run Make Manager
run: make manager
- name: Prepare for e2e tests
run: |
make e2e-cleanup
make e2e-setup
helm lint ./charts/vela-core
helm test -n vela-system kubevela --timeout 5m
- name: Wait for e2e preparation ready
run: |
timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:38081/api/components)" != "200" ]]; do sleep 5; done' || false
- name: Run api e2e tests
run: make e2e-api-test
- name: Run e2e tests
run: make e2e-test
- name: Stop kubevela, get profile
run: make end-e2e
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: /tmp/e2e-profile.out
flags: e2etests
name: codecov-umbrella
- name: Clean e2e profile
run: rm /tmp/e2e-profile.out
- name: Cleanup image
if: ${{ always() }}
run: make image-cleanup
staticcheck:
runs-on: ubuntu-20.04
needs: detect-noop
@@ -100,7 +222,7 @@ jobs:
- name: Install StaticCheck
run: GO111MODULE=off go get honnef.co/go/tools/cmd/staticcheck
- name: Static Check
run: staticcheck ./...
@@ -169,10 +291,10 @@ jobs:
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v2
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
go-version: 1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@@ -180,5 +302,3 @@ jobs:
run: make cross-build
- name: Run compress binary
run: make compress
- name: Run make reviewable
run: make reviewable

View File

@@ -128,22 +128,3 @@ jobs:
helm repo index --url https://$BUCKET.$ENDPOINT/core $LOCAL_OSS_DIRECTORY
- name: sync local to cloud
run: ./ossutil --config-file .ossutilconfig sync $LOCAL_OSS_DIRECTORY oss://$BUCKET/core -f
publish-capabilities:
env:
CAPABILITY_BUCKET: kubevela-registry
CAPABILITY_DIR: capabilities
CAPABILITY_ENDPOINT: oss-cn-beijing.aliyuncs.com
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Install ossutil
run: wget http://gosspublic.alicdn.com/ossutil/1.7.0/ossutil64 && chmod +x ossutil64 && mv ossutil64 ossutil
- name: Configure Alibaba Cloud OSSUTIL
run: ./ossutil --config-file .ossutilconfig config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${CAPABILITY_ENDPOINT} -c .ossutilconfig
- name: sync capabilities bucket to local
run: ./ossutil --config-file .ossutilconfig sync oss://$CAPABILITY_BUCKET $CAPABILITY_DIR
- name: rsync all capabilites
run: rsync vela-templates/registry/auto-gen/* $CAPABILITY_DIR
- name: sync local to cloud
run: ./ossutil --config-file .ossutilconfig sync $CAPABILITY_DIR oss://$CAPABILITY_BUCKET -f

View File

@@ -18,7 +18,7 @@ jobs:
with:
python-version: '3.7'
- name: Clean md files
run: python ./hack/website/format.py markdown ./docs/en
run: python ./hack/website/clean-md.py ./docs/en
- name: Sync to kubevela.io Repo
env:
SSH_DEPLOY_KEY: ${{ secrets.GH_PAGES_DEPLOY }}

View File

@@ -13,10 +13,10 @@ jobs:
VELA_VERSION: ${{ github.ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set up Go
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.16
go-version: 1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@@ -127,12 +127,7 @@ jobs:
asset_content_type: text/plain
- uses: actions/setup-node@v1
with:
node-version: "12.x"
- uses: actions/setup-python@v2
with:
python-version: "3.7"
- name: Clean md files
run: python ./hack/website/format.py markdown ./docs/en
node-version: '12.x'
- name: Sync release to kubevela.io Repo
env:
SSH_DEPLOY_KEY: ${{ secrets.GH_PAGES_DEPLOY }}
@@ -141,4 +136,4 @@ jobs:
run: |
bash ./hack/website/release.sh
- name: Update kubectl plugin version in krew-index
uses: rajatjindal/krew-release-bot@v0.0.38
uses: rajatjindal/krew-release-bot@v0.0.38

View File

@@ -1,81 +0,0 @@
name: Unit-Test
on:
push:
branches:
- master
- release-*
workflow_dispatch: {}
pull_request:
branches:
- master
- release-*
env:
# Common versions
GO_VERSION: '1.16'
GOLANGCI_VERSION: 'v1.38'
KIND_VERSION: 'v0.7.0'
jobs:
detect-noop:
runs-on: ubuntu-20.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
- name: Detect No-op Changes
id: noop
uses: fkirc/skip-duplicate-actions@v3.3.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
concurrent_skipping: false
unit-tests:
runs-on: ubuntu-20.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: ${{ env.GO_VERSION }}
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
submodules: true
- name: Cache Go Dependencies
uses: actions/cache@v2
with:
path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-pkg-
- name: Install ginkgo
run: |
sudo apt-get install -y golang-ginkgo-dev
- name: Setup Kind Cluster
uses: engineerd/setup-kind@v0.5.0
with:
version: ${{ env.KIND_VERSION }}
- name: install Kubebuilder
uses: wonderflow/kubebuilder-action@v1.1
- name: Run Make test
run: make test
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
name: codecov-umbrella

View File

@@ -3,62 +3,184 @@
## About KubeVela
KubeVela project is initialized and maintained by the cloud native community since day 0 with [bootstrapping contributors from 8+ different organizations](https://github.com/oam-dev/kubevela/graphs/contributors).
We intend for KubeVela to have an open governance since the very beginning and donate the project to neutral foundation as soon as it's released.
To help us create a safe and positive community experience for all, we require all participants to adhere to the [Code of Conduct](./CODE_OF_CONDUCT.md).
We intend for KubeVela to have an open governance since the very beginning and donate the project to neutral foundation as soon as it's released.
This document is a guide to help you through the process of contributing to KubeVela.
This doc explains how to set up a development environment, so you can get started
contributing to `kubevela` or build a PoC (Proof of Concept).
## Become a contributor
You can contribute to KubeVela in several ways. Here are some examples:
## Development
* Contribute to the KubeVela codebase.
* Report and triage bugs.
* Develop community CRD operators as workload or trait and contribute to [catalog](https://github.com/oam-dev/catalog).
* Write technical documentation and blog posts, for users and contributors.
* Organize meetups and user groups in your local area.
* Help others by answering questions about KubeVela.
### Prerequisites
For more ways to contribute, check out the [Open Source Guides](https://opensource.guide/how-to-contribute/).
1. Golang version 1.13+
2. Kubernetes version v1.16+ with `~/.kube/config` configured.
3. ginkgo 1.14.0+ (just for [E2E test](./CONTRIBUTING.md#e2e-test))
4. golangci-lint 1.31.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
### Report bugs
We also recommend you to learn about KubeVela's [design](https://kubevela.io/docs/concepts) before dive into its code.
Before submitting a new issue, try to make sure someone hasn't already reported the problem.
Look through the [existing issues](https://github.com/oam-dev/kubevela/issues) for similar issues.
### Build
Report a bug by submitting a [bug report](https://github.com/oam-dev/kubevela/issues/new?assignees=&labels=kind%2Fbug&template=bug_report.md&title=).
Make sure that you provide as much information as possible on how to reproduce the bug.
* Clone this project
Follow the issue template and add additional information that will help us replicate the problem.
```shell script
git clone git@github.com:oam-dev/kubevela.git
```
#### Security issues
KubeVela includes two parts, `vela core` and `vela cli`.
If you believe you've found a security vulnerability, please read our [security policy](https://github.com/oam-dev/kubevela/blob/master/SECURITY.md) for more details.
- The `vela core` is actually a K8s controller, it will watch OAM Spec CRD and deploy resources.
- The `vela cli` is a command line tool that can build, run apps(with the help of `vela core`).
### Suggest enhancements
For local development, we probably need to build both of them.
If you have an idea to improve KubeVela, submit an [feature request](https://github.com/oam-dev/kubevela/issues/new?assignees=&labels=kind%2Ffeature&template=feature_request.md&title=%5BFeature%5D).
* Build Vela CLI
### Triage issues
```shell script
make
```
If you don't have the knowledge or time to code, consider helping with _issue triage_. The community will thank you for saving them time by spending some of yours.
After the vela cli built successfully, `make` command will create `vela` binary to `bin/` under the project.
Read more about the ways you can [Triage issues](/contribute/triage-issues.md).
* Configure `vela` binary to System PATH
### Answering questions
```shell script
export PATH=$PATH:/your/path/to/project/kubevela/bin
```
If you have a question and you can't find the answer in the [documentation](https://kubevela.io/docs/),
the next step is to ask it on the [github discussion](https://github.com/oam-dev/kubevela/discussions).
Then you can use `vela` command directly.
It's important to us to help these users, and we'd love your help. You can help other KubeVela users by answering [their questions](https://github.com/oam-dev/kubevela/discussions).
* Build Vela Core
### Your first contribution
```shell script
make manager
```
Unsure where to begin contributing to KubeVela? Start by browsing issues labeled `good first issue` or `help wanted`.
* Run Vela Core
- [Good first issue](https://github.com/oam-dev/kubevela/labels/good%20first%20issue) issues are generally straightforward to complete.
- [Help wanted](https://github.com/oam-dev/kubevela/labels/help%20wanted) issues are problems we would like the community to help us with regardless of complexity.
Firstly make sure your cluster has CRDs, below is the command that can help install all CRDs.
If you're looking to make a code change, see how to set up your environment for [local development](contribute/developer-guide.md).
```shell script
make core-install
```
When you're ready to contribute, it's time to [Create a pull request](/contribute/create-pull-request.md).
Run locally:
```shell script
make core-run
```
This command will run controller locally, it will use your local KubeConfig which means you need to have a k8s cluster
locally. If you don't have a one, we suggest that you could setup up a cluster with [kind](https://kind.sigs.k8s.io/).
When you're developing `vela-core`, make sure the controller installed by helm chart is not running.
Otherwise, it will conflict with your local running controller.
You can check and uninstall it by using helm.
```shell script
helm list -A
helm uninstall -n vela-system kubevela
```
### Use
You can try use your local built binaries follow [the documentation](https://kubevela.io/docs/quick-start).
## Testing
### Unit test
```shell script
make test
```
### E2E test
**Before e2e test start, make sure you have vela-core running.**
```shell script
make core-run
```
Start to test.
```
make e2e-test
```
## Logging Conventions
### Structured logging
We recommend using `klog.InfoS` to structure the log. The `msg` argument need start from a capital letter.
and name arguments should always use lowerCamelCase.
```golang
// func InfoS(msg string, keysAndValues ...interface{})
klog.InfoS("Reconcile traitDefinition", "traitDefinition", klog.KRef(req.Namespace, req.Name))
// output:
// I0605 10:10:57.308074 22276 traitdefinition_controller.go:59] "Reconcile traitDefinition" traitDefinition="vela-system/expose"
```
### Use `klog.KObj` and `klog.KRef` for Kubernetes objects
`klog.KObj` and `klog.KRef` can unify the output of kubernetes object.
```golang
// KObj is used to create ObjectRef when logging information about Kubernetes objects
klog.InfoS("Start to reconcile", "appDeployment", klog.KObj(appDeployment))
// KRef is used to create ObjectRef when logging information about Kubernetes objects without access to metav1.Object
klog.InfoS("Reconcile application", "application", klog.KRef(req.Namespace, req.Name))
```
### Logging Level
[This file](https://github.com/oam-dev/kubevela/blob/master/pkg/controller/common/logs.go) contains KubeVela's log level,
you can set the log level by `klog.V(level)`.
```golang
// you can use klog.V(common.LogDebug) to print debug log
klog.V(common.LogDebug).InfoS("Successfully applied components", "workloads", len(workloads))
```
more detail in [Structured Logging Guide](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#structured-logging-in-kubernetes).
## Contribute Docs
Please read [the documentation](https://github.com/oam-dev/kubevela/tree/master/docs/README.md) before contributing to the docs.
- Build docs
```shell script
make docs-build
```
- Local development and preview
```shell script
make docs-start
```
## Make a pull request
Remember to write unit-test and e2e-test after you have finished your code.
Run following checks before making a pull request.
```shell script
make reviewable
```
The command will do some lint checks and clean code.
After that, check in all changes and send a pull request.
## Merge Regulations
Before merging, the pull request should obey the following rules:
- The commit title and message should be clear about what this PR does.
- All test CI should pass green.
- The `codecov/project` should pass. This means the coverage should not drop. See [Codecov commit status](https://docs.codecov.io/docs/commit-status#project-status).

View File

@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16-alpine as builder
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14-alpine as builder
WORKDIR /workspace
# Copy the Go Modules manifests

View File

@@ -1,323 +0,0 @@
# Triage issues
The main goal of issue triage is to categorize all incoming KubeVela issues and make sure each issue has all basic
information needed for anyone else to understand and be able to start working on it.
> **Note:** This information is for OAM/KubeVela project Maintainers, Owners, and Admins.
> If you are a Contributor, then you will not be able to perform most of the tasks in this topic.
The core maintainers of the OAM/KubeVela project are responsible for categorizing all incoming issues and delegating
any critical or important issue to other maintainers. Currently one maintainer each week is responsible.
Besides that part, triage provides an important way to contribute to an open source project.
Triage helps ensure issues resolve quickly by:
- Ensuring the issue's intent and purpose is conveyed precisely. This is necessary because it can be difficult for
an issue to explain how an end user experiences a problem and what actions they took.
- Giving a contributor the information they need before they commit to resolving an issue.
- Lowering the issue count by preventing duplicate issues.
- Streamlining the development process by preventing duplicate discussions.
If you don't have the knowledge or time to code, consider helping with triage.
The community will thank you for saving them time by spending some of yours.
## Simplified flowchart diagram of the issue triage process
<!-- https://textik.com/#908a27a44c590528 -->
```
+-----------------------------+
| |
| New Issues Opened |
+-----------------+ |
| | Or More information needed |
| | |
| +--------------+--------------+
| Ask for more info |
| |
| +--------------+------------+
| | | Yes
| | All informatio needed |
| +-----------+ to categorize the issue +---------------+
| | No | | |
| | +---------------------------+ |
| | +-----------+-----------+ +---------------------------+
+------------+-----+-----+ | | Yes | |
| | | Needs investigation +---------+ label: needs investigation|
| label: needs more info | | | | |
| | +----------+------------+ +-------------+-------------+
+------------------------+ | |
| No |
| |
+----------+----------+ investigate |
| label: type/* | |
| label: area/* +--------------------------+
| |
+--|-------------|----+
| | Yes
| +-------|-------------+ +-------------------+
| | needs priority +----+ label: priority/* |
| +-------|-------------+ +----------|--------+
| | No |
| | |
+----- ------|---+ +--|----- --+ |
| close issue + ---- + done +---------------------+
+----------------+ +-----------+
```
## 1. Find uncategorized issues
To get started with issue triage and finding issues that haven't been triaged you have two alternatives.
### Browse unlabeled issues
The easiest and straight forward way of getting started and finding issues that haven't been triaged is to browse
[unlabeled issues](https://github.com/oam-dev/kubevela/issues?q=is%3Aopen+is%3Aissue+no%3Alabel) and starting from
the bottom and working yourself to the top.
### Subscribe to all notifications
The more advanced, but recommended way is to subscribe to all notifications from this repository which means that
all new issues, pull requests, comments and important status changes are sent to your configured email address.
Read this [guide](https://help.github.com/en/articles/watching-and-unwatching-repositories#watching-a-single-repository)
for help with setting this up.
It's highly recommended that you setup filters to automatically remove emails from the inbox and label/categorize
them accordingly to make it easy for you to understand when you need to act upon a notification or where to look for
finding issues that haven't been triaged etc.
## 2. Ensure the issue contains basic information
Before triaging an issue very far, make sure that the issue's author provided the standard issue information.
This will help you make an educated recommendation on how to categorize the issue.
The KubeVela project utilizes [GitHub issue templates](https://help.github.com/en/articles/creating-issue-templates-for-your-repository)
to guide contributors to provide standard information that must be included for each type of template or type of issue.
### Standard issue information that must be included
Given a certain [issue template]([template](https://github.com/oam-dev/kubevela/issues/new/choose)) have been used
by the issue author or depending how the issue is perceived by the issue triage responsible, the following should
help you understand what standard issue information that must be included.
#### Bug reports
Should explain what happened, what was expected and how to reproduce it together with any additional information that
may help giving a complete picture of what happened such as screenshots, application related YAMLs, and any environment
related information that's applicable and/or maybe related to the reported problem:
- KubeVela version
- K8s cluster version KubeVela is installed on
- Which other K8s CRD controllers used
- Development environment like Go versions, if applicable
#### Enhancement requests
Should explain what enhancement or feature that the author wants to be added and why that is needed.
### Good practices
To make it easier for everyone to understand and find issues they're searching for it's suggested as a general rule of thumbs to:
- Make sure that issue titles are named to explain the subject of the issue, has a correct spelling and doesn't include irrelevant information and/or sensitive information.
- Make sure that issue descriptions doesn't include irrelevant information, information from template that haven't been filled out and/or sensitive information.
- Do your best effort to change title and description or request suggested changes by adding a comment.
> **Note:** Above rules is applicable to both new and existing issues of the KubeVela project.
### Do you have all the information needed to categorize an issue?
Depending on the issue, you might not feel all this information is needed. Use your best judgement.
If you cannot triage an issue using what its author provided, explain kindly to the author that they must provide the
above information to clarify the problem. Label issue with `needs more info` and add any related `area/*` or `type/*` labels.
If the author provides the standard information but you are still unable to triage the issue, request additional information.
Do this kindly and politely because you are asking for more of the author's time.
If the author does not respond to the requested information within the timespan of a week,
close the issue with a kind note stating that the author can request for the issue to be reopened when the necessary information is provided.
When you feel you have all the information needed you're ready to [categorizing the issue](#3-categorizing-an-issue).
If you receive a notification with additional information provided but you are not anymore on issue triage and
you feel you do not have time to handle it, you should delegate it to the current person on issue triage.
## 3. Categorizing an issue
An issue can have multiple of the following labels. Typically, a properly categorized issue should at least have:
- One label identifying its type (`type/*`).
- One or multiple labels identifying the functional areas of interest or component (`area/*`), if applicable.
| Label | Description |
| ------------------------ | ------------------------------------------------------------------------- |
| `type/bug` | A feature isn't working as expected given design or documentation. |
| `type/enhancement` | Request for a new feature or enhancement. |
| `type/docs` | Documentation problem or enhancement. |
| `type/question` | Issue is a question or is perceived as such. |
| `type/duplicate` | An existing issue of the same subject/request have already been reported. |
| `type/wontfix` | A reported bug works as intended/by design. |
| `type/invalid` | A reported bug with invalid usage. |
| `area/*` | Subject is related to a functional area of interest or component. |
### Duplicate issues
Make sure it's not a duplicate by searching existing issues using related terms from the issue title and description.
If you think you know there is an existing issue, but can't find it, please reach out to one of the maintainers and ask for help.
If you identify that the issue is a duplicate of an existing issue:
1. Add a comment `/duplicate of #<issue number>`. GitHub will recognize this and add some additional context to the issue activity.
2. The KubeVela bot will do the rest, adding the correct label and closing comment
3. Optionally add any related `area/*` labels.
### Bug reports
If it's not perfectly clear that it's an actual bug, quickly try to reproduce it.
**It's a bug/it can be reproduced:**
1. Add a comment describing detailed steps for how to reproduce it, if applicable.
2. Label the issue `type/bug` and at least one `area/*` label.
3. If you know that maintainers won't be able to put any resources into it for some time then label the issue
with `help wanted` and optionally `good first issue` together with pointers on which code to update to fix the bug.
This should signal to the community that we would appreciate any help we can get to resolve this.
4. Move on to [prioritizing the issue](#4-prioritization-of-issues).
**It can't be reproduced:**
1. Either [ask for more information](#2-ensure-the-issue-contains-basic-information) needed to investigate it more thoroughly.
2. Either [delegate further investigations](#investigation-of-issues) to someone else.
**It works as intended/by design:**
1. Kindly and politely add a comment explaining briefly why we think it works as intended and close the issue.
2. Label the issue `type/wontfix`.
### Enhancement/feature?
1. Label the issue `type/enhancement` and at least one `area/*` label.
2. Move on to [prioritizing the issue](#4-prioritization-of-issues).
### Documentation issue?
First, evaluate if the documentation makes sense to be included in the KubeVela project:
- Is this something we want/can maintain as a project?
- Is this referring to usage of some specific integration/tool and in that case is that a popular use case in combination with KubeVela?
- If unsure, kindly and politely add a comment explaining that we would need [upvotes](https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments)
to identify that lots of other users want/need this.
Second, label the issue `type/docs` and at least one `area/*` label.
**Minor typo/error/lack of information:**
There's a minor typo/error/lack of information that adds a lot of confusion for users and given the amount of work is a big win to make sure fixing it:
1. Either update the documentation yourself and open a pull request.
2. Either delegate the work to someone else by assigning that person to the issue and add the issue to next major/minor milestone.
**Major error/lack of information:**
1. Label the issue with `help wanted` and `good first issue`, if applicable, to signal that we find this important to
fix and we would appreciate any help we can get from the community.
2. Move on to [prioritizing the issue](#4-prioritization-of-issues).
### Support requests and questions
1. Kindly and politely direct the issue author to the [github discussion](https://github.com/oam-dev/kubevela/discussions)
and explain that issue is mainly used for tracking bugs and feature requests.
If possible, it's usually a good idea to add some pointers to the issue author's question.
2. Close the issue and label it with `type/question`.
## 4. Prioritization of issues
In general bugs and enhancement issues should be labeled with a priority.
This is the most difficult thing with triaging issues since it requires a lot of knowledge, context and experience
before being able to think of and start feel comfortable adding a certain priority label.
The key here is asking for help and discuss issues to understand how more experienced project members think and reason.
By doing that you learn more and eventually be more and more comfortable with prioritizing issues.
In case there is an uncertainty around the prioritization of an issue, please ask the maintainers for help.
| Label | Description |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| `priority/critical` | Highest priority. Must be actively worked on as someone's top priority right now. |
| `priority/important-soon` | Must be staffed and worked on either currently, or very soon, ideally in time for the next release. |
| `priority/important-longterm` | Important over the long term, but may not be staffed and/or may need multiple releases to complete. |
| `priority/nice-to-have` | It's a good idea, but not scheduled for any release. |
| `priority/awaiting-more-evidence` | Lowest priority. Possibly useful, but not yet enough interest in it. |
| `priority/unscheduled` | Something to look into before and to be discussed during the planning of the next (upcoming) major/minor stable release. |
**Critical bugs**
1. If a bug has been categorized and any of the following criteria apply, the bug should be labeled as critical and
must be actively worked on as someone's top priority right now.
- Results in any crash or data loss.
- Critical security or performance issues
- Problem that makes a feature unusable
- Multiple users experience a severe problem affecting their business, users etc.
2. Label the issue `priority/critical`.
3. Add the issue to the next upcoming patch release milestone. Create a new milestone if there are none.
4. Escalate the problem to the maintainers.
5. Assign or ask a maintainer for help assigning someone to make this issue their top priority right now.
**Important short-term**
1. Label the issue `priority/important-soon`.
2. Add the issue to the next upcoming patch or major/minor stable release milestone. Ask maintainers for help if unsure if it's a patch or not.
Create a new milestone if there are none.
3. Make sure to add the issue to a suitable backlog of a GitHub project and prioritize it or assign someone to work on it now or very soon.
4. Consider requesting [help from the community](#5-requesting-help-from-the-community), even though it may be problematic given a short amount of time until it should be released.
**Important long-term**
1. Label the issue `priority/important-longterm`.
2. Consider requesting [help from the community](#5-requesting-help-from-the-community).
**Nice to have**
1. Label the issue `priority/nice-to-have`.
2. Consider requesting [help from the community](#5-requesting-help-from-the-community).
**Not critical, but unsure?**
1. Label the issue `priority/unscheduled`.
2. Consider requesting [help from the community](#5-requesting-help-from-the-community).
## 5. Requesting help from the community
Depending on the issue and/or priority, it's always a good idea to consider signalling to the community that help from community
is appreciated and needed in case an issue is not prioritized to be worked on by maintainers. Use your best judgement.
In general, requesting help from the community means that a contribution has a good chance of getting accepted and merged.
1. Kindly and politely add a comment to signal to users subscribed to updates of the issue.
- Explain that the issue would be nice to get resolved, but it isn't prioritized to work on by maintainers for an unforeseen future.
- If possible or applicable, try to help contributors getting starting by adding pointers and references to
what code/files need to be changed and/or ideas of a good way to solve/implement the issue.
2. Label the issue with `help wanted`.
3. If applicable, label the issue with `good first issue` to denote that the issue is suitable for a beginner to work on.
4. If possible, try to estimate the amount of work by adding `effort/small`, `effort/medium` or `effort/large`.
## Investigation of issues
When an issue has all basic information provided, but the triage responsible haven't been able to reproduce the reported
problem at a first glance, the issue is labeled [Needs investigation](https://github.com/oam-dev/kubevela/labels/needs%20investigation).
Depending on the perceived severity and/or number of [upvotes](https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments),
the investigation will either be delegated to another maintainer for further investigation or put on hold until someone else (maintainer or contributor)
picks it up and eventually starts investigating it.
Investigating issues can be a very time consuming task, especially for the maintainers, provide as much related info will
make it easier for maintainers to investigate.
Even if you don't have the time or knowledge to investigate an issue we highly recommend that you [upvote](https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments)
the issue if you happen to have the same problem. If you have further details that may help investigating the issue
please provide as much information as possible.
## Automation
We have some automation that triggers on comments or labels being added to issues.
Many of these automated behaviors are defined in [commands.json](https://github.com/oam-dev/kubevela/blob/main/.github/commands.json).
* Add /duplicate `#<issue number>` to have KubeVela label & close issue with an appropriate message.
* Add `bot/question` and the bot will close it with an appropriate message.
[Read more on bot actions](https://github.com/oam-dev/kubevela/blob/main/.github/bot.md)

View File

@@ -52,7 +52,9 @@ build: fmt vet lint staticcheck vela-cli kubectl-vela
@$(OK) build succeed
vela-cli:
go run hack/chart/generate.go
$(GOBUILD_ENV) go build -o bin/vela -a -ldflags $(LDFLAGS) ./references/cmd/cli/main.go
git checkout references/cmd/cli/fake/chart_source.go
kubectl-vela:
$(GOBUILD_ENV) go build -o bin/kubectl-vela -a -ldflags $(LDFLAGS) ./cmd/plugin/main.go
@@ -64,16 +66,21 @@ doc-gen:
rm -r docs/en/cli/*
go run hack/docgen/gen.go
PWD := $(shell pwd)
docs-build:
docker run -it -v $(PWD)/docs/sidebars.js:/workspace/kubevela.io/sidebars.js \
-v $(PWD)/docs/en:/workspace/kubevela.io/docs \
oamdev/vela-webtool:v1 -t build
ifneq ($(wildcard git-page),)
rm -rf git-page
endif
sh ./hack/website/test-build.sh
docs-start:
docker run -it -p 3000:3000 -v $(PWD)/docs/sidebars.js:/workspace/kubevela.io/sidebars.js \
-v $(PWD)/docs/en:/workspace/kubevela.io/docs \
oamdev/vela-webtool:v1 -t start
ifeq ($(wildcard git-page),)
git clone --single-branch --depth 1 https://github.com/oam-dev/kubevela.io.git git-page
endif
rm -r git-page/docs
rm git-page/sidebars.js
cat docs/sidebars.js > git-page/sidebars.js
cp -R docs/en git-page/docs
cd git-page && yarn install && yarn start
api-gen:
swag init -g references/apiserver/route.go --output references/apiserver/docs
@@ -85,9 +92,10 @@ generate-source:
cross-build:
rm -rf _bin
go get github.com/mitchellh/gox@v0.4.0
go run hack/chart/generate.go
$(GOBUILD_ENV) $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/vela/{{.OS}}-{{.Arch}}/vela" -osarch='$(TARGETS)' ./references/cmd/cli
$(GOBUILD_ENV) $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/kubectl-vela/{{.OS}}-{{.Arch}}/kubectl-vela" -osarch='$(TARGETS)' ./cmd/plugin
git checkout references/cmd/cli/fake/chart_source.go
compress:
( \
@@ -114,9 +122,8 @@ run: fmt vet
# Run go fmt against code
fmt: goimports installcue
go fmt ./...
$(GOIMPORTS) -local github.com/oam-dev/kubevela -w $$(go list -f {{.Dir}} ./...)
$(CUE) fmt ./vela-templates/internal/cue/*
$(CUE) fmt ./vela-templates/registry/cue/*
$(GOIMPORTS) -local github.com/oam-dev/kubevela -w ./pkg ./cmd
$(CUE) fmt ./hack/vela-templates/cue/*
# Run go vet against code
vet:
@@ -225,12 +232,12 @@ core-uninstall: manifests
kubectl delete -f charts/vela-core/crds/
# Generate manifests e.g. CRD, RBAC etc.
manifests: installcue kustomize
manifests: kustomize
go generate $(foreach t,pkg apis,./$(t)/...)
# TODO(yangsoon): kustomize will merge all CRD into a whole file, it may not work if we want patch more than one CRD in this way
$(KUSTOMIZE) build config/crd -o config/crd/base/core.oam.dev_applications.yaml
mv config/crd/base/* charts/vela-core/crds
./vela-templates/gen_definitions.sh
./hack/vela-templates/gen_definitions.sh
./hack/crd/cleanup.sh
GOLANGCILINT_VERSION ?= v1.31.0

View File

@@ -18,11 +18,11 @@ KubeVela is a modern application platform that makes deploying and managing appl
## Features
**Application Centric** - KubeVela introduces declarative yet higher level API (known as [OAM](https://oam.dev/)) to model a full deployment of microservices across hybrid environments in consistent approach. No infrastructure level concerns, simply deploy.
**Application Centric** - Leveraging Open Application Model (OAM), KubeVela introduces consistent yet higher level API to capture a full deployment of microservices on top of hybrid environments. Placement strategy and patch, traffic shifting and rolling update are all declared at application level. No infrastructure level concern, simply deploy.
**Natively Extensible** - KubeVela backend is implemented with [CUE](https://cuelang.org/). Whenever your needs grow, KubeVela's capabilities can naturally expand in a IaC-style approach. No restrictions, simply programming.
**Natively Extensible** - KubeVela uses [CUE](https://github.com/cuelang/cue) to glue capabilities (e.g. workload types, operational behaviors, and cloud services) provided by runtime infrastructure and expose them to users via self-service API. When users' needs grow, these API can naturally expand in programmable approach. No restriction, fully flexible.
**Runtime Agnostic** - KubeVela relies on Kubernetes as control plane but it's adaptable to any runtime infrastructures. It can deploy and manage diverse workload types including container, cloud functions, databases, or even EC2 instances across hybrid environments.
**Runtime Agnostic** - KubeVela is built with Kubernetes as control plane but adaptable to any runtime as data-plane. It can deploy (and manage) diverse workload types such as container, cloud functions, databases, or even EC2 instances across hybrid environments. Also, this means KubeVela seamlessly works with any Kubernetes compatible CI/CD or GitOps tools via declarative API.
## Getting Started
@@ -52,9 +52,5 @@ Full documentation is available on the [KubeVela website](https://kubevela.io/).
## Contributing
Check out [CONTRIBUTING](./CONTRIBUTING.md) to see how to develop with KubeVela.
## Report Vulnerability
Security is a first priority thing for us at KubeVela. If you come across a related issue, please send email to security@mail.kubevela.io .
## Code of Conduct
KubeVela adopts [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).

View File

@@ -1,20 +0,0 @@
# Security Policy
## Reporting a Vulnerability
If you've found a security issue that you'd like to disclose confidentially please send email to security@mail.kubevela.io .
### Who Reads Email Sent to security@mail.kubevela.io?
Only a restricted and carefully chosen group of KubeVela maintainers will have access to material sent to the security@mail.kubevela.io address.
No outside users can subscribe to this list.
### What to Send to security@mail.kubevela.io
Please provide as much information about your system and the issue as possible when contacting the list.
## How We Respond
Email sent to security@mail.kubevela.io is read and acknowledged with a non-automated response within three working days.
For issues that are complicated and require significant attention,
we will open an investigation and will provide you with a mechanism to check the status of our progress at any time.

View File

@@ -163,8 +163,6 @@ const (
ApplicationRollingOut ApplicationPhase = "rollingOut"
// ApplicationRendering means the app is rendering
ApplicationRendering ApplicationPhase = "rendering"
// ApplicationRunningWorkflow means the app is running workflow
ApplicationRunningWorkflow ApplicationPhase = "runningWorkflow"
// ApplicationRunning means the app finished rendering and applied result to the cluster
ApplicationRunning ApplicationPhase = "running"
// ApplicationHealthChecking means the app finished rendering and applied result to the cluster, but still unhealthy
@@ -205,14 +203,6 @@ type RawComponent struct {
Raw runtime.RawExtension `json:"raw"`
}
// WorkflowStepStatus record the status of a workflow step
type WorkflowStepStatus struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
Phase WorkflowStepPhase `json:"phase,omitempty"`
ResourceRef runtimev1alpha1.TypedReference `json:"resourceRef,omitempty"`
}
// AppStatus defines the observed state of Application
type AppStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
@@ -232,30 +222,13 @@ type AppStatus struct {
// ResourceTracker record the status of the ResourceTracker
ResourceTracker *runtimev1alpha1.TypedReference `json:"resourceTracker,omitempty"`
// Workflow record the status of workflow steps
Workflow []WorkflowStepStatus `json:"workflow,omitempty"`
// LatestRevision of the application configuration it generates
// +optional
LatestRevision *Revision `json:"latestRevision,omitempty"`
}
// WorkflowStepPhase describes the phase of a workflow step.
type WorkflowStepPhase string
const (
// WorkflowStepPhaseSucceeded will make the controller run the next step.
WorkflowStepPhaseSucceeded WorkflowStepPhase = "succeeded"
// WorkflowStepPhaseFailed will make the controller stop the workflow and report error in `message`.
WorkflowStepPhaseFailed WorkflowStepPhase = "failed"
// WorkflowStepPhaseStopped will make the controller stop the workflow.
WorkflowStepPhaseStopped WorkflowStepPhase = "stopped"
// WorkflowStepPhaseRunning will make the controller continue the workflow.
WorkflowStepPhaseRunning WorkflowStepPhase = "running"
)
// DefinitionType describes the type of DefinitionRevision.
// +kubebuilder:validation:Enum=Component;Trait;Policy;WorkflowStep
// +kubebuilder:validation:Enum=Component;Trait
type DefinitionType string
const (
@@ -264,12 +237,6 @@ const (
// TraitType represents DefinitionRevision refer to type TraitDefinition
TraitType DefinitionType = "Trait"
// PolicyType represents DefinitionRevision refer to type PolicyDefinition
PolicyType DefinitionType = "Policy"
// WorkflowStepType represents DefinitionRevision refer to type WorkflowStepDefinition
WorkflowStepType DefinitionType = "WorkflowStep"
)
// AppRolloutStatus defines the observed state of AppRollout

View File

@@ -62,11 +62,6 @@ func (in *AppStatus) DeepCopyInto(out *AppStatus) {
*out = new(v1alpha1.TypedReference)
**out = **in
}
if in.Workflow != nil {
in, out := &in.Workflow, &out.Workflow
*out = make([]WorkflowStepStatus, len(*in))
copy(*out, *in)
}
if in.LatestRevision != nil {
in, out := &in.LatestRevision, &out.LatestRevision
*out = new(Revision)
@@ -343,22 +338,6 @@ func (in *Terraform) DeepCopy() *Terraform {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStepStatus) DeepCopyInto(out *WorkflowStepStatus) {
*out = *in
out.ResourceRef = in.ResourceRef
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepStatus.
func (in *WorkflowStepStatus) DeepCopy() *WorkflowStepStatus {
if in == nil {
return nil
}
out := new(WorkflowStepStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkloadGVK) DeepCopyInto(out *WorkloadGVK) {
*out = *in

View File

@@ -22,10 +22,9 @@ package v1alpha2
import (
"github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
standard_oam_devv1alpha1 "github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

View File

@@ -50,43 +50,10 @@ type ApplicationComponent struct {
Scopes map[string]string `json:"scopes,omitempty"`
}
// AppPolicy defines a global policy for all components in the app.
type AppPolicy struct {
// Name is the unique name of the policy.
Name string `json:"name"`
Type string `json:"type"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
}
// WorkflowStep defines how to execute a workflow step.
type WorkflowStep struct {
// Name is the unique name of the workflow step.
Name string `json:"name"`
Type string `json:"type"`
// +kubebuilder:pruning:PreserveUnknownFields
Properties runtime.RawExtension `json:"properties,omitempty"`
}
// ApplicationSpec is the spec of Application
type ApplicationSpec struct {
Components []ApplicationComponent `json:"components"`
// Policies defines the global policies for all components in the app, e.g. security, metrics, gitops,
// multi-cluster placement rules, etc.
// Policies are applied after components are rendered and before workflow steps are executed.
Policies []AppPolicy `json:"policies,omitempty"`
// Workflow defines how to customize the control logic.
// If workflow is specified, Vela won't apply any resource, but provide rendered output in AppRevision.
// Workflow steps are executed in array order, and each step:
// - will have a context in annotation.
// - should mark "finish" phase in status.conditions.
Workflow []WorkflowStep `json:"workflow,omitempty"`
// TODO(wonderflow): we should have application level scopes supported here
// RolloutPlan is the details on how to rollout the resources

View File

@@ -17,7 +17,6 @@
package v1beta1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
@@ -51,9 +50,6 @@ type ApplicationRevisionSpec struct {
// +kubebuilder:validation:EmbeddedResource
// +kubebuilder:pruning:PreserveUnknownFields
ApplicationConfiguration runtime.RawExtension `json:"applicationConfiguration"`
// ResourcesConfigMap references the ConfigMap that's generated to contain all final rendered resources.
ResourcesConfigMap corev1.LocalObjectReference `json:"resourcesConfigMap,omitempty"`
}
// +kubebuilder:object:root=true

View File

@@ -38,12 +38,6 @@ type DefinitionRevisionSpec struct {
// TraitDefinition records the snapshot of the created/modified TraitDefinition
TraitDefinition TraitDefinition `json:"traitDefinition,omitempty"`
// PolicyDefinition records the snapshot of the created/modified PolicyDefinition
PolicyDefinition PolicyDefinition `json:"policyDefinition,omitempty"`
// WorkflowStepDefinition records the snapshot of the created/modified WorkflowStepDefinition
WorkflowStepDefinition WorkflowStepDefinition `json:"workflowStepDefinition,omitempty"`
}
// +kubebuilder:object:root=true

View File

@@ -1,77 +0,0 @@
/*
Copyright 2021. The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
)
// PolicyDefinitionSpec defines the desired state of PolicyDefinition
type PolicyDefinitionSpec struct {
// Reference to the CustomResourceDefinition that defines this trait kind.
Reference common.DefinitionReference `json:"definitionRef,omitempty"`
// Schematic defines the data format and template of the encapsulation of the policy definition
// +optional
Schematic *common.Schematic `json:"schematic,omitempty"`
}
// PolicyDefinitionStatus is the status of PolicyDefinition
type PolicyDefinitionStatus struct {
// ConditionedStatus reflects the observed status of a resource
runtimev1alpha1.ConditionedStatus `json:",inline"`
// LatestRevision of the component definition
// +optional
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
}
// SetConditions set condition for PolicyDefinition
func (d *PolicyDefinition) SetConditions(c ...runtimev1alpha1.Condition) {
d.Status.SetConditions(c...)
}
// GetCondition gets condition from PolicyDefinition
func (d *PolicyDefinition) GetCondition(conditionType runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
return d.Status.GetCondition(conditionType)
}
// +kubebuilder:object:root=true
// PolicyDefinition is the Schema for the policydefinitions API
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=policy
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
type PolicyDefinition struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PolicyDefinitionSpec `json:"spec,omitempty"`
Status PolicyDefinitionStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// PolicyDefinitionList contains a list of PolicyDefinition
type PolicyDefinitionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PolicyDefinition `json:"items"`
}

View File

@@ -61,22 +61,6 @@ var (
TraitDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(TraitDefinitionKind)
)
// PolicyDefinition type metadata.
var (
PolicyDefinitionKind = reflect.TypeOf(PolicyDefinition{}).Name()
PolicyDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: PolicyDefinitionKind}.String()
PolicyDefinitionKindAPIVersion = PolicyDefinitionKind + "." + SchemeGroupVersion.String()
PolicyDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(PolicyDefinitionKind)
)
// WorkflowStepDefinition type metadata.
var (
WorkflowStepDefinitionKind = reflect.TypeOf(WorkflowStepDefinition{}).Name()
WorkflowStepDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: WorkflowStepDefinitionKind}.String()
WorkflowStepDefinitionKindAPIVersion = WorkflowStepDefinitionKind + "." + SchemeGroupVersion.String()
WorkflowStepDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(WorkflowStepDefinitionKind)
)
// DefinitionRevision type metadata.
var (
DefinitionRevisionKind = reflect.TypeOf(DefinitionRevision{}).Name()
@@ -145,8 +129,6 @@ func init() {
SchemeBuilder.Register(&ComponentDefinition{}, &ComponentDefinitionList{})
SchemeBuilder.Register(&WorkloadDefinition{}, &WorkloadDefinitionList{})
SchemeBuilder.Register(&TraitDefinition{}, &TraitDefinitionList{})
SchemeBuilder.Register(&PolicyDefinition{}, &PolicyDefinitionList{})
SchemeBuilder.Register(&WorkflowStepDefinition{}, &WorkflowStepDefinitionList{})
SchemeBuilder.Register(&DefinitionRevision{}, &DefinitionRevisionList{})
SchemeBuilder.Register(&ScopeDefinition{}, &ScopeDefinitionList{})
SchemeBuilder.Register(&Application{}, &ApplicationList{})

View File

@@ -1,77 +0,0 @@
/*
Copyright 2021. The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
)
// WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition
type WorkflowStepDefinitionSpec struct {
// Reference to the CustomResourceDefinition that defines this trait kind.
Reference common.DefinitionReference `json:"definitionRef,omitempty"`
// Schematic defines the data format and template of the encapsulation of the workflow step definition
// +optional
Schematic *common.Schematic `json:"schematic,omitempty"`
}
// WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition
type WorkflowStepDefinitionStatus struct {
// ConditionedStatus reflects the observed status of a resource
runtimev1alpha1.ConditionedStatus `json:",inline"`
// LatestRevision of the component definition
// +optional
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
}
// SetConditions set condition for WorkflowStepDefinition
func (d *WorkflowStepDefinition) SetConditions(c ...runtimev1alpha1.Condition) {
d.Status.SetConditions(c...)
}
// GetCondition gets condition from WorkflowStepDefinition
func (d *WorkflowStepDefinition) GetCondition(conditionType runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
return d.Status.GetCondition(conditionType)
}
// +kubebuilder:object:root=true
// WorkflowStepDefinition is the Schema for the workflowstepdefinitions API
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=workflowstep
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
type WorkflowStepDefinition struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec WorkflowStepDefinitionSpec `json:"spec,omitempty"`
Status WorkflowStepDefinitionStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// WorkflowStepDefinitionList contains a list of WorkflowStepDefinition
type WorkflowStepDefinitionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []WorkflowStepDefinition `json:"items"`
}

View File

@@ -21,10 +21,9 @@ limitations under the License.
package v1beta1
import (
"k8s.io/apimachinery/pkg/runtime"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@@ -136,22 +135,6 @@ func (in *AppDeploymentStatus) DeepCopy() *AppDeploymentStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppPolicy) DeepCopyInto(out *AppPolicy) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppPolicy.
func (in *AppPolicy) DeepCopy() *AppPolicy {
if in == nil {
return nil
}
out := new(AppPolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *AppRevision) DeepCopyInto(out *AppRevision) {
*out = *in
@@ -441,7 +424,6 @@ func (in *ApplicationRevisionSpec) DeepCopyInto(out *ApplicationRevisionSpec) {
}
}
in.ApplicationConfiguration.DeepCopyInto(&out.ApplicationConfiguration)
out.ResourcesConfigMap = in.ResourcesConfigMap
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationRevisionSpec.
@@ -464,20 +446,6 @@ func (in *ApplicationSpec) DeepCopyInto(out *ApplicationSpec) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Policies != nil {
in, out := &in.Policies, &out.Policies
*out = make([]AppPolicy, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Workflow != nil {
in, out := &in.Workflow, &out.Workflow
*out = make([]WorkflowStep, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.RolloutPlan != nil {
in, out := &in.RolloutPlan, &out.RolloutPlan
*out = new(v1alpha1.RolloutPlan)
@@ -840,8 +808,6 @@ func (in *DefinitionRevisionSpec) DeepCopyInto(out *DefinitionRevisionSpec) {
*out = *in
in.ComponentDefinition.DeepCopyInto(&out.ComponentDefinition)
in.TraitDefinition.DeepCopyInto(&out.TraitDefinition)
in.PolicyDefinition.DeepCopyInto(&out.PolicyDefinition)
in.WorkflowStepDefinition.DeepCopyInto(&out.WorkflowStepDefinition)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DefinitionRevisionSpec.
@@ -955,107 +921,6 @@ func (in *PlacementStatus) DeepCopy() *PlacementStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyDefinition) DeepCopyInto(out *PolicyDefinition) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDefinition.
func (in *PolicyDefinition) DeepCopy() *PolicyDefinition {
if in == nil {
return nil
}
out := new(PolicyDefinition)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PolicyDefinition) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyDefinitionList) DeepCopyInto(out *PolicyDefinitionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PolicyDefinition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDefinitionList.
func (in *PolicyDefinitionList) DeepCopy() *PolicyDefinitionList {
if in == nil {
return nil
}
out := new(PolicyDefinitionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PolicyDefinitionList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyDefinitionSpec) DeepCopyInto(out *PolicyDefinitionSpec) {
*out = *in
out.Reference = in.Reference
if in.Schematic != nil {
in, out := &in.Schematic, &out.Schematic
*out = new(common.Schematic)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDefinitionSpec.
func (in *PolicyDefinitionSpec) DeepCopy() *PolicyDefinitionSpec {
if in == nil {
return nil
}
out := new(PolicyDefinitionSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyDefinitionStatus) DeepCopyInto(out *PolicyDefinitionStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.LatestRevision != nil {
in, out := &in.LatestRevision, &out.LatestRevision
*out = new(common.Revision)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyDefinitionStatus.
func (in *PolicyDefinitionStatus) DeepCopy() *PolicyDefinitionStatus {
if in == nil {
return nil
}
out := new(PolicyDefinitionStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceTracker) DeepCopyInto(out *ResourceTracker) {
*out = *in
@@ -1411,123 +1276,6 @@ func (in *WeightedTarget) DeepCopy() *WeightedTarget {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStep) DeepCopyInto(out *WorkflowStep) {
*out = *in
in.Properties.DeepCopyInto(&out.Properties)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStep.
func (in *WorkflowStep) DeepCopy() *WorkflowStep {
if in == nil {
return nil
}
out := new(WorkflowStep)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStepDefinition) DeepCopyInto(out *WorkflowStepDefinition) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepDefinition.
func (in *WorkflowStepDefinition) DeepCopy() *WorkflowStepDefinition {
if in == nil {
return nil
}
out := new(WorkflowStepDefinition)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *WorkflowStepDefinition) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStepDefinitionList) DeepCopyInto(out *WorkflowStepDefinitionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]WorkflowStepDefinition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepDefinitionList.
func (in *WorkflowStepDefinitionList) DeepCopy() *WorkflowStepDefinitionList {
if in == nil {
return nil
}
out := new(WorkflowStepDefinitionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *WorkflowStepDefinitionList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStepDefinitionSpec) DeepCopyInto(out *WorkflowStepDefinitionSpec) {
*out = *in
out.Reference = in.Reference
if in.Schematic != nil {
in, out := &in.Schematic, &out.Schematic
*out = new(common.Schematic)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepDefinitionSpec.
func (in *WorkflowStepDefinitionSpec) DeepCopy() *WorkflowStepDefinitionSpec {
if in == nil {
return nil
}
out := new(WorkflowStepDefinitionSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkflowStepDefinitionStatus) DeepCopyInto(out *WorkflowStepDefinitionStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.LatestRevision != nil {
in, out := &in.LatestRevision, &out.LatestRevision
*out = new(common.Revision)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepDefinitionStatus.
func (in *WorkflowStepDefinitionStatus) DeepCopy() *WorkflowStepDefinitionStatus {
if in == nil {
return nil
}
out := new(WorkflowStepDefinitionStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WorkloadDefinition) DeepCopyInto(out *WorkloadDefinition) {
*out = *in

View File

@@ -22,9 +22,6 @@ import (
"cuelang.org/go/cue"
"github.com/google/go-cmp/cmp"
"github.com/spf13/pflag"
"k8s.io/apimachinery/pkg/runtime"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
)
// Source record the source of Capability
@@ -65,10 +62,6 @@ type Capability struct {
// Terraform
TerraformConfiguration string `json:"terraformConfiguration,omitempty"`
// KubeTemplate
KubeTemplate runtime.RawExtension `json:"kubetemplate,omitempty"`
KubeParameter []common.KubeParameter `json:"kubeparameter,omitempty"`
}
// Chart defines all necessary information to install a whole chart
@@ -99,10 +92,6 @@ const (
TypeTrait CapType = "trait"
// TypeScope represent OAM Scope
TypeScope CapType = "scope"
// TypeWorkflowStep represent OAM Workflow
TypeWorkflowStep CapType = "workflowstep"
// TypePolicy represent OAM Policy
TypePolicy CapType = "policy"
)
// CapabilityConfigMapNamePrefix is the prefix for capability ConfigMap name
@@ -134,7 +123,6 @@ type Parameter struct {
Required bool `json:"required,omitempty"`
Default interface{} `json:"default,omitempty"`
Usage string `json:"usage,omitempty"`
Ignore bool `json:"ignore,omitempty"`
Type cue.Kind `json:"type,omitempty"`
Alias string `json:"alias,omitempty"`
JSONType string `json:"jsonType,omitempty"`

View File

@@ -1,37 +0,0 @@
/*
Copyright 2021 The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package types
import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)
// ComponentManifest contains resources rendered from an application component.
type ComponentManifest struct {
Name string
RevisionName string
RevisionHash string
StandardWorkload *unstructured.Unstructured
Traits []*unstructured.Unstructured
Scopes []*corev1.ObjectReference
// PackagedWorkloadResources contain all the workload related resources. It could be a Helm
// Release, Git Repo or anything that can package and run a workload.
PackagedWorkloadResources []*unstructured.Unstructured
PackagedTraitResources map[string][]*unstructured.Unstructured
}

View File

@@ -20,7 +20,6 @@ package types
const (
ReasonParsed = "Parsed"
ReasonRendered = "Rendered"
ReasonRevisoned = "Revisioned"
ReasonApplied = "Applied"
ReasonHealthCheck = "HealthChecked"
ReasonDeployed = "Deployed"
@@ -28,8 +27,6 @@ const (
ReasonFailedParse = "FailedParse"
ReasonFailedRender = "FailedRender"
ReasonFailedRevision = "FailedRevision"
ReasonFailedWorkflow = "FailedWorkflow"
ReasonFailedApply = "FailedApply"
ReasonFailedHealthCheck = "FailedHealthCheck"
ReasonFailedGC = "FailedGC"
@@ -40,7 +37,6 @@ const (
const (
MessageParsed = "Parsed successfully"
MessageRendered = "Rendered successfully"
MessageRevisioned = "Revisioned successfully"
MessageApplied = "Applied successfully"
MessageHealthCheck = "Health checked healthy"
MessageDeployed = "Deployed successfully"
@@ -48,7 +44,6 @@ const (
MessageFailedParse = "fail to parse application, err: %v"
MessageFailedRender = "fail to render application, err: %v"
MessageFailedRevision = "fail to handle application revision, err: %v"
MessageFailedApply = "fail to apply component, err: %v"
MessageFailedHealthCheck = "fail to health check, err: %v"
MessageFailedGC = "fail to garbage collection, err: %v"

View File

@@ -29,8 +29,6 @@ const (
DefaultEnvName = "default"
// DefaultAppNamespace defines the default K8s namespace for Apps created by KubeVela
DefaultAppNamespace = "default"
// AutoDetectWorkloadDefinition defines the default workload type for ComponentDefinition which doesn't specify a workload
AutoDetectWorkloadDefinition = "autodetects.core.oam.dev"
)
const (
@@ -67,5 +65,5 @@ const (
// TypeSystem defines one category
TypeSystem = "System"
// TypePlugin defines one category used in Kubectl Plugin
TypePlugin = "Plugin Command"
TypePlugin = "Debug and Test"
)

View File

@@ -542,40 +542,6 @@ spec:
status:
description: ApplicationPhase is a label for the condition of a application at the current time
type: string
workflow:
description: Workflow record the status of workflow steps
items:
description: WorkflowStepStatus record the status of a workflow step
properties:
name:
type: string
phase:
description: WorkflowStepPhase describes the phase of a workflow step.
type: string
resourceRef:
description: A TypedReference refers to an object by Name, Kind, and APIVersion. It is commonly used to reference cluster-scoped objects or objects where the namespace is already known.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
type:
type: string
type: object
type: array
type: object
type: object
applicationConfiguration:
@@ -1328,24 +1294,6 @@ spec:
- type
type: object
type: array
policies:
description: Policies defines the global policies for all components in the app, e.g. security, metrics, gitops, multi-cluster placement rules, etc. Policies are applied after components are rendered and before workflow steps are executed.
items:
description: AppPolicy defines a global policy for all components in the app.
properties:
name:
description: Name is the unique name of the policy.
type: string
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- name
- type
type: object
type: array
rolloutPlan:
description: RolloutPlan is the details on how to rollout the resources The controller simply replace the old resources with the new one if there is no rollout plan involved
properties:
@@ -1564,24 +1512,6 @@ spec:
format: int32
type: integer
type: object
workflow:
description: 'Workflow defines how to customize the control logic. If workflow is specified, Vela won''t apply any resource, but provide rendered output in AppRevision. Workflow steps are executed in array order, and each step: - will have a context in annotation. - should mark "finish" phase in status.conditions.'
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
name:
description: Name is the unique name of the workflow step.
type: string
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- name
- type
type: object
type: array
required:
- components
type: object
@@ -1817,40 +1747,6 @@ spec:
status:
description: ApplicationPhase is a label for the condition of a application at the current time
type: string
workflow:
description: Workflow record the status of workflow steps
items:
description: WorkflowStepStatus record the status of a workflow step
properties:
name:
type: string
phase:
description: WorkflowStepPhase describes the phase of a workflow step.
type: string
resourceRef:
description: A TypedReference refers to an object by Name, Kind, and APIVersion. It is commonly used to reference cluster-scoped objects or objects where the namespace is already known.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
type:
type: string
type: object
type: array
type: object
type: object
applicationConfiguration:
@@ -2088,13 +1984,6 @@ spec:
- raw
type: object
type: array
resourcesConfigMap:
description: ResourcesConfigMap references the ConfigMap that's generated to contain all final rendered resources.
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
scopeDefinitions:
additionalProperties:
description: A ScopeDefinition registers a kind of Kubernetes custom resource as a valid OAM scope kind by referencing its CustomResourceDefinition. The CRD is used to validate the schema of the scope when it is embedded in an OAM ApplicationConfiguration.

View File

@@ -554,40 +554,6 @@ spec:
status:
description: ApplicationPhase is a label for the condition of a application at the current time
type: string
workflow:
description: Workflow record the status of workflow steps
items:
description: WorkflowStepStatus record the status of a workflow step
properties:
name:
type: string
phase:
description: WorkflowStepPhase describes the phase of a workflow step.
type: string
resourceRef:
description: A TypedReference refers to an object by Name, Kind, and APIVersion. It is commonly used to reference cluster-scoped objects or objects where the namespace is already known.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
type:
type: string
type: object
type: array
type: object
type: object
served: true
@@ -665,24 +631,6 @@ spec:
- type
type: object
type: array
policies:
description: Policies defines the global policies for all components in the app, e.g. security, metrics, gitops, multi-cluster placement rules, etc. Policies are applied after components are rendered and before workflow steps are executed.
items:
description: AppPolicy defines a global policy for all components in the app.
properties:
name:
description: Name is the unique name of the policy.
type: string
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- name
- type
type: object
type: array
rolloutPlan:
description: RolloutPlan is the details on how to rollout the resources The controller simply replace the old resources with the new one if there is no rollout plan involved
properties:
@@ -901,24 +849,6 @@ spec:
format: int32
type: integer
type: object
workflow:
description: 'Workflow defines how to customize the control logic. If workflow is specified, Vela won''t apply any resource, but provide rendered output in AppRevision. Workflow steps are executed in array order, and each step: - will have a context in annotation. - should mark "finish" phase in status.conditions.'
items:
description: WorkflowStep defines how to execute a workflow step.
properties:
name:
description: Name is the unique name of the workflow step.
type: string
properties:
type: object
x-kubernetes-preserve-unknown-fields: true
type:
type: string
required:
- name
- type
type: object
type: array
required:
- components
type: object
@@ -1154,40 +1084,6 @@ spec:
status:
description: ApplicationPhase is a label for the condition of a application at the current time
type: string
workflow:
description: Workflow record the status of workflow steps
items:
description: WorkflowStepStatus record the status of a workflow step
properties:
name:
type: string
phase:
description: WorkflowStepPhase describes the phase of a workflow step.
type: string
resourceRef:
description: A TypedReference refers to an object by Name, Kind, and APIVersion. It is commonly used to reference cluster-scoped objects or objects where the namespace is already known.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
type:
type: string
type: object
type: array
type: object
type: object
served: true

View File

@@ -264,171 +264,7 @@ spec:
enum:
- Component
- Trait
- Policy
- WorkflowStep
type: string
policyDefinition:
description: PolicyDefinition records the snapshot of the created/modified PolicyDefinition
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: PolicyDefinitionSpec defines the desired state of PolicyDefinition
properties:
definitionRef:
description: Reference to the CustomResourceDefinition that defines this trait kind.
properties:
name:
description: Name of the referenced CustomResourceDefinition.
type: string
version:
description: Version indicate which version should be used if CRD has multiple versions by default it will use the first one if not specified
type: string
required:
- name
type: object
schematic:
description: Schematic defines the data format and template of the encapsulation of the policy definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
default: false
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: PolicyDefinitionStatus is the status of PolicyDefinition
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastTransitionTime:
description: LastTransitionTime is the last time this condition transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from one status to another.
type: string
status:
description: Status of this condition; is it currently True, False, or Unknown?
type: string
type:
description: Type of this condition. At most one of each condition type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
latestRevision:
description: LatestRevision of the component definition
properties:
name:
type: string
revision:
format: int64
type: integer
revisionHash:
description: RevisionHash record the hash value of the spec of ApplicationRevision object.
type: string
required:
- name
- revision
type: object
type: object
type: object
revision:
description: Revision record revision number of DefinitionRevision
format: int64
@@ -634,168 +470,6 @@ spec:
type: object
type: object
type: object
workflowStepDefinition:
description: WorkflowStepDefinition records the snapshot of the created/modified WorkflowStepDefinition
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition
properties:
definitionRef:
description: Reference to the CustomResourceDefinition that defines this trait kind.
properties:
name:
description: Name of the referenced CustomResourceDefinition.
type: string
version:
description: Version indicate which version should be used if CRD has multiple versions by default it will use the first one if not specified
type: string
required:
- name
type: object
schematic:
description: Schematic defines the data format and template of the encapsulation of the workflow step definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
default: false
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastTransitionTime:
description: LastTransitionTime is the last time this condition transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from one status to another.
type: string
status:
description: Status of this condition; is it currently True, False, or Unknown?
type: string
type:
description: Type of this condition. At most one of each condition type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
latestRevision:
description: LatestRevision of the component definition
properties:
name:
type: string
revision:
format: int64
type: integer
revisionHash:
description: RevisionHash record the hash value of the spec of ApplicationRevision object.
type: string
required:
- name
- revision
type: object
type: object
type: object
required:
- definitionType
- revision

View File

@@ -1,195 +0,0 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
name: policydefinitions.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: PolicyDefinition
listKind: PolicyDefinitionList
plural: policydefinitions
shortNames:
- policy
singular: policydefinition
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: PolicyDefinition is the Schema for the policydefinitions API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: PolicyDefinitionSpec defines the desired state of PolicyDefinition
properties:
definitionRef:
description: Reference to the CustomResourceDefinition that defines this trait kind.
properties:
name:
description: Name of the referenced CustomResourceDefinition.
type: string
version:
description: Version indicate which version should be used if CRD has multiple versions by default it will use the first one if not specified
type: string
required:
- name
type: object
schematic:
description: Schematic defines the data format and template of the encapsulation of the policy definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
default: false
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: PolicyDefinitionStatus is the status of PolicyDefinition
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastTransitionTime:
description: LastTransitionTime is the last time this condition transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from one status to another.
type: string
status:
description: Status of this condition; is it currently True, False, or Unknown?
type: string
type:
description: Type of this condition. At most one of each condition type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
latestRevision:
description: LatestRevision of the component definition
properties:
name:
type: string
revision:
format: int64
type: integer
revisionHash:
description: RevisionHash record the hash value of the spec of ApplicationRevision object.
type: string
required:
- name
- revision
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,195 +0,0 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
name: workflowstepdefinitions.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: WorkflowStepDefinition
listKind: WorkflowStepDefinitionList
plural: workflowstepdefinitions
shortNames:
- workflowstep
singular: workflowstepdefinition
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: WorkflowStepDefinition is the Schema for the workflowstepdefinitions API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition
properties:
definitionRef:
description: Reference to the CustomResourceDefinition that defines this trait kind.
properties:
name:
description: Name of the referenced CustomResourceDefinition.
type: string
version:
description: Version indicate which version should be used if CRD has multiple versions by default it will use the first one if not specified
type: string
required:
- name
type: object
schematic:
description: Schematic defines the data format and template of the encapsulation of the workflow step definition
properties:
cue:
description: CUE defines the encapsulation in CUE format
properties:
template:
description: Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field. Template is a required field if CUE is defined in Capability Definition.
type: string
required:
- template
type: object
helm:
description: A Helm represents resources used by a Helm module
properties:
release:
description: Release records a Helm release used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
repository:
description: HelmRelease records a Helm repository used by a Helm module workload.
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- release
- repository
type: object
kube:
description: Kube defines the encapsulation in raw Kubernetes resource format
properties:
parameters:
description: Parameters defines configurable parameters
items:
description: A KubeParameter defines a configurable parameter of a component.
properties:
description:
description: Description of this parameter.
type: string
fieldPaths:
description: "FieldPaths specifies an array of fields within this workload that will be overwritten by the value of this parameter. \tAll fields must be of the same type. Fields are specified as JSON field paths without a leading dot, for example 'spec.replicas'."
items:
type: string
type: array
name:
description: Name of this parameter
type: string
required:
default: false
description: Required specifies whether or not a value for this parameter must be supplied when authoring an Application.
type: boolean
type:
description: 'ValueType indicates the type of the parameter value, and only supports basic data types: string, number, boolean.'
enum:
- string
- number
- boolean
type: string
required:
- fieldPaths
- name
- type
type: object
type: array
template:
description: Template defines the raw Kubernetes resource
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- template
type: object
terraform:
description: Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
properties:
configuration:
description: Configuration is Terraform Configuration
type: string
type:
default: hcl
description: Type specifies which Terraform configuration it is, HCL or JSON syntax
enum:
- hcl
- json
type: string
required:
- configuration
type: object
type: object
type: object
status:
description: WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition
properties:
conditions:
description: Conditions of the resource.
items:
description: A Condition that may apply to a resource.
properties:
lastTransitionTime:
description: LastTransitionTime is the last time this condition transitioned from one status to another.
format: date-time
type: string
message:
description: A Message containing details about this condition's last transition from one status to another, if any.
type: string
reason:
description: A Reason for this condition's last transition from one status to another.
type: string
status:
description: Status of this condition; is it currently True, False, or Unknown?
type: string
type:
description: Type of this condition. At most one of each condition type may apply to a resource at any point in time.
type: string
required:
- lastTransitionTime
- reason
- status
- type
type: object
type: array
latestRevision:
description: LatestRevision of the component definition
properties:
name:
type: string
revision:
format: int64
type: integer
revisionHash:
description: RevisionHash record the hash value of the spec of ApplicationRevision object.
type: string
required:
- name
- revision
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -115,30 +115,5 @@ webhooks:
- UPDATE
resources:
- podspecworkloads
- clientConfig:
caBundle: Cg==
service:
name: {{ template "kubevela.name" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutating-core-oam-dev-v1beta1-componentdefinitions
{{- if .Values.admissionWebhooks.patch.enabled }}
failurePolicy: Ignore
{{- else }}
failurePolicy: Fail
{{- end }}
name: mutating.core.oam-dev.v1beta1.componentdefinitions
sideEffects: None
admissionReviewVersions:
- v1beta1
rules:
- apiGroups:
- core.oam.dev
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- componentdefinitions
{{- end -}}

View File

@@ -163,30 +163,4 @@ webhooks:
- UPDATE
resources:
- applications
- clientConfig:
caBundle: Cg==
service:
name: {{ template "kubevela.name" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validating-core-oam-dev-v1beta1-componentdefinitions
{{- if .Values.admissionWebhooks.patch.enabled }}
failurePolicy: Ignore
{{- else }}
failurePolicy: Fail
{{- end }}
name: validating.core.oam-dev.v1beta1.componentdefinitions
sideEffects: None
admissionReviewVersions:
- v1beta1
rules:
- apiGroups:
- core.oam.dev
apiVersions:
- v1beta1
operations:
- CREATE
- UPDATE
resources:
- componentdefinitions
{{- end -}}

View File

@@ -1,10 +0,0 @@
apiVersion: core.oam.dev/v1beta1
kind: WorkloadDefinition
metadata:
annotations:
definition.oam.dev/description: "autodetects.core.oam.dev is the default workload type of ComponentDefinition"
name: autodetects.core.oam.dev
namespace: {{.Values.systemDefinitionNamespace}}
spec:
definitionRef:
name: autodetects.core.oam.dev

View File

@@ -8,7 +8,8 @@ metadata:
namespace: {{.Values.systemDefinitionNamespace}}
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
schematic:
cue:
template: |

View File

@@ -1,36 +0,0 @@
# Code generated by KubeVela templates. DO NOT EDIT.
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
annotations:
definition.oam.dev/description: "Expose port to enable web traffic for your component."
name: expose
namespace: {{.Values.systemDefinitionNamespace}}
spec:
appliesToWorkloads:
- deployments.apps
podDisruptive: false
schematic:
cue:
template: |
outputs: service: {
apiVersion: "v1"
kind: "Service"
metadata:
name: context.name
spec: {
selector:
"app.oam.dev/component": context.name
ports: [
for p in parameter.port {
port: p
targetPort: p
},
]
}
}
parameter: {
// +usage=Specify the exposion ports
port: [...int]
}

View File

@@ -24,7 +24,8 @@ spec:
healthPolicy: |
isHealth: len(context.outputs.service.spec.clusterIP) > 0
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: false
schematic:
cue:

View File

@@ -8,7 +8,8 @@ metadata:
namespace: {{.Values.systemDefinitionNamespace}}
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: false
schematic:
cue:

View File

@@ -1,46 +0,0 @@
# Code generated by KubeVela templates. DO NOT EDIT.
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
annotations:
definition.oam.dev/description: "Binding secrets of cloud resources to component env"
name: service-binding
namespace: {{.Values.systemDefinitionNamespace}}
spec:
appliesToWorkloads:
- webservice
- worker
schematic:
cue:
template: |
patch: {
spec: template: spec: {
// +patchKey=name
containers: [{
name: context.name
// +patchKey=name
env: [
for envName, v in parameter.envMappings {
name: envName
valueFrom: {
secretKeyRef: {
name: v.secret
if v["key"] != _|_ {
key: v.key
}
if v["key"] == _|_ {
key: envName
}
}
}
},
]
}]
}
}
parameter: {
// +usage=The mapping of environment variables to secret
envMappings: [string]: [string]: string
}

View File

@@ -29,77 +29,10 @@ spec:
if parameter["cmd"] != _|_ {
command: parameter.cmd
}
if parameter["env"] != _|_ {
env: parameter.env
}
if parameter["cpu"] != _|_ {
resources: {
limits:
cpu: parameter.cpu
requests:
cpu: parameter.cpu
}
}
if parameter["memory"] != _|_ {
resources: {
limits:
memory: parameter.memory
requests:
memory: parameter.memory
}
}
if parameter["volumes"] != _|_ {
volumeMounts: [ for v in parameter.volumes {
{
mountPath: v.mountPath
name: v.name
}}]
}
}]
if parameter["volumes"] != _|_ {
volumes: [ for v in parameter.volumes {
{
name: v.name
if v.type == "pvc" {
persistentVolumeClaim: {
claimName: v.claimName
}
}
if v.type == "configMap" {
configMap: {
defaultMode: v.defaultMode
name: v.cmName
if v.items != _|_ {
items: v.items
}
}
}
if v.type == "secret" {
secret: {
defaultMode: v.defaultMode
secretName: v.secretName
if v.items != _|_ {
items: v.items
}
}
}
if v.type == "emptyDir" {
emptyDir: {
medium: v.medium
}
}
}}]
}
}
}
}
parameter: {
// +usage=Specify number of tasks to run in parallel
// +short=c
@@ -114,109 +47,5 @@ spec:
// +usage=Commands to run in the container
cmd?: [...string]
// +usage=Define arguments by using environment variables
env?: [...{
// +usage=Environment variable name
name: string
// +usage=The value of the environment variable
value?: string
// +usage=Specifies a source the value of this var should come from
valueFrom?: {
// +usage=Selects a key of a secret in the pod's namespace
secretKeyRef: {
// +usage=The name of the secret in the pod's namespace to select from
name: string
// +usage=The key of the secret to select from. Must be a valid secret key
key: string
}
}
}]
// +usage=Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core)
cpu?: string
// +usage=Specifies the attributes of the memory resource required for the container.
memory?: string
// +usage=Declare volumes and volumeMounts
volumes?: [...{
name: string
mountPath: string
// +usage=Specify volume type, options: "pvc","configMap","secret","emptyDir"
type: "pvc" | "configMap" | "secret" | "emptyDir"
if type == "pvc" {
claimName: string
}
if type == "configMap" {
defaultMode: *420 | int
cmName: string
items?: [...{
key: string
path: string
mode: *511 | int
}]
}
if type == "secret" {
defaultMode: *420 | int
secretName: string
items?: [...{
key: string
path: string
mode: *511 | int
}]
}
if type == "emptyDir" {
medium: *"" | "Memory"
}
}]
// +usage=Instructions for assessing whether the container is alive.
livenessProbe?: #HealthProbe
// +usage=Instructions for assessing whether the container is in a suitable state to serve traffic.
readinessProbe?: #HealthProbe
}
#HealthProbe: {
// +usage=Instructions for assessing container health by executing a command. Either this attribute or the httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the httpGet attribute and the tcpSocket attribute.
exec?: {
// +usage=A command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures.
command: [...string]
}
// +usage=Instructions for assessing container health by executing an HTTP GET request. Either this attribute or the exec attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the tcpSocket attribute.
httpGet?: {
// +usage=The endpoint, relative to the port, to which the HTTP GET request should be directed.
path: string
// +usage=The TCP socket within the container to which the HTTP GET request should be directed.
port: int
httpHeaders?: [...{
name: string
value: string
}]
}
// +usage=Instructions for assessing container health by probing a TCP socket. Either this attribute or the exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the httpGet attribute.
tcpSocket?: {
// +usage=The TCP socket within the container that should be probed to assess container health.
port: int
}
// +usage=Number of seconds after the container is started before the first probe is initiated.
initialDelaySeconds: *0 | int
// +usage=How often, in seconds, to execute the probe.
periodSeconds: *10 | int
// +usage=Number of seconds after which the probe times out.
timeoutSeconds: *1 | int
// +usage=Minimum consecutive successes for the probe to be considered successful after having failed.
successThreshold: *1 | int
// +usage=Number of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).
failureThreshold: *3 | int
}

View File

@@ -37,9 +37,6 @@ spec:
containers: [{
name: context.name
image: parameter.image
ports: [{
containerPort: parameter.port
}]
if parameter["cmd"] != _|_ {
command: parameter.cmd
@@ -53,6 +50,10 @@ spec:
env: context.config
}
ports: [{
containerPort: parameter.port
}]
if parameter["cpu"] != _|_ {
resources: {
limits:
@@ -62,15 +63,6 @@ spec:
}
}
if parameter["memory"] != _|_ {
resources: {
limits:
memory: parameter.memory
requests:
memory: parameter.memory
}
}
if parameter["volumes"] != _|_ {
volumeMounts: [ for v in parameter.volumes {
{
@@ -78,15 +70,6 @@ spec:
name: v.name
}}]
}
if parameter["livenessProbe"] != _|_ {
livenessProbe: parameter.livenessProbe
}
if parameter["readinessProbe"] != _|_ {
readinessProbe: parameter.readinessProbe
}
}]
if parameter["volumes"] != _|_ {
@@ -124,25 +107,20 @@ spec:
}}]
}
}
}
}
}
}
parameter: {
// +usage=Which image would you like to use for your service
// +short=i
image: string
// +usage=Which port do you want customer traffic sent to
// +short=p
port: *80 | int
// +ignore
// +usage=If addRevisionLabel is true, the appRevision label will be added to the underlying pods
addRevisionLabel: *false | bool
// +usage=Commands to run in the container
cmd?: [...string]
// +usage=Which port do you want customer traffic sent to
// +short=p
port: *80 | int
// +usage=Define arguments by using environment variables
env?: [...{
// +usage=Environment variable name
@@ -160,12 +138,11 @@ spec:
}
}
}]
// +usage=Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core)
cpu?: string
// +usage=Specifies the attributes of the memory resource required for the container.
memory?: string
// If addRevisionLabel is true, the appRevision label will be added to the underlying pods
addRevisionLabel: *false | bool
// +usage=Declare volumes and volumeMounts
volumes?: [...{
@@ -198,53 +175,5 @@ spec:
medium: *"" | "Memory"
}
}]
// +usage=Instructions for assessing whether the container is alive.
livenessProbe?: #HealthProbe
// +usage=Instructions for assessing whether the container is in a suitable state to serve traffic.
readinessProbe?: #HealthProbe
}
#HealthProbe: {
// +usage=Instructions for assessing container health by executing a command. Either this attribute or the httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the httpGet attribute and the tcpSocket attribute.
exec?: {
// +usage=A command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures.
command: [...string]
}
// +usage=Instructions for assessing container health by executing an HTTP GET request. Either this attribute or the exec attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the tcpSocket attribute.
httpGet?: {
// +usage=The endpoint, relative to the port, to which the HTTP GET request should be directed.
path: string
// +usage=The TCP socket within the container to which the HTTP GET request should be directed.
port: int
httpHeaders?: [...{
name: string
value: string
}]
}
// +usage=Instructions for assessing container health by probing a TCP socket. Either this attribute or the exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the httpGet attribute.
tcpSocket?: {
// +usage=The TCP socket within the container that should be probed to assess container health.
port: int
}
// +usage=Number of seconds after the container is started before the first probe is initiated.
initialDelaySeconds: *0 | int
// +usage=How often, in seconds, to execute the probe.
periodSeconds: *10 | int
// +usage=Number of seconds after which the probe times out.
timeoutSeconds: *1 | int
// +usage=Minimum consecutive successes for the probe to be considered successful after having failed.
successThreshold: *1 | int
// +usage=Number of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).
failureThreshold: *3 | int
}

View File

@@ -36,28 +36,6 @@ spec:
command: parameter.cmd
}
if parameter["env"] != _|_ {
env: parameter.env
}
if parameter["cpu"] != _|_ {
resources: {
limits:
cpu: parameter.cpu
requests:
cpu: parameter.cpu
}
}
if parameter["memory"] != _|_ {
resources: {
limits:
memory: parameter.memory
requests:
memory: parameter.memory
}
}
if parameter["volumes"] != _|_ {
volumeMounts: [ for v in parameter.volumes {
{
@@ -65,88 +43,53 @@ spec:
name: v.name
}}]
}
if parameter["livenessProbe"] != _|_ {
livenessProbe: parameter.livenessProbe
}
if parameter["readinessProbe"] != _|_ {
readinessProbe: parameter.readinessProbe
}
}]
if parameter["volumes"] != _|_ {
volumes: [ for v in parameter.volumes {
{
name: v.name
if v.type == "pvc" {
persistentVolumeClaim: {
claimName: v.claimName
}
}
if v.type == "configMap" {
configMap: {
defaultMode: v.defaultMode
name: v.cmName
if v.items != _|_ {
items: v.items
if parameter["volumes"] != _|_ {
volumes: [ for v in parameter.volumes {
{
name: v.name
if v.type == "pvc" {
persistentVolumeClaim: {
claimName: v.claimName
}
}
}
if v.type == "secret" {
secret: {
defaultMode: v.defaultMode
secretName: v.secretName
if v.items != _|_ {
items: v.items
if v.type == "configMap" {
configMap: {
defaultMode: v.defaultMode
name: v.cmName
if v.items != _|_ {
items: v.items
}
}
}
}
if v.type == "emptyDir" {
emptyDir: {
medium: v.medium
if v.type == "secret" {
secret: {
defaultMode: v.defaultMode
secretName: v.secretName
if v.items != _|_ {
items: v.items
}
}
}
}
}}]
if v.type == "emptyDir" {
emptyDir: {
medium: v.medium
}
}
}}]
}
}
}
}
}
}
parameter: {
// +usage=Which image would you like to use for your service
// +short=i
image: string
// +usage=Commands to run in the container
cmd?: [...string]
// +usage=Define arguments by using environment variables
env?: [...{
// +usage=Environment variable name
name: string
// +usage=The value of the environment variable
value?: string
// +usage=Specifies a source the value of this var should come from
valueFrom?: {
// +usage=Selects a key of a secret in the pod's namespace
secretKeyRef: {
// +usage=The name of the secret in the pod's namespace to select from
name: string
// +usage=The key of the secret to select from. Must be a valid secret key
key: string
}
}
}]
// +usage=Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core)
cpu?: string
// +usage=Specifies the attributes of the memory resource required for the container.
memory?: string
// +usage=Declare volumes and volumeMounts
volumes?: [...{
name: string
@@ -178,53 +121,5 @@ spec:
medium: *"" | "Memory"
}
}]
// +usage=Instructions for assessing whether the container is alive.
livenessProbe?: #HealthProbe
// +usage=Instructions for assessing whether the container is in a suitable state to serve traffic.
readinessProbe?: #HealthProbe
}
#HealthProbe: {
// +usage=Instructions for assessing container health by executing a command. Either this attribute or the httpGet attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the httpGet attribute and the tcpSocket attribute.
exec?: {
// +usage=A command to be executed inside the container to assess its health. Each space delimited token of the command is a separate array element. Commands exiting 0 are considered to be successful probes, whilst all other exit codes are considered failures.
command: [...string]
}
// +usage=Instructions for assessing container health by executing an HTTP GET request. Either this attribute or the exec attribute or the tcpSocket attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the tcpSocket attribute.
httpGet?: {
// +usage=The endpoint, relative to the port, to which the HTTP GET request should be directed.
path: string
// +usage=The TCP socket within the container to which the HTTP GET request should be directed.
port: int
httpHeaders?: [...{
name: string
value: string
}]
}
// +usage=Instructions for assessing container health by probing a TCP socket. Either this attribute or the exec attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with both the exec attribute and the httpGet attribute.
tcpSocket?: {
// +usage=The TCP socket within the container that should be probed to assess container health.
port: int
}
// +usage=Number of seconds after the container is started before the first probe is initiated.
initialDelaySeconds: *0 | int
// +usage=How often, in seconds, to execute the probe.
periodSeconds: *10 | int
// +usage=Number of seconds after which the probe times out.
timeoutSeconds: *1 | int
// +usage=Minimum consecutive successes for the probe to be considered successful after having failed.
successThreshold: *1 | int
// +usage=Number of consecutive failures required to determine the container is not alive (liveness probe) or not ready (readiness probe).
failureThreshold: *3 | int
}

View File

@@ -118,7 +118,6 @@ spec:
- "--use-webhook=true"
- "--webhook-port={{ .Values.webhookService.port }}"
- "--webhook-cert-dir={{ .Values.admissionWebhooks.certificate.mountPath }}"
- "--autogen-workload-definition={{ .Values.admissionWebhooks.autoGenWorkloadDefinition }}"
{{ end }}
{{ if not .Values.useAppConfig }}
- "--app-config-installed=false"
@@ -178,4 +177,4 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -3,11 +3,10 @@ kind: Application
metadata:
annotations:
helm.sh/hook: test-success
helm.sh/hook-delete-policy: hook-succeeded
name: helm-test-vela-app
name: first-vela-app
spec:
components:
- name: helm-test-express-server
- name: express-server
type: webservice
properties:
image: crccheck/hello-world
@@ -25,7 +24,6 @@ metadata:
name: "{{ .Release.Name }}-application-test"
annotations:
"helm.sh/hook": test
helm.sh/hook-delete-policy: hook-succeeded
spec:
serviceAccountName: kubevela-vela-core
containers:
@@ -42,16 +40,16 @@ spec:
echo "Waiting application is ready..."
echo "waiting for application being Applied"
kubectl -n vela-system wait --for=condition=Applied application helm-test-vela-app --timeout=3m
kubectl -n vela-system wait --for=condition=Applied application first-vela-app --timeout=3m
echo "application being Applied"
# wait for deploy being created
echo "waiting for deployment being available"
kubectl -n vela-system wait --for=condition=available deploy helm-test-express-server --timeout 3m
kubectl -n vela-system wait --for=condition=available deploy express-server --timeout 3m
echo "deployment being available"
# wait for ingress being created
while ! [ `kubectl -n vela-system get ing helm-test-express-server | grep -v NAME | wc -l` = 1 ]; do
while ! [ `kubectl -n vela-system get ing express-server | grep -v NAME | wc -l` = 1 ]; do
echo "waiting for ingress being created"
sleep 1
done

View File

@@ -77,11 +77,7 @@ admissionWebhooks:
tolerations: []
certManager:
enabled: false
# If autoGenWorkloadDefinition is true, webhook will auto generated workloadDefinition which componentDefinition refers to
autoGenWorkloadDefinition: true
#Enable debug logs for development purpose
logDebug: false
#If non-empty, write log files in this path
logFilePath: ""

View File

@@ -36,7 +36,7 @@ import (
oamcontroller "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev"
oamv1alpha2 "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1alpha2"
"github.com/oam-dev/kubevela/pkg/controller/utils"
"github.com/oam-dev/kubevela/pkg/cue/packages"
"github.com/oam-dev/kubevela/pkg/dsl/definition"
"github.com/oam-dev/kubevela/pkg/oam"
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
"github.com/oam-dev/kubevela/pkg/utils/common"
@@ -91,7 +91,6 @@ func main() {
"custom-revision-hook-url is a webhook url which will let KubeVela core to call with applicationConfiguration and component info and return a customized component revision")
flag.BoolVar(&controllerArgs.ApplicationConfigurationInstalled, "app-config-installed", true,
"app-config-installed indicates if applicationConfiguration CRD is installed")
flag.BoolVar(&controllerArgs.AutoGenWorkloadDefinition, "autogen-workload-definition", true, "Automatic generated workloadDefinition which componentDefinition refers to.")
flag.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.")
flag.StringVar(&applyOnceOnly, "apply-once-only", "false",
"For the purpose of some production environment that workload or trait should not be affected if no spec change, available options: on, off, force.")
@@ -173,10 +172,10 @@ func main() {
os.Exit(1)
}
controllerArgs.DiscoveryMapper = dm
pd, err := packages.NewPackageDiscover(mgr.GetConfig())
pd, err := definition.NewPackageDiscover(mgr.GetConfig())
if err != nil {
klog.Error(err, "Failed to create CRD discovery for CUE package client")
if !packages.IsCUEParseErr(err) {
if !definition.IsCUEParseErr(err) {
os.Exit(1)
}
}

View File

@@ -1,8 +0,0 @@
# Contribute
This directory contains guides for contributors to the KubeVela project.
* [Create a pull request](./create-pull-request.md)
* [Developer guide](./developer-guide.md)
* [Triage issues](./triage-issues.md)
* [Code conventions](./coding-conventions.md)

View File

@@ -1,162 +0,0 @@
# KubeVela code conventions
- Bash
- https://google.github.io/styleguide/shell.xml
- Ensure that build, release, test, and cluster-management scripts run on
macOS
- Go
- [Go Code Review Comments](https://github.com/golang/go/wiki/CodeReviewComments)
- [Effective Go](https://golang.org/doc/effective_go.html)
- Know and avoid [Go landmines](https://gist.github.com/lavalamp/4bd23295a9f32706a48f)
- Comment your code.
- [Go's commenting conventions](http://blog.golang.org/godoc-documenting-go-code)
- If reviewers ask questions about why the code is the way it is, that's a
sign that comments might be helpful.
- Command-line flags should use dashes, not underscores
- Naming
- Please consider package name when selecting an interface name, and avoid
redundancy.
- e.g.: `storage.Interface` is better than `storage.StorageInterface`.
- Do not use uppercase characters, underscores, or dashes in package
names.
- Please consider parent directory name when choosing a package name.
- so pkg/controllers/autoscaler/foo.go should say `package autoscaler`
not `package autoscalercontroller`.
- Unless there's a good reason, the `package foo` line should match
the name of the directory in which the .go file exists.
- Importers can use a different name if they need to disambiguate.
- Locks should be called `lock` and should never be embedded (always `lock
sync.Mutex`). When multiple locks are present, give each lock a distinct name
following Go conventions - `stateLock`, `mapLock` etc.
- KubeVela also follows the Kubernetes conventions
- [API changes](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api_changes.md)
- [API conventions](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md)
## Testing conventions
- All new packages and most new significant functionality must come with unit
tests
- Table-driven tests are preferred for testing multiple scenarios/inputs; for
example, see [TestNamespaceAuthorization](https://git.k8s.io/kubernetes/test/integration/auth/auth_test.go)
- Unit tests must pass on macOS and Windows platforms - if you use Linux
specific features, your test case must either be skipped on windows or compiled
out (skipped is better when running Linux specific commands, compiled out is
required when your code does not compile on Windows).
- Avoid relying on Docker hub (e.g. pull from Docker hub). Use gcr.io instead.
- Avoid waiting for a short amount of time (or without waiting) and expect an
asynchronous thing to happen (e.g. wait for 1 seconds and expect a Pod to be
running). Wait and retry instead.
- Significant features should come with integration (test/integration) and/or
end-to-end (e2e/) tests. TOOD(@wonderflow): add detail test guides.
- Including new vela cli commands and major features of existing commands
## Directory and file conventions
- Avoid package sprawl. Find an appropriate subdirectory for new packages.
- Libraries with no more appropriate home belong in new package
subdirectories of pkg/util
- Avoid general utility packages. Packages called "util" are suspect. Instead,
derive a name that describes your desired function. For example, the utility
functions dealing with waiting for operations are in the "wait" package and
include functionality like Poll. So the full name is wait.Poll
- All filenames should be lowercase
- Go source files and directories use underscores, not dashes
- Package directories should generally avoid using separators as much as
possible (when packages are multiple words, they usually should be in nested
subdirectories).
- Document directories and filenames should use dashes rather than underscores
- Contrived examples that illustrate system features belong in
/docs/user-guide or /docs/admin, depending on whether it is a feature primarily
intended for users that deploy applications or cluster administrators,
respectively. Actual application examples belong in /examples.
- Examples should also illustrate [best practices for configuration and using the system](https://kubernetes.io/docs/concepts/configuration/overview/)
- Third-party code
- Go code for normal third-party dependencies is managed using
[go modules](https://github.com/golang/go/wiki/Modules)
- Other third-party code belongs in `/third_party`
- forked third party Go code goes in `/third_party/forked`
- forked _golang stdlib_ code goes in `/third_party/forked/golang`
- Third-party code must include licenses
- This includes modified third-party code and excerpts, as well
## Logging Conventions
### Structured logging
We recommend using `klog.InfoS` to structure the log. The `msg` argument need start from a capital letter.
and name arguments should always use lowerCamelCase.
```golang
// func InfoS(msg string, keysAndValues ...interface{})
klog.InfoS("Reconcile traitDefinition", "traitDefinition", klog.KRef(req.Namespace, req.Name))
// output:
// I0605 10:10:57.308074 22276 traitdefinition_controller.go:59] "Reconcile traitDefinition" traitDefinition="vela-system/expose"
```
### Use `klog.KObj` and `klog.KRef` for Kubernetes objects
`klog.KObj` and `klog.KRef` can unify the output of kubernetes object.
```golang
// KObj is used to create ObjectRef when logging information about Kubernetes objects
klog.InfoS("Start to reconcile", "appDeployment", klog.KObj(appDeployment))
// KRef is used to create ObjectRef when logging information about Kubernetes objects without access to metav1.Object
klog.InfoS("Reconcile application", "application", klog.KRef(req.Namespace, req.Name))
```
### Logging Level
[This file](https://github.com/oam-dev/kubevela/blob/master/pkg/controller/common/logs.go) contains KubeVela's log level,
you can set the log level by `klog.V(level)`.
```golang
// you can use klog.V(common.LogDebug) to print debug log
klog.V(common.LogDebug).InfoS("Successfully applied components", "workloads", len(workloads))
```
Looking for more details in [Structured Logging Guide](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#structured-logging-in-kubernetes).
## Linting and formatting
To ensure consistency across the Go codebase, we require all code to pass a number of linter checks.
To run all linters, use the `reviewable` Makefile target:
```shell script
make reviewable
```
The command will clean code along with some lint checks. Please remember to check in all changes after that.

View File

@@ -1,86 +0,0 @@
# Create a pull request
We're excited that you're considering making a contribution to the KubeVela project!
This document guides you through the process of creating a [pull request](https://help.github.com/en/articles/about-pull-requests/).
## Before you begin
We know you're excited to create your first pull request. Before we get started, read these resources first:
- Learn how to start [Contributing to KubeVela](/CONTRIBUTING.md).
- Make sure your code follows the relevant [style guides](/contribute/style-guides).
## Your first pull request
If this is your first time contributing to an open-source project on GitHub, make sure you read about [Creating a pull request](https://help.github.com/en/articles/creating-a-pull-request).
To increase the chance of having your pull request accepted, make sure your pull request follows these guidelines:
- Title and description matches the implementation.
- Commits within the pull request follow the [Formatting guidelines](#Formatting-guidelines).
- The pull request closes one related issue.
- The pull request contains necessary tests that verify the intended behavior.
- If your pull request has conflicts, rebase your branch onto the main branch.
If the pull request fixes a bug:
- The pull request description must include `Closes #<issue number>` or `Fixes #<issue number>`.
- To avoid regressions, the pull request should include tests that replicate the fixed bug.
Please refer to the [code conventions](/contribute/coding-conventions.md) for better code style and conventions.
## Code review
Once you've created a pull request, the next step is to have someone review your change.
A review is a learning opportunity for both the reviewer and the author of the pull request.
If you think a specific person needs to review your pull request, then you can tag them in the description or in a comment.
Tag a user by typing the `@` symbol followed by their GitHub username.
We recommend that you read [How to do a code review](https://google.github.io/eng-practices/review/reviewer/) to learn more about code reviews.
## Formatting guidelines
A well-written pull request minimizes the time to get your change accepted.
These guidelines help you write good commit messages and descriptions for your pull requests.
### Commit message format
KubeVela uses the guidelines for commit messages outlined in [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/), with the following additions:
- Subject line must begin with the _area_ of the commit.
- A footer in the form of an optional [keyword and issue reference](https://help.github.com/en/articles/closing-issues-using-keywords).
#### Area
The area should use upper camel case, e.g. UpperCamelCase.
Prefer using one of the following areas:
- **Application:** Changes to the application controller.
- **Component:** Changes to the component related code or definition controller.
- **Trait:** Changes to the trait related code or definition controller.
- **CUE:** Changes to the CUE related logic.
- **Docs:** Changes to documentation.
- **AppConfig:** Changes to AppConfig related code.
**Examples**
- `Application: Support workflow in application controller`
- `CUE: Fix patch parse issues`
- `Docs: Changed url to URL in all documentation files`
### Pull request titles
The KubeVela team _squashes_ all commits into one when we accept a pull request.
The title of the pull request becomes the subject line of the squashed commit message.
We still encourage contributors to write informative commit messages, as they become a part of the Git commit body.
We use the pull request title when we generate change logs for releases. As such, we strive to make the title as informative as possible.
Make sure that the title for your pull request uses the same format as the subject line in the commit message.
### Pass all the CI checks
Before merge, All test CI should pass green.
The `codecov/project` should also pass. This means the coverage should not drop. See [Codecov commit status](https://docs.codecov.io/docs/commit-status#project-status).

View File

@@ -1,145 +0,0 @@
# Developer guide
This guide helps you get started developing KubeVela.
## Prerequisites
1. Golang version 1.16+
2. Kubernetes version v1.18+ with `~/.kube/config` configured.
3. ginkgo 1.14.0+ (just for [E2E test](./developer-guide.md#e2e-test))
4. golangci-lint 1.38.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
5. kubebuilder v2.3.0+
<details>
<summary>Install Kubebuilder manually</summary>
linux:
```
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz
tar -zxvf kubebuilder_2.3.1_linux_amd64.tar.gz
mkdir -p /usr/local/kubebuilder/bin
sudo mv kubebuilder_2.3.1_linux_amd64/bin/* /usr/local/kubebuilder/bin
```
macOS:
```
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_darwin_amd64.tar.gz
tar -zxvf kubebuilder_2.3.1_darwin_amd64.tar.gz
mkdir -p /usr/local/kubebuilder/bin
sudo mv kubebuilder_2.3.1_darwin_amd64/bin/* /usr/local/kubebuilder/bin
```
</details>
You may also be interested with KubeVela's [design](https://github.com/oam-dev/kubevela/tree/master/design/vela-core) before diving into its code.
## Build
* Clone this project
```shell script
git clone git@github.com:oam-dev/kubevela.git
```
KubeVela includes two parts, `vela core` and `vela cli`.
- The `vela core` is actually a K8s controller, it will watch OAM Spec CRD and deploy resources.
- The `vela cli` is a command line tool that can build, run apps(with the help of `vela core`).
For local development, we probably need to build both of them.
* Build Vela CLI
```shell script
make
```
After the vela cli built successfully, `make` command will create `vela` binary to `bin/` under the project.
* Configure `vela` binary to System PATH
```shell script
export PATH=$PATH:/your/path/to/project/kubevela/bin
```
Then you can use `vela` command directly.
* Build Vela Core
```shell script
make manager
```
* Run Vela Core
Firstly make sure your cluster has CRDs, below is the command that can help install all CRDs.
```shell script
make core-install
```
Run locally:
```shell script
make core-run
```
This command will run controller locally, it will use your local KubeConfig which means you need to have a k8s cluster
locally. If you don't have a one, we suggest that you could setup up a cluster with [kind](https://kind.sigs.k8s.io/).
When you're developing `vela-core`, make sure the controller installed by helm chart is not running.
Otherwise, it will conflict with your local running controller.
You can check and uninstall it by using helm.
```shell script
helm list -A
helm uninstall -n vela-system kubevela
```
## Use
You can try use your local built binaries follow [the documentation](https://kubevela.io/docs/quick-start).
## Testing
### Unit test
```shell script
make test
```
### E2E test
**Before e2e test start, make sure you have vela-core running.**
```shell script
make core-run
```
Start to test.
```
make e2e-test
```
## Contribute Docs
Please read [the documentation](https://github.com/oam-dev/kubevela/tree/master/docs/README.md) before contributing to the docs.
- Build docs
```shell script
make docs-build
```
- Local development and preview
```shell script
make docs-start
```
## Next steps
* Read our [code conventions](coding-conventions.md)
* Learn how to [Create a pull request](create-pull-request.md)

View File

@@ -1,40 +0,0 @@
# Triage issues
Triage helps ensure that issues resolve quickly by:
- Ensuring the issue's intent and purpose is conveyed precisely. This is necessary because it can be difficult for
an issue to explain how an end user experiences a problem and what actions they took.
- Giving a contributor the information they need before they commit to resolving an issue.
- Lowering the issue count by preventing duplicate issues.
- Streamlining the development process by preventing duplicate discussions.
This document gives you some ideas on what you can do to help. For more information, read more about [how the core KubeVela team triage issues](/ISSUE_TRIAGE.md).
## Improve issues
Improve issues by suggesting improvements to the title and description. If you think an issue has formatting issues,
bad language, or grammatical errors, post a comment to let the author and maintainers know.
## Report resolved issues
If you think an issue has been resolved, or is no longer relevant, suggest us to close it.
Add a comment on the issue, where you explain the reason it should be closed.
Make sure to include any related issues and pull requests.
## Investigate issues
Investigate issues that we haven't been able to reproduce yet.
In some cases, there are many combinations of usage that make it difficult for us to reproduce certain issues.
Help us by adding more information.
## Vote on issues
Use [GitHub reactions](https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments)
to let us know what's important to you. Vote on bugs if you've experienced the same problem. **Don't vote, or react, by commenting on the issue.**
Read more about [how we prioritize issues](/ISSUE_TRIAGE.md#4-prioritization-of-issues).
## Report duplicates
If you find two issues that describe the same thing, add a comment in one of the issues, with a reference (`#<issue number>`) to the other.
Explain why you think the issue is duplicated.

View File

@@ -1,27 +0,0 @@
# KubeVela Controller Parameters Reference
| parameter | type | default | describe |
| :-------------------------: | :----: | :-------------------------------: | :----------------------------------------------------------: |
| use-webhook | bool | false | Enable Admission Webhook |
| webhook-cert-dir | string | /k8s-webhook-server/serving-certs | Admission webhook cert/key dir. |
| webhook-port | int | 9443 | Admission webhook listen address |
| metrics-addr | string | :8080 | The address the metric endpoint binds to. |
| enable-leader-election | bool | false | Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager. |
| leader-election-namespace | string | "" | Determines the namespace in which the leader election configmap will be created. |
| log-file-path | string | "" | The file to write logs to. |
| log-file-max-size | int | 1024 | Defines the maximum size a log file can grow to, Unit is megabytes. |
| log-debug | bool | false | Enable debug logs for development purpose |
| revision-limit | int | 50 | revision-limit is the maximum number of revisions that will be maintained. The default value is 50. |
| application-revision-limit | int | 10 | application-revision-limit is the maximum number of application useless revisions that will be maintained, if the useless revisions exceed this number, older ones will be GCed first.The default value is 10. |
| definition-revision-limit | int | 20 | definition-revision-limit is the maximum number of component/trait definition useless revisions that will be maintained, if the useless revisions exceed this number, older ones will be GCed first.The default value is 20. |
| custom-revision-hook-url | string | "" | custom-revision-hook-url is a webhook url which will let KubeVela core to call with applicationConfiguration and component info and return a customized component revision |
| app-config-installed | bool | true | app-config-installed indicates if applicationConfiguration CRD is installed |
| autogen-workload-definition | bool | true | Automatic generated workloadDefinition which componentDefinition refers to |
| health-addr | string | :9440 | The address the health endpoint binds to. |
| apply-once-only | string | false | For the purpose of some production environment that workload or trait should not be affected if no spec change, available options: on, off, force. |
| disable-caps | string | "" | To be disabled builtin capability list. |
| storage-driver | string | Local | Application file save to the storage driver |
| informer-re-sync-interval | time | 2h | controller shared informer lister full re-sync period |
| system-definition-namespace | string | vela-system | define the namespace of the system-level definition |
| concurrent-reconciles | int | 4 | concurrent-reconciles is the concurrent reconcile number of the controller. |
| depend-check-wait | time | 30s | depend-check-wait is the time to wait for ApplicationConfiguration's dependent-resource ready. |

View File

@@ -1,33 +0,0 @@
# KubeVela Plugin Registry Reference
## registry interface intro
`Registry` interface definitions have two methods: `GetCap` and `ListCaps`. Here "Cap" can represent trait or component definition
```go
// Registry define a registry stores trait & component defs
type Registry interface {
GetCap(addonName string) (types.Capability, []byte, error)
ListCaps() ([]types.Capability, error)
}
```
Now we have implemented:`GithubRegistry`, `LocalRegistry` and `OssRegistry`, which represent three types of registry source.
To create a `Registry` object you should and must call `NewRegistry()`.
### Helper type or function
You could use `RegistryFile` to convert `[]byte` (easily got from all kinds of source) to `Capability`. Here is `RegistryFile`'s definition.
```go
// RegistryFile describes a file item in registry
type RegistryFile struct {
data []byte // file content
name string // file's name
}
```
## Registry vs Capcenter
How they differ from each other? `Capcenter` is a type for vela CLI. It has some function to sync content from remote and local `~/.vela` directory and apply some `ComponentDefinition` or `TraitDefinition` to the cluster. In the contrast, `Registry` is a type for kubectl vela plugin, which focuses on cluster directly. In one word, `Registry` has no local operations. They share some basic function.

View File

@@ -1,294 +0,0 @@
# Initilizing Environments For Application Deployment
## Background
A team of application development usually needs to initialize some shared environments for developers to deploy applications to.
For example, a team would initialize two environments, a *dev* environment for testing applications,
and a *prod* environment for running applications to serve live traffic.
The environment is a logical concept grouping common resources that multiple application deployments would depend on.
A list of resources we want to initialize per environment:
- K8s Clusters. Different environments might have clusters of different size and version, e.g.
small v1.10 k8s cluster for *dev* environment and large v1.9 k8s cluster for *prod* environment.
- Admin policies. Production environment would usually set global policies on all application deployments,
like chaos testing, SLO requirements, security scanning, misconfiguration detection.
- Operators & CRDs. Environments contains a variety of Operators & CRDs as system capabilities.
These operators can include domain registration, routing, logging, monitoring, autoscaling, etc.
- Shared services. Environments contains a variety of system services that are be shared by applications.
These resources can include DB, cache, load balancers, API Gateways, etc.
With the introduction of environment, the user workflow on Vela works like:
- Platform team defines system Components for Environments.
- Platform team initializes Environments using system Components.
- Platform team defines user Components for Applications.
- Developers choose user Components and Environments to deploy Applicatons.
When initializing environments, there are additional requirements:
- The ability to describe dependency relations between environments. For example, both *dev* and *prod* environments
would depend on a common environment that sets up operators both *dev* and *prod* would use.
In the following we propose solutions to implement environment concept for application delivery.
## Initialzer CRD
We propose to add an Initializer CRD:
```yaml
kind: Initializer
metadata:
name: prod-env
spec:
# appTemplate indicates the application template to render and deploy an system application.
appTemplate:
# We can use Application to deploy the resources that an environment needs.
# An environment setup can be done just like deploying applications in system level.
metadata:
...
spec:
# system components
components:
...
# system policies
policies:
...
# dependsOn indicates the other initializers that this depends on.
# It will not apply its components until all dependencies exist.
dependsOn:
- ref:
apiVersion: core.oam.dev/v1beta1
kind: Initializer
name: common-operators
```
By providing this initializer CRD, users can initialize environments by deploying system components --
the abstractions is flexible enough to do work like provisioning cloud resources, handling db migration,
installing system operators, etc.
Additionally, initializer dependency enables separating common setup tasks like setting up namespaces,
RBAC rules, accounts into reusable modules.
## Initializer-Related Operators
The Initializer CRD groups initialization resources together.
To satisfy each resource and its use case, we also need to implement the supporting operators and definitions.
In the following, we will walk through each use case and discuss the design of solution.
### Case 1: K8s Cluster
In this case, an initializer contains some clusters, and developers specify an initializer name to deploy apps.
Platform team would define placement rules as a Policy and deploy the environment as an Initializer:
```yaml
kind: Initializer
metadata:
name: prod-env
spec:
appTemplate:
spec:
policies:
- name: prod-env-placement
type: placement
properties:
# clusters of specified names or matched labels will be selected
clusterSelector:
names: ["prod-1" "prod-2"]
labels:
tier: prod
```
Developers would define how to deploy to clusters based on environments via Workflow:
```yaml
kind: Application
metadata:
name: my-app
spec:
workflow:
- name: deploy2clusters
type: deploy2clusters
properties:
# target indicates the name of the initializer
# which contains the selected clusters information.
target: prod-env
# propagation indicates how to propagate the app to the clusters.
# all: all clusters will get one instance of the app
# twin: pick two clusters to deploy two instances of the app
# single: pick one cluster to deploy only one instance of the app
propagation: all
```
Under the hood, the `placement` Policy would be translated to Placement objects that contains cluster information.
The `deploy2clusters` Workflow Steps would trigger `deploy2clusters` Operator to read Placement objects via `target` name
and handles progapation of the app's resources to selected clusters.
### Case 2: Admin Policy
In this case, an initializer contains some admin policies, and developers specify an initializer to deploy apps.
Platform team would define an admin policy as a Policy, and deploy such an environment as an Initializer:
```yaml
kind: Initializer
metadata:
name: prod-env
spec:
appTemplate:
spec:
policies:
- name: prod-env-slo-policy
type: slo-policy
properties:
properties:
# slo indicates the service in this env must be 99.99% up
slo: "99.99"
- name: prod-env-chaos-policy
type: chaos-policy
properties:
properties:
io:
action: fault
volumePath: /var/run/etcd
path: /var/run/etcd/**/*
percent: 50
duration: "400s"
```
Developers would specify a target to deploy via Workflow, which automatically does policy checks in the background:
```yaml
kind: Application
metadata:
name: my-app
spec:
workflow:
- name: check-policy
type: check-policy
properties:
# This app will be checked against the policies in the given target
target: prod-env
# If policy checks failed, send alerts to spcified channels
notifications:
slack: slack_url
dingding: dingding_url
```
Under the hood, the `slo-policy` and `chaos-policy` Policies would be translated to data objects (e.g. ConfigMap
or dedicated Policy objects) that contains policy data.
The `check-policy` Workflow Steps would trigger `check-policy` Operator to register the apps
to handlers of the target's policy checks, and handle notifications.
### case 3: Operator & CRD
In this case, an initializer defines the system Operators ands CRDs to be installed on a cluster.
Deploying such an initializer will setup these services and definitions on the host cluster.
Platform team would define these Operators and CRDs as Components, and deploy such an environment as an Initializer:
```yaml
kind: Initializer
metadata:
name: prod-env
spec:
appTemplate:
spec:
components:
- name: prod-monitoring-operator
# Reuse the built-in Helm/Kustomize ComponentDefinition to deploy Operators from Git repo.
type: helm-git
properties:
chart:
repository: operator-git-repo-url
name: monitoring-operator
version: 3.2.0
- name: prod-logging-operator
type: kustomize-git
properties:
sourceRef:
kind: GitRepository
name: logging-operator
path: ./apps/prod
```
Under the hood, Vela will support built-in ComponentDefinitions to deploy Helm charts or Kustomize folders
via git url. We can use this functionality to deploy system operators.
### case 4: Shared Service
In this case, an Initializer defines shared services to be installed on the cluster.
Deploying such an initializer will setup these services on the host cluster.
Platform team would define the shared services as Components, and deploy such an environment as an Initializer:
```yaml
kind: Initializer
metadata:
name: prod-env
spec:
appTemplate:
spec:
components:
- name: prod-policy-env
# Reuse the built-in Helm ComponentDefinition to deploy Crossplane resource.
type: helm-git
properties:
chart:
repository: crossplane-mysql-url
name: mysql
version: 3.2.0
- name: prod-policy-env
# Reuse the built-in Terraform ComponentDefinition to deploy cloud resource.
type: terraform-git
properties:
module:
source: "git::https://github.com/catalog/kafka.git"
outputs:
- key: queue_urls
moduleOutputName: queue_urls
- key: json_string
moduleOutputName: json_string
variables:
- key: ACCESS_KEY_ID
sensitive: true
environmentVariable: true
- key: SECRET_ACCESS_KEY
sensitive: true
environmentVariable: true
- key: CONFIRM_DESTROY
value: "1"
sensitive: false
environmentVariable: true
```
## Implementation Plan
We will discuss the details of implementation plan in this section.
### Environment Controller
- Add a new Initializer CRD and controller skeleton in KubeVela. Add reconcile logic:
- If finalizer doesn't exist, add finalizer to the object.
- If obj DeletionTimestamp is non-zero (i.e. being deleted):
- Wait until the Application resource are deleted entirely.
The resource tracker finalizer will ensure all children resources are deleted entirely first.
- Then remove finalizer.
- Check initializer dependency:
- If any of them does not exist, try reconcile later.
- Handle each resource:
- Render the `appTemplate` into an Application object.
- Put Initializer name into the label `app.oam.dev/initializer-name` of Application object.
- Put Initializer CR as an ownerRef into the Application object.
- Apply the Application object.
## Considerations

View File

@@ -1,345 +0,0 @@
# Application-Level Policies and Customized Control-Logic Workflow Design
## Background
The current model consists of mainly Components and Traits. While this enables the Application object to plug-in operational capabilities, it is still no flexible enough. Specifically, it has the following limitations:
- The current control logic could not be customized. Once the Vela controller renders final k8s resources, it simply applies them without any extension points. In some scenarios, users want to do more complex operations like:
- Blue-green upgrade old-new app revisions.
- User interaction like manual approval/rollback.
- Distributing workloads across multiple clusters.
- Enforcing policies and auditting.
- Pushing finalized k8s resources to Git for GitOps (via Flux/Argo) without applying the resources in Vela.
- There is no application-level config, but only per-component config. In some scenarios, users want to have app-level policies like:
- Security: RBAC rules, audit settings, secret backend types.
- Insights: app delivery lead time, frequence, MTTR.
## Proposal
To resolve the aforementioned problems, we propose to add app-level policies and customizable workflow to Application API:
```yaml
kind: Application
spec:
componnets: ...
# Policies are rendered after components are rendered but before workflow are started
policies:
- type: security
properties:
rbac: ...
audit: enabled
secretBackend: vault
- type: deployment-insights
properties:
leadTime: enabled
frequency: enabled
mttr: enabled
# workflow is used to customize the control logic.
# If workflow is specified, Vela won't apply any resource, but provide rendered resources in a ConfigMap, referenced via AppRevision.
# workflow steps are executed in array order, and each step:
# - will have a context in annotation.
# - should mark "finish" phase in status.conditions.
workflow:
# blue-green rollout
- type: blue-green-rollout
stage: post-render # stage could be pre/post-render. Default is post-render.
properties:
partition: "50%"
# traffic shift
- type: traffic-shift
properties:
partition: "50%"
# promote/rollback
- type: rollout-promotion
propertie:
manualApproval: true
rollbackIfNotApproved: true
```
This also implicates we will add two Definition CRDs -- `PolicyDefinition` and `WorkflowStepDefinition`:
```yaml
apiVersion: core.oam.dev/v1beta1
kind: WorkflowStepDefinition
metadata:
name: gitops
spec:
schematic:
cue:
template: |
output: {
kind: GitOps
spec:
source:
repoURL: parameter.source
branch: parameter.branch
...
}
parameters: {
source: string
branch: string
}
---
apiVersion: core.oam.dev/v1beta1
kind: PolicyDefinition
spec:
schematic:
cue:
template: ...
```
## Technical Details
To support policies and workflow, the application controller will be modified as the following:
- Before rendering the components, the controller will first execute the `stage: pre-render` steps.
- App controller will put rendered resources (including Components, Traits, Policies) into a ConfigMap, and reference the ConfigMap name in AppRevision as below:
```yaml
kind: ApplicationRevision
spec:
...
resourcesConfigMap:
name: my-app-v1-resources
---
kind: ConfigMap
metadata:
name: my-app-v1-resources
data:
resources: |
{
"apiVersion": "apps/v1",
"kind": "Deployment",
"metadata": {
"name": "mysvc"
},
"spec": {
"replicas": 1
}
}
...more json-marshalled resources...
```
- If workflow is specified, the controller will then apply the ApplicationRevision, but skip applying ApplicationContext. In this way, the resources won't be applied by Vela controller.
- The controller will then reconcile the workflow step by step. Each workflow step will be recorded in the Application.status:
```yaml
kind: Application
status:
workflow:
- type: rollout-promotion
phase: running # succeeded | failed | stopped
resourceRef:
kind: Rollout
name: ...
```
- Note that each workflow step must be idempotent, which means it should be able to process an object that are already submitted and processed. A non-idempotent example would be a controller that keeps appending item to an array field.
Each workflow step has the following interactions with the app controller:
- The controller will apply the workflow object with annotation `app.oam.dev/workflow-context`. This annotation will pass in the context marshalled in json defined as the following:
```go
type WorkflowContext struct {
AppName string
AppRevisionName string
WorkflowIndex int
}
```
- The controller will wait for the workflow object's `status.conditions` to have this condition:
```yaml
conditions:
- type: workflow-progress
status: 'True'
reason: 'Succeeded'
message: '{"observedGeneration":1}'
```
The reason could be one of the following:
- `Succeeded`: This will make the controller run the next step. The observed generation number should be written in `message` since Vela will check it to detect the newer decision on spec change.
- `Stopped`: This will make the controller stop the workflow.
- `Failed`: This will make the controller stop the workflow. The error should be reported in `message`.
## Use Cases
In this section we will walk through how we implement workflow solutions for the following use cases.
### Case 1: Multi-cluster
In this case, users want to distribute workflow to multiple clusters. The dispatcher implementation is flexible and could be based on [open-cluster-management](https://open-cluster-management.io/) or other methods.
```yaml
workflow:
- type: open-cluster-management
properties:
placement:
- clusterSelector:
region: east
replicas: "70%"
- clusterSelector:
region: west
replicas: "20%"
```
The process goes as:
- During infra setup, the Cluster objects are applied and agents are setup in each cluster to manage lifecycle of k8s clusters.
- Once the Application is applied, the OCM controller can retrieve all rendered resources from AppRevision. It will apply a ManifestWork object including all resources. Then the OCM agent will execute the workload creation in each cluster.
### Case 2: Blue-green rollout
In this case, users want to rollout a new version of the application components in a blue-green rolling upgrade style.
```yaml
workflow:
# blue-green rollout
- type: blue-green-rollout
properties:
partition: "50%"
# traffic shift
- type: traffic-shift
properties:
partition: "50%"
# promote/rollback
- type: rollout-promotion
propertie:
manualApproval: true
rollbackIfNotApproved: true
```
The process goes as:
- By default, each modification of the Application object will generate an AppRevision object. The rollout controller will get the current revision from the context and retrieve the previous revision via kube API.
- Then the rollout controller will do the operation to rollings replicas between two revisions (the actual behavior depends on the workload type, e.g. Deployment or CloneSet).
- Once the rollover is done, the rollout controller can shift partial traffic to the new revision too.
- The rollout controller will wait for the manual approval. In this case, it is in the status of Rollout object:
```yaml
kind: Rollout
status:
pause: true # change this to false
```
The reference to the rollout object will be in the Application object:
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
status:
workflow:
- type: rollout-promotion
resourceRef:
kind: Rollout
name: ...
```
### Case 3: Data Passing
In this case, users want to deploy a database component first, wait the database to be up and ready, and then deploy the application with database connection secret.
```yaml
components:
- name: my-db
type: mysql
properties:
- name: my-app
type: webservice
workflow:
- type: apply-component
properties:
name: my-db
# Wait for the MySQL object's status.connSecret to have value.
- type: conditional-wait
properties:
resourceRef:
apiVersion: database.example.org/v1alpha1
kind: MySQLInstance
name: my-db
conditions:
- field: status.connSecret
op: NotEmpty
# Patch my-app Deployment object's field with the secret name
# emitted from MySQL object. And then apply my-app component.
- type: apply-component
properties:
name: my-app
patch:
to:
field: spec.containers[0].envFrom[0].secretRef.name
valueFrom:
apiVersion: database.example.org/v1alpha1
kind: MySQLInstance
name: my-db
field: status.connSecret
```
### Case 4: GitOps rollout
In this case, users just want Vela to provide final k8s resources and push them to Git, and then integrate with ArgoCD/Flux to do final rollout. Users will setup a GitOps workflow like below:
```yaml
workflow:
- type: gitops # This part configures how to push resources to Git repo
properties:
gitRepo: git-repo-url
branch: branch
credentials: ...
```
The process goes as:
- Everytime an Appliation event is triggered, the GitOps workflow controller will push the rendered resources to a Git repo. This will trigger ArgoCD/Flux to do continuous deployment.
### Case 5: Template-based rollout
In this case, a template for Application object has already been defined. Instead of writing the `spec.components`, users will reference the template and provide parameters/patch to it.
```yaml
workflow:
- type: helm-template
stage: pre-render
properties:
source: git-repo-url
path: chart/folder/path
parameters:
image: my-image
replicas: 3
---
workflow:
- type: kustomize-patch
stage: pre-render
properties:
source: git-repo-url
path: base/folder/path
patch:
spec:
components:
- name: instance
properties:
image: prod-image
```
The process goes as:
- On creating the application, app controller will apply the HelmTemplate/KustomizePatch objects, and wait for its status.
- The HelmTemplate/KustomizePatch controller would read the template from specified source, render the final config. It will compare the config with the Application object -- if there is difference, it will write back to the Application object per se.
- The update of Application will trigger another event, the app controller will apply the HelmTemplate/KustomizePatch objects with new context. But this time, the HelmTemplate/KustomizePatch controller will find no diff after the rendering. So it will skip this time.
## Considerations
### Comparison with Argo Workflow/Tekton
The workflow defined here are k8s resource based and very simple one direction workflow. It's mainly used to customize Vela control logic to do more complex deployment operations.
While Argo Workflow/Tekton shares similar idea to provide workflow functionalities, they are container based and provide more complex features like parameters sharing (using volumes and sidecars). More importantly, these projects couldn't satisfy our needs. Otherwise we can just use them in our implementation.

View File

@@ -54,29 +54,19 @@ When you add or modify the docs, these three files(`docs/en/`, `docs/en/resource
[comment]: <> (TODO: ADD how to translate into Chinese or other language here.)
## Preview Website
## Local Development
You can preview the website locally with docker container. Every time you modify the files under the docs or sidebars.js,
it will sync automatically:
You can preview the website locally with the `node` and `yarn` installed.
Every time you modify the files under the docs, you need to re-run the following command, it will not sync automatically:
```shell
make docs-start
```
## Build Website
## Build in Local
You can build Kubevela website in local to test the correctness of docs, only run the following cmd:
```shell
make docs-build
```
If you don't want to use docker to preview and build the website, we provide simple scripts in the `hack/website` to help you develop and debug locally.
```
# preview the website
bash hack/website/docs-start.sh
# build the website
bash hack/website/test-build.sh
```

View File

@@ -1,8 +1,6 @@
---
title: Other Install Topics
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## Install KubeVela with cert-manager
@@ -49,44 +47,7 @@ REVISION: 1
NOTES:
Welcome to use the KubeVela! Enjoy your shipping application journey!
```
## Install Kubectl Vela Plugin
Install vela kubectl plugin can help you to ship applications more easily!
<Tabs
className="unique-tabs"
defaultValue="krew"
values={[
{label: 'Krew', value: 'krew'},
{label: 'Script', value: 'script'},
]}>
<TabItem value="krew">
1. [Install and set up](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) Krew on your machine.
2. Discover plugins available on Krew:
```shell
kubectl krew update
```
3. install kubectl vela:
```shell script
kubectl krew install vela
```
</TabItem>
<TabItem value="script">
**macOS/Linux**
```shell script
curl -fsSl https://kubevela.io/script/install-kubectl-vela.sh | bash
```
You can also download the binary from [release pages ( >= v1.0.3)](https://github.com/oam-dev/kubevela/releases) manually.
Kubectl will discover it from your system path automatically.
</TabItem>
</Tabs>
For more usage please reference [kubectl plugin](./developers/references/kubectl-plugin).
## Upgrade
### Step 1. Update Helm repo

View File

@@ -15,7 +15,7 @@ vela cap center config <centerName> <centerURL> [flags]
### Examples
```
vela cap center config mycenter https://github.com/oam-dev/catalog/tree/master/registry
vela cap center config mycenter https://github.com/oam-dev/catalog/cap-center
```
### Options
@@ -35,4 +35,4 @@ vela cap center config mycenter https://github.com/oam-dev/catalog/tree/master/r
* [vela cap center](vela_cap_center) - Manage Capability Center
###### Auto generated by spf13/cobra on 6-May-2021
###### Auto generated by spf13/cobra on 20-Mar-2021

View File

@@ -30,6 +30,6 @@ vela system cue-packages
### SEE ALSO
* [vela system](vela_system) - System management utilities
* [vela system](vela_system.md) - System management utilities
###### Auto generated by spf13/cobra on 2-May-2021

View File

@@ -34,6 +34,6 @@ vela live-diff -f app-v2.yaml -r app-v1 --context 10
### SEE ALSO
* [vela system](vela_system) - System management utilities
* [vela system](vela_system.md) - System management utilities
###### Auto generated by spf13/cobra on 2-May-2021

View File

@@ -43,4 +43,5 @@ Before releasing an application to production, it's important to test the code i
Here are some recommended next steps:
- Learn KubeVela's [core concepts](./concepts)
- Learn how to [deploy an application](end-user/application) in detail and understand how it works.

View File

@@ -11,16 +11,11 @@ KubeVela is able to discover OAM definition files in this repo automatically and
Add and sync a capability center in KubeVela:
```bash
vela cap center config my-center https://github.com/oam-dev/catalog/tree/master/registry
```
```console
$ vela cap center config my-center https://github.com/oam-dev/catalog/tree/master/registry
successfully sync 1/1 from my-center remote center
Successfully configured capability center my-center and sync from remote
```
```bash
vela cap center sync my-center
```
```console
$ vela cap center sync my-center
successfully sync 1/1 from my-center remote center
sync finished
```
@@ -32,9 +27,7 @@ Now, this capability center `my-center` is ready to use.
You are allowed to add more capability centers and list them.
```bash
vela cap center ls
```
```console
$ vela cap center ls
NAME ADDRESS
my-center https://github.com/oam-dev/catalog/tree/master/registry
```
@@ -44,7 +37,7 @@ my-center https://github.com/oam-dev/catalog/tree/master/registry
Or, remove one.
```bash
vela cap center remove my-center
$ vela cap center remove my-center
```
## List all available capabilities in capability center
@@ -52,9 +45,7 @@ vela cap center remove my-center
Or, list all available capabilities in certain center.
```bash
vela cap ls my-center
```
```console
$ vela cap ls my-center
NAME CENTER TYPE DEFINITION STATUS APPLIES-TO
clonesetservice my-center componentDefinition clonesets.apps.kruise.io uninstalled []
```
@@ -72,9 +63,7 @@ helm install kruise https://github.com/openkruise/kruise/releases/download/v0.7.
Install `clonesetservice` component from `my-center`.
```bash
vela cap install my-center/clonesetservice
```
```console
$ vela cap install my-center/clonesetservice
Installing component capability clonesetservice
Successfully installed capability clonesetservice from my-center
```
@@ -84,9 +73,7 @@ Successfully installed capability clonesetservice from my-center
Let's check the `clonesetservice` appears in your platform firstly:
```bash
vela components
```
```console
$ vela components
NAME NAMESPACE WORKLOAD DESCRIPTION
clonesetservice vela-system clonesets.apps.kruise.io Describes long-running, scalable, containerized services
that have a stable network endpoint to receive external
@@ -98,7 +85,7 @@ clonesetservice vela-system clonesets.apps.kruise.io Describes long-running, sca
Great! Now let's deploy an app via Appfile.
```bash
cat << EOF > vela.yaml
$ cat << EOF > vela.yaml
name: testapp
services:
testsvc:
@@ -109,9 +96,7 @@ EOF
```
```bash
vela up
```
```console
$ vela up
Parsing vela appfile ...
Load Template ...
@@ -133,9 +118,7 @@ Updating: core.oam.dev/v1alpha2, Kind=HealthScope in default
then you can Get a cloneset in your environment.
```shell
kubectl get clonesets.apps.kruise.io
```
```console
$ kubectl get clonesets.apps.kruise.io
NAME DESIRED UPDATED UPDATED_READY READY TOTAL AGE
testsvc 1 1 1 1 1 46s
```
@@ -145,8 +128,6 @@ testsvc 1 1 1 1 1 46s
> NOTE: make sure no apps are using the capability before uninstalling.
```bash
vela cap uninstall my-center/clonesetservice
```
```console
$ vela cap uninstall my-center/clonesetservice
Successfully uninstalled capability clonesetservice
```

View File

@@ -3,7 +3,7 @@ title: Check Application Logs
---
```bash
vela logs testapp
$ vela logs testapp
```
It will let you select the container to get logs from. If there is only one container it will select automatically.

View File

@@ -7,9 +7,7 @@ title: Configuring data/env in Application
## `vela config set`
```bash
vela config set test a=b c=d
```
```console
$ vela config set test a=b c=d
reading existing config data and merging with user input
config data saved successfully ✅
```
@@ -17,9 +15,7 @@ config data saved successfully ✅
## `vela config get`
```bash
vela config get test
```
```console
$ vela config get test
Data:
a: b
c: d
@@ -28,20 +24,16 @@ Data:
## `vela config del`
```bash
vela config del test
```
```console
$ vela config del test
config (test) deleted successfully
```
## `vela config ls`
```bash
vela config set test a=b
vela config set test2 c=d
vela config ls
```
```console
$ vela config set test a=b
$ vela config set test2 c=d
$ vela config ls
NAME
test
test2
@@ -52,7 +44,7 @@ test2
The config data can be set as the env in applications.
```bash
vela config set demo DEMO_HELLO=helloworld
$ vela config set demo DEMO_HELLO=helloworld
```
Save the following to `vela.yaml` in current directory:
@@ -67,9 +59,7 @@ services:
Then run:
```bash
vela up
```
```console
$ vela up
Parsing vela.yaml ...
Loading templates ...
@@ -90,8 +80,6 @@ App has not been deployed, creating a new deployment...
Check env var:
```
vela exec testapp -- printenv | grep DEMO_HELLO
```
```console
$ vela exec testapp -- printenv | grep DEMO_HELLO
DEMO_HELLO=helloworld
```

View File

@@ -8,18 +8,14 @@ A typical set of deployment environment is `test`, `staging`, `prod`, etc.
## Create environment
```bash
vela env init demo --email my@email.com
```
```console
$ vela env init demo --email my@email.com
environment demo created, Namespace: default, Email: my@email.com
```
## Check the deployment environment metadata
```bash
vela env ls
```
```console
$ vela env ls
NAME CURRENT NAMESPACE EMAIL DOMAIN
default default
demo * default my@email.com
@@ -32,16 +28,12 @@ By default, the environment will use `default` namespace in K8s.
You could change the config by executing the environment again.
```bash
vela env init demo --namespace demo
```
```console
$ vela env init demo --namespace demo
environment demo created, Namespace: demo, Email: my@email.com
```
```bash
vela env ls
```
```console
$ vela env ls
NAME CURRENT NAMESPACE EMAIL DOMAIN
default default
demo * demo my@email.com
@@ -58,9 +50,7 @@ your app by this domain with an mTLS supported automatically.
For example, you could get the public IP from ingress service.
```bash
kubectl get svc -A | grep LoadBalancer
```
```console
$ kubectl get svc -A | grep LoadBalancer
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
nginx-ingress-lb LoadBalancer 172.21.2.174 123.57.10.233 80:32740/TCP,443:32086/TCP 41d
```
@@ -76,9 +66,7 @@ You could also use `123.57.10.233.xip.io` as your domain, if you don't have a cu
```bash
vela env init demo --domain 123.57.10.233.xip.io
```
```console
$ vela env init demo --domain 123.57.10.233.xip.io
environment demo updated, Namespace: demo, Email: my@email.com
```
@@ -99,9 +87,7 @@ servcies:
```
```
curl http://123.57.10.233.xip.io/testapp
```
```console
$ curl http://123.57.10.233.xip.io/testapp
Hello World
```

View File

@@ -4,7 +4,7 @@ title: Execute Commands in Container
Run:
```
vela exec testapp -- /bin/sh
$ vela exec testapp -- /bin/sh
```
This open a shell within the container of testapp.

View File

@@ -88,8 +88,8 @@ In the following workflow, we will build and deploy an example NodeJS app under
git clone and go to the testapp directory:
```bash
git clone https://github.com/oam-dev/kubevela.git
cd kubevela/docs/examples/testapp
$ git clone https://github.com/oam-dev/kubevela.git
$ cd kubevela/docs/examples/testapp
```
The example contains NodeJS app code, Dockerfile to build the app.
@@ -108,9 +108,7 @@ We are going to use it to build and deploy the app.
Run the following command:
```bash
vela up
```
```console
$ vela up
Parsing vela.yaml ...
Loading templates ...
@@ -141,9 +139,7 @@ App has not been deployed, creating a new deployment...
Check the status of the service:
```bash
vela status testapp
```
```console
$ vela status testapp
About:
Name: testapp
@@ -183,7 +179,7 @@ Add local option to `build`:
Then deploy the app to kind:
```bash
vela up
$ vela up
```
<details><summary>(Advanced) Check rendered manifests</summary>
@@ -241,7 +237,7 @@ services:
Then deploy Appfile again to update the application:
```bash
vela up
$ vela up
```
Congratulations! You have just deployed an app using `Appfile`.

View File

@@ -5,9 +5,7 @@ title: Port Forwarding
Once your web services of the application deployed, you can access it locally via `port-forward`.
```bash
vela ls
```
```console
$ vela ls
NAME APP WORKLOAD TRAITS STATUS CREATED-TIME
express-server testapp webservice Deployed 2020-09-18 22:42:04 +0800 CST
```
@@ -15,13 +13,11 @@ express-server testapp webservice Deployed 2020-09-18 22:42:04 +0800
It will directly open browser for you.
```bash
vela port-forward testapp
```
```console
$ vela port-forward testapp
Forwarding from 127.0.0.1:8080 -> 80
Forwarding from [::1]:8080 -> 80
Forward successfully! Opening browser ...
Handling connection for 8080
Handling connection for 8080
```
```

View File

@@ -30,9 +30,7 @@ Also, KubeVela is by design a Kubernetes controller (i.e. works on server side),
Occasionally you might hit the issue as below. It happens when the last KubeVela release deletion hasn't completed.
```
vela install
```
```console
$ vela install
- Installing Vela Core Chart:
install chart vela-core, version 0.1.0, desc : A Helm chart for Kube Vela core, contains 35 file
Failed to install the chart with error: serviceaccounts "cert-manager-cainjector" is forbidden: unable to create new content in namespace cert-manager because it is being terminated
@@ -46,9 +44,7 @@ Error: failed to create resource: serviceaccounts "cert-manager-cainjector" is f
Take a break and try again in a few seconds.
```
vela install
```
```console
$ vela install
- Installing Vela Core Chart:
Vela system along with OAM runtime already exist.
Automatically discover capabilities successfully ✅ Add(0) Update(0) Delete(8)
@@ -69,9 +65,7 @@ TYPE CATEGORY DESCRIPTION
And manually apply all WorkloadDefinition and TraitDefinition manifests to have all capabilities back.
```
kubectl apply -f charts/vela-core/templates/defwithtemplate
```
```console
$ kubectl apply -f charts/vela-core/templates/defwithtemplate
traitdefinition.core.oam.dev/autoscale created
traitdefinition.core.oam.dev/scaler created
traitdefinition.core.oam.dev/metrics created
@@ -80,11 +74,8 @@ traitdefinition.core.oam.dev/route created
workloaddefinition.core.oam.dev/task created
workloaddefinition.core.oam.dev/webservice created
workloaddefinition.core.oam.dev/worker created
```
```
vela workloads
```
```console
$ vela workloads
Automatically discover capabilities successfully ✅ Add(8) Update(0) Delete(0)
TYPE CATEGORY DESCRIPTION
@@ -108,9 +99,7 @@ worker Long-running scalable backend worker without network endpoint
Occasionally you might hit the issue as below. It happens when there is an old OAM Kubernetes Runtime release, or you applied `ScopeDefinition` before.
```
vela install
```
```console
$ vela install
- Installing Vela Core Chart:
install chart vela-core, version 0.1.0, desc : A Helm chart for Kube Vela core, contains 35 file
Failed to install the chart with error: ScopeDefinition "healthscopes.core.oam.dev" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; annotation validation error: key "meta.helm.sh/release-name" must equal "kubevela": current value is "oam"; annotation validation error: key "meta.helm.sh/release-namespace" must equal "vela-system": current value is "oam-system"
@@ -124,15 +113,10 @@ vela install
Delete `ScopeDefinition` "healthscopes.core.oam.dev" and try again.
```
kubectl delete ScopeDefinition "healthscopes.core.oam.dev"
```
```console
$ kubectl delete ScopeDefinition "healthscopes.core.oam.dev"
scopedefinition.core.oam.dev "healthscopes.core.oam.dev" deleted
```
```
vela install
```
```console
$ vela install
- Installing Vela Core Chart:
install chart vela-core, version 0.1.0, desc : A Helm chart for Kube Vela core, contains 35 file
Successfully installed the chart, status: deployed, last deployed time = 2020-12-03 16:26:41.491426 +0800 CST m=+4.026069452
@@ -157,9 +141,7 @@ TYPE CATEGORY DESCRIPTION
When you look into the logs of Pod kubevela-vela-core and found the issue as below.
```
kubectl get pod -n vela-system -l app.kubernetes.io/name=vela-core
```
```console
$ kubectl get pod -n vela-system -l app.kubernetes.io/name=vela-core
NAME READY STATUS RESTARTS AGE
kubevela-vela-core-f8b987775-wjg25 0/1 - 0 35m
```
@@ -170,7 +152,7 @@ kubevela-vela-core-f8b987775-wjg25 0/1 - 0 35m
You can use github container registry instead.
```
docker pull ghcr.io/oam-dev/kubevela/vela-core:latest
$ docker pull ghcr.io/oam-dev/kubevela/vela-core:latest
```
### Warning: Namespace cert-manager exists
@@ -179,9 +161,7 @@ If you hit the issue as below, an `cert-manager` release might exist whose names
with KubeVela.
```
vela install
```
```console
$ vela install
- Installing Vela Core Chart:
install chart vela-core, version 0.1.0, desc : A Helm chart for Kube Vela core, contains 35 file
Failed to install the chart with error: Namespace "cert-manager" in namespace "" exists and cannot be imported into the current release: invalid ownership metadata; label validation error: missing key "app.kubernetes.io/managed-by": must be set to "Helm"; annotation validation error: missing key "meta.helm.sh/release-name": must be set to "kubevela"; annotation validation error: missing key "meta.helm.sh/release-namespace": must be set to "vela-system"
@@ -200,21 +180,13 @@ Try these steps to fix the problem.
- Install KubeVela again
```
helm delete cert-manager -n cert-manager
```
```console
$ helm delete cert-manager -n cert-manager
release "cert-manager" uninstalled
```
```
kubectl delete ns cert-manager
```
```console
$ kubectl delete ns cert-manager
namespace "cert-manager" deleted
```
```
vela install
```
```console
$ vela install
- Installing Vela Core Chart:
install chart vela-core, version 0.1.0, desc : A Helm chart for Kube Vela core, contains 35 file
Successfully installed the chart, status: deployed, last deployed time = 2020-12-04 10:46:46.782617 +0800 CST m=+4.248889379
@@ -277,17 +249,12 @@ is enabled with command `kubectl top nodes` or `kubectl top pods`.
If the output is similar as below, the metrics is enabled.
```shell
kubectl top nodes
```
```console
$ kubectl top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
cn-hongkong.10.0.1.237 288m 7% 5378Mi 78%
cn-hongkong.10.0.1.238 351m 8% 5113Mi 74%
```
```
kubectl top pods
```
```console
$ kubectl top pods
NAME CPU(cores) MEMORY(bytes)
php-apache-65f444bf84-cjbs5 0m 1Mi
wordpress-55c59ccdd5-lf59d 1m 66Mi
@@ -312,7 +279,7 @@ Please refer to [metrics server debug guide](https://help.aliyun.com/document_de
Install metrics server as below, or you can install the [latest version](https://github.com/kubernetes-sigs/metrics-server#installation).
```shell
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.7/components.yaml
$ kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.7/components.yaml
```
Also add the following part under `.spec.template.spec.containers` in the yaml file loaded by `kubectl edit deploy -n kube-system metrics-server`.
@@ -330,7 +297,7 @@ command:
Enable it with following command.
```shell
minikube addons enable metrics-server
$ minikube addons enable metrics-server
```

View File

@@ -1,41 +0,0 @@
---
title: Kubectl plugin
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Install vela kubectl plugin can help you to ship applications more easily!
## Installation
See [advanced-install](../../advanced-install#install-kubectl-vela-plugin)
## Usage
```shell
$ kubectl vela -h
A Highly Extensible Platform Engine based on Kubernetes and Open Application Model.
Usage:
kubectl vela [flags]
kubectl vela [command]
Available Commands:
comp Show components in capability registry
dry-run Dry Run an application, and output the K8s resources as
result to stdout, only CUE template supported for now
live-diff Dry-run an application, and do diff on a specific app
revison. The provided capability definitions will be used
during Dry-run. If any capabilities used in the app are not
found in the provided ones, it will try to find from
cluster.
show Show the reference doc for a workload type or trait
trait Show traits in capability registry
version Prints out build version information
Flags:
-h, --help help for vela
Use "kubectl vela [command] --help" for more information about a command.
```

View File

@@ -14,8 +14,6 @@ Let's check the available components in fresh new KubeVela.
```shell
kubectl get comp -n vela-system
```
```console
NAME WORKLOAD-KIND DESCRIPTION
task Job Describes jobs that run code or a script to completion.
webservice Deployment Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers.
@@ -25,9 +23,7 @@ worker Deployment Describes long-running, scalable, containerize
To show the specification for given component, you could use `vela show`.
```shell
kubectl vela show webservice
```
```console
$ kubectl vela show webservice
# Properties
+------------------+----------------------------------------------------------------------------------+-----------------------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -77,9 +73,7 @@ spec:
Traits are platform provided features that could *overlay* a given component with extra operational behaviors.
```shell
kubectl get trait -n vela-system
```
```console
$ kubectl get trait -n vela-system
NAME APPLIES-TO DESCRIPTION
cpuscaler [webservice worker] Automatically scale the component based on CPU usage.
ingress [webservice worker] Enable public web traffic for the component.
@@ -90,9 +84,7 @@ sidecar [webservice worker] Inject a sideca
Let's check the specification of `sidecar` trait.
```shell
kubectl vela show sidecar
```
```console
$ kubectl vela show sidecar
# Properties
+---------+-----------------------------------------+----------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -145,18 +137,14 @@ spec:
## Step 4: Deploy the Application
```shell
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/enduser/sample.yaml
```
```console
$ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/enduser/sample.yaml
application.core.oam.dev/website created
```
You'll get the application becomes `running`.
```shell
kubectl get application
```
```console
$ kubectl get application
NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
website frontend webservice running true 4m54s
```
@@ -164,9 +152,7 @@ website frontend webservice running true 4m54s
Check the details of the application.
```shell
kubectl get app website -o yaml
```
```console
$ kubectl get app website -o yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
@@ -226,9 +212,7 @@ Specifically:
When updating an application entity, KubeVela will create a new revision for this change.
```shell
kubectl get apprev -l app.oam.dev/name=website
```
```console
$ kubectl get apprev -l app.oam.dev/name=website
NAME AGE
website-v1 35m
```

View File

@@ -15,9 +15,7 @@ The cloud services will be consumed by the application via [Service Binding Trai
Check the parameters of cloud resource components and trait.
```shell
kubectl vela show alibaba-rds
```
```console
$ kubectl vela show alibaba-rds
# Properties
+----------------------------+-------------------------------------------------------------------------+-----------------------------------------------------------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -36,11 +34,8 @@ kubectl vela show alibaba-rds
| namespace | The secret namespace which the cloud resource connection will be written to | string | false | |
+-----------+-----------------------------------------------------------------------------+--------+----------+---------+
```
```shell
kubectl vela show service-binding
```
```console
$ kubectl vela show service-binding
# Properties
+-------------+------------------------------------------------+------------------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -111,9 +106,8 @@ spec:
Check the parameters of cloud service component:
```shell
kubectl vela show alibaba-rds
```
```console
$ kubectl vela show alibaba-rds
# Properties
+---------------+------------------------------------------------+--------+----------+--------------------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -178,16 +172,11 @@ spec:
Deploy and verify the application (by either provider is OK).
```shell
kubectl get application
```
```console
$ kubectl get application
NAME AGE
webapp 46m
```
```shell
kubectl port-forward deployment/express-server 80:80
```
```console
$ kubectl port-forward deployment/express-server 80:80
Forwarding from 127.0.0.1:80 -> 80
Forwarding from [::1]:80 -> 80
Handling connection for 80

View File

@@ -4,48 +4,6 @@ title: Want More?
Components in KubeVela are designed to be brought by users.
## 1. Get from capability center
KubeVela allows you to explore capabilities maintained by platform team.
There are two commands in kubectl vela plugin: `comp` and `trait`.
In case you haven't installed kubectl vela plugin: see [this](../../developers/references/kubectl-plugin#install-kubectl-vela-plugin).
### 1. list
For example, let's try to list all available components in a registry:
```shell
$ kubectl vela comp --discover
Showing components from registry: https://registry.kubevela.net
NAME REGITSRY DEFINITION
cloneset default clonesets.apps.kruise.io
kruise-statefulset default statefulsets.apps.kruise.io
openfaas default functions.openfaas.com
````
Note that the `--discover` flag means show all components not in your cluster.
### 2. install
Then you can install a component like:
```shell
$ kubectl vela comp get cloneset
Installing component capability cloneset
Successfully install trait: cloneset
```
### 3.verify
```shell
$ kubectl get componentdefinition -n vela-system
NAME WORKLOAD-KIND DESCRIPTION
cloneset CloneSet Describes long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers. It was implemented by OpenKruise Cloneset.
...(other componentDefinition)
```
By default, the two commands will retrieve capabilities from [repo](https://registry.kubevela.net) maintained by KubeVela.
## 2. Designed by yourself
Check below documentations about how to bring your own components to the system in various approaches.
- [Helm](../../platform-engineers/helm/component) - Helm chart is a natural form of component, note that you need to have a valid Helm repository (e.g. GitHub repo or a Helm hub) to host the chart in this case.

View File

@@ -35,8 +35,6 @@ spec:
```shell
kubectl vela dry-run -f app.yaml
```
```console
---
# Application(vela-app) -- Comopnent(express-server)
---
@@ -126,9 +124,7 @@ Assume you have just deployed the application in dry-run section.
Then you can list the revisions of the Application.
```shell
kubectl get apprev -l app.oam.dev/name=vela-app
```
```console
$ kubectl get apprev -l app.oam.dev/name=vela-app
NAME AGE
vela-app-v1 50s
```
@@ -377,4 +373,4 @@ while you just want to focus on the changed ones.
+ path: /
```
</details>
</details>

View File

@@ -1,306 +0,0 @@
---
title: Advanced Rollout Plan
---
The rollout plan feature in KubeVela is essentially provided by `AppRollout` API.
## AppRollout Specification
The following describes all the available fields of a AppRollout:
```yaml
apiVersion: core.oam.dev/v1beta1
kind: AppRollout
metadata:
name: rolling-example
spec:
# SourceAppRevisionName contains the name of the appRevisionName that we need to upgrade from.
# it can be empty only when you want to scale an application. +optional
sourceAppRevisionName: test-rolling-v1
# TargetAppRevisionName contains the name of the appRevisionName that we need to upgrade to.
targetAppRevisionName: test-rolling-v2
# The list of component to upgrade in the application.
# We only support single component application so far. +optional
componentList:
- metrics-provider
# RolloutPlan is the details on how to rollout the resources
rolloutPlan:
# RolloutStrategy defines strategies for the rollout plan
# the value can be IncreaseFirst or DecreaseFirst
# Defaults to IncreaseFirst. +optional
rolloutStrategy: "IncreaseFirst"
# The exact distribution among batches.
# its size has to be exactly the same as the NumBatches (if set)
# The total number cannot exceed the targetSize or the size of the source resource
# We will IGNORE the last batch's replica field if it's a percentage since round errors can lead to inaccurate sum
# We highly recommend to leave the last batch's replica field empty
rolloutBatches:
# Replicas is the number of pods to upgrade in this batch
# it can be an absolute number (ex: 5) or a percentage of total pods
# we will ignore the percentage of the last batch to just fill the gap
# Below is an example the first batch contains only 1 pod while the rest of the batches split the rest.
- replicas: 1
- replicas: 50%
- replicas: 50%
# All pods in the batches up to the batchPartition (included) will have
# the target resource specification while the rest still have the source resource
# This is designed for the operators to manually rollout
# Default is the the number of batches which will rollout all the batches. +optional
batchPartition: 1
# Paused the rollout
# defaults to false. +optional
paused: false
# The size of the target resource. In rollout operation it's the same as the size of the source resource.
# when use rollout to scale an application targetSize is the target source you want scale to. +optional
targetSize: 4
```
## Basic Usage
1. Deploy application
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: test-rolling
annotations:
"app.oam.dev/rolling-components": "metrics-provider"
"app.oam.dev/rollout-template": "true"
spec:
components:
- name: metrics-provider
type: worker
properties:
cmd:
- ./podinfo
- stress-cpu=1
image: stefanprodan/podinfo:4.0.6
port: 8080
replicas: 5
```
Verify AppRevision `test-rolling-v1` have generated
```shell
$ kubectl get apprev test-rolling-v1
NAME AGE
test-rolling-v1 9s
```
2. Attach the following rollout plan to upgrade the application to v1
```yaml
apiVersion: core.oam.dev/v1beta1
kind: AppRollout
metadata:
name: rolling-example
spec:
# application (revision) reference
targetAppRevisionName: test-rolling-v1
componentList:
- metrics-provider
rolloutPlan:
rolloutStrategy: "IncreaseFirst"
rolloutBatches:
- replicas: 10%
- replicas: 40%
- replicas: 50%
targetSize: 5
```
User can check the status of the ApplicationRollout and wait for the rollout to complete.
3. User can continue to modify the application image tag and apply.This will generate new AppRevision `test-rolling-v2`
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: test-rolling
annotations:
"app.oam.dev/rolling-components": "metrics-provider"
"app.oam.dev/rollout-template": "true"
spec:
components:
- name: metrics-provider
type: worker
properties:
cmd:
- ./podinfo
- stress-cpu=1
image: stefanprodan/podinfo:5.0.2
port: 8080
replicas: 5
```
Verify AppRevision `test-rolling-v2` have generated
```shell
$ kubectl get apprev test-rolling-v2
NAME AGE
test-rolling-v2 7s
```
4. Apply the application rollout that upgrade the application from v1 to v2
```yaml
apiVersion: core.oam.dev/v1beta1
kind: AppRollout
metadata:
name: rolling-example
spec:
# application (revision) reference
sourceAppRevisionName: test-rolling-v1
targetAppRevisionName: test-rolling-v2
componentList:
- metrics-provider
rolloutPlan:
rolloutStrategy: "IncreaseFirst"
rolloutBatches:
- replicas: 1
- replicas: 2
- replicas: 2
```
User can check the status of the ApplicationRollout and see the rollout completes, and the
ApplicationRollout's "Rolling State" becomes `rolloutSucceed`
## Advanced Usage
Using `AppRollout` separately can enable some advanced use case.
### Revert
5. Apply the application rollout that revert the application from v2 to v1
```yaml
apiVersion: core.oam.dev/v1beta1
kind: AppRollout
metadata:
name: rolling-example
spec:
# application (revision) reference
sourceAppRevisionName: test-rolling-v2
targetAppRevisionName: test-rolling-v1
componentList:
- metrics-provider
rolloutPlan:
rolloutStrategy: "IncreaseFirst"
rolloutBatches:
- replicas: 1
- replicas: 2
- replicas: 2
```
### Skip Revision Rollout
6. User can apply this yaml continue to modify the application image tag.This will generate new AppRevision `test-rolling-v3`
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: test-rolling
annotations:
"app.oam.dev/rolling-components": "metrics-provider"
"app.oam.dev/rollout-template": "true"
spec:
components:
- name: metrics-provider
type: worker
properties:
cmd:
- ./podinfo
- stress-cpu=1
image: stefanprodan/podinfo:5.2.0
port: 8080
replicas: 5
```
Verify AppRevision `test-rolling-v3` have generated
```shell
$ kubectl get apprev test-rolling-v3
NAME AGE
test-rolling-v3 7s
```
7. Apply the application rollout that rollout the application from v1 to v3
```yaml
apiVersion: core.oam.dev/v1beta1
kind: AppRollout
metadata:
name: rolling-example
spec:
# application (revision) reference
sourceAppRevisionName: test-rolling-v1
targetAppRevisionName: test-rolling-v3
componentList:
- metrics-provider
rolloutPlan:
rolloutStrategy: "IncreaseFirst"
rolloutBatches:
- replicas: 1
- replicas: 2
- replicas: 2
```
### Scale the application
Before using AppRollout to scale an application, we must be aware of the real status of workload now. Check the workload status.
```shell
$ kubectl get deploy metrics-provider-v3
NAME READY UP-TO-DATE AVAILABLE AGE
metrics-provider-v3 5/5 5 5 10m
```
Last target appRevision is `test-rolling-v3` and the workload have 5 replicas currently.
8. Apply the appRollout increase the replicas nums of workload to 7.
```yaml
apiVersion: core.oam.dev/v1beta1
kind: AppRollout
metadata:
name: rolling-example
spec:
# sourceAppRevisionName is empty means this is a scale operation
targetAppRevisionName: test-rolling-v3
componentList:
- metrics-provider
rolloutPlan:
rolloutStrategy: "IncreaseFirst"
rolloutBatches:
# split two batches to scale. First batch increase 1 pod and second increase 1.
- replicas: 1
- replicas: 1
# targetSize means that final total size of workload is 7
targetSize: 7
```
## More Details About `AppRollout`
### Design Principles and Goals
There are several attempts at solving rollout problem in the cloud native community. However, none
of them provide a true rolling style upgrade. For example, flagger supports Blue/Green, Canary
and A/B testing. Therefore, we decide to add support for batch based rolling upgrade as
our first style to support in KubeVela.
We design KubeVela rollout solutions with the following principles in mind
- First, we want all flavors of rollout controllers share the same core rollout
related logic. The trait and application related logic can be easily encapsulated into its own
package.
- Second, the core rollout related logic is easily extensible to support different type of
workloads, i.e. Deployment, CloneSet, Statefulset, DaemonSet or even customized workloads.
- Thirdly, the core rollout related logic has a well documented state machine that
does state transition explicitly.
- Finally, the controllers can support all the rollout/upgrade needs of an application running
in a production environment including Blue/Green, Canary and A/B testing.
### State Transition
Here is the high level state transition graph
![](../../resources/approllout-status-transition.jpg)
### Roadmap
Our recent roadmap for rollout plan is [here](./roadmap).

View File

@@ -1,240 +0,0 @@
---
title: Placement
---
## Introduction
In this section, we will introduce how to use KubeVela to place application across multiple clusters with traffic management enabled. For traffic management, KubeVela currently allows you to split the traffic onto both the old and new revisions during rolling update and verify the new version while preserving service availability.
### AppDeployment
The `AppDeployment` API in KubeVela is provided to satisfy such requirements. Here's an overview of the API:
```yaml
apiVersion: core.oam.dev/v1beta1
kind: AppDeployment
metadata:
name: sample-appdeploy
spec:
traffic:
hosts:
- example.com
http:
- match:
# match any requests to 'example.com/example-app'
- uri:
prefix: "/example-app"
# split traffic 50/50 on v1/v2 versions of the app
weightedTargets:
- revisionName: example-app-v1
componentName: testsvc
port: 80
weight: 50
- revisionName: example-app-v2
componentName: testsvc
port: 80
weight: 50
appRevisions:
- # Name of the AppRevision.
# Each modification to Application would generate a new AppRevision.
revisionName: example-app-v1
# Cluster specific workload placement config
placement:
- clusterSelector:
# You can select Clusters by name or labels.
# If multiple clusters is selected, one will be picked via a unique hashing algorithm.
labels:
tier: production
name: prod-cluster-1
distribution:
replicas: 5
- # If no clusterSelector is given, it will use the host cluster in which this CR exists
distribution:
replicas: 5
- revisionName: example-app-v2
placement:
- clusterSelector:
labels:
tier: production
name: prod-cluster-1
distribution:
replicas: 5
- distribution:
replicas: 5
```
### Cluster
The clusters selected in the `placement` part from above is defined in Cluster CRD. Here's what it looks like:
```yaml
apiVersion: core.oam.dev/v1beta1
kind: Cluster
metadata:
name: prod-cluster-1
labels:
tier: production
spec:
kubeconfigSecretRef:
name: kubeconfig-cluster-1 # the secret name
```
The secret must contain the kubeconfig credentials in `config` field:
```yaml
apiVersion: v1
kind: Secret
metadata:
name: kubeconfig-cluster-1
data:
config: ... # kubeconfig data
```
## Quickstart
Here's a step-by-step tutorial for you to try out. All of the yaml files are from [`docs/examples/appdeployment/`](https://github.com/oam-dev/kubevela/tree/master/docs/examples/appdeployment).
You must run all commands in that directory.
1. Create an Application
```bash
cat <<EOF | kubectl apply -f -
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: example-app
annotations:
app.oam.dev/revision-only: "true"
spec:
components:
- name: testsvc
type: webservice
properties:
addRevisionLabel: true
image: crccheck/hello-world
port: 8000
EOF
```
This will create `example-app-v1` AppRevision. Check it:
```bash
kubectl get applicationrevisions.core.oam.dev
```
```console
NAME AGE
example-app-v1 116s
```
> Note: with `app.oam.dev/revision-only: "true"` annotation, above `Application` resource won't create any pod instances and leave the real deployment process to `AppDeployment`.
1. Then use the above AppRevision to create an AppDeployment.
```bash
kubectl apply -f appdeployment-1.yaml
```
> Note: in order to AppDeployment to work, your workload object must have a `spec.replicas` field for scaling.
1. Now you can check that there will 1 deployment and 2 pod instances deployed
```bash
kubectl get deploy
```
```console
NAME READY UP-TO-DATE AVAILABLE AGE
testsvc-v1 2/2 2 0 27s
```
1. Update Application properties:
```bash
cat <<EOF | kubectl apply -f -
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: example-app
annotations:
app.oam.dev/revision-only: "true"
spec:
components:
- name: testsvc
type: webservice
properties:
addRevisionLabel: true
image: nginx
port: 80
EOF
```
This will create a new `example-app-v2` AppRevision. Check it:
```bash
kubectl get applicationrevisions.core.oam.dev
```
```console
NAME
example-app-v1
example-app-v2
```
1. Then use the two AppRevisions to update the AppDeployment:
```bash
kubectl apply -f appdeployment-2.yaml
```
(Optional) If you have Istio installed, you can apply the AppDeployment with traffic split:
```bash
# set up gateway if not yet
kubectl apply -f gateway.yaml
kubectl apply -f appdeployment-2-traffic.yaml
```
Note that for traffic split to work, your must set the following pod labels in workload cue templates (see [webservice.cue](https://github.com/oam-dev/kubevela/blob/master/hack/vela-templates/cue/webservice.cue)):
```shell
"app.oam.dev/component": context.name
"app.oam.dev/appRevision": context.appRevision
```
1. Now you can check that there will 1 deployment and 1 pod per revision.
```bash
kubectl get deploy
```
```console
NAME READY UP-TO-DATE AVAILABLE AGE
testsvc-v1 1/1 1 1 2m14s
testsvc-v2 1/1 1 1 8s
```
(Optional) To verify traffic split:
```bash
# run this in another terminal
kubectl -n istio-system port-forward service/istio-ingressgateway 8080:80
```
```console
Forwarding from 127.0.0.1:8080 -> 8080
Forwarding from [::1]:8080 -> 8080
# The command should return pages of either docker whale or nginx in 50/50
$ curl -H "Host: example-app.example.com" http://localhost:8080/
```
1. Cleanup:
```bash
kubectl delete appdeployments.core.oam.dev --all
kubectl delete applications.core.oam.dev --all
```

View File

@@ -37,7 +37,7 @@ spec:
```
3. Check the reference of the aggregated health probe (`status.service.scopes`).
```shell
kubectl get app vela-app -o yaml
$ kubectl get app vela-app -o yaml
```
```yaml
apiVersion: core.oam.dev/v1beta1
@@ -57,7 +57,7 @@ status:
```
4.Check health scope detail.
```shell
kubectl get healthscope health-check -o yaml
$ kubectl get healthscope health-check -o yaml
```
```yaml
apiVersion: core.oam.dev/v1alpha2

View File

@@ -62,10 +62,5 @@ spec:
User can check the status of the application and see the rollout completes, and the
application's `status.rollout.rollingState` becomes `rolloutSucceed`.
## Advanced Usage
If you want to control and rollout the specific application revisions, or do revert, please refer to [Advanced Usage](advanced-rollout) to learn more details.

View File

@@ -38,9 +38,7 @@ kubectl apply -f myapp.yaml
On runtime cluster, check the workload has been created successfully.
```bash
kubectl get deployments
```
```console
$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
express-server 1/1 1 1 15s
```
@@ -48,17 +46,13 @@ express-server 1/1 1 1 15s
Check the `labels`.
```bash
kubectl get deployments express-server -o jsonpath='{.spec.template.metadata.labels}'
```
```console
$ kubectl get deployments express-server -o jsonpath='{.spec.template.metadata.labels}'
{"app.oam.dev/component":"express-server","release": "stable"}
```
Check the `annotations`.
```bash
kubectl get deployments express-server -o jsonpath='{.spec.template.metadata.annotations}'
```
```console
$ kubectl get deployments express-server -o jsonpath='{.spec.template.metadata.annotations}'
{"description":"web application"}
```

View File

@@ -7,9 +7,7 @@ title: Ingress
The `ingress` trait exposes a component to public Internet via a valid domain.
```shell
kubectl vela show ingress
```
```console
$ kubectl vela show ingress
# Properties
+--------+------------------------------------------------------------------------------+----------------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -43,18 +41,14 @@ spec:
```
```bash
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/vela-app.yaml
```
```console
$ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/vela-app.yaml
application.core.oam.dev/first-vela-app created
```
Check the status until we see `status` is `running` and services are `healthy`:
```bash
kubectl get application first-vela-app -w
```
```console
$ kubectl get application first-vela-app -w
NAME COMPONENT TYPE PHASE HEALTHY STATUS AGE
first-vela-app express-server webservice healthChecking 14s
first-vela-app express-server webservice running true 42s
@@ -63,9 +57,7 @@ first-vela-app express-server webservice running true
Check the trait detail for the its visiting url:
```shell
kubectl get application first-vela-app -o yaml
```
```console
$ kubectl get application first-vela-app -o yaml
apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
@@ -87,9 +79,7 @@ spec:
Then you will be able to visit this application via its domain.
```
curl -H "Host:testsvc.example.com" http://<your ip address>/
```
```console
$ curl -H "Host:testsvc.example.com" http://<your ip address>/
<xmp>
Hello World

View File

@@ -4,56 +4,4 @@ title: Want More?
Traits in KubeVela are designed as modularized building blocks, they are fully customizable and pluggable.
## 1. Get from capability canter
KubeVela allows you to explore capabilities maintained by platform team. There are two commands in kubectl vela
plugin: `comp` and `trait`.
In case you haven't installed kubectl vela plugin: see [this](../../developers/references/kubectl-plugin#install-kubectl-vela-plugin).
### 1. list
For example, let's try to list all available traits in registry:
```shell
$ kubectl vela trait --discover
Showing traits from registry: https://registry.kubevela.net
NAME REGISTRY DEFINITION APPLIES-TO
service-account default [webservice worker]
env default [webservice worker]
flagger-rollout default canaries.flagger.app [webservice]
init-container default [webservice worker]
keda-scaler default scaledobjects.keda.sh [deployments.apps]
metrics default metricstraits.standard.oam.dev [webservice backend task]
node-affinity default [webservice worker]
route default routes.standard.oam.dev [webservice]
virtualgroup default [webservice worker]
```
Note that the `--discover` flag means show all traits not in your cluster.
### 2. install
Then you can install a trait like:
```shell
$ kubectl vela trait get init-container
Installing component capability init-container
Successfully install trait: init-container
```
### 3.verify
```shell
$ kubectl get traitdefinition -n vela-system
NAME APPLIES-TO DESCRIPTION
init-container ["webservice","worker"] add an init container with a shared volume.
...(other trait definitions)
```
By default, the two commands will retrieve capabilities
from [repo](https://registry.kubevela.net) maintained by KubeVela.
## 2. Designed by yourself
Check [this documentation](../../platform-engineers/cue/trait) about how to design and enable your own traits in
KubeVela platform.
Check [this documentation](../../platform-engineers/cue/trait) about how to design and enable your own traits in KubeVela platform.

View File

@@ -5,9 +5,7 @@ title: Manual Scaling
The `scaler` trait allows you to scale your component instance manually.
```shell
kubectl vela show scaler
```
```console
$ kubectl vela show scaler
# Properties
+----------+--------------------------------+------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -50,21 +48,17 @@ spec:
Apply the sample application:
```shell
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/enduser/sample-manual.yaml
```
```console
$ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/enduser/sample-manual.yaml
application.core.oam.dev/website configured
```
In runtime cluster, you can see the underlying deployment of `frontend` component has 2 replicas now.
```shell
kubectl get deploy -l app.oam.dev/name=website
```
```console
$ kubectl get deploy -l app.oam.dev/name=website
NAME READY UP-TO-DATE AVAILABLE AGE
backend 1/1 1 1 19h
frontend 2/2 2 2 19h
```
To scale up or scale down, you just need to modify the `replicas` field of `scaler` trait and re-apply the YAML.
To scale up or scale down, you just need to modify the `replicas` field of `scaler` trait and re-apply the YAML.

View File

@@ -2,10 +2,57 @@
title: Service Binding
---
# Description
Service binding trait will bind data from Kubernetes `Secret` to the application container's ENV.
Service binding trait will bind data from Kubernetes `Secret` to the application container's ENV.
## Sample
```yaml
apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
annotations:
definition.oam.dev/description: "binding cloud resource secrets to pod env"
name: service-binding
spec:
appliesToWorkloads:
- webservice
- worker
schematic:
cue:
template: |
patch: {
spec: template: spec: {
// +patchKey=name
containers: [{
name: context.name
// +patchKey=name
env: [
for envName, v in parameter.envMappings {
name: envName
valueFrom: {
secretKeyRef: {
name: v.secret
if v["key"] != _|_ {
key: v.key
}
if v["key"] == _|_ {
key: envName
}
}
}
},
]
}]
}
}
parameter: {
// +usage=The mapping of environment variables to secret
envMappings: [string]: [string]: string
}
```
With the help of this `service-binding` trait, you can explicitly set parameter `envMappings` to mapping all
environment names with secret key. Here is an example.
```yaml
apiVersion: core.oam.dev/v1beta1
@@ -43,16 +90,3 @@ spec:
secretName: db-conn
```
For more detailed samples, please reference to [cloud resource](../components/cloud-services)
## Specification
```console
# Properties
+-------------+------------------------------------------------+------------------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
+-------------+------------------------------------------------+------------------+----------+---------+
| envMappings | The mapping of environment variables to secret | map[string]{...} | true | |
+-------------+------------------------------------------------+------------------+----------+---------+
```

View File

@@ -7,9 +7,7 @@ The `sidecar` trait allows you to attach a sidecar container to the component.
## Show the Usage of Sidecar
```shell
kubectl vela show sidecar
```
```console
$ kubectl vela show sidecar
# Properties
+---------+-----------------------------------------+-----------------------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -82,9 +80,7 @@ kubectl apply -f app.yaml
On runtime cluster, check the name of running pod.
```shell
kubectl get pod
```
```console
$ kubectl get pod
NAME READY STATUS RESTARTS AGE
log-gen-worker-76945f458b-k7n9k 2/2 Running 0 90s
```
@@ -92,9 +88,7 @@ log-gen-worker-76945f458b-k7n9k 2/2 Running 0 90s
And check the logging output of sidecar.
```shell
kubectl logs -f log-gen-worker-76945f458b-k7n9k count-log
```
```console
$ kubectl logs -f log-gen-worker-76945f458b-k7n9k count-log
0: Fri Apr 16 11:08:45 UTC 2021
1: Fri Apr 16 11:08:46 UTC 2021
2: Fri Apr 16 11:08:47 UTC 2021
@@ -105,4 +99,4 @@ kubectl logs -f log-gen-worker-76945f458b-k7n9k count-log
7: Fri Apr 16 11:08:52 UTC 2021
8: Fri Apr 16 11:08:53 UTC 2021
9: Fri Apr 16 11:08:54 UTC 2021
```
```

View File

@@ -10,13 +10,11 @@ Cloud volumes are not built-in capabilities in KubeVela so you need to enable th
Install and check the `TraitDefinition` for AWS EBS volume trait.
```shell
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/app-with-volumes/td-awsEBS.yaml
$ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/examples/app-with-volumes/td-awsEBS.yaml
```
```shell
kubectl vela show aws-ebs-volume
```
```console
$ kubectl vela show aws-ebs-volume
+-----------+----------------------------------------------------------------+--------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
+-----------+----------------------------------------------------------------+--------+----------+---------+

View File

@@ -5,7 +5,7 @@ title: Installation
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
> For upgrading existing KubeVela, please read the [upgrade guide](./advanced-install/#upgrade).
> For upgrading existing KubeVela, please read the [upgrade guide](./advanced-install#upgrade).
## 1. Choose Control Plane Cluster
@@ -15,7 +15,7 @@ Requirements:
KubeVela relies on Kubernetes as control plane. The control plane could be any managed Kubernetes offering or your own cluster. The only requirement is please ensure [ingress-nginx](https://kubernetes.github.io/ingress-nginx/deploy/) is installed and enabled.
For local deployment and test, you could use `minikube` or `kind`.
For for local deployment and test, you could use `minikube` or `kind`.
<Tabs
className="unique-tabs"
@@ -82,7 +82,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/mast
1. Add helm chart repo for KubeVela
```shell script
helm repo add kubevela https://charts.kubevela.net/core
helm repo add kubevela https://kubevelacharts.oss-accelerate.aliyuncs.com/core
```
2. Update the chart repo
@@ -132,7 +132,7 @@ kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/mast
KubeVela CLI gives you a simplified workflow to manage applications with optimized output. It is not mandatory though.
KubeVela CLI could be [installed as kubectl plugin](./advanced-install#install-kubectl-vela-plugin), or install as standalone binary.
KubeVela CLI could be [installed as kubectl plugin](./kubectl-plugin.mdx), or install as standalone binary.
<Tabs
className="unique-tabs"
@@ -223,4 +223,4 @@ These capabilities are built-in so they are ready to use if showed up. KubeVela
Also, whenever new capabilities are added in the platform, you will immediately see them in above output.
> See the [advanced installation guide](./advanced-install) to learn more about installation details.
> See the [advanced installation guide](./advanced-install) to learn more about installation details.

View File

@@ -8,19 +8,19 @@ slug: /
## Motivation
The trend of cloud-native technology is moving towards pursuing consistent application delivery across clouds and on-premises infrastructures using Kubernetes as the common layer. Kubernetes, although excellent in abstracting low-level infrastructure details, does not introduce abstractions to model software deployment on top of today's hybrid and distributed environments. Weve seen the lack of application level context have impacted user experiences, slowed down productivity, led to unexpected errors or misconfigurations in production.
The trend of cloud-native technology is moving towards pursuing consistent application delivery across clouds and on-premises infrastructures using Kubernetes as the common layer. Kubernetes, although excellent in abstracting low-level infrastructure details, does not introduce abstractions to model software deployment on top of hybrid environments. Weve seen the lack of such application level context have impacted user experiences, slowed down productivity, led to unexpected errors or misconfigurations in production.
On the other hand, modeling the deployment of a microservice application is a highly opinionated and fragmented process. Thus, many solutions tried to solve above problem so far essentially became restricted systems and barely extensible (regardless of whether they are built with Kubernetes or not). As the needs of your application grow, they are almost certain to outgrow the capabilities of such systems. Application teams complain they are too rigid and slow in response to feature requests or improvements. The platform team do want to help but the engineering effort is daunting: any simple change to such platform could easily become a marathon negotiation around the design of its abstraction.
On the other hand, modeling a deployment of a modern microservice application is a highly opinionated and fragmented process today. Thus, most solutions aim to solve above problem (although built with Kubernetes) are essentially restricted systems and barely extensible. As the needs of your application grow, they are almost certain to outgrow the capabilities of such systems. Application teams complain they are too rigid and slow in response to feature requests or improvements. The platform team do want to help but the engineering effort is daunting: any simple API change in the platform could easily become a marathon negotiation around the opinionated abstraction design.
## What is KubeVela?
KubeVela is a modern application platform that makes deploying and managing applications across today's hybrid, multi-cloud environments easier and faster without any restriction or limitation. This is achieved by doing the following:
KubeVela is a modern application platform that aims to make deploying and managing applications across hybrid, multi-cloud environments easier and faster by doing the following:
**Application Centric** - KubeVela introduces declarative yet higher level API (known as [OAM](https://oam.dev/)) to model a full deployment of microservices across hybrid environments in consistent approach. No infrastructure level concerns, simply deploy.
**Application Centric** - KubeVela introduces consistent yet application centric API to capture a full deployment of microservices on top of hybrid environments. No infrastructure level concern, simply deploy.
**Natively Extensible** - KubeVela backend is implemented with [CUE](https://cuelang.org/). Whenever your needs grow, KubeVela's capabilities can naturally expand in a IaC-style approach. No restrictions, simply programming.
**Natively Extensible** - KubeVela uses CUE to glue capabilities provided by runtime infrastructure and expose them to users via self-service API. When users' needs grow, these API can naturally expand in programmable approach.
**Runtime Agnostic** - KubeVela relies on Kubernetes as control plane but it's adaptable to any runtime infrastructures. It can deploy and manage diverse workload types including container, cloud functions, databases, or even EC2 instances across hybrid environments.
**Runtime Agnostic** - KubeVela is built with Kubernetes as control plane but adaptable to any runtime as data-plane. It can deploy (and manage) diverse workload types such as container, cloud functions, databases, or even EC2 instances across hybrid environments.
## Architecture
@@ -30,7 +30,7 @@ The overall architecture of KubeVela is shown as below:
### Control Plane
Control plane is where KubeVela itself lives in. As the project's name implies, KubeVela by design leverages Kubernetes as control plane. This is the key of how KubeVela guarantees full *automation* and strong *determinism* to application delivery at scale. Users will interact with KubeVela via the application centric API to model the application deployment, and KubeVela will distribute it to target *runtime infrastructure* per policies and rules declared by users.
Control plane is where KubeVela itself lives in. As the project's name implies, KubeVela by design leverages Kubernetes as control plane. This is the key of how KubeVela brings full *automation* and strong *determinism* to application delivery at scale. Users will interact with KubeVela via the application centric API to model the application deployment, and KubeVela will distribute it to target *runtime infrastructure* per policies and rules declared by users.
### Runtime Infrastructures
@@ -44,31 +44,34 @@ The typical examples are Heroku and Cloud Foundry. They provide full application
Though the biggest difference lies in **flexibility**.
KubeVela is fully programmable. All capabilities in KubeVela are LEGO-sytle CUE modules and can be extended at any time when your needs grow. Comparing to this mechanism, traditional PaaS systems are highly restricted, i.e. they have to enforce constraints in the type of supported applications and capabilities, and as application needs grows, you always outgrow the capabilities of the PaaS system - this will never happen in KubeVela platform.
KubeVela enables you to serve end users with programmable building blocks (based on [CUE](https://cuelang.org/)) which are fully flexible and can be extended at any time. Comparing to this mechanism, traditional PaaS systems are highly restricted, i.e. they have to enforce constraints in the type of supported applications and capabilities, and as application needs grows, you always outgrow the capabilities of the PaaS system - this will never happen in KubeVela platform.
So think of KubeVela as a Heroku but it is fully extensible when your needs grow.
### KubeVela vs. Serverless
Serverless platform such as AWS Lambda provides extraordinary user experience and agility to deploy serverless applications. However, those platforms impose even more constraints in extensibility. They are arguably "hard-coded" PaaS.
KubeVela can easily deploy both Kubernetes based serverless workloads such as Knative/OpenFaaS, or cloud based functions such as AWS Lambda.
KubeVela can easily deploy both Kubernetes based serverless workloads such as Knative/OpenFaaS, or cloud functions such as AWS Lambda. Simply register what you want to deploy as a "component".
### KubeVela vs. Platform agnostic developer tools
The typical example is Hashicorp's Waypoint. Waypoint is a developer facing tool which introduces a consistent workflow (i.e., build, deploy, release) to ship applications on top of different platforms.
KubeVela can be integrated with such tools seamlessly. In this case, developers would use the Waypoint workflow as the UI to deploy and release applications with KubeVela as the underlying deployment platform.
KubeVela can be integrated with such tools seamlessly. In this case, developers would use the Waypoint workflow as the UI to deploy and manage applications across hybrid environments with KubeVela's abstractions (e.g. applications, components, traits etc).
### KubeVela vs. Helm
Helm is a package manager for Kubernetes that provides package, install, and upgrade a set of YAML files for Kubernetes as a unit.
KubeVela as a modern deployment system can naturally deploy Helm charts. For example, you could use KubeVela to define an application that is composed by a WordPress chart and a AWS RDS Terraform module, orchestrate the components' topology, and then deploy them to multiple environments following certain strategy.
KubeVela as a modern deployment system can naturally deploys Helm charts across hybrid environments. For example, you could easily use KubeVela to declare and deploy an application which is composed by a WordPress Helm chart and a AWS RDS instance defined by Terraform, or distribute the Helm chart to multiple clusters.
Furthermore, KubeVela also supports other encapsulation formats including Kustomize etc.
KubeVela also leverages Helm to manage the capability addons in runtime clusters.
### KubeVela vs. Kubernetes
KubeVela is a Kubernetes add-on for building modern application deployment system. It leverages [Open Application Model](https://github.com/oam-dev/spec) and Kubernetes as control plane to resolve a hard problem - making shipping applications enjoyable.
KubeVela is a Kubernetes add-on for building developer-centric deployment system. It leverages [Open Application Model](https://github.com/oam-dev/spec) and the native Kubernetes extensibility to resolve a hard problem - making shipping applications enjoyable on Kubernetes.
## What's Next

View File

@@ -0,0 +1,75 @@
---
title: Install kubectl plugin
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Install vela kubectl plugin can help you to ship applications more easily!
## Installation
You can install kubectl plugin `kubectl vela` by:
<Tabs
className="unique-tabs"
defaultValue="krew"
values={[
{label: 'Krew', value: 'krew'},
{label: 'Script', value: 'script'},
]}>
<TabItem value="krew">
1. [Install and set up](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) Krew on your machine.
2. Discover plugins available on Krew:
```shell
kubectl krew update
```
3. install kubectl vela:
```shell script
kubectl krew install vela
```
</TabItem>
<TabItem value="script">
**macOS/Linux**
```shell script
curl -fsSl https://kubevela.io/script/install-kubectl-vela.sh | bash
```
You can also download the binary from [release pages ( >= v1.0.3)](https://github.com/oam-dev/kubevela/releases) manually.
Kubectl will discover it from your system path automatically.
</TabItem>
</Tabs>
## Usage
```shell
$ kubectl vela -h
A Highly Extensible Platform Engine based on Kubernetes and Open Application Model.
Usage:
kubectl vela [flags]
kubectl vela [command]
Available Commands:
Flags:
-h, --help help for vela
dry-run Dry Run an application, and output the K8s resources as
result to stdout, only CUE template supported for now
live-diff Dry-run an application, and do diff on a specific app
revison. The provided capability definitions will be used
during Dry-run. If any capabilities used in the app are not
found in the provided ones, it will try to find from
cluster.
show Show the reference doc for a workload type or trait
version Prints out build version information
Use "kubectl vela [command] --help" for more information about a command.
```

View File

@@ -12,8 +12,8 @@ In KubeVela, the needed cloud services are claimed as *components* in an applica
KubeVela relies on [Terraform Controller](https://github.com/oam-dev/terraform-controller) or [Crossplane](http://crossplane.io/) as providers to talk to the clouds. Please check the documentations below for detailed steps.
- [Terraform](./terraform)
- [Crossplane](./crossplane)
- [Terraform](./terraform.md)
- [Crossplane](./crossplane.md)
## Can a Instance of Cloud Services be Shared by Multiple Applications?

View File

@@ -9,7 +9,6 @@ These cloud services are provided by Crossplane.
## Prepare Crossplane
<details>
Please Refer to [Installation](https://github.com/crossplane/provider-alibaba/releases/tag/v0.5.0)
to install Crossplane Alibaba provider v0.5.0.

View File

@@ -12,7 +12,7 @@ The reasons for KubeVela supports CUE as a first-class solution to design abstra
- **CUE is designed for large scale configuration.** CUE has the ability to understand a
configuration worked on by engineers across a whole company and to safely change a value that modifies thousands of objects in a configuration. This aligns very well with KubeVela's original goal to define and ship production level applications at web scale.
- **CUE supports first-class code generation and automation.** CUE can integrate with existing tools and workflows naturally while other tools would have to build complex custom solutions. For example, generate OpenAPI schemas with Go code. This is how KubeVela build developer tools and GUI interfaces based on the CUE templates.
- **CUE supports first-class code generation and automation.** CUE can integrate with existing tools and workflows naturally while other tools would have to build complex custom solutions. For example, generate OpenAPI schemas wigh Go code. This is how KubeVela build developer tools and GUI interfaces based on the CUE templates.
- **CUE integrates very well with Go.**
KubeVela is built with GO just like most projects in Kubernetes system. CUE is also implemented in and exposes a rich API in Go. KubeVela integrates with CUE as its core library and works as a Kubernetes controller. With the help of CUE, KubeVela can easily handle data constraint problems.
@@ -57,7 +57,7 @@ CUE has powerful CLI commands. Let's keep the data in a file named `first.cue` a
cue fmt first.cue
```
* Schema Check, besides `cue fmt`, you can also use `cue vet` to check schema.
* Schema Check, besides `cue fmt`, you can also use `vue vet` to check schema.
```shell
cue vet first.cue
```
@@ -66,9 +66,7 @@ CUE has powerful CLI commands. Let's keep the data in a file named `first.cue` a
You can see the results don't contain `a: float` and `b: int`, because these two variables are calculated.
While the `e: string` doesn't have definitive results, so it keeps as it is.
```shell
cue eval first.cue
```
```console
$ cue eval first.cue
a: 1.5
b: 1
d: [1, 2, 3]
@@ -80,17 +78,13 @@ CUE has powerful CLI commands. Let's keep the data in a file named `first.cue` a
* Render for specified result. For example, we want only know the result of `b` in the file, then we can specify the parameter `-e`.
```shell
cue eval -e b first.cue
```
```console
$ cue eval -e b first.cue
1
```
* Export the result. `cue export` will export the result with final value. It will report an error if some variables are not definitive.
```shell
cue export first.cue
```
```console
$ cue export first.cue
e: cannot convert incomplete value "string" to JSON:
./first.cue:9:4
```
@@ -100,9 +94,7 @@ CUE has powerful CLI commands. Let's keep the data in a file named `first.cue` a
```
Then, the command will work. By default, the result will be rendered in json format.
```shell
cue export first.cue
```
```console
$ cue export first.cue
{
"a": 1.5,
"b": 1,
@@ -120,9 +112,7 @@ CUE has powerful CLI commands. Let's keep the data in a file named `first.cue` a
* Export the result in YAML format.
```shell
cue export first.cue --out yaml
```
```console
$ cue export first.cue --out yaml
a: 1.5
b: 1
d:
@@ -136,9 +126,7 @@ CUE has powerful CLI commands. Let's keep the data in a file named `first.cue` a
* Export the result for specified variable.
```shell
cue export -e g first.cue
```
```console
$ cue export -e g first.cue
{
"h": "abc"
}
@@ -189,9 +177,7 @@ j: null
Let's name it `second.cue`. Then the `cue export` won't complain as the `#abc` is a type not incomplete value.
```shell
cue export second.cue
```
```console
$ cue export second.cue
{}
```
@@ -265,9 +251,7 @@ parameter:{
5. Finally, let's export it in yaml:
```shell
cue export deployment.cue -e template --out yaml
```
```console
$ cue export deployment.cue -e template --out yaml
apiVersion: apps/v1
kind: Deployment
spec:
@@ -361,9 +345,7 @@ Saving it in `third.cue` file.
You can evaluate the result by using `cue eval`:
```shell
cue eval third.cue
```
```console
$ cue eval third.cue
a: 1
b: 3
c: 3
@@ -387,9 +369,7 @@ Saving it in `fourth.cue` file.
You can evaluate the result by using `cue eval`:
```shell
cue eval fourth.cue
```
```console
$ cue eval fourth.cue
price: 200
feel: "bad"
```
@@ -565,4 +545,4 @@ output: {
parameter: {
name: "myapp"
}
```
```

View File

@@ -4,7 +4,7 @@ title: How-to
In this section, it will introduce how to use [CUE](https://cuelang.org/) to declare app components via `ComponentDefinition`.
> Before reading this part, please make sure you've learned the [Definition CRD](../definition-and-templates) in KubeVela.
> Before reading this part, please make sure you've learned the [Definition CRD](../definition-and-templates.md) in KubeVela.
## Declare `ComponentDefinition`
@@ -221,7 +221,7 @@ output: {
It's common that a component definition is composed by multiple API resources, for example, a `webserver` component that is composed by a Deployment and a Service. CUE is a great solution to achieve this in simplified primitives.
> Another approach to do composition in KubeVela of course is [using Helm](../helm/component).
> Another approach to do composition in KubeVela of course is [using Helm](../helm/component.md).
## How-to
@@ -354,21 +354,15 @@ spec:
It will generate and manage below API resources in target cluster:
```shell
kubectl get deployment
```
```console
$ kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
hello-world-v1 1/1 1 1 15s
```
```shell
kubectl get svc
```
```console
$ kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
hello-world-trait-7bdcff98f7 ClusterIP <your ip> <none> 8000/TCP 32s
```
## What's Next
Please check the [Learning CUE](./basic) documentation about why we support CUE as first-class templating solution and more details about using CUE efficiently.
Please check the [Learning CUE](./basic) documentation about why we support CUE as first-class templating solution and more details about using CUE efficiently.

View File

@@ -2,7 +2,7 @@
title: Patch Traits
---
**Patch** is a very common pattern of trait definitions, i.e. the app operators can amend/patch attributes to the component instance (normally the workload) to enable certain operational features such as sidecar or node affinity rules (and this should be done **before** the resources applied to target cluster).
**Patch** is a very common pattern of trait definitions, i.e. the app operators can amend/path attributes to the component instance (normally the workload) to enable certain operational features such as sidecar or node affinity rules (and this should be done **before** the resources applied to target cluster).
This pattern is extremely useful when the component definition is provided by third-party component provider (e.g. software distributor) so app operators do not have privilege to change its template.
@@ -19,7 +19,8 @@ metadata:
name: node-affinity
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: true
schematic:
cue:
@@ -96,17 +97,15 @@ By default, patch trait in KubeVela leverages the CUE `merge` operation. It has
### Strategy Patch
Strategy Patch is effective by adding annotation, and supports the following two ways
The `strategy patch` is useful for patching array list.
> Note that this is not a standard CUE feature, KubeVela enhanced CUE in this case.
#### 1. With `+patchKey=<key_name>` annotation
This is useful for patching array list, merging logic of two array lists will not follow the CUE behavior. Instead, it will treat the list as object and use a strategy merge approach:
With `//+patchKey=<key_name>` annotation, merging logic of two array lists will not follow the CUE behavior. Instead, it will treat the list as object and use a strategy merge approach:
- if a duplicated key is found, the patch data will be merge with the existing values;
- if no duplication found, the patch will append into the array list.
The example of strategy patch trait with 'patchKey' will like below:
The example of strategy patch trait will like below:
```yaml
apiVersion: core.oam.dev/v1beta1
@@ -117,7 +116,8 @@ metadata:
name: sidecar
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: true
schematic:
cue:
@@ -146,7 +146,8 @@ metadata:
name: expose
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: true
schematic:
cue:
@@ -173,76 +174,6 @@ spec:
So the above trait which attaches a Service to given component instance will patch an corresponding label to the workload first and then render the Service resource based on template in `outputs`.
#### 2. With `+patchStrategy=retainkeys` annotation
Similar to strategy [retainkeys](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/#use-strategic-merge-patch-to-update-a-deployment-using-the-retainkeys-strategy) in K8s strategic merge patch
In some scenarios that the entire object needs to be replaced, retainkeys strategy is the best choice. the example as follows:
Assume the Deployment is the base resource
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: retainkeys-demo
spec:
selector:
matchLabels:
app: nginx
strategy:
type: rollingUpdate
rollingUpdate:
maxSurge: 30%
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: retainkeys-demo-ctr
image: nginx
```
Now want to replace rollingUpdate strategy with a new strategy, you can write the patch trait like below
```yaml
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: recreate
spec:
appliesToWorkloads:
- deployments.apps
extension:
template: |-
patch: {
spec: {
// +patchStrategy=retainKeys
strategy: type: "Recreate"
}
}
```
Then the base resource becomes as follows
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: retainkeys-demo
spec:
selector:
matchLabels:
app: nginx
strategy:
type: Recreate
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: retainkeys-demo-ctr
image: nginx
```
## More Use Cases of Patch Trait
Patch trait is in general pretty useful to separate operational concerns from the component definition, here are some more examples.
@@ -260,7 +191,8 @@ metadata:
name: virtualgroup
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: true
schematic:
cue:
@@ -310,7 +242,8 @@ metadata:
name: kautoscale
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: false
schematic:
cue:
@@ -346,7 +279,8 @@ metadata:
name: env
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: true
schematic:
cue:
@@ -387,7 +321,8 @@ metadata:
name: service-account
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: true
schematic:
cue:
@@ -433,7 +368,8 @@ metadata:
name: init-container
spec:
appliesToWorkloads:
- deployments.apps
- webservice
- worker
podDisruptive: true
schematic:
cue:

View File

@@ -27,7 +27,7 @@ context:{
}
```
Trait will not have the `context.output`, other fields are the same.
Trait will not have the `context.ouput`, other fields are the same.
The example of health check likes below:

View File

@@ -132,10 +132,10 @@ parameter: {
}
```
After everything is done, there's a script [`vela-templates/mergedef.sh`](https://github.com/oam-dev/kubevela/blob/master/vela-templates/mergedef.sh) to merge the `def.yaml` and `def.cue` into a completed Definition Object.
After everything is done, there's a script [`hack/vela-templates/mergedef.sh`](https://github.com/oam-dev/kubevela/blob/master/hack/vela-templates/mergedef.sh) to merge the `def.yaml` and `def.cue` into a completed Definition Object.
```shell
./vela-templates/mergedef.sh def.yaml def.cue > microservice-def.yaml
$ ./hack/vela-templates/mergedef.sh def.yaml def.cue > microservice-def.yaml
```
## Debug CUE template
@@ -143,9 +143,7 @@ After everything is done, there's a script [`vela-templates/mergedef.sh`](https:
### Use `cue vet` to Validate
```shell
cue vet def.cue
```
```console
$ cue vet def.cue
output.metadata.name: reference "context" not found:
./def.cue:6:14
output.spec.selector.matchLabels.app: reference "context" not found:
@@ -176,18 +174,14 @@ context: {
Then execute the command:
```shell
cue vet def.cue
```
```console
$ cue vet def.cue
some instances are incomplete; use the -c flag to show errors or suppress this message
```
The `reference "context" not found` error is gone, but `cue vet` only validates the data type which is not enough to ensure the login in template is correct. Hence we need to use `cue vet -c` for complete validation:
```shell
cue vet def.cue -c
```
```console
$ cue vet def.cue -c
context.name: incomplete value string
output.metadata.name: incomplete value string
output.spec.selector.matchLabels.app: incomplete value string
@@ -232,9 +226,7 @@ cue vet def.cue -c
The `cue export` can export rendered result in YAMl foramt:
```shell
cue export -e output def.cue --out yaml
```
```console
$ cue export -e output def.cue --out yaml
apiVersion: apps/v1
kind: Deployment
metadata:
@@ -258,9 +250,7 @@ spec:
```
```shell
cue export -e outputs.service def.cue --out yaml
```
```console
$ cue export -e outputs.service def.cue --out yaml
apiVersion: v1
kind: Service
metadata:
@@ -296,9 +286,7 @@ There are two kinds of ways to import internal `kube` packages.
2. Import them with third-party packages style. You can run `vela system cue-packages` to list all build-in `kube` packages
to know the `third-party packages` supported currently.
```shell
vela system cue-packages
```
```console
$ vela system cue-packages
DEFINITION-NAME IMPORT-PATH USAGE
#Deployment k8s.io/apps/v1 Kube Object for apps/v1.Deployment
#Service k8s.io/core/v1 Kube Object for v1.Service
@@ -330,7 +318,7 @@ touch def.cue
In KubeVela, we don't need to download these packages as they're automatically generated from K8s API.
But for local test, we need to use `cue get go` to fetch Go packages and convert them to CUE format files.
So, by using K8s `Deployment` and `Service`, we need download and convert to CUE definitions for the `core` and `apps` Kubernetes modules like below:
So, by using K8s `Deployment` and `Serivice`, we need download and convert to CUE definitions for the `core` and `apps` Kubernetes modules like below:
```shell
cue get go k8s.io/api/core/v1
@@ -532,9 +520,7 @@ parameter: {
Use `cue export` to see the export result.
```shell
cue export def.cue --out yaml
```
```console
$ cue export def.cue --out yaml
output:
metadata:
name: test
@@ -590,7 +576,7 @@ When CUE template is good, we can use `vela system dry-run` to dry run and check
First, we need use `mergedef.sh` to merge the definition and cue files.
```shell
mergedef.sh def.yaml def.cue > componentdef.yaml
$ mergedef.sh def.yaml def.cue > componentdef.yaml
```
Then, let's create an Application named `test-app.yaml`.
@@ -618,9 +604,7 @@ spec:
Dry run the application by using `vela system dry-run`.
```shell
vela system dry-run -f test-app.yaml -d componentdef.yaml
```
```console
$ vela system dry-run -f test-app.yaml -d componentdef.yaml
---
# Application(boutique) -- Comopnent(frontend)
---

View File

@@ -70,6 +70,7 @@ metadata:
spec:
appliesToWorkloads:
- deployments.apps
- webservice
conflictsWith:
- service
workloadRefPath: spec.wrokloadRef
@@ -84,15 +85,16 @@ This field defines the constraints that what kinds of workloads this trait is al
- It accepts an array of string as value.
- Each item in the array refers to one or a group of workload types to which this trait is allowded to apply.
There are three approaches to denote one or a group of workload types.
There are four approaches to denote one or a group of workload types.
- `ComponentDefinition` name, e.g., `webservice`, `worker`
- `ComponentDefinition` definition reference (CRD name), e.g., `deployments.apps`
- Resource group of `ComponentDefinition` definition reference prefixed with `*.`, e.g., `*.apps`, `*.oam.dev`. This means the trait is allowded to apply to any workloads in this group.
- `*` means this trait is allowded to apply to any workloads
If this field is omitted, it means this trait is allowded to apply to any workload types.
KubeVela will raise an error if a trait is applied to a workload type which is NOT included in the `appliesToWorkloads`.
KubeVela will raise an error if a trait is applied to a workload which is NOT included in the `appliesToWorkloads`.
##### `.spec.conflictsWith`
@@ -116,7 +118,7 @@ This field defines the field path of the trait which is used to store the refere
If this field is set, KubeVela core will automatically fill the workload reference into target field of the trait. Then the trait controller can get the workload reference from the trait latter. So this field usually accompanies with the traits whose controllers relying on the workload reference at runtime.
Please check [scaler](https://github.com/oam-dev/kubevela/blob/master/charts/vela-core/templates/defwithtemplate/scaler.yaml) trait as a demonstration of how to set this field.
Please check [scaler](https://github.com/oam-dev/kubevela/blob/master/charts/vela-core/templates/defwithtemplate/manualscale.yaml) trait as a demonstration of how to set this field.
##### `.spec.podDisruptive`
@@ -240,9 +242,7 @@ In KubeVela, definition entities are mutable. Each time a `ComponentDefinition`
For example, we can design a new parameter named `args` for the `webservice` component definition by applying a new definition with same name as below.
```shell
kubectl vela show webservice
```
```console
$ kubectl vela show webservice
# Properties
+-------+----------------------------------------------------+----------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -258,9 +258,7 @@ kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/docs/
The change will take effect immediately.
```shell
kubectl vela show webservice
```
```console
$ kubectl vela show webservice
# Properties
+-------+----------------------------------------------------+----------+----------+---------+
| NAME | DESCRIPTION | TYPE | REQUIRED | DEFAULT |
@@ -273,9 +271,7 @@ kubectl vela show webservice
We will see a new definition revision will be automatically generated, `v2` is the latest version, `v1` is the previous one.
```shell
kubectl get definitionrevision -l="componentdefinition.oam.dev/name=webservice" -n vela-system
```
```console
$ kubectl get definitionrevision -l="componentdefinition.oam.dev/name=webservice" -n vela-system
NAME REVISION HASH TYPE
webservice-v1 1 3f6886d9832021ba Component
webservice-v2 2 b3b9978e7164d973 Component
@@ -320,4 +316,4 @@ spec:
- '1000'
args:
- wait
```
```

View File

@@ -4,7 +4,7 @@ title: How-to
In this section, it will introduce how to declare Helm charts as components via `ComponentDefinition`.
> Before reading this part, please make sure you've learned [the definition and template concepts](../definition-and-templates).
> Before reading this part, please make sure you've learned [the definition and template concepts](../definition-and-templates.md).
## Prerequisite
@@ -65,24 +65,18 @@ The component `properties` is exactly the [overlay values](https://github.com/ca
Deploy the application and after several minutes (it may take time to fetch Helm chart), you can check the Helm release is installed.
```shell
helm ls -A
```
```console
$ helm ls -A
myapp-demo-podinfo default 1 2021-03-05 02:02:18.692317102 +0000 UTC deployed podinfo-5.1.4 5.1.4
```
Check the workload defined in the chart has been created successfully.
```shell
kubectl get deploy
```
```console
$ kubectl get deploy
NAME READY UP-TO-DATE AVAILABLE AGE
myapp-demo-podinfo 1/1 1 1 66m
```
Check the values (`image.tag = 5.1.2`) from application's `properties` are assigned to the chart.
```shell
kubectl get deployment myapp-demo-podinfo -o json | jq '.spec.template.spec.containers[0].image'
```
```console
$ kubectl get deployment myapp-demo-podinfo -o json | jq '.spec.template.spec.containers[0].image'
"ghcr.io/stefanprodan/podinfo:5.1.2"
```

Some files were not shown because too many files have changed in this diff Show More