mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-27 08:14:21 +00:00
Compare commits
232 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb6b050d15 | ||
|
|
ec8427c419 | ||
|
|
3211c89610 | ||
|
|
92f31a100e | ||
|
|
960322c21f | ||
|
|
f0596c4914 | ||
|
|
4ff9639daa | ||
|
|
8513c40b62 | ||
|
|
9224e8eb47 | ||
|
|
ee547ec441 | ||
|
|
dc4071d0bc | ||
|
|
1ec07b0198 | ||
|
|
a848dd1bf3 | ||
|
|
901b1ef83e | ||
|
|
79c2209d19 | ||
|
|
c018b4e722 | ||
|
|
28ede4adca | ||
|
|
c61efb1352 | ||
|
|
b36bfa02a6 | ||
|
|
6f9d49be52 | ||
|
|
f702b845be | ||
|
|
2a2bc40282 | ||
|
|
305360b755 | ||
|
|
799bcf9cef | ||
|
|
21cae61f93 | ||
|
|
89507ec8ef | ||
|
|
2bd0e0af81 | ||
|
|
169b02f965 | ||
|
|
9f44bb128f | ||
|
|
b7d16f7188 | ||
|
|
06585fea92 | ||
|
|
7d3397ac31 | ||
|
|
8f9104387e | ||
|
|
2c3c97560d | ||
|
|
ee906dbd5a | ||
|
|
a4e68dd604 | ||
|
|
b45b9dd6c7 | ||
|
|
c52847eaaa | ||
|
|
306b21459e | ||
|
|
af5bdd713f | ||
|
|
2bd770d88d | ||
|
|
39db378bcd | ||
|
|
0c22a4c72e | ||
|
|
1a37228e03 | ||
|
|
c02e1eae9e | ||
|
|
014513d55e | ||
|
|
5e4f270b1e | ||
|
|
ec388b11bb | ||
|
|
fb40432309 | ||
|
|
e7ab480e40 | ||
|
|
9aae23e163 | ||
|
|
f7718b4c08 | ||
|
|
6ef0605542 | ||
|
|
12a2eb8491 | ||
|
|
8b27ade1cb | ||
|
|
b8f18153b3 | ||
|
|
7658a05b84 | ||
|
|
ba2d945079 | ||
|
|
6b931d9b32 | ||
|
|
43754e89b6 | ||
|
|
26b4e3c2d5 | ||
|
|
cfadfd8763 | ||
|
|
6480873e81 | ||
|
|
2e975e678c | ||
|
|
fa7b6fa85f | ||
|
|
d31a983c7e | ||
|
|
6303d311c8 | ||
|
|
bfb0f94b82 | ||
|
|
855f194228 | ||
|
|
db03c6e291 | ||
|
|
be8403dc0d | ||
|
|
edaac86304 | ||
|
|
fc805214c7 | ||
|
|
ee9b44fa80 | ||
|
|
aa5a11bcdd | ||
|
|
80d4a8bfd1 | ||
|
|
31e5eb05c5 | ||
|
|
615f81c251 | ||
|
|
899e7e1647 | ||
|
|
c7bb52a4d4 | ||
|
|
31012bc7e5 | ||
|
|
03259630c2 | ||
|
|
2876d2f921 | ||
|
|
ba7a4a33fc | ||
|
|
e6397723db | ||
|
|
2165624ba8 | ||
|
|
3c233d3a9b | ||
|
|
ecae9e4785 | ||
|
|
32921796e8 | ||
|
|
83ed11e254 | ||
|
|
461968ab5c | ||
|
|
d42aff9fb2 | ||
|
|
5a6cfa401c | ||
|
|
9027a78c4f | ||
|
|
816b7d2d6f | ||
|
|
050b66b5d0 | ||
|
|
6862435594 | ||
|
|
c195580126 | ||
|
|
0747b03c50 | ||
|
|
25558b2c86 | ||
|
|
f1ff1564fb | ||
|
|
ebfd1dfe15 | ||
|
|
51873e0b4d | ||
|
|
bcd6fb08cc | ||
|
|
7457c39f48 | ||
|
|
7a81bba7ca | ||
|
|
5a4b70479c | ||
|
|
2becbebceb | ||
|
|
cf57610e20 | ||
|
|
244b3f7f48 | ||
|
|
42c9e68512 | ||
|
|
17b4a2c966 | ||
|
|
5266274c60 | ||
|
|
00ee2bfad4 | ||
|
|
e6445f7458 | ||
|
|
debc0da3b6 | ||
|
|
ea823db8ea | ||
|
|
fb8c33af8d | ||
|
|
974027e233 | ||
|
|
cb946bff95 | ||
|
|
f22c8995f4 | ||
|
|
550d708637 | ||
|
|
1a592496a1 | ||
|
|
a5eb3161eb | ||
|
|
ffa965d637 | ||
|
|
ef16da72f5 | ||
|
|
19657d488f | ||
|
|
b9fc2180c5 | ||
|
|
daef0523fa | ||
|
|
3269c4f48f | ||
|
|
2526760080 | ||
|
|
5ec22917a1 | ||
|
|
efb76ee5ee | ||
|
|
47222606dd | ||
|
|
fe81ed1653 | ||
|
|
51fe5e7c7b | ||
|
|
3e6002cc95 | ||
|
|
6792d7ded1 | ||
|
|
2b2eb9701c | ||
|
|
93559a2f01 | ||
|
|
ecf3f5d664 | ||
|
|
54e30b1f8b | ||
|
|
de7bb9ba46 | ||
|
|
c1d6dedb5d | ||
|
|
9a89699691 | ||
|
|
34819f8d80 | ||
|
|
6486b7878f | ||
|
|
9fcfb7e1df | ||
|
|
8d4fe38cc3 | ||
|
|
48052e59ee | ||
|
|
b0c9e4b78a | ||
|
|
4e7af35e61 | ||
|
|
4264a63613 | ||
|
|
f90140ee5b | ||
|
|
57dc83976d | ||
|
|
2a88bf271a | ||
|
|
84a17764ed | ||
|
|
98a6d7a8cf | ||
|
|
dd5a74235d | ||
|
|
c10cbead76 | ||
|
|
28e417ef47 | ||
|
|
43a674b6f7 | ||
|
|
cfab53f97b | ||
|
|
df7dca81da | ||
|
|
22b6e87d58 | ||
|
|
4b768c49a6 | ||
|
|
cd4615405f | ||
|
|
ccc3576a4c | ||
|
|
3dd5e493c6 | ||
|
|
e120e141ee | ||
|
|
e794da5492 | ||
|
|
7031e04c75 | ||
|
|
e8de0e29df | ||
|
|
d67ce4d2a1 | ||
|
|
40ab610a8e | ||
|
|
78b1c5b32c | ||
|
|
7b957df709 | ||
|
|
3edc6ed317 | ||
|
|
c43dad4907 | ||
|
|
b4b9fcfaf0 | ||
|
|
3af42feb02 | ||
|
|
16ddba80b3 | ||
|
|
32bb102a86 | ||
|
|
0fcc6498cb | ||
|
|
ab72ddbea4 | ||
|
|
10d360c03c | ||
|
|
4b609e0fff | ||
|
|
49e8aca2bd | ||
|
|
c5ecd0aff3 | ||
|
|
adac554333 | ||
|
|
c6e15fae2d | ||
|
|
7f75d22ab6 | ||
|
|
e148a901a9 | ||
|
|
9c5e156e23 | ||
|
|
626eb5eb68 | ||
|
|
72f3d22942 | ||
|
|
07351d9dd7 | ||
|
|
6ac7e88a63 | ||
|
|
36d2b9e761 | ||
|
|
1681fe7de2 | ||
|
|
214a5ee4aa | ||
|
|
e69548a72a | ||
|
|
877b7b8cb6 | ||
|
|
2476f83b1b | ||
|
|
c9929cf7cf | ||
|
|
8b9c927572 | ||
|
|
b59fe17f4d | ||
|
|
645fd3f917 | ||
|
|
15e1564983 | ||
|
|
c24c039b15 | ||
|
|
8e2205ef07 | ||
|
|
cd3c91b537 | ||
|
|
f6e3fc31d1 | ||
|
|
1f5d3bde7b | ||
|
|
0fc1c3132e | ||
|
|
f18ee6586a | ||
|
|
da8457fbf0 | ||
|
|
29e97a6040 | ||
|
|
5c0f26c6f6 | ||
|
|
fd3f300901 | ||
|
|
025ce5d74d | ||
|
|
bbb2c527d9 | ||
|
|
65db8753de | ||
|
|
890aef14f3 | ||
|
|
7371496f27 | ||
|
|
f792bf2bbf | ||
|
|
9ca4f64030 | ||
|
|
d5909a13f3 | ||
|
|
9b5c72e5ad | ||
|
|
88d3042767 | ||
|
|
9f6e53269d | ||
|
|
66f157cca7 |
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,7 +1,7 @@
|
||||
---
|
||||
name: Bug report
|
||||
name: "\U0001F41B Bug report"
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
title: ""
|
||||
labels: kind/bug
|
||||
assignees: ''
|
||||
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: Feature request
|
||||
name: "\U0001F680 Feature request"
|
||||
about: Suggest an idea for this project
|
||||
title: "[Feature]"
|
||||
labels: kind/feature
|
||||
|
||||
6
.github/workflows/dashboard.yml
vendored
6
.github/workflows/dashboard.yml
vendored
@@ -4,12 +4,16 @@ on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./dashboard
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [10.x]
|
||||
|
||||
53
.github/workflows/docker.yml
vendored
53
.github/workflows/docker.yml
vendored
@@ -3,23 +3,54 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Publish to Github Docker Package Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@2.21
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then
|
||||
VERSION=latest
|
||||
fi
|
||||
echo ::set-output name=VERSION::${VERSION}
|
||||
- name: Get git revision
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::set-output name=git_revision::$(git rev-parse --short HEAD)"
|
||||
- name: Login ghcr.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
name: oam-dev/kubevela/vela-core
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: docker.pkg.github.com
|
||||
tags: "latest"
|
||||
- name: Publish to Docker Hub Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@2.21
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.CR_PAT }}
|
||||
- name: Login docker.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
name: oamdev/vela-core
|
||||
registry: docker.io
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
tags: "latest"
|
||||
- uses: docker/setup-qemu-action@v1
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
- uses: docker/build-push-action@v2
|
||||
name: Build & Pushing
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
labels: |-
|
||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
build-args: |
|
||||
GITVERSION=git-${{ steps.vars.outputs.git_revision }}
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
tags: |-
|
||||
ghcr.io/${{ github.repository }}/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
docker.io/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
48
.github/workflows/e2e.yml
vendored
48
.github/workflows/e2e.yml
vendored
@@ -1,48 +0,0 @@
|
||||
name: E2E
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: e2e-tests
|
||||
runs-on: aliyun
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Setup Kind Cluster
|
||||
uses: engineerd/setup-kind@v0.4.0
|
||||
with:
|
||||
version: "v0.7.0"
|
||||
skipClusterCreation: true
|
||||
|
||||
- name: Setup Kind Cluster
|
||||
run: |
|
||||
kind delete cluster
|
||||
kind create cluster
|
||||
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: Run e2e tests
|
||||
run: |
|
||||
make e2e-cleanup
|
||||
make e2e-setup
|
||||
make e2e-test
|
||||
make e2e-api-test
|
||||
131
.github/workflows/go.yml
vendored
131
.github/workflows/go.yml
vendored
@@ -2,35 +2,57 @@ name: Go
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches: [master]
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- '**.md'
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.14'
|
||||
GOLANGCI_VERSION: 'v1.31'
|
||||
DOCKER_BUILDX_VERSION: 'v0.4.2'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: unit-tests
|
||||
|
||||
unit-tests:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.14
|
||||
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.4.0
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
version: "v0.7.0"
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
|
||||
- name: install Kubebuilder
|
||||
uses: RyanSiu1995/kubebuilder-action@v1
|
||||
uses: wonderflow/kubebuilder-action@v1.1
|
||||
|
||||
- name: Run Make test
|
||||
run: make test
|
||||
@@ -42,3 +64,98 @@ jobs:
|
||||
file: ./coverage.txt
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
|
||||
e2e-tests:
|
||||
runs-on: aliyun
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Setup Kind Cluster
|
||||
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
|
||||
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
|
||||
|
||||
- name: Wait for e2e preparation ready
|
||||
run: |
|
||||
timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:38081/api/workloads)" != "200" ]]; do sleep 5; done' || false
|
||||
|
||||
- name: Run e2e tests
|
||||
run: |
|
||||
make e2e-api-test
|
||||
make e2e-test
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
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-
|
||||
|
||||
# This action uses its own setup-go, which always seems to use the latest
|
||||
# stable version of Go. We could run 'make lint' to ensure our desired Go
|
||||
# version, but we prefer this action because it leaves 'annotations' (i.e.
|
||||
# it comments on PRs to point out linter violations).
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_VERSION }}
|
||||
|
||||
check-diff:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- 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: Check Diff
|
||||
run: make check-diff
|
||||
27
.github/workflows/release.yml
vendored
27
.github/workflows/release.yml
vendored
@@ -20,6 +20,9 @@ jobs:
|
||||
id: go
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
|
||||
- name: Use Node.js 10.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
@@ -28,6 +31,10 @@ jobs:
|
||||
run: make npm-install
|
||||
- name: Run npm build
|
||||
run: make npm-build
|
||||
- name: Tag helm chart image
|
||||
run: |
|
||||
sed -i 's/latest/${{ steps.get_version.outputs.VERSION }}/g' charts/vela-core/values.yaml
|
||||
sed -i 's/0.1.0/${{ steps.get_version.outputs.VERSION }}/g' charts/vela-core/Chart.yaml
|
||||
- name: Run generate-source
|
||||
run: make generate-source
|
||||
- name: Run cross-build
|
||||
@@ -40,9 +47,6 @@ jobs:
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Release ${{ github.ref }}
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
|
||||
- name: Upload Linux tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
@@ -91,19 +95,4 @@ jobs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/sha256sums.txt
|
||||
asset_name: sha256sums.txt
|
||||
asset_content_type: text/plain
|
||||
- name: Publish to Github Docker Package Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@2.21
|
||||
with:
|
||||
name: oam-dev/kubevela/vela-core
|
||||
username: $GITHUB_ACTOR
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
registry: docker.pkg.github.com
|
||||
tags: "${{ steps.get_version.outputs.VERSION }}"
|
||||
- name: Publish to Docker Hub Registry
|
||||
uses: elgohr/Publish-Docker-Github-Action@2.21
|
||||
with:
|
||||
name: oamdev/vela-core
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
tags: "${{ steps.get_version.outputs.VERSION }}"
|
||||
asset_content_type: text/plain
|
||||
206
.golangci.yml
Normal file
206
.golangci.yml
Normal file
@@ -0,0 +1,206 @@
|
||||
run:
|
||||
timeout: 10m
|
||||
|
||||
skip-files:
|
||||
- "zz_generated\\..+\\.go$"
|
||||
- ".*_test.go$"
|
||||
|
||||
skip-dirs:
|
||||
- "hack"
|
||||
- "e2e"
|
||||
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
format: colored-line-number
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
|
||||
# default is false: such cases aren't reported by default.
|
||||
check-type-assertions: false
|
||||
|
||||
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
|
||||
# default is false: such cases aren't reported by default.
|
||||
check-blank: false
|
||||
|
||||
# [deprecated] comma-separated list of pairs of the form pkg:regex
|
||||
# the regex is used to ignore names within pkg. (default "fmt:.*").
|
||||
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
|
||||
ignore: fmt:.*,io/ioutil:^Read.*
|
||||
|
||||
exhaustive:
|
||||
# indicates that switch statements are to be considered exhaustive if a
|
||||
# 'default' case is present, even if all enum members aren't listed in the
|
||||
# switch
|
||||
default-signifies-exhaustive: true
|
||||
|
||||
govet:
|
||||
# report about shadowed variables
|
||||
check-shadowing: false
|
||||
|
||||
golint:
|
||||
# minimal confidence for issues, default is 0.8
|
||||
min-confidence: 0.8
|
||||
|
||||
gofmt:
|
||||
# simplify code: gofmt with `-s` option, true by default
|
||||
simplify: true
|
||||
|
||||
goimports:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
# it's a comma-separated list of prefixes
|
||||
local-prefixes: github.com/oam-dev/kubevela
|
||||
|
||||
gocyclo:
|
||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||
min-complexity: 30
|
||||
|
||||
maligned:
|
||||
# print struct with more effective memory layout or not, false by default
|
||||
suggest-new: true
|
||||
|
||||
dupl:
|
||||
# tokens count to trigger issue, 150 by default
|
||||
threshold: 100
|
||||
|
||||
goconst:
|
||||
# minimal length of string constant, 3 by default
|
||||
min-len: 3
|
||||
# minimal occurrences count to trigger, 3 by default
|
||||
min-occurrences: 5
|
||||
|
||||
lll:
|
||||
# tab width in spaces. Default to 1.
|
||||
tab-width: 1
|
||||
|
||||
unused:
|
||||
# treat code as a program (not a library) and report unused exported identifiers; default is false.
|
||||
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
|
||||
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
|
||||
# with golangci-lint call it on a directory with the changed file.
|
||||
check-exported: false
|
||||
|
||||
unparam:
|
||||
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
|
||||
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
|
||||
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
|
||||
# with golangci-lint call it on a directory with the changed file.
|
||||
check-exported: false
|
||||
|
||||
nakedret:
|
||||
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||
max-func-lines: 30
|
||||
|
||||
gocritic:
|
||||
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
|
||||
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
|
||||
enabled-tags:
|
||||
- performance
|
||||
|
||||
settings: # settings passed to gocritic
|
||||
captLocal: # must be valid enabled check name
|
||||
paramsOnly: true
|
||||
rangeValCopy:
|
||||
sizeThreshold: 32
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- megacheck
|
||||
- govet
|
||||
- gocyclo
|
||||
- gocritic
|
||||
- interfacer
|
||||
- goconst
|
||||
- goimports
|
||||
- gofmt # We enable this as well as goimports for its simplify mode.
|
||||
- golint
|
||||
- unconvert
|
||||
- misspell
|
||||
- nakedret
|
||||
|
||||
presets:
|
||||
- bugs
|
||||
- unused
|
||||
fast: false
|
||||
|
||||
|
||||
issues:
|
||||
# Excluding configuration per-path and per-linter
|
||||
exclude-rules:
|
||||
# Exclude some linters from running on tests files.
|
||||
- path: _test(ing)?\.go
|
||||
linters:
|
||||
- gocyclo
|
||||
- errcheck
|
||||
- dupl
|
||||
- gosec
|
||||
- scopelint
|
||||
- unparam
|
||||
|
||||
# Ease some gocritic warnings on test files.
|
||||
- path: _test\.go
|
||||
text: "(unnamedResult|exitAfterDefer)"
|
||||
linters:
|
||||
- gocritic
|
||||
|
||||
# These are performance optimisations rather than style issues per se.
|
||||
# They warn when function arguments or range values copy a lot of memory
|
||||
# rather than using a pointer.
|
||||
- text: "(hugeParam|rangeValCopy):"
|
||||
linters:
|
||||
- gocritic
|
||||
|
||||
# This "TestMain should call os.Exit to set exit code" warning is not clever
|
||||
# enough to notice that we call a helper method that calls os.Exit.
|
||||
- text: "SA3000:"
|
||||
linters:
|
||||
- staticcheck
|
||||
|
||||
- text: "k8s.io/api/core/v1"
|
||||
linters:
|
||||
- goimports
|
||||
|
||||
# This is a "potential hardcoded credentials" warning. It's triggered by
|
||||
# any variable with 'secret' in the same, and thus hits a lot of false
|
||||
# positives in Kubernetes land where a Secret is an object type.
|
||||
- text: "G101:"
|
||||
linters:
|
||||
- gosec
|
||||
- gas
|
||||
|
||||
# This is an 'errors unhandled' warning that duplicates errcheck.
|
||||
- text: "G104:"
|
||||
linters:
|
||||
- gosec
|
||||
- gas
|
||||
|
||||
# The Azure AddToUserAgent method appends to the existing user agent string.
|
||||
# It returns an error if you pass it an empty string lettinga you know the
|
||||
# user agent did not change, making it more of a warning.
|
||||
- text: \.AddToUserAgent
|
||||
linters:
|
||||
- errcheck
|
||||
|
||||
- text: "don't use an underscore"
|
||||
linters:
|
||||
- golint
|
||||
|
||||
# Independently from option `exclude` we use default exclude patterns,
|
||||
# it can be disabled by this option. To list all
|
||||
# excluded by default patterns execute `golangci-lint run --help`.
|
||||
# Default value for this option is true.
|
||||
exclude-use-default: false
|
||||
|
||||
# Show only new issues: if there are unstaged changes or untracked files,
|
||||
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
|
||||
# It's a super-useful option for integration of golangci-lint into existing
|
||||
# large codebase. It's not practical to fix all existing issues at the moment
|
||||
# of integration: much better don't allow issues in new code.
|
||||
# Default is false.
|
||||
new: false
|
||||
|
||||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
||||
max-per-linter: 0
|
||||
|
||||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
||||
max-same-issues: 0
|
||||
@@ -1,4 +1,4 @@
|
||||
# CONTRIBUTING
|
||||
# CONTRIBUTING Guide
|
||||
|
||||
## About KubeVela
|
||||
|
||||
@@ -7,14 +7,19 @@ KubeVela project is initialized and maintained by the cloud native community sin
|
||||
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).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
1. Golang version 1.13+
|
||||
2. Kubernetes version v1.16+ with `~/.kube/config` configured.
|
||||
3. ginkgo 1.14.0+ (just for [E2E test](https://github.com/oam-dev/kubevela/blob/master/DEVELOPMENT.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.
|
||||
|
||||
## Build
|
||||
We also recommend you to learn about KubeVela's [design](docs/en/design.md) before dive into its code.
|
||||
|
||||
### Build
|
||||
|
||||
* Clone this project
|
||||
|
||||
@@ -61,7 +66,7 @@ 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/).
|
||||
|
||||
## Use
|
||||
### Use
|
||||
|
||||
* Create environment
|
||||
|
||||
@@ -130,7 +135,7 @@ $ vela delete abc
|
||||
delete apps succeed abc from default
|
||||
```
|
||||
|
||||
## Tests
|
||||
## Testing
|
||||
|
||||
### Unit test
|
||||
|
||||
@@ -154,3 +159,11 @@ make e2e-test
|
||||
|
||||
## Make a pull request
|
||||
Remember to write unit-test and e2e test before making 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).
|
||||
|
||||
22
Dockerfile
22
Dockerfile
@@ -1,5 +1,5 @@
|
||||
# Build the manager binary
|
||||
FROM golang:1.13 as builder
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14 as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
@@ -11,18 +11,28 @@ RUN go mod download
|
||||
|
||||
# Copy the go source
|
||||
COPY cmd/core/main.go main.go
|
||||
COPY api/ api/
|
||||
COPY apis/ apis/
|
||||
COPY pkg/ pkg/
|
||||
COPY version/ version/
|
||||
|
||||
# Build
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
|
||||
ARG TARGETARCH
|
||||
ARG VERSION
|
||||
ARG GITVERSION
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on \
|
||||
go build -a -ldflags "-X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
|
||||
-o manager-${TARGETARCH} main.go
|
||||
|
||||
# Use distroless as minimal base image to package the manager binary
|
||||
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||
# oamdev/gcr.io-distroless-static:nonroot is syncd from gcr.io/distroless/static:nonroot as somewhere can't reach gcr.io
|
||||
FROM oamdev/gcr.io-distroless-static:nonroot
|
||||
# Could use `--build-arg=BASE_DISTROLESS=gcr.io/distroless/static:nonroot` to overwrite
|
||||
ARG BASE_DISTROLESS
|
||||
FROM ${BASE_DISTROLESS:-gcr.io/distroless/static:nonroot}
|
||||
|
||||
WORKDIR /
|
||||
COPY --from=builder /workspace/manager .
|
||||
|
||||
ARG TARGETARCH
|
||||
COPY --from=builder /workspace/manager-${TARGETARCH} /manager
|
||||
USER nonroot:nonroot
|
||||
|
||||
ENTRYPOINT ["/manager"]
|
||||
|
||||
125
Makefile
125
Makefile
@@ -1,14 +1,31 @@
|
||||
# Vela version
|
||||
VELA_VERSION ?= 0.1.0
|
||||
VELA_VERSION ?= master
|
||||
# Repo info
|
||||
GIT_COMMIT ?= git-$(shell git rev-parse --short HEAD)
|
||||
VELA_VERSION_VAR := github.com/oam-dev/kubevela/version.VelaVersion
|
||||
GIT_COMMIT ?= git-$(shell git rev-parse --short HEAD)
|
||||
GIT_COMMIT_LONG ?= $(shell git rev-parse HEAD)
|
||||
VELA_VERSION_VAR := github.com/oam-dev/kubevela/version.VelaVersion
|
||||
VELA_GITVERSION_VAR := github.com/oam-dev/kubevela/version.GitRevision
|
||||
LDFLAGS ?= "-X $(VELA_VERSION_VAR)=$(VELA_VERSION) -X $(VELA_GITVERSION_VAR)=$(GIT_COMMIT)"
|
||||
LDFLAGS ?= "-X $(VELA_VERSION_VAR)=$(VELA_VERSION) -X $(VELA_GITVERSION_VAR)=$(GIT_COMMIT)"
|
||||
|
||||
GOX = go run github.com/mitchellh/gox
|
||||
TARGETS := darwin/amd64 linux/amd64 windows/amd64
|
||||
DIST_DIRS := find * -type d -exec
|
||||
GOX = go run github.com/mitchellh/gox
|
||||
TARGETS := darwin/amd64 linux/amd64 windows/amd64
|
||||
DIST_DIRS := find * -type d -exec
|
||||
|
||||
TIME_LONG = `date +%Y-%m-%d' '%H:%M:%S`
|
||||
TIME_SHORT = `date +%H:%M:%S`
|
||||
TIME = $(TIME_SHORT)
|
||||
|
||||
BLUE := $(shell printf "\033[34m")
|
||||
YELLOW := $(shell printf "\033[33m")
|
||||
RED := $(shell printf "\033[31m")
|
||||
GREEN := $(shell printf "\033[32m")
|
||||
CNone := $(shell printf "\033[0m")
|
||||
|
||||
INFO = echo ${TIME} ${BLUE}[ .. ]${CNone}
|
||||
WARN = echo ${TIME} ${YELLOW}[WARN]${CNone}
|
||||
ERR = echo ${TIME} ${RED}[FAIL]${CNone}
|
||||
OK = echo ${TIME} ${GREEN}[ OK ]${CNone}
|
||||
FAIL = (echo ${TIME} ${RED}[FAIL]${CNone} && false)
|
||||
|
||||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
|
||||
ifeq (,$(shell go env GOBIN))
|
||||
@@ -22,12 +39,14 @@ all: build
|
||||
# Run tests
|
||||
test: vet lint
|
||||
go test -race -coverprofile=coverage.txt -covermode=atomic ./pkg/... ./cmd/...
|
||||
@$(OK) unit-tests pass
|
||||
|
||||
# Build manager binary
|
||||
build: fmt vet lint
|
||||
go run hack/chart/generate.go
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
|
||||
git checkout cmd/vela/fake/chart_source.go
|
||||
@$(OK) build succeed
|
||||
|
||||
vela-cli:
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
|
||||
@@ -38,9 +57,10 @@ npm-build:
|
||||
npm-install:
|
||||
cd dashboard && npm install && cd ./..
|
||||
|
||||
generate-doc:
|
||||
rm -r docs/cli/*
|
||||
doc-gen:
|
||||
rm -r docs/en/cli/*
|
||||
go run hack/docgen/gen.go
|
||||
go run hack/references/generate.go
|
||||
|
||||
generate-source:
|
||||
go run hack/frontend/source.go
|
||||
@@ -51,6 +71,8 @@ cross-build:
|
||||
|
||||
compress:
|
||||
( \
|
||||
echo "\n## Release Info\nVERSION: $(VELA_VERSION)" >> README.md && \
|
||||
echo "GIT_COMMIT: $(GIT_COMMIT_LONG)\n" >> README.md && \
|
||||
cd _bin && \
|
||||
$(DIST_DIRS) cp ../LICENSE {} \; && \
|
||||
$(DIST_DIRS) cp ../README.md {} \; && \
|
||||
@@ -64,20 +86,29 @@ run: fmt vet
|
||||
go run ./cmd/core/main.go
|
||||
|
||||
# Run go fmt against code
|
||||
fmt:
|
||||
fmt: goimports installcue
|
||||
go fmt ./...
|
||||
./hack/cue-fmt.sh
|
||||
$(GOIMPORTS) -local github.com/oam-dev/kubevela -w ./pkg ./cmd
|
||||
$(CUE) fmt ./hack/vela-templates/cue/*
|
||||
|
||||
# Run go vet against code
|
||||
vet:
|
||||
go vet ./...
|
||||
|
||||
lint: golangci
|
||||
$(GOLANGCILINT) run --timeout 10m -E golint,goimports ./...
|
||||
$(GOLANGCILINT) run ./...
|
||||
|
||||
reviewable: fmt vet lint manifests
|
||||
go mod tidy
|
||||
|
||||
# Execute auto-gen code commands and ensure branch is clean.
|
||||
check-diff: reviewable
|
||||
git diff --quiet || ($(ERR) please run 'make reviewable' to include all changes && false)
|
||||
@$(OK) branch is clean
|
||||
|
||||
# Build the docker image
|
||||
docker-build: test
|
||||
docker build . -t ${IMG}
|
||||
docker-build:
|
||||
docker build --build-arg=VERSION=$(VELA_VERSION) --build-arg=GITVERSION=$(GIT_COMMIT) . -t ${IMG}
|
||||
|
||||
# Push the docker image
|
||||
docker-push:
|
||||
@@ -93,6 +124,10 @@ e2e-setup:
|
||||
e2e-test:
|
||||
# Run e2e test
|
||||
ginkgo -v -skipPackage capability,setup,apiserver -r e2e
|
||||
ginkgo -v ./test/e2e-test
|
||||
# integration test will clean environment, please don't put test behind it.
|
||||
CGO_ENABLED=0 go test -timeout 1h -count=1 -v -tags 'integration' ./test/integration
|
||||
@$(OK) tests pass
|
||||
|
||||
e2e-api-test:
|
||||
# Run e2e test
|
||||
@@ -109,27 +144,28 @@ kind-load:
|
||||
|
||||
# Image URL to use all building/pushing image targets
|
||||
IMG ?= vela-core:latest
|
||||
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
|
||||
CRD_OPTIONS ?= "crd:crdVersions=v1"
|
||||
|
||||
# Run tests
|
||||
core-test: generate fmt vet manifests
|
||||
core-test: fmt vet manifests
|
||||
go test ./pkg/... -coverprofile cover.out
|
||||
|
||||
# Build manager binary
|
||||
manager: generate fmt vet lint manifests
|
||||
manager: fmt vet lint manifests
|
||||
go build -o bin/manager ./cmd/core/main.go
|
||||
|
||||
# Run against the configured Kubernetes cluster in ~/.kube/config
|
||||
core-run: generate fmt vet manifests
|
||||
core-run: fmt vet manifests
|
||||
go run ./cmd/core/main.go
|
||||
|
||||
# Install CRDs and Definitions of Vela Core into a cluster, this is for develop convenient.
|
||||
core-install: manifests
|
||||
kubectl apply -f hack/namespace.yaml
|
||||
kubectl apply -f charts/vela-core/crds/
|
||||
kubectl apply -f charts/vela-core/templates/defwithtemplate/
|
||||
kubectl apply -f charts/vela-core/templates/definitions/
|
||||
bin/vela system update
|
||||
kubectl apply -f charts/vela-core/templates/velaConfig.yaml
|
||||
bin/vela workloads
|
||||
@$(OK) install succeed
|
||||
|
||||
# Uninstall CRDs and Definitions of Vela Core from a cluster, this is for develop convenient.
|
||||
core-uninstall: manifests
|
||||
@@ -138,31 +174,10 @@ core-uninstall: manifests
|
||||
kubectl delete -f charts/vela-core/crds/
|
||||
|
||||
# Generate manifests e.g. CRD, RBAC etc.
|
||||
manifests: controller-gen
|
||||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=charts/vela-core/crds
|
||||
manifests:
|
||||
go generate $(foreach t,pkg apis,./$(t)/...)
|
||||
./hack/vela-templates/gen_definitions.sh
|
||||
|
||||
# Generate code
|
||||
generate: controller-gen
|
||||
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
|
||||
|
||||
# find or download controller-gen
|
||||
# download controller-gen if necessary
|
||||
controller-gen:
|
||||
ifeq (, $(shell which controller-gen))
|
||||
@{ \
|
||||
set -e ;\
|
||||
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
|
||||
cd $$CONTROLLER_GEN_TMP_DIR ;\
|
||||
go mod init tmp ;\
|
||||
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.2.5 ;\
|
||||
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
|
||||
}
|
||||
CONTROLLER_GEN=$(GOBIN)/controller-gen
|
||||
else
|
||||
CONTROLLER_GEN=$(shell which controller-gen)
|
||||
endif
|
||||
|
||||
GOLANGCILINT_VERSION ?= v1.29.0
|
||||
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
HOSTARCH := $(shell uname -m)
|
||||
@@ -182,3 +197,27 @@ GOLANGCILINT=$(GOBIN)/golangci-lint
|
||||
else
|
||||
GOLANGCILINT=$(shell which golangci-lint)
|
||||
endif
|
||||
|
||||
.PHONY: goimports
|
||||
goimports:
|
||||
ifeq (, $(shell which goimports))
|
||||
@{ \
|
||||
set -e ;\
|
||||
GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports ;\
|
||||
}
|
||||
GOIMPORTS=$(GOBIN)/goimports
|
||||
else
|
||||
GOIMPORTS=$(shell which goimports)
|
||||
endif
|
||||
|
||||
.PHONY: installcue
|
||||
installcue:
|
||||
ifeq (, $(shell which cue))
|
||||
@{ \
|
||||
set -e ;\
|
||||
GO111MODULE=off go get -u cuelang.org/go/cmd/cue ;\
|
||||
}
|
||||
CUE=$(GOBIN)/cue
|
||||
else
|
||||
CUE=$(shell which cue)
|
||||
endif
|
||||
1
OWNERS
1
OWNERS
@@ -5,5 +5,4 @@ approvers:
|
||||
reviewers:
|
||||
- kubevela-controller
|
||||
- kubevela-dashboard
|
||||
- oam-k8s-runtime
|
||||
- oam-spec
|
||||
@@ -14,14 +14,7 @@ aliases:
|
||||
- hongchaodeng
|
||||
- zzxwill
|
||||
- ryanzhang-oss
|
||||
|
||||
oam-k8s-runtime: # inherit from https://github.com/crossplane/oam-kubernetes-runtime/blob/master/OWNERS.md
|
||||
- hongchaodeng
|
||||
- wonderflow
|
||||
- ryanzhang-oss
|
||||
- captainroy-hy
|
||||
- negz
|
||||
- hasheddan
|
||||
|
||||
oam-spec: # inherit from https://github.com/oam-dev/spec/blob/master/OWNERS.md
|
||||
- hongchaodeng
|
||||
|
||||
19
README.md
19
README.md
@@ -1,4 +1,13 @@
|
||||

|
||||

|
||||
[](https://goreportcard.com/report/github.com/oam-dev/kubevela)
|
||||

|
||||
[](https://codecov.io/gh/oam-dev/kubevela)
|
||||
[](/LICENSE)
|
||||
[](https://github.com/oam-dev/kubevela/releases)
|
||||
[](https://www.tickgit.com/browse?repo=github.com/oam-dev/kubevela)
|
||||
[](https://twitter.com/oam_dev)
|
||||
|
||||

|
||||
|
||||
*Make shipping applications more enjoyable.*
|
||||
|
||||
@@ -11,18 +20,18 @@ For platform builders, KubeVela serves as a framework that empowers them to crea
|
||||
- Slack: [Discuss](https://cloud-native.slack.com/archives/C01BLQ3HTJA)
|
||||
- Gitter: [Community](https://gitter.im/oam-dev/community)
|
||||
|
||||
> NOTE: KubeVela is still in early stage and iterating quickly. It's currently under preview release.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Quick start guides are available on [this section](docs/quick-start.md).
|
||||
Quick start guides are available on [this section](https://kubevela.io/#/en/quick-start).
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation is available on the [documentation section](docs/README.md).
|
||||
For full documentation, please visit the KubeVela website: [https://kubevela.io](https://kubevela.io/).
|
||||
|
||||
## Contributing
|
||||
Check out [CONTRIBUTING](./CONTRIBUTING.md) to see how to develop with KubeVela.
|
||||
|
||||
## Code of Conduct
|
||||
This project has adopted the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). See [CODE OF CONDUCT](CODE_OF_CONDUCT.md) for details.
|
||||
|
||||
> NOTE: KubeVela is an early project and iterating quickly to continue to make it easier to ship applications and build platforms atop. It's still under preview release for now.
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
|
||||
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 v1alpha2 contains API Schema definitions for the core.oam.dev v1alpha2 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=core.oam.dev
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: "core.oam.dev", Version: "v1alpha2"}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
|
||||
// AddToScheme adds the types in this group-version to the given scheme.
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
@@ -1,115 +0,0 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationDeployment) DeepCopyInto(out *ApplicationDeployment) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationDeployment.
|
||||
func (in *ApplicationDeployment) DeepCopy() *ApplicationDeployment {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationDeployment)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApplicationDeployment) 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 *ApplicationDeploymentList) DeepCopyInto(out *ApplicationDeploymentList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]ApplicationDeployment, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationDeploymentList.
|
||||
func (in *ApplicationDeploymentList) DeepCopy() *ApplicationDeploymentList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationDeploymentList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *ApplicationDeploymentList) 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 *ApplicationDeploymentSpec) DeepCopyInto(out *ApplicationDeploymentSpec) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationDeploymentSpec.
|
||||
func (in *ApplicationDeploymentSpec) DeepCopy() *ApplicationDeploymentSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationDeploymentSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationDeploymentStatus) DeepCopyInto(out *ApplicationDeploymentStatus) {
|
||||
*out = *in
|
||||
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationDeploymentStatus.
|
||||
func (in *ApplicationDeploymentStatus) DeepCopy() *ApplicationDeploymentStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationDeploymentStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/rest"
|
||||
)
|
||||
|
||||
type Args struct {
|
||||
Config *rest.Config
|
||||
Schema *runtime.Scheme
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package types
|
||||
|
||||
const (
|
||||
DefaultOAMNS = "vela-system"
|
||||
DefaultOAMReleaseName = "kubevela"
|
||||
DefaultOAMRuntimeChartName = "vela-core"
|
||||
DefaultOAMVersion = ">0.0.0-0"
|
||||
|
||||
DefaultEnvName = "default"
|
||||
DefaultAppNamespace = "default"
|
||||
)
|
||||
|
||||
const (
|
||||
AnnAPIVersion = "definition.oam.dev/apiVersion"
|
||||
AnnKind = "definition.oam.dev/kind"
|
||||
AnnDescription = "definition.oam.dev/description"
|
||||
|
||||
LabelPodSpecable = "workload.oam.dev/podspecable"
|
||||
)
|
||||
|
||||
const (
|
||||
StatusDeployed = "Deployed"
|
||||
StatusStaging = "Staging"
|
||||
)
|
||||
|
||||
type EnvMeta struct {
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
|
||||
// Below are not arguments, should be auto-generated
|
||||
Issuer string `json:"issuer"`
|
||||
Current string `json:"current,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
TagCommandType = "commandType"
|
||||
|
||||
TypeStart = "Getting Started"
|
||||
TypeApp = "Applications"
|
||||
TypeTraits = "Traits"
|
||||
TypeRelease = "Release"
|
||||
TypeOthers = "Others"
|
||||
TypeSystem = "System"
|
||||
)
|
||||
2
apis/apis.go
Normal file
2
apis/apis.go
Normal file
@@ -0,0 +1,2 @@
|
||||
// Package apis contains all api types of KubeVela
|
||||
package apis
|
||||
37
apis/core.oam.dev/groupversion_info.go
Normal file
37
apis/core.oam.dev/groupversion_info.go
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
Copyright 2020 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 core_oam_dev contains API Schema definitions for the core.oam.dev v1alpha2 API group
|
||||
package core_oam_dev
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Register the types with the Scheme so the resources can map objects to GroupVersionKinds and back
|
||||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme)
|
||||
}
|
||||
|
||||
// AddToSchemes may be used to add all resources defined in the project to a Scheme
|
||||
var AddToSchemes runtime.SchemeBuilder
|
||||
|
||||
// AddToScheme adds all Resources to the Scheme
|
||||
func AddToScheme(s *runtime.Scheme) error {
|
||||
return AddToSchemes.AddToScheme(s)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
|
||||
Copyright 2020 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.
|
||||
@@ -25,19 +25,19 @@ import (
|
||||
|
||||
// ApplicationDeploymentSpec defines the desired state of ApplicationDeployment
|
||||
type ApplicationDeploymentSpec struct {
|
||||
//TODO add spec here
|
||||
// TODO add spec here
|
||||
}
|
||||
|
||||
// ApplicationDeploymentStatus defines the observed state of ApplicationDeployment
|
||||
type ApplicationDeploymentStatus struct {
|
||||
//TODO add status field here
|
||||
// TODO add status field here
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// ApplicationDeployment is the Schema for the ApplicationDeployment API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// ApplicationDeployment is the Schema for the ApplicationDeployment API
|
||||
type ApplicationDeployment struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -46,14 +46,10 @@ type ApplicationDeployment struct {
|
||||
Status ApplicationDeploymentStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// ApplicationDeploymentList contains a list of ApplicationDeployment
|
||||
// +kubebuilder:object:root=true
|
||||
type ApplicationDeploymentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApplicationDeployment `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&ApplicationDeployment{}, &ApplicationDeploymentList{})
|
||||
}
|
||||
73
apis/core.oam.dev/v1alpha2/application_types.go
Normal file
73
apis/core.oam.dev/v1alpha2/application_types.go
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
|
||||
|
||||
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 v1alpha2
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// ApplicationPhase is a label for the condition of a application at the current time
|
||||
type ApplicationPhase string
|
||||
|
||||
const (
|
||||
// ApplicationRendering means the app is rendering
|
||||
ApplicationRendering ApplicationPhase = "rendering"
|
||||
// ApplicationRunning means the app finished rendering and applied result to the cluster
|
||||
ApplicationRunning ApplicationPhase = "running"
|
||||
)
|
||||
|
||||
// AppStatus defines the observed state of Application
|
||||
type AppStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
Phase ApplicationPhase `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// Application is the Schema for the applications API
|
||||
// +kubebuilder:subresource:status
|
||||
type Application struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Spec runtime.RawExtension `json:"spec,omitempty"`
|
||||
Status AppStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationList contains a list of Application
|
||||
type ApplicationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Application `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Application{}, &ApplicationList{})
|
||||
}
|
||||
104
apis/core.oam.dev/v1alpha2/core_scope_types.go
Normal file
104
apis/core.oam.dev/v1alpha2/core_scope_types.go
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
import (
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// HealthStatus represents health status strings.
|
||||
type HealthStatus string
|
||||
|
||||
const (
|
||||
// StatusHealthy represents healthy status.
|
||||
StatusHealthy HealthStatus = "HEALTHY"
|
||||
// StatusUnhealthy represents unhealthy status.
|
||||
StatusUnhealthy = "UNHEALTHY"
|
||||
// StatusUnknown represents unknown status.
|
||||
StatusUnknown = "UNKNOWN"
|
||||
)
|
||||
|
||||
var _ oam.Scope = &HealthScope{}
|
||||
|
||||
// A HealthScopeSpec defines the desired state of a HealthScope.
|
||||
type HealthScopeSpec struct {
|
||||
// ProbeTimeout is the amount of time in seconds to wait when receiving a response before marked failure.
|
||||
ProbeTimeout *int32 `json:"probe-timeout,omitempty"`
|
||||
|
||||
// ProbeInterval is the amount of time in seconds between probing tries.
|
||||
ProbeInterval *int32 `json:"probe-interval,omitempty"`
|
||||
|
||||
// WorkloadReferences to the workloads that are in this scope.
|
||||
WorkloadReferences []runtimev1alpha1.TypedReference `json:"workloadRefs"`
|
||||
}
|
||||
|
||||
// A HealthScopeStatus represents the observed state of a HealthScope.
|
||||
type HealthScopeStatus struct {
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// ScopeHealthCondition represents health condition summary of the scope
|
||||
ScopeHealthCondition ScopeHealthCondition `json:"scopeHealthCondition"`
|
||||
|
||||
// WorkloadHealthConditions represents health condition of workloads in the scope
|
||||
WorkloadHealthConditions []*WorkloadHealthCondition `json:"healthConditions,omitempty"`
|
||||
}
|
||||
|
||||
// ScopeHealthCondition represents health condition summary of a scope.
|
||||
type ScopeHealthCondition struct {
|
||||
HealthStatus HealthStatus `json:"healthStatus"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
HealthyWorkloads int64 `json:"healthyWorkloads,omitempty"`
|
||||
UnhealthyWorkloads int64 `json:"unhealthyWorkloads,omitempty"`
|
||||
UnknownWorkloads int64 `json:"unknownWorkloads,omitempty"`
|
||||
}
|
||||
|
||||
// WorkloadHealthCondition represents informative health condition.
|
||||
type WorkloadHealthCondition struct {
|
||||
// ComponentName represents the component name if target is a workload
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
TargetWorkload runtimev1alpha1.TypedReference `json:"targetWorkload,omitempty"`
|
||||
HealthStatus HealthStatus `json:"healthStatus"`
|
||||
Diagnosis string `json:"diagnosis,omitempty"`
|
||||
// WorkloadStatus represents status of workloads whose HealthStatus is UNKNOWN.
|
||||
WorkloadStatus string `json:"workloadStatus,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A HealthScope determines an aggregate health status based of the health of components.
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:JSONPath=".status.health",name=HEALTH,type=string
|
||||
type HealthScope struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HealthScopeSpec `json:"spec,omitempty"`
|
||||
Status HealthScopeStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// HealthScopeList contains a list of HealthScope.
|
||||
type HealthScopeList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []HealthScope `json:"items"`
|
||||
}
|
||||
63
apis/core.oam.dev/v1alpha2/core_trait_types.go
Normal file
63
apis/core.oam.dev/v1alpha2/core_trait_types.go
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
import (
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
var _ oam.Trait = &ManualScalerTrait{}
|
||||
|
||||
// A ManualScalerTraitSpec defines the desired state of a ManualScalerTrait.
|
||||
type ManualScalerTraitSpec struct {
|
||||
// ReplicaCount of the workload this trait applies to.
|
||||
ReplicaCount int32 `json:"replicaCount"`
|
||||
|
||||
// WorkloadReference to the workload this trait applies to.
|
||||
WorkloadReference runtimev1alpha1.TypedReference `json:"workloadRef"`
|
||||
}
|
||||
|
||||
// A ManualScalerTraitStatus represents the observed state of a
|
||||
// ManualScalerTrait.
|
||||
type ManualScalerTraitStatus struct {
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A ManualScalerTrait determines how many replicas a workload should have.
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ManualScalerTrait struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ManualScalerTraitSpec `json:"spec,omitempty"`
|
||||
Status ManualScalerTraitStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ManualScalerTraitList contains a list of ManualScalerTrait.
|
||||
type ManualScalerTraitList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ManualScalerTrait `json:"items"`
|
||||
}
|
||||
548
apis/core.oam.dev/v1alpha2/core_types.go
Normal file
548
apis/core.oam.dev/v1alpha2/core_types.go
Normal file
@@ -0,0 +1,548 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
)
|
||||
|
||||
// A DefinitionReference refers to a CustomResourceDefinition by name.
|
||||
type DefinitionReference struct {
|
||||
// Name of the referenced CustomResourceDefinition.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Version indicate which version should be used if CRD has multiple versions
|
||||
// by default it will use the first one if not specified
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// A ChildResourceKind defines a child Kubernetes resource kind with a selector
|
||||
type ChildResourceKind struct {
|
||||
// APIVersion of the child resource
|
||||
APIVersion string `json:"apiVersion"`
|
||||
|
||||
// Kind of the child resource
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Selector to select the child resources that the workload wants to expose to traits
|
||||
Selector map[string]string `json:"selector,omitempty"`
|
||||
}
|
||||
|
||||
// A WorkloadDefinitionSpec defines the desired state of a WorkloadDefinition.
|
||||
type WorkloadDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this workload kind.
|
||||
Reference DefinitionReference `json:"definitionRef"`
|
||||
|
||||
// ChildResourceKinds are the list of GVK of the child resources this workload generates
|
||||
ChildResourceKinds []ChildResourceKind `json:"childResourceKinds,omitempty"`
|
||||
|
||||
// RevisionLabel indicates which label for underlying resources(e.g. pods) of this workload
|
||||
// can be used by trait to create resource selectors(e.g. label selector for pods).
|
||||
// +optional
|
||||
RevisionLabel string `json:"revisionLabel,omitempty"`
|
||||
|
||||
// PodSpecPath indicates where/if this workload has K8s podSpec field
|
||||
// if one workload has podSpec, trait can do lot's of assumption such as port, env, volume fields.
|
||||
// +optional
|
||||
PodSpecPath string `json:"podSpecPath,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A WorkloadDefinition registers a kind of Kubernetes custom resource as a
|
||||
// valid OAM workload kind by referencing its CustomResourceDefinition. The CRD
|
||||
// is used to validate the schema of the workload when it is embedded in an OAM
|
||||
// Component.
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.definitionRef.name",name=DEFINITION-NAME,type=string
|
||||
// +kubebuilder:resource:scope=Cluster,categories={crossplane,oam}
|
||||
type WorkloadDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec WorkloadDefinitionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// WorkloadDefinitionList contains a list of WorkloadDefinition.
|
||||
type WorkloadDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []WorkloadDefinition `json:"items"`
|
||||
}
|
||||
|
||||
// A TraitDefinitionSpec defines the desired state of a TraitDefinition.
|
||||
type TraitDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this trait kind.
|
||||
Reference DefinitionReference `json:"definitionRef"`
|
||||
|
||||
// Revision indicates whether a trait is aware of component revision
|
||||
// +optional
|
||||
RevisionEnabled bool `json:"revisionEnabled,omitempty"`
|
||||
|
||||
// WorkloadRefPath indicates where/if a trait accepts a workloadRef object
|
||||
// +optional
|
||||
WorkloadRefPath string `json:"workloadRefPath,omitempty"`
|
||||
|
||||
// AppliesToWorkloads specifies the list of workload kinds this trait
|
||||
// applies to. Workload kinds are specified in kind.group/version format,
|
||||
// e.g. server.core.oam.dev/v1alpha2. Traits that omit this field apply to
|
||||
// all workload kinds.
|
||||
// +optional
|
||||
AppliesToWorkloads []string `json:"appliesToWorkloads,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A TraitDefinition registers a kind of Kubernetes custom resource as a valid
|
||||
// OAM trait kind by referencing its CustomResourceDefinition. The CRD is used
|
||||
// to validate the schema of the trait when it is embedded in an OAM
|
||||
// ApplicationConfiguration.
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.definitionRef.name",name=DEFINITION-NAME,type=string
|
||||
// +kubebuilder:resource:scope=Cluster,categories={crossplane,oam}
|
||||
type TraitDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec TraitDefinitionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// TraitDefinitionList contains a list of TraitDefinition.
|
||||
type TraitDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []TraitDefinition `json:"items"`
|
||||
}
|
||||
|
||||
// A ScopeDefinitionSpec defines the desired state of a ScopeDefinition.
|
||||
type ScopeDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this scope kind.
|
||||
Reference DefinitionReference `json:"definitionRef"`
|
||||
|
||||
// WorkloadRefsPath indicates if/where a scope accepts workloadRef objects
|
||||
WorkloadRefsPath string `json:"workloadRefsPath,omitempty"`
|
||||
|
||||
// AllowComponentOverlap specifies whether an OAM component may exist in
|
||||
// multiple instances of this kind of scope.
|
||||
AllowComponentOverlap bool `json:"allowComponentOverlap"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// 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.
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.definitionRef.name",name=DEFINITION-NAME,type=string
|
||||
// +kubebuilder:resource:scope=Cluster,categories={crossplane,oam}
|
||||
type ScopeDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ScopeDefinitionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ScopeDefinitionList contains a list of ScopeDefinition.
|
||||
type ScopeDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ScopeDefinition `json:"items"`
|
||||
}
|
||||
|
||||
// A ComponentParameter defines a configurable parameter of a component.
|
||||
type ComponentParameter struct {
|
||||
// Name of this parameter. OAM ApplicationConfigurations will specify
|
||||
// parameter values using this name.
|
||||
Name string `json:"name"`
|
||||
|
||||
// FieldPaths specifies an array of fields within this Component's workload
|
||||
// that will be overwritten by the value of this parameter. The type of the
|
||||
// parameter (e.g. int, string) is inferred from the type of these fields;
|
||||
// All fields must be of the same type. Fields are specified as JSON field
|
||||
// paths without a leading dot, for example 'spec.replicas'.
|
||||
FieldPaths []string `json:"fieldPaths"`
|
||||
|
||||
// +kubebuilder:default:=false
|
||||
// Required specifies whether or not a value for this parameter must be
|
||||
// supplied when authoring an ApplicationConfiguration.
|
||||
// +optional
|
||||
Required *bool `json:"required,omitempty"`
|
||||
|
||||
// Description of this parameter.
|
||||
// +optional
|
||||
Description *string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// A ComponentSpec defines the desired state of a Component.
|
||||
type ComponentSpec struct {
|
||||
// A Workload that will be created for each ApplicationConfiguration that
|
||||
// includes this Component. Workload is an instance of a workloadDefinition.
|
||||
// We either use the GVK info or a special "type" field in the workload to associate
|
||||
// the content of the workload with its workloadDefinition
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Workload runtime.RawExtension `json:"workload"`
|
||||
|
||||
// Parameters exposed by this component. ApplicationConfigurations that
|
||||
// reference this component may specify values for these parameters, which
|
||||
// will in turn be injected into the embedded workload.
|
||||
// +optional
|
||||
Parameters []ComponentParameter `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
// A ComponentStatus represents the observed state of a Component.
|
||||
type ComponentStatus struct {
|
||||
// The generation observed by the component controller.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration"`
|
||||
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// LatestRevision of component
|
||||
// +optional
|
||||
LatestRevision *Revision `json:"latestRevision,omitempty"`
|
||||
|
||||
// One Component should only be used by one AppConfig
|
||||
}
|
||||
|
||||
// Revision has name and revision number
|
||||
type Revision struct {
|
||||
Name string `json:"name"`
|
||||
Revision int64 `json:"revision"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A Component describes how an OAM workload kind may be instantiated.
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.workload.kind",name=WORKLOAD-KIND,type=string
|
||||
// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
type Component struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ComponentSpec `json:"spec,omitempty"`
|
||||
Status ComponentStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ComponentList contains a list of Component.
|
||||
type ComponentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Component `json:"items"`
|
||||
}
|
||||
|
||||
// A ComponentParameterValue specifies a value for a named parameter. The
|
||||
// associated component must publish a parameter with this name.
|
||||
type ComponentParameterValue struct {
|
||||
// Name of the component parameter to set.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Value to set.
|
||||
Value intstr.IntOrString `json:"value"`
|
||||
}
|
||||
|
||||
// A ComponentTrait specifies a trait that should be applied to a component.
|
||||
type ComponentTrait struct {
|
||||
// A Trait that will be created for the component
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Trait runtime.RawExtension `json:"trait"`
|
||||
|
||||
// DataOutputs specify the data output sources from this trait.
|
||||
// +optional
|
||||
DataOutputs []DataOutput `json:"dataOutputs,omitempty"`
|
||||
|
||||
// DataInputs specify the data input sinks into this trait.
|
||||
// +optional
|
||||
DataInputs []DataInput `json:"dataInputs,omitempty"`
|
||||
}
|
||||
|
||||
// A ComponentScope specifies a scope in which a component should exist.
|
||||
type ComponentScope struct {
|
||||
// A ScopeReference must refer to an OAM scope resource.
|
||||
ScopeReference runtimev1alpha1.TypedReference `json:"scopeRef"`
|
||||
}
|
||||
|
||||
// An ApplicationConfigurationComponent specifies a component of an
|
||||
// ApplicationConfiguration. Each component is used to instantiate a workload.
|
||||
type ApplicationConfigurationComponent struct {
|
||||
// ComponentName specifies a component whose latest revision will be bind
|
||||
// with ApplicationConfiguration. When the spec of the referenced component
|
||||
// changes, ApplicationConfiguration will automatically migrate all trait
|
||||
// affect from the prior revision to the new one. This is mutually exclusive
|
||||
// with RevisionName.
|
||||
// +optional
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
|
||||
// RevisionName of a specific component revision to which to bind
|
||||
// ApplicationConfiguration. This is mutually exclusive with componentName.
|
||||
// +optional
|
||||
RevisionName string `json:"revisionName,omitempty"`
|
||||
|
||||
// DataOutputs specify the data output sources from this component.
|
||||
DataOutputs []DataOutput `json:"dataOutputs,omitempty"`
|
||||
|
||||
// DataInputs specify the data input sinks into this component.
|
||||
DataInputs []DataInput `json:"dataInputs,omitempty"`
|
||||
|
||||
// ParameterValues specify values for the the specified component's
|
||||
// parameters. Any parameter required by the component must be specified.
|
||||
// +optional
|
||||
ParameterValues []ComponentParameterValue `json:"parameterValues,omitempty"`
|
||||
|
||||
// Traits of the specified component.
|
||||
// +optional
|
||||
Traits []ComponentTrait `json:"traits,omitempty"`
|
||||
|
||||
// Scopes in which the specified component should exist.
|
||||
// +optional
|
||||
Scopes []ComponentScope `json:"scopes,omitempty"`
|
||||
}
|
||||
|
||||
// An ApplicationConfigurationSpec defines the desired state of a
|
||||
// ApplicationConfiguration.
|
||||
type ApplicationConfigurationSpec struct {
|
||||
// Components of which this ApplicationConfiguration consists. Each
|
||||
// component will be used to instantiate a workload.
|
||||
Components []ApplicationConfigurationComponent `json:"components"`
|
||||
}
|
||||
|
||||
// A TraitStatus represents the state of a trait.
|
||||
type TraitStatus string
|
||||
|
||||
// A WorkloadTrait represents a trait associated with a workload and its status
|
||||
type WorkloadTrait struct {
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the status of the trait
|
||||
Status TraitStatus `json:"status,omitempty"`
|
||||
|
||||
// Reference to a trait created by an ApplicationConfiguration.
|
||||
Reference runtimev1alpha1.TypedReference `json:"traitRef"`
|
||||
|
||||
// Message will allow controller to leave some additional information for this trait
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// A ScopeStatus represents the state of a scope.
|
||||
type ScopeStatus string
|
||||
|
||||
// A WorkloadScope represents a scope associated with a workload and its status
|
||||
type WorkloadScope struct {
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the status of the scope
|
||||
Status ScopeStatus `json:"status,omitempty"`
|
||||
|
||||
// Reference to a scope created by an ApplicationConfiguration.
|
||||
Reference runtimev1alpha1.TypedReference `json:"scopeRef"`
|
||||
}
|
||||
|
||||
// A WorkloadStatus represents the status of a workload.
|
||||
type WorkloadStatus struct {
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the entire status of the workload
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
// ComponentName that produced this workload.
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
|
||||
// ComponentRevisionName of current component
|
||||
ComponentRevisionName string `json:"componentRevisionName,omitempty"`
|
||||
|
||||
// Reference to a workload created by an ApplicationConfiguration.
|
||||
Reference runtimev1alpha1.TypedReference `json:"workloadRef,omitempty"`
|
||||
|
||||
// Traits associated with this workload.
|
||||
Traits []WorkloadTrait `json:"traits,omitempty"`
|
||||
|
||||
// Scopes associated with this workload.
|
||||
Scopes []WorkloadScope `json:"scopes,omitempty"`
|
||||
}
|
||||
|
||||
// HistoryWorkload contain the old component revision that are still running
|
||||
type HistoryWorkload struct {
|
||||
// Revision of this workload
|
||||
Revision string `json:"revision,omitempty"`
|
||||
|
||||
// Reference to running workload.
|
||||
Reference runtimev1alpha1.TypedReference `json:"workloadRef,omitempty"`
|
||||
}
|
||||
|
||||
// A ApplicationStatus represents the state of the entire application.
|
||||
type ApplicationStatus string
|
||||
|
||||
// An ApplicationConfigurationStatus represents the observed state of a
|
||||
// ApplicationConfiguration.
|
||||
type ApplicationConfigurationStatus struct {
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the status of the entire application
|
||||
Status ApplicationStatus `json:"status,omitempty"`
|
||||
|
||||
Dependency DependencyStatus `json:"dependency,omitempty"`
|
||||
|
||||
// Workloads created by this ApplicationConfiguration.
|
||||
Workloads []WorkloadStatus `json:"workloads,omitempty"`
|
||||
|
||||
// The generation observed by the appConfig controller.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration"`
|
||||
|
||||
// HistoryWorkloads will record history but still working revision workloads.
|
||||
HistoryWorkloads []HistoryWorkload `json:"historyWorkloads,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyStatus represents the observed state of the dependency of
|
||||
// an ApplicationConfiguration.
|
||||
type DependencyStatus struct {
|
||||
Unsatisfied []UnstaifiedDependency `json:"unsatisfied,omitempty"`
|
||||
}
|
||||
|
||||
// UnstaifiedDependency describes unsatisfied dependency flow between
|
||||
// one pair of objects.
|
||||
type UnstaifiedDependency struct {
|
||||
Reason string `json:"reason"`
|
||||
From DependencyFromObject `json:"from"`
|
||||
To DependencyToObject `json:"to"`
|
||||
}
|
||||
|
||||
// DependencyFromObject represents the object that dependency data comes from.
|
||||
type DependencyFromObject struct {
|
||||
runtimev1alpha1.TypedReference `json:",inline"`
|
||||
FieldPath string `json:"fieldPath,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyToObject represents the object that dependency data goes to.
|
||||
type DependencyToObject struct {
|
||||
runtimev1alpha1.TypedReference `json:",inline"`
|
||||
FieldPaths []string `json:"fieldPaths,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// An ApplicationConfiguration represents an OAM application.
|
||||
// +kubebuilder:resource:shortName=appconfig,categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ApplicationConfiguration struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationConfigurationSpec `json:"spec,omitempty"`
|
||||
Status ApplicationConfigurationStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationConfigurationList contains a list of ApplicationConfiguration.
|
||||
type ApplicationConfigurationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApplicationConfiguration `json:"items"`
|
||||
}
|
||||
|
||||
// DataOutput specifies a data output source from an object.
|
||||
type DataOutput struct {
|
||||
// Name is the unique name of a DataOutput in an ApplicationConfiguration.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// FieldPath refers to the value of an object's field.
|
||||
FieldPath string `json:"fieldPath,omitempty"`
|
||||
|
||||
// Conditions specify the conditions that should be satisfied before emitting a data output.
|
||||
// Different conditions are AND-ed together.
|
||||
// If no conditions is specified, it is by default to check output value not empty.
|
||||
// +optional
|
||||
Conditions []ConditionRequirement `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// DataInput specifies a data input sink to an object.
|
||||
// If input is array, it will be appended to the target field paths.
|
||||
type DataInput struct {
|
||||
// ValueFrom specifies the value source.
|
||||
ValueFrom DataInputValueFrom `json:"valueFrom,omitempty"`
|
||||
|
||||
// ToFieldPaths specifies the field paths of an object to fill passed value.
|
||||
ToFieldPaths []string `json:"toFieldPaths,omitempty"`
|
||||
}
|
||||
|
||||
// DataInputValueFrom specifies the value source for a data input.
|
||||
type DataInputValueFrom struct {
|
||||
// DataOutputName matches a name of a DataOutput in the same AppConfig.
|
||||
DataOutputName string `json:"dataOutputName"`
|
||||
}
|
||||
|
||||
// ConditionRequirement specifies the requirement to match a value.
|
||||
type ConditionRequirement struct {
|
||||
Operator ConditionOperator `json:"op"`
|
||||
|
||||
// +optional
|
||||
// Value specifies an expected value
|
||||
// This is mutually exclusive with ValueFrom
|
||||
Value string `json:"value,omitempty"`
|
||||
// +optional
|
||||
// ValueFrom specifies expected value from AppConfig
|
||||
// This is mutually exclusive with Value
|
||||
ValueFrom ValueFrom `json:"valueFrom,omitempty"`
|
||||
|
||||
// +optional
|
||||
// FieldPath specifies got value from workload/trait object
|
||||
FieldPath string `json:"fieldPath,omitempty"`
|
||||
}
|
||||
|
||||
// ValueFrom gets value from AppConfig object by specifying a path
|
||||
type ValueFrom struct {
|
||||
FieldPath string `json:"fieldPath"`
|
||||
}
|
||||
|
||||
// ConditionOperator specifies the operator to match a value.
|
||||
type ConditionOperator string
|
||||
|
||||
const (
|
||||
// ConditionEqual indicates equal to given value
|
||||
ConditionEqual ConditionOperator = "eq"
|
||||
// ConditionNotEqual indicates not equal to given value
|
||||
ConditionNotEqual ConditionOperator = "notEq"
|
||||
// ConditionNotEmpty indicates given value not empty
|
||||
ConditionNotEmpty ConditionOperator = "notEmpty"
|
||||
)
|
||||
409
apis/core.oam.dev/v1alpha2/core_workload_types.go
Normal file
409
apis/core.oam.dev/v1alpha2/core_workload_types.go
Normal file
@@ -0,0 +1,409 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// An OperatingSystem required by a containerised workload.
|
||||
type OperatingSystem string
|
||||
|
||||
// Supported operating system types.
|
||||
const (
|
||||
OperatingSystemLinux OperatingSystem = "linux"
|
||||
OperatingSystemWindows OperatingSystem = "windows"
|
||||
)
|
||||
|
||||
// A CPUArchitecture required by a containerised workload.
|
||||
type CPUArchitecture string
|
||||
|
||||
// Supported architectures
|
||||
const (
|
||||
CPUArchitectureI386 CPUArchitecture = "i386"
|
||||
CPUArchitectureAMD64 CPUArchitecture = "amd64"
|
||||
CPUArchitectureARM CPUArchitecture = "arm"
|
||||
CPUArchitectureARM64 CPUArchitecture = "arm64"
|
||||
)
|
||||
|
||||
// A SecretKeySelector is a reference to a secret key in an arbitrary namespace.
|
||||
type SecretKeySelector struct {
|
||||
// The name of the secret.
|
||||
Name string `json:"name"`
|
||||
|
||||
// The key to select.
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
// TODO(negz): The OAM spec calls for float64 quantities in some cases, but this
|
||||
// is incompatible with controller-gen and Kubernetes API conventions. We should
|
||||
// reassess whether resource.Quantity is appropriate after resolving
|
||||
// https://github.com/oam-dev/spec/issues/313
|
||||
|
||||
// CPUResources required by a container.
|
||||
type CPUResources struct {
|
||||
// Required CPU count. 1.0 represents one CPU core.
|
||||
Required resource.Quantity `json:"required"`
|
||||
}
|
||||
|
||||
// MemoryResources required by a container.
|
||||
type MemoryResources struct {
|
||||
// Required memory.
|
||||
Required resource.Quantity `json:"required"`
|
||||
}
|
||||
|
||||
// GPUResources required by a container.
|
||||
type GPUResources struct {
|
||||
// Required GPU count.
|
||||
Required resource.Quantity `json:"required"`
|
||||
}
|
||||
|
||||
// DiskResource required by a container.
|
||||
type DiskResource struct {
|
||||
// Required disk space.
|
||||
Required resource.Quantity `json:"required"`
|
||||
|
||||
// Ephemeral specifies whether an external disk needs to be mounted.
|
||||
// +optional
|
||||
Ephemeral *bool `json:"ephemeral,omitempty"`
|
||||
}
|
||||
|
||||
// A VolumeAccessMode determines how a volume may be accessed.
|
||||
type VolumeAccessMode string
|
||||
|
||||
// Volume access modes.
|
||||
const (
|
||||
VolumeAccessModeRO VolumeAccessMode = "RO"
|
||||
VolumeAccessModeRW VolumeAccessMode = "RW"
|
||||
)
|
||||
|
||||
// A VolumeSharingPolicy determines how a volume may be shared.
|
||||
type VolumeSharingPolicy string
|
||||
|
||||
// Volume sharing policies.
|
||||
const (
|
||||
VolumeSharingPolicyExclusive VolumeSharingPolicy = "Exclusive"
|
||||
VolumeSharingPolicyShared VolumeSharingPolicy = "Shared"
|
||||
)
|
||||
|
||||
// VolumeResource required by a container.
|
||||
type VolumeResource struct {
|
||||
// Name of this volume. Must be unique within its container.
|
||||
Name string `json:"name"`
|
||||
|
||||
// MountPath at which this volume will be mounted within its container.
|
||||
MountPath string `json:"mountPath"`
|
||||
|
||||
// TODO(negz): Use +kubebuilder:default marker to default AccessMode to RW
|
||||
// and SharingPolicy to Exclusive once we're generating v1 CRDs.
|
||||
|
||||
// AccessMode of this volume; RO (read only) or RW (read and write).
|
||||
// +optional
|
||||
// +kubebuilder:validation:Enum=RO;RW
|
||||
AccessMode *VolumeAccessMode `json:"accessMode,omitempty"`
|
||||
|
||||
// SharingPolicy of this volume; Exclusive or Shared.
|
||||
// +optional
|
||||
// +kubebuilder:validation:Enum=Exclusive;Shared
|
||||
SharingPolicy *VolumeSharingPolicy `json:"sharingPolicy,omitempty"`
|
||||
|
||||
// Disk requirements of this volume.
|
||||
// +optional
|
||||
Disk *DiskResource `json:"disk,omitempty"`
|
||||
}
|
||||
|
||||
// ExtendedResource required by a container.
|
||||
type ExtendedResource struct {
|
||||
// Name of the external resource. Resource names are specified in
|
||||
// kind.group/version format, e.g. motionsensor.ext.example.com/v1.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Required extended resource(s), e.g. 8 or "very-cool-widget"
|
||||
Required intstr.IntOrString `json:"required"`
|
||||
}
|
||||
|
||||
// ContainerResources specifies a container's required compute resources.
|
||||
type ContainerResources struct {
|
||||
// CPU required by this container.
|
||||
CPU CPUResources `json:"cpu"`
|
||||
|
||||
// Memory required by this container.
|
||||
Memory MemoryResources `json:"memory"`
|
||||
|
||||
// GPU required by this container.
|
||||
// +optional
|
||||
GPU *GPUResources `json:"gpu,omitempty"`
|
||||
|
||||
// Volumes required by this container.
|
||||
// +optional
|
||||
Volumes []VolumeResource `json:"volumes,omitempty"`
|
||||
|
||||
// Extended resources required by this container.
|
||||
// +optional
|
||||
Extended []ExtendedResource `json:"extended,omitempty"`
|
||||
}
|
||||
|
||||
// A ContainerEnvVar specifies an environment variable that should be set within
|
||||
// a container.
|
||||
type ContainerEnvVar struct {
|
||||
// Name of the environment variable. Must be composed of valid Unicode
|
||||
// letter and number characters, as well as _ and -.
|
||||
// +kubebuilder:validation:Pattern=^[-_a-zA-Z0-9]+$
|
||||
Name string `json:"name"`
|
||||
|
||||
// Value of the environment variable.
|
||||
// +optional
|
||||
Value *string `json:"value,omitempty"`
|
||||
|
||||
// FromSecret is a secret key reference which can be used to assign a value
|
||||
// to the environment variable.
|
||||
// +optional
|
||||
FromSecret *SecretKeySelector `json:"fromSecret,omitempty"`
|
||||
}
|
||||
|
||||
// A ContainerConfigFile specifies a configuration file that should be written
|
||||
// within a container.
|
||||
type ContainerConfigFile struct {
|
||||
// Path within the container at which the configuration file should be
|
||||
// written.
|
||||
Path string `json:"path"`
|
||||
|
||||
// Value that should be written to the configuration file.
|
||||
// +optional
|
||||
Value *string `json:"value,omitempty"`
|
||||
|
||||
// FromSecret is a secret key reference which can be used to assign a value
|
||||
// to be written to the configuration file at the given path in the
|
||||
// container.
|
||||
// +optional
|
||||
FromSecret *SecretKeySelector `json:"fromSecret,omitempty"`
|
||||
}
|
||||
|
||||
// A TransportProtocol represents a transport layer protocol.
|
||||
type TransportProtocol string
|
||||
|
||||
// Transport protocols.
|
||||
const (
|
||||
TransportProtocolTCP TransportProtocol = "TCP"
|
||||
TransportProtocolUDP TransportProtocol = "UDP"
|
||||
)
|
||||
|
||||
// A ContainerPort specifies a port that is exposed by a container.
|
||||
type ContainerPort struct {
|
||||
// Name of this port. Must be unique within its container. Must be lowercase
|
||||
// alphabetical characters.
|
||||
// +kubebuilder:validation:Pattern=^[a-z]+$
|
||||
Name string `json:"name"`
|
||||
|
||||
// Port number. Must be unique within its container.
|
||||
Port int32 `json:"containerPort"`
|
||||
|
||||
// TODO(negz): Use +kubebuilder:default marker to default Protocol to TCP
|
||||
// once we're generating v1 CRDs.
|
||||
|
||||
// Protocol used by the server listening on this port.
|
||||
// +kubebuilder:validation:Enum=TCP;UDP
|
||||
// +optional
|
||||
Protocol *TransportProtocol `json:"protocol,omitempty"`
|
||||
}
|
||||
|
||||
// An ExecProbe probes a container's health by executing a command.
|
||||
type ExecProbe struct {
|
||||
// Command to be run by this probe.
|
||||
Command []string `json:"command"`
|
||||
}
|
||||
|
||||
// A HTTPHeader to be passed when probing a container.
|
||||
type HTTPHeader struct {
|
||||
// Name of this HTTP header. Must be unique per probe.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Value of this HTTP header.
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// A HTTPGetProbe probes a container's health by sending an HTTP GET request.
|
||||
type HTTPGetProbe struct {
|
||||
// Path to probe, e.g. '/healthz'.
|
||||
Path string `json:"path"`
|
||||
|
||||
// Port to probe.
|
||||
Port int32 `json:"port"`
|
||||
|
||||
// HTTPHeaders to send with the GET request.
|
||||
// +optional
|
||||
HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"`
|
||||
}
|
||||
|
||||
// A TCPSocketProbe probes a container's health by connecting to a TCP socket.
|
||||
type TCPSocketProbe struct {
|
||||
// Port this probe should connect to.
|
||||
Port int32 `json:"port"`
|
||||
}
|
||||
|
||||
// A ContainerHealthProbe specifies how to probe the health of a container.
|
||||
// Exactly one of Exec, HTTPGet, or TCPSocket must be specified.
|
||||
type ContainerHealthProbe struct {
|
||||
// Exec probes a container's health by executing a command.
|
||||
// +optional
|
||||
Exec *ExecProbe `json:"exec,omitempty"`
|
||||
|
||||
// HTTPGet probes a container's health by sending an HTTP GET request.
|
||||
// +optional
|
||||
HTTPGet *HTTPGetProbe `json:"httpGet,omitempty"`
|
||||
|
||||
// TCPSocketProbe probes a container's health by connecting to a TCP socket.
|
||||
// +optional
|
||||
TCPSocket *TCPSocketProbe `json:"tcpSocket,omitempty"`
|
||||
|
||||
// InitialDelaySeconds after a container starts before the first probe.
|
||||
// +optional
|
||||
InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"`
|
||||
|
||||
// TODO(negz): Use +kubebuilder:default marker to default PeriodSeconds,
|
||||
// TimeoutSeconds, SuccessThreshold, and FailureThreshold to 10, 1, 1, and 3
|
||||
// respectively once we're generating v1 CRDs.
|
||||
|
||||
// PeriodSeconds between probes.
|
||||
// +optional
|
||||
PeriodSeconds *int32 `json:"periodSeconds,omitempty"`
|
||||
|
||||
// TimeoutSeconds after which the probe times out.
|
||||
// +optional
|
||||
TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
|
||||
|
||||
// SuccessThreshold specifies how many consecutive probes must success in
|
||||
// order for the container to be considered healthy.
|
||||
// +optional
|
||||
SuccessThreshold *int32 `json:"successThreshold,omitempty"`
|
||||
|
||||
// FailureThreshold specifies how many consecutive probes must fail in order
|
||||
// for the container to be considered healthy.
|
||||
// +optional
|
||||
FailureThreshold *int32 `json:"failureThreshold,omitempty"`
|
||||
}
|
||||
|
||||
// A Container represents an Open Containers Initiative (OCI) container.
|
||||
type Container struct {
|
||||
// Name of this container. Must be unique within its workload.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Image this container should run. Must be a path-like or URI-like
|
||||
// representation of an OCI image. May be prefixed with a registry address
|
||||
// and should be suffixed with a tag.
|
||||
Image string `json:"image"`
|
||||
|
||||
// Resources required by this container
|
||||
// +optional
|
||||
Resources *ContainerResources `json:"resources,omitempty"`
|
||||
|
||||
// Command to be run by this container.
|
||||
// +optional
|
||||
Command []string `json:"command,omitempty"`
|
||||
|
||||
// Arguments to be passed to the command run by this container.
|
||||
// +optional
|
||||
Arguments []string `json:"args,omitempty"`
|
||||
|
||||
// Environment variables that should be set within this container.
|
||||
// +optional
|
||||
Environment []ContainerEnvVar `json:"env,omitempty"`
|
||||
|
||||
// ConfigFiles that should be written within this container.
|
||||
// +optional
|
||||
ConfigFiles []ContainerConfigFile `json:"config,omitempty"`
|
||||
|
||||
// Ports exposed by this container.
|
||||
// +optional
|
||||
Ports []ContainerPort `json:"ports,omitempty"`
|
||||
|
||||
// A LivenessProbe assesses whether this container is alive. Containers that
|
||||
// fail liveness probes will be restarted.
|
||||
// +optional
|
||||
LivenessProbe *ContainerHealthProbe `json:"livenessProbe,omitempty"`
|
||||
|
||||
// A ReadinessProbe assesses whether this container is ready to serve
|
||||
// requests. Containers that fail readiness probes will be withdrawn from
|
||||
// service.
|
||||
// +optional
|
||||
ReadinessProbe *ContainerHealthProbe `json:"readinessProbe,omitempty"`
|
||||
|
||||
// TODO(negz): Ideally the key within this secret would be configurable, but
|
||||
// the current OAM spec allows only a secret name.
|
||||
|
||||
// ImagePullSecret specifies the name of a Secret from which the
|
||||
// credentials required to pull this container's image can be loaded.
|
||||
// +optional
|
||||
ImagePullSecret *string `json:"imagePullSecret,omitempty"`
|
||||
}
|
||||
|
||||
// A ContainerizedWorkloadSpec defines the desired state of a
|
||||
// ContainerizedWorkload.
|
||||
type ContainerizedWorkloadSpec struct {
|
||||
// OperatingSystem required by this workload.
|
||||
// +kubebuilder:validation:Enum=linux;windows
|
||||
// +optional
|
||||
OperatingSystem *OperatingSystem `json:"osType,omitempty"`
|
||||
|
||||
// CPUArchitecture required by this workload.
|
||||
// +kubebuilder:validation:Enum=i386;amd64;arm;arm64
|
||||
// +optional
|
||||
CPUArchitecture *CPUArchitecture `json:"arch,omitempty"`
|
||||
|
||||
// Containers of which this workload consists.
|
||||
Containers []Container `json:"containers"`
|
||||
}
|
||||
|
||||
// A ContainerizedWorkloadStatus represents the observed state of a
|
||||
// ContainerizedWorkload.
|
||||
type ContainerizedWorkloadStatus struct {
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// Resources managed by this containerised workload.
|
||||
Resources []runtimev1alpha1.TypedReference `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
var _ oam.Workload = &ContainerizedWorkload{}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A ContainerizedWorkload is a workload that runs OCI containers.
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ContainerizedWorkload struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ContainerizedWorkloadSpec `json:"spec,omitempty"`
|
||||
Status ContainerizedWorkloadStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ContainerizedWorkloadList contains a list of ContainerizedWorkload.
|
||||
type ContainerizedWorkloadList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ContainerizedWorkload `json:"items"`
|
||||
}
|
||||
22
apis/core.oam.dev/v1alpha2/doc.go
Normal file
22
apis/core.oam.dev/v1alpha2/doc.go
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2 contains resources relating to the Open Application Model.
|
||||
// See https://github.com/oam-dev/spec for more details.
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=core.oam.dev
|
||||
// +versionName=v1alpha2
|
||||
package v1alpha2
|
||||
93
apis/core.oam.dev/v1alpha2/methods.go
Normal file
93
apis/core.oam.dev/v1alpha2/methods.go
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
Copyright 2020 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.
|
||||
*/
|
||||
|
||||
// This code is manually implemented, but should be generated in the future.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
)
|
||||
|
||||
// GetCondition of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return tr.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
tr.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetWorkloadReference of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) GetWorkloadReference() runtimev1alpha1.TypedReference {
|
||||
return tr.Spec.WorkloadReference
|
||||
}
|
||||
|
||||
// SetWorkloadReference of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) SetWorkloadReference(r runtimev1alpha1.TypedReference) {
|
||||
tr.Spec.WorkloadReference = r
|
||||
}
|
||||
|
||||
// GetCondition of this ApplicationConfiguration.
|
||||
func (ac *ApplicationConfiguration) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return ac.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ApplicationConfiguration.
|
||||
func (ac *ApplicationConfiguration) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
ac.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this Component.
|
||||
func (cm *Component) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return cm.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this Component.
|
||||
func (cm *Component) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
cm.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this ContainerizedWorkload.
|
||||
func (wl *ContainerizedWorkload) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return wl.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ContainerizedWorkload.
|
||||
func (wl *ContainerizedWorkload) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
wl.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this HealthScope.
|
||||
func (hs *HealthScope) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return hs.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this HealthScope.
|
||||
func (hs *HealthScope) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
hs.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetWorkloadReferences to get all workload references for scope.
|
||||
func (hs *HealthScope) GetWorkloadReferences() []runtimev1alpha1.TypedReference {
|
||||
return hs.Spec.WorkloadReferences
|
||||
}
|
||||
|
||||
// AddWorkloadReference to add a workload reference to this scope.
|
||||
func (hs *HealthScope) AddWorkloadReference(r runtimev1alpha1.TypedReference) {
|
||||
hs.Spec.WorkloadReferences = append(hs.Spec.WorkloadReferences, r)
|
||||
}
|
||||
114
apis/core.oam.dev/v1alpha2/register.go
Normal file
114
apis/core.oam.dev/v1alpha2/register.go
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
Copyright 2020 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 v1alpha2
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
// Package type metadata.
|
||||
const (
|
||||
Group = "core.oam.dev"
|
||||
Version = "v1alpha2"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
)
|
||||
|
||||
// WorkloadDefinition type metadata.
|
||||
var (
|
||||
WorkloadDefinitionKind = reflect.TypeOf(WorkloadDefinition{}).Name()
|
||||
WorkloadDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: WorkloadDefinitionKind}.String()
|
||||
WorkloadDefinitionKindAPIVersion = WorkloadDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
WorkloadDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(WorkloadDefinitionKind)
|
||||
)
|
||||
|
||||
// TraitDefinition type metadata.
|
||||
var (
|
||||
TraitDefinitionKind = reflect.TypeOf(TraitDefinition{}).Name()
|
||||
TraitDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: TraitDefinitionKind}.String()
|
||||
TraitDefinitionKindAPIVersion = TraitDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
TraitDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(TraitDefinitionKind)
|
||||
)
|
||||
|
||||
// ScopeDefinition type metadata.
|
||||
var (
|
||||
ScopeDefinitionKind = reflect.TypeOf(ScopeDefinition{}).Name()
|
||||
ScopeDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: ScopeDefinitionKind}.String()
|
||||
ScopeDefinitionKindAPIVersion = ScopeDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
ScopeDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(ScopeDefinitionKind)
|
||||
)
|
||||
|
||||
// Component type metadata.
|
||||
var (
|
||||
ComponentKind = reflect.TypeOf(Component{}).Name()
|
||||
ComponentGroupKind = schema.GroupKind{Group: Group, Kind: ComponentKind}.String()
|
||||
ComponentKindAPIVersion = ComponentKind + "." + SchemeGroupVersion.String()
|
||||
ComponentGroupVersionKind = SchemeGroupVersion.WithKind(ComponentKind)
|
||||
)
|
||||
|
||||
// ApplicationConfiguration type metadata.
|
||||
var (
|
||||
ApplicationConfigurationKind = reflect.TypeOf(ApplicationConfiguration{}).Name()
|
||||
ApplicationConfigurationGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationConfigurationKind}.String()
|
||||
ApplicationConfigurationKindAPIVersion = ApplicationConfigurationKind + "." + SchemeGroupVersion.String()
|
||||
ApplicationConfigurationGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationConfigurationKind)
|
||||
)
|
||||
|
||||
// ContainerizedWorkload type metadata.
|
||||
var (
|
||||
ContainerizedWorkloadKind = reflect.TypeOf(ContainerizedWorkload{}).Name()
|
||||
ContainerizedWorkloadGroupKind = schema.GroupKind{Group: Group, Kind: ContainerizedWorkloadKind}.String()
|
||||
ContainerizedWorkloadKindAPIVersion = ContainerizedWorkloadKind + "." + SchemeGroupVersion.String()
|
||||
ContainerizedWorkloadGroupVersionKind = SchemeGroupVersion.WithKind(ContainerizedWorkloadKind)
|
||||
)
|
||||
|
||||
// ManualScalerTrait type metadata.
|
||||
var (
|
||||
ManualScalerTraitKind = reflect.TypeOf(ManualScalerTrait{}).Name()
|
||||
ManualScalerTraitGroupKind = schema.GroupKind{Group: Group, Kind: ManualScalerTraitKind}.String()
|
||||
ManualScalerTraitKindAPIVersion = ManualScalerTraitKind + "." + SchemeGroupVersion.String()
|
||||
ManualScalerTraitGroupVersionKind = SchemeGroupVersion.WithKind(ManualScalerTraitKind)
|
||||
)
|
||||
|
||||
// HealthScope type metadata.
|
||||
var (
|
||||
HealthScopeKind = reflect.TypeOf(HealthScope{}).Name()
|
||||
HealthScopeGroupKind = schema.GroupKind{Group: Group, Kind: HealthScopeKind}.String()
|
||||
HealthScopeKindAPIVersion = HealthScopeKind + "." + SchemeGroupVersion.String()
|
||||
HealthScopeGroupVersionKind = SchemeGroupVersion.WithKind(HealthScopeKind)
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&WorkloadDefinition{}, &WorkloadDefinitionList{})
|
||||
SchemeBuilder.Register(&TraitDefinition{}, &TraitDefinitionList{})
|
||||
SchemeBuilder.Register(&ScopeDefinition{}, &ScopeDefinitionList{})
|
||||
SchemeBuilder.Register(&Component{}, &ComponentList{})
|
||||
SchemeBuilder.Register(&ApplicationConfiguration{}, &ApplicationConfigurationList{})
|
||||
SchemeBuilder.Register(&ContainerizedWorkload{}, &ContainerizedWorkloadList{})
|
||||
SchemeBuilder.Register(&ManualScalerTrait{}, &ManualScalerTraitList{})
|
||||
SchemeBuilder.Register(&HealthScope{}, &HealthScopeList{})
|
||||
SchemeBuilder.Register(&ApplicationDeployment{}, &ApplicationDeploymentList{})
|
||||
}
|
||||
1856
apis/core.oam.dev/v1alpha2/zz_generated.deepcopy.go
Normal file
1856
apis/core.oam.dev/v1alpha2/zz_generated.deepcopy.go
Normal file
File diff suppressed because it is too large
Load Diff
21
apis/generate.go
Normal file
21
apis/generate.go
Normal file
@@ -0,0 +1,21 @@
|
||||
// +build generate
|
||||
|
||||
// See the below link for details on what is happening here.
|
||||
// https://github.com/golang/go/wiki/Modules#how-can-i-track-tool-dependencies-for-a-module
|
||||
|
||||
// NOTE(@wonderflow) We don't remove existing CRDs here, because the crd folders contain not only auto generated.
|
||||
|
||||
// Generate deepcopy methodsets and CRD manifests
|
||||
//go:generate go run -tags generate sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile=../hack/boilerplate.go.txt paths=./... crd:crdVersions=v1 output:artifacts:config=../charts/vela-core/crds
|
||||
|
||||
// Generate legacy_support for K8s 1.12~1.15 versions CRD manifests
|
||||
//go:generate go run -tags generate sigs.k8s.io/controller-tools/cmd/controller-gen object:headerFile=../hack/boilerplate.go.txt paths=./... crd:trivialVersions=true output:artifacts:config=../legacy/charts/vela-core-legacy/crds
|
||||
//go:generate go run ../legacy/convert/main.go ../legacy/charts/vela-core-legacy/crds
|
||||
|
||||
//go:generate go run ../hack/crd/update.go ../charts/vela-core/crds/
|
||||
|
||||
package apis
|
||||
|
||||
import (
|
||||
_ "sigs.k8s.io/controller-tools/cmd/controller-gen" //nolint:typecheck
|
||||
)
|
||||
@@ -30,9 +30,9 @@ type Protocol string
|
||||
// TriggerType defines the type of trigger
|
||||
type TriggerType string
|
||||
|
||||
// Autoscaler is the Schema for the autoscalers API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// Autoscaler is the Schema for the autoscalers API
|
||||
type Autoscaler struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -41,18 +41,22 @@ type Autoscaler struct {
|
||||
Status AutoscalerStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for CR status
|
||||
func (as *Autoscaler) SetConditions(c ...v1alpha1.Condition) {
|
||||
as.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition get condition from CR status
|
||||
func (as *Autoscaler) GetCondition(conditionType v1alpha1.ConditionType) v1alpha1.Condition {
|
||||
return as.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
// GetWorkloadReference get workload reference
|
||||
func (as *Autoscaler) GetWorkloadReference() v1alpha1.TypedReference {
|
||||
return as.Spec.WorkloadReference
|
||||
}
|
||||
|
||||
// SetWorkloadReference set workload reference
|
||||
func (as *Autoscaler) SetWorkloadReference(reference v1alpha1.TypedReference) {
|
||||
as.Spec.WorkloadReference = reference
|
||||
}
|
||||
@@ -18,9 +18,10 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
"github.com/crossplane/oam-kubernetes-runtime/pkg/oam"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
@@ -99,20 +100,22 @@ func init() {
|
||||
|
||||
var _ oam.Trait = &MetricsTrait{}
|
||||
|
||||
// SetConditions for set CR condition
|
||||
func (tr *MetricsTrait) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
tr.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition for get CR condition
|
||||
func (tr *MetricsTrait) GetCondition(c runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return tr.Status.GetCondition(c)
|
||||
}
|
||||
|
||||
// GetWorkloadReference of this ManualScalerTrait.
|
||||
// GetWorkloadReference of this MetricsTrait.
|
||||
func (tr *MetricsTrait) GetWorkloadReference() runtimev1alpha1.TypedReference {
|
||||
return tr.Spec.WorkloadReference
|
||||
}
|
||||
|
||||
// SetWorkloadReference of this ManualScalerTrait.
|
||||
// SetWorkloadReference of this MetricsTrait.
|
||||
func (tr *MetricsTrait) SetWorkloadReference(r runtimev1alpha1.TypedReference) {
|
||||
tr.Spec.WorkloadReference = r
|
||||
}
|
||||
@@ -18,9 +18,10 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
cpv1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
"github.com/crossplane/oam-kubernetes-runtime/pkg/oam"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// PodSpecWorkloadSpec defines the desired state of PodSpecWorkload
|
||||
@@ -73,10 +74,12 @@ func init() {
|
||||
|
||||
var _ oam.Workload = &PodSpecWorkload{}
|
||||
|
||||
// SetConditions set condition for this CR
|
||||
func (in *PodSpecWorkload) SetConditions(c ...cpv1alpha1.Condition) {
|
||||
in.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition set condition for this CR
|
||||
func (in *PodSpecWorkload) GetCondition(c cpv1alpha1.ConditionType) cpv1alpha1.Condition {
|
||||
return in.Status.GetCondition(c)
|
||||
}
|
||||
@@ -18,9 +18,10 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
"github.com/crossplane/oam-kubernetes-runtime/pkg/oam"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
@@ -66,6 +67,7 @@ type Rule struct {
|
||||
Backend *Backend `json:"backend,omitempty"`
|
||||
}
|
||||
|
||||
// TLS defines certificate issuer and type for mTLS configuration
|
||||
type TLS struct {
|
||||
IssuerName string `json:"issuerName,omitempty"`
|
||||
|
||||
@@ -74,13 +76,17 @@ type TLS struct {
|
||||
Type IssuerType `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
// IssuerType defines the type of issuer
|
||||
type IssuerType string
|
||||
|
||||
const (
|
||||
ClusterIssuer IssuerType = "ClusterIssuer"
|
||||
// ClusterIssuer is a cluster level type of issuer
|
||||
ClusterIssuer IssuerType = "ClusterIssuer"
|
||||
// NamespaceIssuer is the default one
|
||||
NamespaceIssuer IssuerType = "Issuer"
|
||||
)
|
||||
|
||||
// Backend defines backend configure for route trait.
|
||||
// Route will automatically discover podSpec and label for BackendService.
|
||||
// If BackendService is already set, discovery won't work.
|
||||
// If BackendService is not set, the discovery mechanism will work.
|
||||
@@ -109,10 +115,10 @@ type RouteStatus struct {
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// Route is the Schema for the routes API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// Route is the Schema for the routes API
|
||||
type Route struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -121,8 +127,8 @@ type Route struct {
|
||||
Status RouteStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// RouteList contains a list of Route
|
||||
// +kubebuilder:object:root=true
|
||||
type RouteList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
@@ -135,20 +141,22 @@ func init() {
|
||||
|
||||
var _ oam.Trait = &Route{}
|
||||
|
||||
// SetConditions set condition for CR status
|
||||
func (r *Route) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
r.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition get condition from CR status
|
||||
func (r *Route) GetCondition(c runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return r.Status.GetCondition(c)
|
||||
}
|
||||
|
||||
// GetWorkloadReference of this ManualScalerTrait.
|
||||
// GetWorkloadReference of this Route Trait.
|
||||
func (r *Route) GetWorkloadReference() runtimev1alpha1.TypedReference {
|
||||
return r.Spec.WorkloadReference
|
||||
}
|
||||
|
||||
// SetWorkloadReference of this ManualScalerTrait.
|
||||
// SetWorkloadReference of this Route Trait.
|
||||
func (r *Route) SetWorkloadReference(rt runtimev1alpha1.TypedReference) {
|
||||
r.Spec.WorkloadReference = rt
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
|
||||
Copyright 2020 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.
|
||||
23
apis/types/args.go
Normal file
23
apis/types/args.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package types
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/client-go/rest"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client/config"
|
||||
)
|
||||
|
||||
// Args is args for controller-runtime client
|
||||
type Args struct {
|
||||
Config *rest.Config
|
||||
Schema *runtime.Scheme
|
||||
}
|
||||
|
||||
// SetConfig insert kubeconfig into Args
|
||||
func (a *Args) SetConfig() error {
|
||||
restConf, err := config.GetConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a.Config = restConf
|
||||
return nil
|
||||
}
|
||||
@@ -26,12 +26,14 @@ import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// Source record the source of Capability
|
||||
type Source struct {
|
||||
RepoName string `json:"repoName"`
|
||||
ChartName string `json:"chartName,omitempty"`
|
||||
}
|
||||
|
||||
type CrdInfo struct {
|
||||
// CRDInfo record the CRD info of the Capability
|
||||
type CRDInfo struct {
|
||||
APIVersion string `json:"apiVersion"`
|
||||
Kind string `json:"kind"`
|
||||
}
|
||||
@@ -49,35 +51,44 @@ type Capability struct {
|
||||
Status string `json:"status,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
|
||||
//trait only
|
||||
// trait only
|
||||
AppliesTo []string `json:"appliesTo,omitempty"`
|
||||
|
||||
// Plugin Source
|
||||
Source *Source `json:"source,omitempty"`
|
||||
Install *Installation `json:"install,omitempty"`
|
||||
CrdInfo *CrdInfo `json:"crdInfo,omitempty"`
|
||||
CrdInfo *CRDInfo `json:"crdInfo,omitempty"`
|
||||
}
|
||||
|
||||
// Chart defines all necessary information to install a whole chart
|
||||
type Chart struct {
|
||||
Repo string `json:"repo"`
|
||||
URL string `json:"url"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Version string `json:"version"`
|
||||
Repo string `json:"repo"`
|
||||
URL string `json:"url"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Version string `json:"version"`
|
||||
Values map[string]interface{} `json:"values"`
|
||||
}
|
||||
|
||||
// Installation defines the installation method for this Capability, currently only helm is supported
|
||||
type Installation struct {
|
||||
Helm Chart `json:"helm"`
|
||||
// TODO(wonderflow) add raw yaml file support for install capability
|
||||
}
|
||||
|
||||
// CapType defines the type of capability
|
||||
type CapType string
|
||||
|
||||
const (
|
||||
// TypeWorkload represents OAM Workload
|
||||
TypeWorkload CapType = "workload"
|
||||
TypeTrait CapType = "trait"
|
||||
TypeScope CapType = "scope"
|
||||
// TypeTrait represents OAM Trait
|
||||
TypeTrait CapType = "trait"
|
||||
// TypeScope represent OAM Scope
|
||||
TypeScope CapType = "scope"
|
||||
)
|
||||
|
||||
// Parameter defines a parameter for cli from capability template
|
||||
type Parameter struct {
|
||||
Name string `json:"name"`
|
||||
Short string `json:"short,omitempty"`
|
||||
@@ -92,11 +103,8 @@ type Parameter struct {
|
||||
func ConvertTemplateJSON2Object(in *runtime.RawExtension) (Capability, error) {
|
||||
var t Capability
|
||||
var extension Capability
|
||||
if in == nil {
|
||||
return t, fmt.Errorf("extension field is nil")
|
||||
}
|
||||
if in.Raw == nil {
|
||||
return t, fmt.Errorf("template object is nil")
|
||||
if in == nil || in.Raw == nil {
|
||||
return t, fmt.Errorf("no template found")
|
||||
}
|
||||
err := json.Unmarshal(in.Raw, &extension)
|
||||
if err == nil {
|
||||
@@ -105,11 +113,13 @@ func ConvertTemplateJSON2Object(in *runtime.RawExtension) (Capability, error) {
|
||||
return t, err
|
||||
}
|
||||
|
||||
// SetFlagBy set cli flag from Parameter
|
||||
func SetFlagBy(flags *pflag.FlagSet, v Parameter) {
|
||||
name := v.Name
|
||||
if v.Alias != "" {
|
||||
name = v.Alias
|
||||
}
|
||||
// nolint:exhaustive
|
||||
switch v.Type {
|
||||
case cue.IntKind:
|
||||
var vv int64
|
||||
@@ -141,15 +151,19 @@ func SetFlagBy(flags *pflag.FlagSet, v Parameter) {
|
||||
vv = val
|
||||
}
|
||||
flags.Float64P(name, v.Short, vv, v.Usage)
|
||||
default:
|
||||
// other types not supported yet
|
||||
}
|
||||
}
|
||||
|
||||
// CapabilityCmpOptions will set compare option
|
||||
var CapabilityCmpOptions = []cmp.Option{
|
||||
cmp.Comparer(func(a, b Parameter) bool {
|
||||
if a.Name != b.Name || a.Short != b.Short || a.Required != b.Required ||
|
||||
a.Usage != b.Usage || a.Type != b.Type {
|
||||
return false
|
||||
}
|
||||
// nolint:exhaustive
|
||||
switch a.Type {
|
||||
case cue.IntKind:
|
||||
var va, vb int64
|
||||
@@ -188,7 +202,7 @@ var CapabilityCmpOptions = []cmp.Option{
|
||||
case int:
|
||||
va = float64(vala)
|
||||
case float64:
|
||||
va = float64(vala)
|
||||
va = vala
|
||||
}
|
||||
switch valb := b.Default.(type) {
|
||||
case int64:
|
||||
@@ -198,13 +212,16 @@ var CapabilityCmpOptions = []cmp.Option{
|
||||
case int:
|
||||
vb = float64(valb)
|
||||
case float64:
|
||||
vb = float64(valb)
|
||||
vb = valb
|
||||
}
|
||||
return va == vb
|
||||
default:
|
||||
// complex type not supported, will regard them as not changed.
|
||||
}
|
||||
return true
|
||||
})}
|
||||
|
||||
// EqualCapability will check whether two capabilities is equal
|
||||
func EqualCapability(a, b Capability) bool {
|
||||
return cmp.Equal(a, b, CapabilityCmpOptions...)
|
||||
}
|
||||
53
apis/types/types.go
Normal file
53
apis/types/types.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package types
|
||||
|
||||
const (
|
||||
// DefaultKubeVelaNS defines the default KubeVela namespace in Kubernetes
|
||||
DefaultKubeVelaNS = "vela-system"
|
||||
// DefaultKubeVelaReleaseName defines the default name of KubeVela Release
|
||||
DefaultKubeVelaReleaseName = "kubevela"
|
||||
// DefaultKubeVelaChartName defines the default chart name of KubeVela, this variable MUST align to the chart name of this repo
|
||||
DefaultKubeVelaChartName = "vela-core"
|
||||
// DefaultKubeVelaVersion defines the default version needed for KubeVela chart
|
||||
DefaultKubeVelaVersion = ">0.0.0-0"
|
||||
// DefaultEnvName defines the default environment name for Apps created by KubeVela
|
||||
DefaultEnvName = "default"
|
||||
// DefaultAppNamespace defines the default K8s namespace for Apps created by KubeVela
|
||||
DefaultAppNamespace = "default"
|
||||
)
|
||||
|
||||
const (
|
||||
// AnnDescription is the annotation which describe what is the capability used for in a WorkloadDefinition/TraitDefinition Object
|
||||
AnnDescription = "definition.oam.dev/description"
|
||||
)
|
||||
|
||||
const (
|
||||
// StatusDeployed represents the App was deployed
|
||||
StatusDeployed = "Deployed"
|
||||
// StatusStaging represents the App was changed locally and it's spec is diff from the deployed one, or not deployed at all
|
||||
StatusStaging = "Staging"
|
||||
)
|
||||
|
||||
// EnvMeta stores the info for app environment
|
||||
type EnvMeta struct {
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace"`
|
||||
Email string `json:"email,omitempty"`
|
||||
Domain string `json:"domain,omitempty"`
|
||||
|
||||
// Below are not arguments, should be auto-generated
|
||||
Issuer string `json:"issuer"`
|
||||
Current string `json:"current,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
// TagCommandType used for tag cli category
|
||||
TagCommandType = "commandType"
|
||||
// TypeStart defines one category
|
||||
TypeStart = "Getting Started"
|
||||
// TypeApp defines one category
|
||||
TypeApp = "Managing Applications"
|
||||
// TypeCap defines one category
|
||||
TypeCap = "Managing Capabilities"
|
||||
// TypeSystem defines one category
|
||||
TypeSystem = "System"
|
||||
)
|
||||
@@ -27,47 +27,31 @@ spec:
|
||||
description: An ApplicationConfiguration represents an OAM application.
|
||||
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'
|
||||
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'
|
||||
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: An ApplicationConfigurationSpec defines the desired state
|
||||
of a ApplicationConfiguration.
|
||||
description: An ApplicationConfigurationSpec defines the desired state of a ApplicationConfiguration.
|
||||
properties:
|
||||
components:
|
||||
description: Components of which this ApplicationConfiguration consists.
|
||||
Each component will be used to instantiate a workload.
|
||||
description: Components of which this ApplicationConfiguration consists. Each component will be used to instantiate a workload.
|
||||
items:
|
||||
description: An ApplicationConfigurationComponent specifies a component
|
||||
of an ApplicationConfiguration. Each component is used to instantiate
|
||||
a workload.
|
||||
description: An ApplicationConfigurationComponent specifies a component of an ApplicationConfiguration. Each component is used to instantiate a workload.
|
||||
properties:
|
||||
componentName:
|
||||
description: ComponentName specifies a component whose latest
|
||||
revision will be bind with ApplicationConfiguration. When
|
||||
the spec of the referenced component changes, ApplicationConfiguration
|
||||
will automatically migrate all trait affect from the prior
|
||||
revision to the new one. This is mutually exclusive with RevisionName.
|
||||
description: ComponentName specifies a component whose latest revision will be bind with ApplicationConfiguration. When the spec of the referenced component changes, ApplicationConfiguration will automatically migrate all trait affect from the prior revision to the new one. This is mutually exclusive with RevisionName.
|
||||
type: string
|
||||
dataInputs:
|
||||
description: DataInputs specify the data input sinks into this
|
||||
component.
|
||||
description: DataInputs specify the data input sinks into this component.
|
||||
items:
|
||||
description: DataInput specifies a data input sink to an object.
|
||||
If input is array, it will be appended to the target field
|
||||
paths.
|
||||
description: DataInput specifies a data input sink to an object. If input is array, it will be appended to the target field paths.
|
||||
properties:
|
||||
toFieldPaths:
|
||||
description: ToFieldPaths specifies the field paths of
|
||||
an object to fill passed value.
|
||||
description: ToFieldPaths specifies the field paths of an object to fill passed value.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
@@ -75,8 +59,7 @@ spec:
|
||||
description: ValueFrom specifies the value source.
|
||||
properties:
|
||||
dataOutputName:
|
||||
description: DataOutputName matches a name of a DataOutput
|
||||
in the same AppConfig.
|
||||
description: DataOutputName matches a name of a DataOutput in the same AppConfig.
|
||||
type: string
|
||||
required:
|
||||
- dataOutputName
|
||||
@@ -84,38 +67,26 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
dataOutputs:
|
||||
description: DataOutputs specify the data output sources from
|
||||
this component.
|
||||
description: DataOutputs specify the data output sources from this component.
|
||||
items:
|
||||
description: DataOutput specifies a data output source from
|
||||
an object.
|
||||
description: DataOutput specifies a data output source from an object.
|
||||
properties:
|
||||
conditions:
|
||||
description: Conditions specify the conditions that should
|
||||
be satisfied before emitting a data output. Different
|
||||
conditions are AND-ed together. If no conditions is
|
||||
specified, it is by default to check output value not
|
||||
empty.
|
||||
description: Conditions specify the conditions that should be satisfied before emitting a data output. Different conditions are AND-ed together. If no conditions is specified, it is by default to check output value not empty.
|
||||
items:
|
||||
description: ConditionRequirement specifies the requirement
|
||||
to match a value.
|
||||
description: ConditionRequirement specifies the requirement to match a value.
|
||||
properties:
|
||||
fieldPath:
|
||||
description: FieldPath specifies got value from
|
||||
workload/trait object
|
||||
description: FieldPath specifies got value from workload/trait object
|
||||
type: string
|
||||
op:
|
||||
description: ConditionOperator specifies the operator
|
||||
to match a value.
|
||||
description: ConditionOperator specifies the operator to match a value.
|
||||
type: string
|
||||
value:
|
||||
description: Value specifies an expected value This
|
||||
is mutually exclusive with ValueFrom
|
||||
description: Value specifies an expected value This is mutually exclusive with ValueFrom
|
||||
type: string
|
||||
valueFrom:
|
||||
description: ValueFrom specifies expected value
|
||||
from AppConfig This is mutually exclusive with
|
||||
Value
|
||||
description: ValueFrom specifies expected value from AppConfig This is mutually exclusive with Value
|
||||
properties:
|
||||
fieldPath:
|
||||
type: string
|
||||
@@ -127,23 +98,17 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
fieldPath:
|
||||
description: FieldPath refers to the value of an object's
|
||||
field.
|
||||
description: FieldPath refers to the value of an object's field.
|
||||
type: string
|
||||
name:
|
||||
description: Name is the unique name of a DataOutput in
|
||||
an ApplicationConfiguration.
|
||||
description: Name is the unique name of a DataOutput in an ApplicationConfiguration.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
parameterValues:
|
||||
description: ParameterValues specify values for the the specified
|
||||
component's parameters. Any parameter required by the component
|
||||
must be specified.
|
||||
description: ParameterValues specify values for the the specified component's parameters. Any parameter required by the component must be specified.
|
||||
items:
|
||||
description: A ComponentParameterValue specifies a value for
|
||||
a named parameter. The associated component must publish
|
||||
a parameter with this name.
|
||||
description: A ComponentParameterValue specifies a value for a named parameter. The associated component must publish a parameter with this name.
|
||||
properties:
|
||||
name:
|
||||
description: Name of the component parameter to set.
|
||||
@@ -160,20 +125,15 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
revisionName:
|
||||
description: RevisionName of a specific component revision to
|
||||
which to bind ApplicationConfiguration. This is mutually exclusive
|
||||
with componentName.
|
||||
description: RevisionName of a specific component revision to which to bind ApplicationConfiguration. This is mutually exclusive with componentName.
|
||||
type: string
|
||||
scopes:
|
||||
description: Scopes in which the specified component should
|
||||
exist.
|
||||
description: Scopes in which the specified component should exist.
|
||||
items:
|
||||
description: A ComponentScope specifies a scope in which a
|
||||
component should exist.
|
||||
description: A ComponentScope specifies a scope in which a component should exist.
|
||||
properties:
|
||||
scopeRef:
|
||||
description: A ScopeReference must refer to an OAM scope
|
||||
resource.
|
||||
description: A ScopeReference must refer to an OAM scope resource.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the referenced object.
|
||||
@@ -199,20 +159,15 @@ spec:
|
||||
traits:
|
||||
description: Traits of the specified component.
|
||||
items:
|
||||
description: A ComponentTrait specifies a trait that should
|
||||
be applied to a component.
|
||||
description: A ComponentTrait specifies a trait that should be applied to a component.
|
||||
properties:
|
||||
dataInputs:
|
||||
description: DataInputs specify the data input sinks into
|
||||
this trait.
|
||||
description: DataInputs specify the data input sinks into this trait.
|
||||
items:
|
||||
description: DataInput specifies a data input sink to
|
||||
an object. If input is array, it will be appended
|
||||
to the target field paths.
|
||||
description: DataInput specifies a data input sink to an object. If input is array, it will be appended to the target field paths.
|
||||
properties:
|
||||
toFieldPaths:
|
||||
description: ToFieldPaths specifies the field paths
|
||||
of an object to fill passed value.
|
||||
description: ToFieldPaths specifies the field paths of an object to fill passed value.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
@@ -220,8 +175,7 @@ spec:
|
||||
description: ValueFrom specifies the value source.
|
||||
properties:
|
||||
dataOutputName:
|
||||
description: DataOutputName matches a name of
|
||||
a DataOutput in the same AppConfig.
|
||||
description: DataOutputName matches a name of a DataOutput in the same AppConfig.
|
||||
type: string
|
||||
required:
|
||||
- dataOutputName
|
||||
@@ -229,38 +183,26 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
dataOutputs:
|
||||
description: DataOutputs specify the data output sources
|
||||
from this trait.
|
||||
description: DataOutputs specify the data output sources from this trait.
|
||||
items:
|
||||
description: DataOutput specifies a data output source
|
||||
from an object.
|
||||
description: DataOutput specifies a data output source from an object.
|
||||
properties:
|
||||
conditions:
|
||||
description: Conditions specify the conditions that
|
||||
should be satisfied before emitting a data output.
|
||||
Different conditions are AND-ed together. If no
|
||||
conditions is specified, it is by default to check
|
||||
output value not empty.
|
||||
description: Conditions specify the conditions that should be satisfied before emitting a data output. Different conditions are AND-ed together. If no conditions is specified, it is by default to check output value not empty.
|
||||
items:
|
||||
description: ConditionRequirement specifies the
|
||||
requirement to match a value.
|
||||
description: ConditionRequirement specifies the requirement to match a value.
|
||||
properties:
|
||||
fieldPath:
|
||||
description: FieldPath specifies got value
|
||||
from workload/trait object
|
||||
description: FieldPath specifies got value from workload/trait object
|
||||
type: string
|
||||
op:
|
||||
description: ConditionOperator specifies the
|
||||
operator to match a value.
|
||||
description: ConditionOperator specifies the operator to match a value.
|
||||
type: string
|
||||
value:
|
||||
description: Value specifies an expected value
|
||||
This is mutually exclusive with ValueFrom
|
||||
description: Value specifies an expected value This is mutually exclusive with ValueFrom
|
||||
type: string
|
||||
valueFrom:
|
||||
description: ValueFrom specifies expected
|
||||
value from AppConfig This is mutually exclusive
|
||||
with Value
|
||||
description: ValueFrom specifies expected value from AppConfig This is mutually exclusive with Value
|
||||
properties:
|
||||
fieldPath:
|
||||
type: string
|
||||
@@ -272,12 +214,10 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
fieldPath:
|
||||
description: FieldPath refers to the value of an
|
||||
object's field.
|
||||
description: FieldPath refers to the value of an object's field.
|
||||
type: string
|
||||
name:
|
||||
description: Name is the unique name of a DataOutput
|
||||
in an ApplicationConfiguration.
|
||||
description: Name is the unique name of a DataOutput in an ApplicationConfiguration.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
@@ -296,8 +236,7 @@ spec:
|
||||
- components
|
||||
type: object
|
||||
status:
|
||||
description: An ApplicationConfigurationStatus represents the observed
|
||||
state of a ApplicationConfiguration.
|
||||
description: An ApplicationConfigurationStatus represents the observed state of a ApplicationConfiguration.
|
||||
properties:
|
||||
conditions:
|
||||
description: Conditions of the resource.
|
||||
@@ -305,25 +244,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
@@ -333,17 +267,14 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
dependency:
|
||||
description: DependencyStatus represents the observed state of the
|
||||
dependency of an ApplicationConfiguration.
|
||||
description: DependencyStatus represents the observed state of the dependency of an ApplicationConfiguration.
|
||||
properties:
|
||||
unsatisfied:
|
||||
items:
|
||||
description: UnstaifiedDependency describes unsatisfied dependency
|
||||
flow between one pair of objects.
|
||||
description: UnstaifiedDependency describes unsatisfied dependency flow between one pair of objects.
|
||||
properties:
|
||||
from:
|
||||
description: DependencyFromObject represents the object
|
||||
that dependency data comes from.
|
||||
description: DependencyFromObject represents the object that dependency data comes from.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the referenced object.
|
||||
@@ -367,8 +298,7 @@ spec:
|
||||
reason:
|
||||
type: string
|
||||
to:
|
||||
description: DependencyToObject represents the object that
|
||||
dependency data goes to.
|
||||
description: DependencyToObject represents the object that dependency data goes to.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the referenced object.
|
||||
@@ -399,14 +329,12 @@ spec:
|
||||
type: array
|
||||
type: object
|
||||
historyWorkloads:
|
||||
description: HistoryWorkloads will record history but still working
|
||||
revision workloads.
|
||||
description: HistoryWorkloads will record history but still working revision workloads.
|
||||
items:
|
||||
description: HistoryWorkload contain the old component revision
|
||||
that are still running
|
||||
description: HistoryWorkload contain the old component revision that are still running
|
||||
properties:
|
||||
revision:
|
||||
description: component revision of this workload
|
||||
description: Revision of this workload
|
||||
type: string
|
||||
workloadRef:
|
||||
description: Reference to running workload.
|
||||
@@ -435,9 +363,7 @@ spec:
|
||||
format: int64
|
||||
type: integer
|
||||
status:
|
||||
description: Status is a place holder for a customized controller
|
||||
to fill if it needs a single place to summarize the status of the
|
||||
entire application
|
||||
description: Status is a place holder for a customized controller to fill if it needs a single place to summarize the status of the entire application
|
||||
type: string
|
||||
workloads:
|
||||
description: Workloads created by this ApplicationConfiguration.
|
||||
@@ -453,8 +379,7 @@ spec:
|
||||
scopes:
|
||||
description: Scopes associated with this workload.
|
||||
items:
|
||||
description: A WorkloadScope represents a scope associated
|
||||
with a workload and its status
|
||||
description: A WorkloadScope represents a scope associated with a workload and its status
|
||||
properties:
|
||||
scopeRef:
|
||||
description: Reference to a scope created by an ApplicationConfiguration.
|
||||
@@ -477,29 +402,25 @@ spec:
|
||||
- name
|
||||
type: object
|
||||
status:
|
||||
description: Status is a place holder for a customized
|
||||
controller to fill if it needs a single place to summarize
|
||||
the status of the scope
|
||||
description: Status is a place holder for a customized controller to fill if it needs a single place to summarize the status of the scope
|
||||
type: string
|
||||
required:
|
||||
- scopeRef
|
||||
type: object
|
||||
type: array
|
||||
status:
|
||||
description: Status is a place holder for a customized controller
|
||||
to fill if it needs a single place to summarize the entire
|
||||
status of the workload
|
||||
description: Status is a place holder for a customized controller to fill if it needs a single place to summarize the entire status of the workload
|
||||
type: string
|
||||
traits:
|
||||
description: Traits associated with this workload.
|
||||
items:
|
||||
description: A WorkloadTrait represents a trait associated
|
||||
with a workload and its status
|
||||
description: A WorkloadTrait represents a trait associated with a workload and its status
|
||||
properties:
|
||||
message:
|
||||
description: Message will allow controller to leave some additional information for this trait
|
||||
type: string
|
||||
status:
|
||||
description: Status is a place holder for a customized
|
||||
controller to fill if it needs a single place to summarize
|
||||
the status of the trait
|
||||
description: Status is a place holder for a customized controller to fill if it needs a single place to summarize the status of the trait
|
||||
type: string
|
||||
traitRef:
|
||||
description: Reference to a trait created by an ApplicationConfiguration.
|
||||
|
||||
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.2.5
|
||||
controller-gen.kubebuilder.io/version: v0.2.4
|
||||
creationTimestamp: null
|
||||
name: applicationdeployments.core.oam.dev
|
||||
spec:
|
||||
@@ -21,18 +21,13 @@ spec:
|
||||
- name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: ApplicationDeployment is the Schema for the ApplicationDeployment
|
||||
API
|
||||
description: ApplicationDeployment is the Schema for the ApplicationDeployment 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'
|
||||
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'
|
||||
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
|
||||
@@ -40,8 +35,7 @@ spec:
|
||||
description: ApplicationDeploymentSpec defines the desired state of ApplicationDeployment
|
||||
type: object
|
||||
status:
|
||||
description: ApplicationDeploymentStatus defines the observed state of
|
||||
ApplicationDeployment
|
||||
description: ApplicationDeploymentStatus defines the observed state of ApplicationDeployment
|
||||
properties:
|
||||
conditions:
|
||||
description: Conditions of the resource.
|
||||
@@ -49,25 +43,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
|
||||
80
charts/vela-core/crds/core.oam.dev_applications.yaml
Normal file
80
charts/vela-core/crds/core.oam.dev_applications.yaml
Normal file
@@ -0,0 +1,80 @@
|
||||
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.2.4
|
||||
creationTimestamp: null
|
||||
name: applications.core.oam.dev
|
||||
spec:
|
||||
group: core.oam.dev
|
||||
names:
|
||||
kind: Application
|
||||
listKind: ApplicationList
|
||||
plural: applications
|
||||
singular: application
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: Application is the Schema for the applications 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:
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
status:
|
||||
description: AppStatus defines the observed state of Application
|
||||
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
|
||||
status:
|
||||
description: ApplicationPhase is a label for the condition of a application at the current time
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
status:
|
||||
acceptedNames:
|
||||
kind: ""
|
||||
plural: ""
|
||||
conditions: []
|
||||
storedVersions: []
|
||||
@@ -32,14 +32,10 @@ spec:
|
||||
description: A Component describes how an OAM workload kind may be instantiated.
|
||||
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'
|
||||
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'
|
||||
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
|
||||
@@ -47,34 +43,24 @@ spec:
|
||||
description: A ComponentSpec defines the desired state of a Component.
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters exposed by this component. ApplicationConfigurations
|
||||
that reference this component may specify values for these parameters,
|
||||
which will in turn be injected into the embedded workload.
|
||||
description: Parameters exposed by this component. ApplicationConfigurations that reference this component may specify values for these parameters, which will in turn be injected into the embedded workload.
|
||||
items:
|
||||
description: A ComponentParameter defines a configurable parameter
|
||||
of a component.
|
||||
description: A ComponentParameter 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 Component's workload that will be overwritten by the
|
||||
value of this parameter. The type of the parameter (e.g. int,
|
||||
string) is inferred from the type of these fields; All fields
|
||||
must be of the same type. Fields are specified as JSON field
|
||||
paths without a leading dot, for example 'spec.replicas'.
|
||||
description: FieldPaths specifies an array of fields within this Component's workload that will be overwritten by the value of this parameter. The type of the parameter (e.g. int, string) is inferred from the type of these fields; All 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. OAM ApplicationConfigurations
|
||||
will specify parameter values using this name.
|
||||
description: Name of this parameter. OAM ApplicationConfigurations will specify parameter values using this name.
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not a value for this
|
||||
parameter must be supplied when authoring an ApplicationConfiguration.
|
||||
description: Required specifies whether or not a value for this parameter must be supplied when authoring an ApplicationConfiguration.
|
||||
type: boolean
|
||||
required:
|
||||
- fieldPaths
|
||||
@@ -82,10 +68,7 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
workload:
|
||||
description: A Workload that will be created for each ApplicationConfiguration
|
||||
that includes this Component. Workload is an instance of a workloadDefinition.
|
||||
We either use the GVK info or a special "type" field in the workload
|
||||
to associate the content of the workload with its workloadDefinition
|
||||
description: A Workload that will be created for each ApplicationConfiguration that includes this Component. Workload is an instance of a workloadDefinition. We either use the GVK info or a special "type" field in the workload to associate the content of the workload with its workloadDefinition
|
||||
type: object
|
||||
x-kubernetes-embedded-resource: true
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
@@ -101,25 +84,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -25,20 +25,15 @@ spec:
|
||||
description: A ContainerizedWorkload is a workload that runs OCI containers.
|
||||
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'
|
||||
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'
|
||||
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: A ContainerizedWorkloadSpec defines the desired state of
|
||||
a ContainerizedWorkload.
|
||||
description: A ContainerizedWorkloadSpec defines the desired state of a ContainerizedWorkload.
|
||||
properties:
|
||||
arch:
|
||||
description: CPUArchitecture required by this workload.
|
||||
@@ -51,12 +46,10 @@ spec:
|
||||
containers:
|
||||
description: Containers of which this workload consists.
|
||||
items:
|
||||
description: A Container represents an Open Containers Initiative
|
||||
(OCI) container.
|
||||
description: A Container represents an Open Containers Initiative (OCI) container.
|
||||
properties:
|
||||
args:
|
||||
description: Arguments to be passed to the command run by this
|
||||
container.
|
||||
description: Arguments to be passed to the command run by this container.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
@@ -66,16 +59,12 @@ spec:
|
||||
type: string
|
||||
type: array
|
||||
config:
|
||||
description: ConfigFiles that should be written within this
|
||||
container.
|
||||
description: ConfigFiles that should be written within this container.
|
||||
items:
|
||||
description: A ContainerConfigFile specifies a configuration
|
||||
file that should be written within a container.
|
||||
description: A ContainerConfigFile specifies a configuration file that should be written within a container.
|
||||
properties:
|
||||
fromSecret:
|
||||
description: FromSecret is a secret key reference which
|
||||
can be used to assign a value to be written to the configuration
|
||||
file at the given path in the container.
|
||||
description: FromSecret is a secret key reference which can be used to assign a value to be written to the configuration file at the given path in the container.
|
||||
properties:
|
||||
key:
|
||||
description: The key to select.
|
||||
@@ -88,27 +77,22 @@ spec:
|
||||
- name
|
||||
type: object
|
||||
path:
|
||||
description: Path within the container at which the configuration
|
||||
file should be written.
|
||||
description: Path within the container at which the configuration file should be written.
|
||||
type: string
|
||||
value:
|
||||
description: Value that should be written to the configuration
|
||||
file.
|
||||
description: Value that should be written to the configuration file.
|
||||
type: string
|
||||
required:
|
||||
- path
|
||||
type: object
|
||||
type: array
|
||||
env:
|
||||
description: Environment variables that should be set within
|
||||
this container.
|
||||
description: Environment variables that should be set within this container.
|
||||
items:
|
||||
description: A ContainerEnvVar specifies an environment variable
|
||||
that should be set within a container.
|
||||
description: A ContainerEnvVar specifies an environment variable that should be set within a container.
|
||||
properties:
|
||||
fromSecret:
|
||||
description: FromSecret is a secret key reference which
|
||||
can be used to assign a value to the environment variable.
|
||||
description: FromSecret is a secret key reference which can be used to assign a value to the environment variable.
|
||||
properties:
|
||||
key:
|
||||
description: The key to select.
|
||||
@@ -121,9 +105,7 @@ spec:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name of the environment variable. Must be
|
||||
composed of valid Unicode letter and number characters,
|
||||
as well as _ and -.
|
||||
description: Name of the environment variable. Must be composed of valid Unicode letter and number characters, as well as _ and -.
|
||||
pattern: ^[-_a-zA-Z0-9]+$
|
||||
type: string
|
||||
value:
|
||||
@@ -134,22 +116,16 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
image:
|
||||
description: Image this container should run. Must be a path-like
|
||||
or URI-like representation of an OCI image. May be prefixed
|
||||
with a registry address and should be suffixed with a tag.
|
||||
description: Image this container should run. Must be a path-like or URI-like representation of an OCI image. May be prefixed with a registry address and should be suffixed with a tag.
|
||||
type: string
|
||||
imagePullSecret:
|
||||
description: ImagePullSecret specifies the name of a Secret
|
||||
from which the credentials required to pull this container's
|
||||
image can be loaded.
|
||||
description: ImagePullSecret specifies the name of a Secret from which the credentials required to pull this container's image can be loaded.
|
||||
type: string
|
||||
livenessProbe:
|
||||
description: A LivenessProbe assesses whether this container
|
||||
is alive. Containers that fail liveness probes will be restarted.
|
||||
description: A LivenessProbe assesses whether this container is alive. Containers that fail liveness probes will be restarted.
|
||||
properties:
|
||||
exec:
|
||||
description: Exec probes a container's health by executing
|
||||
a command.
|
||||
description: Exec probes a container's health by executing a command.
|
||||
properties:
|
||||
command:
|
||||
description: Command to be run by this probe.
|
||||
@@ -160,24 +136,19 @@ spec:
|
||||
- command
|
||||
type: object
|
||||
failureThreshold:
|
||||
description: FailureThreshold specifies how many consecutive
|
||||
probes must fail in order for the container to be considered
|
||||
healthy.
|
||||
description: FailureThreshold specifies how many consecutive probes must fail in order for the container to be considered healthy.
|
||||
format: int32
|
||||
type: integer
|
||||
httpGet:
|
||||
description: HTTPGet probes a container's health by sending
|
||||
an HTTP GET request.
|
||||
description: HTTPGet probes a container's health by sending an HTTP GET request.
|
||||
properties:
|
||||
httpHeaders:
|
||||
description: HTTPHeaders to send with the GET request.
|
||||
items:
|
||||
description: A HTTPHeader to be passed when probing
|
||||
a container.
|
||||
description: A HTTPHeader to be passed when probing a container.
|
||||
properties:
|
||||
name:
|
||||
description: Name of this HTTP header. Must be
|
||||
unique per probe.
|
||||
description: Name of this HTTP header. Must be unique per probe.
|
||||
type: string
|
||||
value:
|
||||
description: Value of this HTTP header.
|
||||
@@ -199,8 +170,7 @@ spec:
|
||||
- port
|
||||
type: object
|
||||
initialDelaySeconds:
|
||||
description: InitialDelaySeconds after a container starts
|
||||
before the first probe.
|
||||
description: InitialDelaySeconds after a container starts before the first probe.
|
||||
format: int32
|
||||
type: integer
|
||||
periodSeconds:
|
||||
@@ -208,14 +178,11 @@ spec:
|
||||
format: int32
|
||||
type: integer
|
||||
successThreshold:
|
||||
description: SuccessThreshold specifies how many consecutive
|
||||
probes must success in order for the container to be considered
|
||||
healthy.
|
||||
description: SuccessThreshold specifies how many consecutive probes must success in order for the container to be considered healthy.
|
||||
format: int32
|
||||
type: integer
|
||||
tcpSocket:
|
||||
description: TCPSocketProbe probes a container's health
|
||||
by connecting to a TCP socket.
|
||||
description: TCPSocketProbe probes a container's health by connecting to a TCP socket.
|
||||
properties:
|
||||
port:
|
||||
description: Port this probe should connect to.
|
||||
@@ -225,33 +192,28 @@ spec:
|
||||
- port
|
||||
type: object
|
||||
timeoutSeconds:
|
||||
description: TimeoutSeconds after which the probe times
|
||||
out.
|
||||
description: TimeoutSeconds after which the probe times out.
|
||||
format: int32
|
||||
type: integer
|
||||
type: object
|
||||
name:
|
||||
description: Name of this container. Must be unique within its
|
||||
workload.
|
||||
description: Name of this container. Must be unique within its workload.
|
||||
type: string
|
||||
ports:
|
||||
description: Ports exposed by this container.
|
||||
items:
|
||||
description: A ContainerPort specifies a port that is exposed
|
||||
by a container.
|
||||
description: A ContainerPort specifies a port that is exposed by a container.
|
||||
properties:
|
||||
containerPort:
|
||||
description: Port number. Must be unique within its container.
|
||||
format: int32
|
||||
type: integer
|
||||
name:
|
||||
description: Name of this port. Must be unique within
|
||||
its container. Must be lowercase alphabetical characters.
|
||||
description: Name of this port. Must be unique within its container. Must be lowercase alphabetical characters.
|
||||
pattern: ^[a-z]+$
|
||||
type: string
|
||||
protocol:
|
||||
description: Protocol used by the server listening on
|
||||
this port.
|
||||
description: Protocol used by the server listening on this port.
|
||||
enum:
|
||||
- TCP
|
||||
- UDP
|
||||
@@ -262,13 +224,10 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
readinessProbe:
|
||||
description: A ReadinessProbe assesses whether this container
|
||||
is ready to serve requests. Containers that fail readiness
|
||||
probes will be withdrawn from service.
|
||||
description: A ReadinessProbe assesses whether this container is ready to serve requests. Containers that fail readiness probes will be withdrawn from service.
|
||||
properties:
|
||||
exec:
|
||||
description: Exec probes a container's health by executing
|
||||
a command.
|
||||
description: Exec probes a container's health by executing a command.
|
||||
properties:
|
||||
command:
|
||||
description: Command to be run by this probe.
|
||||
@@ -279,24 +238,19 @@ spec:
|
||||
- command
|
||||
type: object
|
||||
failureThreshold:
|
||||
description: FailureThreshold specifies how many consecutive
|
||||
probes must fail in order for the container to be considered
|
||||
healthy.
|
||||
description: FailureThreshold specifies how many consecutive probes must fail in order for the container to be considered healthy.
|
||||
format: int32
|
||||
type: integer
|
||||
httpGet:
|
||||
description: HTTPGet probes a container's health by sending
|
||||
an HTTP GET request.
|
||||
description: HTTPGet probes a container's health by sending an HTTP GET request.
|
||||
properties:
|
||||
httpHeaders:
|
||||
description: HTTPHeaders to send with the GET request.
|
||||
items:
|
||||
description: A HTTPHeader to be passed when probing
|
||||
a container.
|
||||
description: A HTTPHeader to be passed when probing a container.
|
||||
properties:
|
||||
name:
|
||||
description: Name of this HTTP header. Must be
|
||||
unique per probe.
|
||||
description: Name of this HTTP header. Must be unique per probe.
|
||||
type: string
|
||||
value:
|
||||
description: Value of this HTTP header.
|
||||
@@ -318,8 +272,7 @@ spec:
|
||||
- port
|
||||
type: object
|
||||
initialDelaySeconds:
|
||||
description: InitialDelaySeconds after a container starts
|
||||
before the first probe.
|
||||
description: InitialDelaySeconds after a container starts before the first probe.
|
||||
format: int32
|
||||
type: integer
|
||||
periodSeconds:
|
||||
@@ -327,14 +280,11 @@ spec:
|
||||
format: int32
|
||||
type: integer
|
||||
successThreshold:
|
||||
description: SuccessThreshold specifies how many consecutive
|
||||
probes must success in order for the container to be considered
|
||||
healthy.
|
||||
description: SuccessThreshold specifies how many consecutive probes must success in order for the container to be considered healthy.
|
||||
format: int32
|
||||
type: integer
|
||||
tcpSocket:
|
||||
description: TCPSocketProbe probes a container's health
|
||||
by connecting to a TCP socket.
|
||||
description: TCPSocketProbe probes a container's health by connecting to a TCP socket.
|
||||
properties:
|
||||
port:
|
||||
description: Port this probe should connect to.
|
||||
@@ -344,8 +294,7 @@ spec:
|
||||
- port
|
||||
type: object
|
||||
timeoutSeconds:
|
||||
description: TimeoutSeconds after which the probe times
|
||||
out.
|
||||
description: TimeoutSeconds after which the probe times out.
|
||||
format: int32
|
||||
type: integer
|
||||
type: object
|
||||
@@ -356,8 +305,7 @@ spec:
|
||||
description: CPU required by this container.
|
||||
properties:
|
||||
required:
|
||||
description: Required CPU count. 1.0 represents one
|
||||
CPU core.
|
||||
description: Required CPU count. 1.0 represents one CPU core.
|
||||
type: string
|
||||
required:
|
||||
- required
|
||||
@@ -368,16 +316,13 @@ spec:
|
||||
description: ExtendedResource required by a container.
|
||||
properties:
|
||||
name:
|
||||
description: Name of the external resource. Resource
|
||||
names are specified in kind.group/version format,
|
||||
e.g. motionsensor.ext.example.com/v1.
|
||||
description: Name of the external resource. Resource names are specified in kind.group/version format, e.g. motionsensor.ext.example.com/v1.
|
||||
type: string
|
||||
required:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
description: Required extended resource(s), e.g. 8
|
||||
or "very-cool-widget"
|
||||
description: Required extended resource(s), e.g. 8 or "very-cool-widget"
|
||||
x-kubernetes-int-or-string: true
|
||||
required:
|
||||
- name
|
||||
@@ -408,8 +353,7 @@ spec:
|
||||
description: VolumeResource required by a container.
|
||||
properties:
|
||||
accessMode:
|
||||
description: AccessMode of this volume; RO (read only)
|
||||
or RW (read and write).
|
||||
description: AccessMode of this volume; RO (read only) or RW (read and write).
|
||||
enum:
|
||||
- RO
|
||||
- RW
|
||||
@@ -418,8 +362,7 @@ spec:
|
||||
description: Disk requirements of this volume.
|
||||
properties:
|
||||
ephemeral:
|
||||
description: Ephemeral specifies whether an external
|
||||
disk needs to be mounted.
|
||||
description: Ephemeral specifies whether an external disk needs to be mounted.
|
||||
type: boolean
|
||||
required:
|
||||
description: Required disk space.
|
||||
@@ -428,16 +371,13 @@ spec:
|
||||
- required
|
||||
type: object
|
||||
mountPath:
|
||||
description: MountPath at which this volume will be
|
||||
mounted within its container.
|
||||
description: MountPath at which this volume will be mounted within its container.
|
||||
type: string
|
||||
name:
|
||||
description: Name of this volume. Must be unique within
|
||||
its container.
|
||||
description: Name of this volume. Must be unique within its container.
|
||||
type: string
|
||||
sharingPolicy:
|
||||
description: SharingPolicy of this volume; Exclusive
|
||||
or Shared.
|
||||
description: SharingPolicy of this volume; Exclusive or Shared.
|
||||
enum:
|
||||
- Exclusive
|
||||
- Shared
|
||||
@@ -466,8 +406,7 @@ spec:
|
||||
- containers
|
||||
type: object
|
||||
status:
|
||||
description: A ContainerizedWorkloadStatus represents the observed state
|
||||
of a ContainerizedWorkload.
|
||||
description: A ContainerizedWorkloadStatus represents the observed state of a ContainerizedWorkload.
|
||||
properties:
|
||||
conditions:
|
||||
description: Conditions of the resource.
|
||||
@@ -475,25 +414,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
@@ -505,9 +439,7 @@ spec:
|
||||
resources:
|
||||
description: Resources managed by this containerised workload.
|
||||
items:
|
||||
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.
|
||||
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.
|
||||
|
||||
@@ -26,18 +26,13 @@ spec:
|
||||
name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: A HealthScope determines an aggregate health status based of
|
||||
the health of components.
|
||||
description: A HealthScope determines an aggregate health status based of the health of components.
|
||||
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'
|
||||
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'
|
||||
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
|
||||
@@ -45,22 +40,17 @@ spec:
|
||||
description: A HealthScopeSpec defines the desired state of a HealthScope.
|
||||
properties:
|
||||
probe-interval:
|
||||
description: ProbeInterval is the amount of time in seconds between
|
||||
probing tries.
|
||||
description: ProbeInterval is the amount of time in seconds between probing tries.
|
||||
format: int32
|
||||
type: integer
|
||||
probe-timeout:
|
||||
description: ProbeTimeout is the amount of time in seconds to wait
|
||||
when receiving a response before marked failure.
|
||||
description: ProbeTimeout is the amount of time in seconds to wait when receiving a response before marked failure.
|
||||
format: int32
|
||||
type: integer
|
||||
workloadRefs:
|
||||
description: WorkloadReferences to the workloads that are in this
|
||||
scope.
|
||||
description: WorkloadReferences to the workloads that are in this scope.
|
||||
items:
|
||||
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.
|
||||
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.
|
||||
@@ -92,25 +82,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
@@ -120,15 +105,12 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
healthConditions:
|
||||
description: WorkloadHealthConditions represents health condition
|
||||
of workloads in the scope
|
||||
description: WorkloadHealthConditions represents health condition of workloads in the scope
|
||||
items:
|
||||
description: WorkloadHealthCondition represents informative health
|
||||
condition.
|
||||
description: WorkloadHealthCondition represents informative health condition.
|
||||
properties:
|
||||
componentName:
|
||||
description: ComponentName represents the component name if
|
||||
target is a workload
|
||||
description: ComponentName represents the component name if target is a workload
|
||||
type: string
|
||||
diagnosis:
|
||||
type: string
|
||||
@@ -136,9 +118,7 @@ spec:
|
||||
description: HealthStatus represents health status strings.
|
||||
type: string
|
||||
targetWorkload:
|
||||
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.
|
||||
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.
|
||||
@@ -158,16 +138,14 @@ spec:
|
||||
- name
|
||||
type: object
|
||||
workloadStatus:
|
||||
description: WorkloadStatus represents status of workloads whose
|
||||
HealthStatus is UNKNOWN.
|
||||
description: WorkloadStatus represents status of workloads whose HealthStatus is UNKNOWN.
|
||||
type: string
|
||||
required:
|
||||
- healthStatus
|
||||
type: object
|
||||
type: array
|
||||
scopeHealthCondition:
|
||||
description: ScopeHealthCondition represents health condition summary
|
||||
of the scope
|
||||
description: ScopeHealthCondition represents health condition summary of the scope
|
||||
properties:
|
||||
healthStatus:
|
||||
description: HealthStatus represents health status strings.
|
||||
|
||||
@@ -22,18 +22,13 @@ spec:
|
||||
- name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: A ManualScalerTrait determines how many replicas a workload should
|
||||
have.
|
||||
description: A ManualScalerTrait determines how many replicas a workload should have.
|
||||
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'
|
||||
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'
|
||||
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
|
||||
@@ -45,8 +40,7 @@ spec:
|
||||
format: int32
|
||||
type: integer
|
||||
workloadRef:
|
||||
description: WorkloadReference to the workload this trait applies
|
||||
to.
|
||||
description: WorkloadReference to the workload this trait applies to.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the referenced object.
|
||||
@@ -70,8 +64,7 @@ spec:
|
||||
- workloadRef
|
||||
type: object
|
||||
status:
|
||||
description: A ManualScalerTraitStatus represents the observed state of
|
||||
a ManualScalerTrait.
|
||||
description: A ManualScalerTraitStatus represents the observed state of a ManualScalerTrait.
|
||||
properties:
|
||||
conditions:
|
||||
description: Conditions of the resource.
|
||||
@@ -79,25 +72,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -26,20 +26,13 @@ spec:
|
||||
name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
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.
|
||||
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.
|
||||
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'
|
||||
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'
|
||||
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
|
||||
@@ -47,27 +40,26 @@ spec:
|
||||
description: A ScopeDefinitionSpec defines the desired state of a ScopeDefinition.
|
||||
properties:
|
||||
allowComponentOverlap:
|
||||
description: AllowComponentOverlap specifies whether an OAM component
|
||||
may exist in multiple instances of this kind of scope.
|
||||
description: AllowComponentOverlap specifies whether an OAM component may exist in multiple instances of this kind of scope.
|
||||
type: boolean
|
||||
definitionRef:
|
||||
description: Reference to the CustomResourceDefinition that defines
|
||||
this scope kind.
|
||||
description: Reference to the CustomResourceDefinition that defines this scope 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
|
||||
extension:
|
||||
description: Extension is used for extension needs by OAM platform
|
||||
builders
|
||||
description: Extension is used for extension needs by OAM platform builders
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
workloadRefsPath:
|
||||
description: WorkloadRefsPath indicates if/where a scope accepts workloadRef
|
||||
objects
|
||||
description: WorkloadRefsPath indicates if/where a scope accepts workloadRef objects
|
||||
type: string
|
||||
required:
|
||||
- allowComponentOverlap
|
||||
|
||||
@@ -26,20 +26,13 @@ spec:
|
||||
name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: A TraitDefinition registers a kind of Kubernetes custom resource
|
||||
as a valid OAM trait kind by referencing its CustomResourceDefinition. The
|
||||
CRD is used to validate the schema of the trait when it is embedded in an
|
||||
OAM ApplicationConfiguration.
|
||||
description: A TraitDefinition registers a kind of Kubernetes custom resource as a valid OAM trait kind by referencing its CustomResourceDefinition. The CRD is used to validate the schema of the trait when it is embedded in an OAM ApplicationConfiguration.
|
||||
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'
|
||||
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'
|
||||
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
|
||||
@@ -47,35 +40,31 @@ spec:
|
||||
description: A TraitDefinitionSpec defines the desired state of a TraitDefinition.
|
||||
properties:
|
||||
appliesToWorkloads:
|
||||
description: AppliesToWorkloads specifies the list of workload kinds
|
||||
this trait applies to. Workload kinds are specified in kind.group/version
|
||||
format, e.g. server.core.oam.dev/v1alpha2. Traits that omit this
|
||||
field apply to all workload kinds.
|
||||
description: AppliesToWorkloads specifies the list of workload kinds this trait applies to. Workload kinds are specified in kind.group/version format, e.g. server.core.oam.dev/v1alpha2. Traits that omit this field apply to all workload kinds.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
definitionRef:
|
||||
description: Reference to the CustomResourceDefinition that defines
|
||||
this trait kind.
|
||||
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
|
||||
extension:
|
||||
description: Extension is used for extension needs by OAM platform
|
||||
builders
|
||||
description: Extension is used for extension needs by OAM platform builders
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
revisionEnabled:
|
||||
description: Revision indicates whether a trait is aware of component
|
||||
revision
|
||||
description: Revision indicates whether a trait is aware of component revision
|
||||
type: boolean
|
||||
workloadRefPath:
|
||||
description: WorkloadRefPath indicates where/if a trait accepts a
|
||||
workloadRef object
|
||||
description: WorkloadRefPath indicates where/if a trait accepts a workloadRef object
|
||||
type: string
|
||||
required:
|
||||
- definitionRef
|
||||
|
||||
@@ -26,20 +26,13 @@ spec:
|
||||
name: v1alpha2
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: A WorkloadDefinition registers a kind of Kubernetes custom resource
|
||||
as a valid OAM workload kind by referencing its CustomResourceDefinition.
|
||||
The CRD is used to validate the schema of the workload when it is embedded
|
||||
in an OAM Component.
|
||||
description: A WorkloadDefinition registers a kind of Kubernetes custom resource as a valid OAM workload kind by referencing its CustomResourceDefinition. The CRD is used to validate the schema of the workload when it is embedded in an OAM Component.
|
||||
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'
|
||||
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'
|
||||
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
|
||||
@@ -47,11 +40,9 @@ spec:
|
||||
description: A WorkloadDefinitionSpec defines the desired state of a WorkloadDefinition.
|
||||
properties:
|
||||
childResourceKinds:
|
||||
description: ChildResourceKinds are the list of GVK of the child resources
|
||||
this workload generates
|
||||
description: ChildResourceKinds are the list of GVK of the child resources this workload generates
|
||||
items:
|
||||
description: A ChildResourceKind defines a child Kubernetes resource
|
||||
kind with a selector
|
||||
description: A ChildResourceKind defines a child Kubernetes resource kind with a selector
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the child resource
|
||||
@@ -62,8 +53,7 @@ spec:
|
||||
selector:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Selector to select the child resources that the
|
||||
workload wants to expose to traits
|
||||
description: Selector to select the child resources that the workload wants to expose to traits
|
||||
type: object
|
||||
required:
|
||||
- apiVersion
|
||||
@@ -71,29 +61,26 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
definitionRef:
|
||||
description: Reference to the CustomResourceDefinition that defines
|
||||
this workload kind.
|
||||
description: Reference to the CustomResourceDefinition that defines this workload 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
|
||||
extension:
|
||||
description: Extension is used for extension needs by OAM platform
|
||||
builders
|
||||
description: Extension is used for extension needs by OAM platform builders
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
podSpecPath:
|
||||
description: PodSpecPath indicates where/if this workload has K8s
|
||||
podSpec field if one workload has podSpec, trait can do lot's of
|
||||
assumption such as port, env, volume fields.
|
||||
description: PodSpecPath indicates where/if this workload has K8s podSpec field if one workload has podSpec, trait can do lot's of assumption such as port, env, volume fields.
|
||||
type: string
|
||||
revisionLabel:
|
||||
description: RevisionLabel indicates which label for underlying resources(e.g.
|
||||
pods) of this workload can be used by trait to create resource selectors(e.g.
|
||||
label selector for pods).
|
||||
description: RevisionLabel indicates which label for underlying resources(e.g. pods) of this workload can be used by trait to create resource selectors(e.g. label selector for pods).
|
||||
type: string
|
||||
required:
|
||||
- definitionRef
|
||||
|
||||
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.2.5
|
||||
controller-gen.kubebuilder.io/version: v0.2.4
|
||||
creationTimestamp: null
|
||||
name: autoscalers.standard.oam.dev
|
||||
spec:
|
||||
@@ -24,14 +24,10 @@ spec:
|
||||
description: Autoscaler is the Schema for the autoscalers 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'
|
||||
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'
|
||||
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
|
||||
@@ -47,9 +43,7 @@ spec:
|
||||
format: int32
|
||||
type: integer
|
||||
targetWorkload:
|
||||
description: TargetWorkload specify the workload which is going to
|
||||
be scaled, it could be WorkloadReference or the child resource of
|
||||
it
|
||||
description: TargetWorkload specify the workload which is going to be scaled, it could be WorkloadReference or the child resource of it
|
||||
properties:
|
||||
apiVersion:
|
||||
type: string
|
||||
@@ -71,8 +65,7 @@ spec:
|
||||
description: Condition set the condition when to trigger scaling
|
||||
type: object
|
||||
name:
|
||||
description: Name is the trigger name, if not set, it will be
|
||||
automatically generated and make it globally unique
|
||||
description: Name is the trigger name, if not set, it will be automatically generated and make it globally unique
|
||||
type: string
|
||||
type:
|
||||
description: Type allows value in [cpu/memory/storage/ephemeral-storage、cron、pps、qps/rps、custom]
|
||||
@@ -114,25 +107,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.2.5
|
||||
controller-gen.kubebuilder.io/version: v0.2.4
|
||||
creationTimestamp: null
|
||||
name: metricstraits.standard.oam.dev
|
||||
spec:
|
||||
@@ -24,14 +24,10 @@ spec:
|
||||
description: MetricsTrait is the Schema for the metricstraits 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'
|
||||
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'
|
||||
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
|
||||
@@ -45,8 +41,7 @@ spec:
|
||||
description: The default is true
|
||||
type: boolean
|
||||
format:
|
||||
description: The format of the metrics data, The default and only
|
||||
supported format is "prometheus" for now
|
||||
description: The format of the metrics data, The default and only supported format is "prometheus" for now
|
||||
type: string
|
||||
path:
|
||||
description: HTTP path to scrape for metrics. default is /metrics
|
||||
@@ -55,27 +50,19 @@ spec:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
description: Number or name of the port to access on the pods
|
||||
targeted by the service. The default is discovered automatically
|
||||
from podTemplate, metricTrait will create a service for the
|
||||
workload
|
||||
description: Number or name of the port to access on the pods targeted by the service. The default is discovered automatically from podTemplate, metricTrait will create a service for the workload
|
||||
x-kubernetes-int-or-string: true
|
||||
scheme:
|
||||
description: Scheme at which metrics should be scraped The default
|
||||
and only supported scheme is "http"
|
||||
description: Scheme at which metrics should be scraped The default and only supported scheme is "http"
|
||||
type: string
|
||||
selector:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: Route service traffic to pods with label keys and
|
||||
values matching this The default is discovered automatically
|
||||
from podTemplate. If no podTemplate, use the labels specified
|
||||
here, or use the labels of the workload
|
||||
description: Route service traffic to pods with label keys and values matching this The default is discovered automatically from podTemplate. If no podTemplate, use the labels specified here, or use the labels of the workload
|
||||
type: object
|
||||
type: object
|
||||
workloadRef:
|
||||
description: WorkloadReference to the workload whose metrics needs
|
||||
to be exposed
|
||||
description: WorkloadReference to the workload whose metrics needs to be exposed
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the referenced object.
|
||||
@@ -106,25 +93,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.2.5
|
||||
controller-gen.kubebuilder.io/version: v0.2.4
|
||||
creationTimestamp: null
|
||||
name: routes.standard.oam.dev
|
||||
spec:
|
||||
@@ -24,14 +24,10 @@ spec:
|
||||
description: Route is the Schema for the routes 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'
|
||||
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'
|
||||
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
|
||||
@@ -42,8 +38,7 @@ spec:
|
||||
description: Host is the host of the route
|
||||
type: string
|
||||
provider:
|
||||
description: Provider indicate which ingress controller implementation
|
||||
the route trait will use, by default it's nginx-ingress
|
||||
description: Provider indicate which ingress controller implementation the route trait will use, by default it's nginx-ingress
|
||||
type: string
|
||||
rules:
|
||||
description: Rules contain multiple rules of route
|
||||
@@ -51,46 +46,38 @@ spec:
|
||||
description: Rule defines to route rule
|
||||
properties:
|
||||
backend:
|
||||
description: Backend indicate how to connect backend service
|
||||
If it's nil, will auto discovery
|
||||
description: Backend indicate how to connect backend service If it's nil, will auto discovery
|
||||
properties:
|
||||
backendService:
|
||||
description: BackendService specifies the backend K8s service
|
||||
and port, it's optional
|
||||
description: BackendService specifies the backend K8s service and port, it's optional
|
||||
properties:
|
||||
port:
|
||||
anyOf:
|
||||
- type: integer
|
||||
- type: string
|
||||
description: Port allow you direct specify backend service
|
||||
port.
|
||||
description: Port allow you direct specify backend service port.
|
||||
x-kubernetes-int-or-string: true
|
||||
serviceName:
|
||||
description: ServiceName allow you direct specify K8s
|
||||
service for backend service.
|
||||
description: ServiceName allow you direct specify K8s service for backend service.
|
||||
type: string
|
||||
required:
|
||||
- port
|
||||
- serviceName
|
||||
type: object
|
||||
readTimeout:
|
||||
description: ReadTimeout used for setting read timeout duration
|
||||
for backend service, the unit is second.
|
||||
description: ReadTimeout used for setting read timeout duration for backend service, the unit is second.
|
||||
type: integer
|
||||
sendTimeout:
|
||||
description: SendTimeout used for setting send timeout duration
|
||||
for backend service, the unit is second.
|
||||
description: SendTimeout used for setting send timeout duration for backend service, the unit is second.
|
||||
type: integer
|
||||
type: object
|
||||
customHeaders:
|
||||
additionalProperties:
|
||||
type: string
|
||||
description: CustomHeaders pass a custom list of headers to
|
||||
the backend service.
|
||||
description: CustomHeaders pass a custom list of headers to the backend service.
|
||||
type: object
|
||||
defaultBackend:
|
||||
description: DefaultBackend will become the ingress default
|
||||
backend if the backend is not available
|
||||
description: DefaultBackend will become the ingress default backend if the backend is not available
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the referenced object.
|
||||
@@ -110,34 +97,28 @@ spec:
|
||||
- name
|
||||
type: object
|
||||
name:
|
||||
description: Name will become the suffix of underlying ingress
|
||||
created by this rule, if not, will use index as suffix.
|
||||
description: Name will become the suffix of underlying ingress created by this rule, if not, will use index as suffix.
|
||||
type: string
|
||||
path:
|
||||
description: Path is location Path, default for "/"
|
||||
type: string
|
||||
rewriteTarget:
|
||||
description: RewriteTarget will rewrite request from Path to
|
||||
RewriteTarget path.
|
||||
description: RewriteTarget will rewrite request from Path to RewriteTarget path.
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
tls:
|
||||
description: TLS indicate route trait will create SSL secret using
|
||||
cert-manager with specified issuer If this is nil, route trait will
|
||||
use a selfsigned issuer
|
||||
description: TLS indicate route trait will create SSL secret using cert-manager with specified issuer If this is nil, route trait will use a selfsigned issuer
|
||||
properties:
|
||||
issuerName:
|
||||
type: string
|
||||
type:
|
||||
default: Issuer
|
||||
description: Type indicate the issuer is ClusterIssuer or Issuer(namespace
|
||||
issuer), by default, it's Issuer
|
||||
description: Type indicate the issuer is ClusterIssuer or Issuer(namespace issuer), by default, it's Issuer
|
||||
type: string
|
||||
type: object
|
||||
workloadRef:
|
||||
description: WorkloadReference to the workload whose metrics needs
|
||||
to be exposed
|
||||
description: WorkloadReference to the workload whose metrics needs to be exposed
|
||||
properties:
|
||||
apiVersion:
|
||||
description: APIVersion of the referenced object.
|
||||
@@ -168,25 +149,20 @@ spec:
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
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?
|
||||
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.
|
||||
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
|
||||
@@ -197,9 +173,7 @@ spec:
|
||||
type: array
|
||||
ingresses:
|
||||
items:
|
||||
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.
|
||||
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.
|
||||
@@ -220,9 +194,7 @@ spec:
|
||||
type: object
|
||||
type: array
|
||||
service:
|
||||
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.
|
||||
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.
|
||||
|
||||
@@ -840,7 +840,7 @@ spec:
|
||||
ports:
|
||||
- name: https
|
||||
port: 443
|
||||
targetPort: 10250
|
||||
targetPort: 13622
|
||||
selector:
|
||||
app.kubernetes.io/component: webhook
|
||||
app.kubernetes.io/instance: cert-manager
|
||||
@@ -881,7 +881,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
image: quay.io/jetstack/cert-manager-cainjector:v1.0.3
|
||||
image: quay.io/jetstack/cert-manager-cainjector:v1.1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: cert-manager
|
||||
resources: {}
|
||||
@@ -926,7 +926,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
image: quay.io/jetstack/cert-manager-controller:v1.0.3
|
||||
image: quay.io/jetstack/cert-manager-controller:v1.1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
name: cert-manager
|
||||
ports:
|
||||
@@ -963,7 +963,7 @@ spec:
|
||||
containers:
|
||||
- args:
|
||||
- --v=2
|
||||
- --secure-port=10250
|
||||
- --secure-port=13622
|
||||
- --dynamic-serving-ca-secret-namespace=$(POD_NAMESPACE)
|
||||
- --dynamic-serving-ca-secret-name=cert-manager-webhook-ca
|
||||
- --dynamic-serving-dns-names=cert-manager-webhook,cert-manager-webhook.cert-manager,cert-manager-webhook.cert-manager.svc
|
||||
@@ -972,7 +972,7 @@ spec:
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
image: quay.io/jetstack/cert-manager-webhook:v1.0.3
|
||||
image: quay.io/jetstack/cert-manager-webhook:v1.1.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
livenessProbe:
|
||||
failureThreshold: 3
|
||||
@@ -986,7 +986,7 @@ spec:
|
||||
timeoutSeconds: 1
|
||||
name: cert-manager
|
||||
ports:
|
||||
- containerPort: 10250
|
||||
- containerPort: 13622
|
||||
name: https
|
||||
readinessProbe:
|
||||
failureThreshold: 3
|
||||
|
||||
@@ -2,9 +2,6 @@ apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ScopeDefinition
|
||||
metadata:
|
||||
name: healthscopes.core.oam.dev
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: core.oam.dev/v1alpha2
|
||||
definition.oam.dev/kind: HealthScope
|
||||
namespace: default
|
||||
spec:
|
||||
workloadRefsPath: spec.workloadRefs
|
||||
|
||||
@@ -1,35 +1,34 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: autoscale
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: standard.oam.dev/v1alpha1
|
||||
definition.oam.dev/kind: Autoscaler
|
||||
definition.oam.dev/description: "Automatically scale workloads"
|
||||
definition.oam.dev/description: "`Autoscale` is used to automatically scale workloads by resource utilization metrics or cron triggers."
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- webservice
|
||||
- backend
|
||||
- deployments.apps
|
||||
- podspecworkload
|
||||
- worker
|
||||
workloadRefPath: spec.workloadRef
|
||||
definitionRef:
|
||||
name: autoscalers.standard.oam.dev
|
||||
extension:
|
||||
template: |
|
||||
import "strconv"
|
||||
|
||||
output: {
|
||||
apiVersion: "standard.oam.dev/v1alpha1"
|
||||
kind: "Autoscaler"
|
||||
spec: {
|
||||
minReplicas: parameter.min
|
||||
maxReplicas: parameter.max
|
||||
if parameter["cpu"] != _|_ && parameter["cron"] != _|_ {
|
||||
if parameter["cpuPercent"] != _|_ && parameter["cron"] != _|_ {
|
||||
triggers: [cpuScaler, cronScaler]
|
||||
}
|
||||
if parameter["cpu"] != _|_ && parameter["cron"] == _|_ {
|
||||
if parameter["cpuPercent"] != _|_ && parameter["cron"] == _|_ {
|
||||
triggers: [cpuScaler]
|
||||
}
|
||||
if parameter["cpu"] == _|_ && parameter["cron"] != _|_ {
|
||||
if parameter["cpuPercent"] == _|_ && parameter["cron"] != _|_ {
|
||||
triggers: [cronScaler]
|
||||
}
|
||||
}
|
||||
@@ -39,34 +38,45 @@ spec:
|
||||
type: "cpu"
|
||||
condition: {
|
||||
type: "Utilization"
|
||||
if parameter["cpu"] != _|_ {
|
||||
value: parameter.cpu
|
||||
if parameter["cpuPercent"] != _|_ {
|
||||
// Temporarily use `strconv` for type converting. This bug will be fixed in kubevela#585
|
||||
value: strconv.FormatInt(parameter.cpuPercent, 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cronScaler: {
|
||||
type: "cron"
|
||||
if parameter["cron"] != _|_ {
|
||||
condition: parameter.cron
|
||||
if parameter["cron"] != _|_ && parameter.cron["replicas"] != _|_ {
|
||||
condition: {
|
||||
startAt: parameter.cron.startAt
|
||||
duration: parameter.cron.duration
|
||||
days: parameter.cron.days
|
||||
replicas: strconv.FormatInt(parameter.cron.replicas, 10)
|
||||
timezone: parameter.cron.timezone
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parameter: {
|
||||
// +usage=minimal replicas of the workload
|
||||
// +usage=Minimal replicas of the workload
|
||||
min: int
|
||||
// +usage=maximal replicas of the workload
|
||||
// +usage=Maximal replicas of the workload
|
||||
max: int
|
||||
// +usage=specify the value for CPU utilization, like 80, which means 80%
|
||||
cpu?: string
|
||||
// +usage=just for `appfile`, not available for Cli usage
|
||||
// +usage=Specify the value for CPU utilization, like 80, which means 80%
|
||||
// +alias=cpu-percent
|
||||
cpuPercent?: int
|
||||
// +usage=Cron type auto-scaling. Just for `appfile`, not available for Cli usage
|
||||
cron?: {
|
||||
startAt: string
|
||||
// +usage=The time to start scaling, like `08:00`
|
||||
startAt: string
|
||||
// +usage=For how long the scaling will last
|
||||
duration: string
|
||||
// +usage=several workdays or weekends, like "Monday, Tuesday"
|
||||
days: string
|
||||
replicas: string
|
||||
// +usage=timezone, like "America/Seattle"
|
||||
// +usage=Several workdays or weekends, like "Monday, Tuesday"
|
||||
days: string
|
||||
// +usage=The target replicas to be scaled to
|
||||
replicas: int
|
||||
// +usage=Timezone, like "America/Los_Angeles"
|
||||
timezone: string
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: core.oam.dev/v1alpha2
|
||||
definition.oam.dev/kind: ManualScalerTrait
|
||||
definition.oam.dev/description: "Scale replica for workload"
|
||||
definition.oam.dev/description: "`Scaler` is used to configure replicas for your service."
|
||||
name: scaler
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- webservice
|
||||
- containerizedworkloads.core.oam.dev
|
||||
- deployments.apps
|
||||
- worker
|
||||
definitionRef:
|
||||
name: manualscalertraits.core.oam.dev
|
||||
workloadRefPath: spec.workloadRef
|
||||
@@ -20,11 +18,12 @@ spec:
|
||||
apiVersion: "core.oam.dev/v1alpha2"
|
||||
kind: "ManualScalerTrait"
|
||||
spec: {
|
||||
replicaCount: parameter.replica
|
||||
replicaCount: parameter.replicas
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
//+short=r
|
||||
replica: *1 | int
|
||||
//+usage=Replicas of the workload
|
||||
replicas: *1 | int
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: metric
|
||||
name: metrics
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: standard.oam.dev/v1alpha1
|
||||
definition.oam.dev/kind: MetricsTrait
|
||||
definition.oam.dev/description: "Add metric monitoring for workload"
|
||||
definition.oam.dev/description: "`Metrics` is used to configure monitoring metrics for your service."
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- webservice
|
||||
- backend
|
||||
- task
|
||||
- containerizedworkloads.core.oam.dev
|
||||
- clonesetworkloads.apps.kruise.io
|
||||
- deployments.apps
|
||||
- statefulsets.apps
|
||||
definitionRef:
|
||||
name: metricstraits.standard.oam.dev
|
||||
workloadRefPath: spec.workloadRef
|
||||
@@ -28,16 +23,17 @@ spec:
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=format of the metrics, default as prometheus
|
||||
// +usage=Format of the metrics, default as prometheus
|
||||
// +short=f
|
||||
format: *"prometheus" | string
|
||||
// +usage= the metric path of the service
|
||||
path: *"/metrics" | string
|
||||
// +usage=The metrics path of the service
|
||||
path: *"/metrics" | string
|
||||
// +usage=The way to retrieve data which can take the values `http` or `https`
|
||||
scheme: *"http" | string
|
||||
enabled: *true | bool
|
||||
// +usage= the port for metrics, will discovery automatically by default
|
||||
// +usage=The port for metrics, will discovery automatically by default
|
||||
port: *0 | >=1024 & <=65535 & int
|
||||
// +usage= the label selector for the pods, will discovery automatically by default
|
||||
// +usage=The label selector for the pods, will discovery automatically by default
|
||||
selector?: [string]: string
|
||||
}
|
||||
|
||||
|
||||
53
charts/vela-core/templates/defwithtemplate/rollout.yaml
Normal file
53
charts/vela-core/templates/defwithtemplate/rollout.yaml
Normal file
@@ -0,0 +1,53 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: rollout
|
||||
annotations:
|
||||
definition.oam.dev/description: "`Rollout` is used to configure Canary deployment strategy for your application."
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- webservice
|
||||
definitionRef:
|
||||
name: canaries.flagger.app
|
||||
workloadRefPath: spec.targetRef
|
||||
revisionEnabled: true
|
||||
extension:
|
||||
template: |-
|
||||
output: {
|
||||
apiVersion: "flagger.app/v1beta1"
|
||||
kind: "Canary"
|
||||
spec: {
|
||||
provider: "smi"
|
||||
progressDeadlineSeconds: 60
|
||||
service: {
|
||||
// Currently Traffic route is not supported, but this is required field for flagger CRD
|
||||
port: 80
|
||||
// Currently Traffic route is not supported, but this is required field for flagger CRD
|
||||
targetPort: 8080
|
||||
}
|
||||
analysis: {
|
||||
interval: parameter.interval
|
||||
// max number of failed metric checks before rollback
|
||||
threshold: 10
|
||||
// max traffic percentage routed to canary
|
||||
// percentage (0-100)
|
||||
maxWeight: 50
|
||||
// canary increment step
|
||||
// percentage (0-100)
|
||||
stepWeight: parameter.stepWeight
|
||||
// max replicas scale up to canary
|
||||
maxReplicas: parameter.replicas
|
||||
}
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Total replicas of the workload
|
||||
replicas: *2 | int
|
||||
// +alias=step-weight
|
||||
// +usage=Weight percent of every step in rolling update
|
||||
stepWeight: *50 | int
|
||||
// +usage=Schedule interval time
|
||||
interval: *"30s" | string
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: route
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: standard.oam.dev/v1alpha1
|
||||
definition.oam.dev/kind: Route
|
||||
definition.oam.dev/description: "Add a route for workload"
|
||||
definition.oam.dev/description: "`Route` is used to configure external access to your service."
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- webservice
|
||||
- deployments.apps
|
||||
workloadRefPath: spec.workloadRef
|
||||
definitionRef:
|
||||
name: routes.standard.oam.dev
|
||||
@@ -33,7 +31,9 @@ spec:
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage= Domain name
|
||||
domain: *"" | string
|
||||
|
||||
issuer: *"" | string
|
||||
rules?: [...{
|
||||
path: string
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: WorkloadDefinition
|
||||
metadata:
|
||||
name: task
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: "v1"
|
||||
definition.oam.dev/kind: "Job"
|
||||
definition.oam.dev/description: "One-time task/job"
|
||||
definition.oam.dev/description: "`Task` is a workload type to describe jobs that run code or a script to completion."
|
||||
spec:
|
||||
definitionRef:
|
||||
name: jobs
|
||||
name: jobs.batch
|
||||
extension:
|
||||
template: |
|
||||
output: {
|
||||
apiVersion: "v1"
|
||||
apiVersion: "batch/v1"
|
||||
kind: "Job"
|
||||
spec: {
|
||||
parallelism: parameter.count
|
||||
completions: parameter.count
|
||||
template: spec: {
|
||||
restartPolicy: parameter.restart
|
||||
containers: [{
|
||||
name: context.name
|
||||
image: parameter.image
|
||||
@@ -34,10 +34,14 @@ spec:
|
||||
// +short=c
|
||||
count: *1 | int
|
||||
|
||||
// +usage=specify app image
|
||||
// +usage=Which image would you like to use for your service
|
||||
// +short=i
|
||||
image: string
|
||||
|
||||
// +usage=Define the job restart policy, the value can only be Never or OnFailure. By default, it's Never.
|
||||
restart: *"Never" | string
|
||||
|
||||
// +usage=Commands to run in the container
|
||||
cmd?: [...string]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: WorkloadDefinition
|
||||
metadata:
|
||||
name: webservice
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: "apps/v1"
|
||||
definition.oam.dev/kind: "Deployment"
|
||||
definition.oam.dev/description: "Long running service with network routes"
|
||||
definition.oam.dev/description: "`Webservice` is a workload type to describe long-running, scalable, containerized services that have a stable network endpoint to receive external network traffic from customers.
|
||||
If workload type is skipped for any service defined in Appfile, it will be defaulted to `Web Service` type."
|
||||
spec:
|
||||
definitionRef:
|
||||
name: deployments.apps
|
||||
@@ -38,24 +38,19 @@ spec:
|
||||
}
|
||||
|
||||
if context["config"] != _|_ {
|
||||
env: [
|
||||
for k, v in context.config {
|
||||
name: k
|
||||
value: v
|
||||
},
|
||||
]
|
||||
env: context.config
|
||||
}
|
||||
|
||||
ports: [{
|
||||
containerPort: parameter.port
|
||||
}]
|
||||
|
||||
if parameter["cpuRequests"] != _|_ {
|
||||
if parameter["cpu"] != _|_ {
|
||||
resources: {
|
||||
limits:
|
||||
cpu: parameter.cpuRequests
|
||||
cpu: parameter.cpu
|
||||
requests:
|
||||
cpu: parameter.cpuRequests
|
||||
cpu: parameter.cpu
|
||||
}
|
||||
}
|
||||
}]
|
||||
@@ -64,28 +59,34 @@ spec:
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=specify app image
|
||||
// +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=specify port for container
|
||||
// +usage=Which port do you want customer traffic sent to
|
||||
// +short=p
|
||||
port: *6379 | int
|
||||
|
||||
port: *80 | int
|
||||
// +usage=Define arguments by using environment variables
|
||||
env?: [...{
|
||||
name: string
|
||||
// +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
|
||||
key: string
|
||||
// +usage=The key of the secret to select from. Must be a valid secret key
|
||||
key: string
|
||||
}
|
||||
}
|
||||
}]
|
||||
// +usage=CPU core requests for the workload
|
||||
// +alias=cpu-requests
|
||||
cpuRequests?: string
|
||||
// +usage=Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core)
|
||||
cpu?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT.
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: WorkloadDefinition
|
||||
metadata:
|
||||
name: worker
|
||||
annotations:
|
||||
definition.oam.dev/apiVersion: "apps/v1"
|
||||
definition.oam.dev/kind: "Deployment"
|
||||
definition.oam.dev/description: "Backend worker without ports exposed"
|
||||
definition.oam.dev/description: "`Worker` is a workload type to describe long-running, scalable, containerized services that running at backend. They do NOT have network endpoint to receive external network traffic."
|
||||
spec:
|
||||
definitionRef:
|
||||
name: deployments.apps
|
||||
@@ -43,10 +42,10 @@ spec:
|
||||
}
|
||||
|
||||
parameter: {
|
||||
// +usage=specify app image
|
||||
// +usage=Which image would you like to use for your service
|
||||
// +short=i
|
||||
image: string
|
||||
|
||||
// +usage=Commands to run in the container
|
||||
cmd?: [...string]
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,11 @@ spec:
|
||||
- "--use-webhook=true"
|
||||
- "--webhook-port={{ .Values.webhookService.port }}"
|
||||
- "--webhook-cert-dir={{ .Values.certificate.mountPath }}"
|
||||
{{ end }}
|
||||
- "--health-addr=:{{ .Values.healthCheck.port }}"
|
||||
{{ end }}
|
||||
{{ if ne .Values.disableCaps "" }}
|
||||
- "--disable-caps={{ .Values.disableCaps }}"
|
||||
{{ end }}
|
||||
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
||||
imagePullPolicy: {{ quote .Values.image.pullPolicy }}
|
||||
resources:
|
||||
|
||||
@@ -2,7 +2,8 @@ apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: vela-config
|
||||
namespace: {{ .Release.Namespace }}
|
||||
# TODO: Currently namespace MUST be vela-system
|
||||
namespace: vela-system
|
||||
data:
|
||||
servicemonitors.monitoring.coreos.com: |
|
||||
{
|
||||
@@ -14,11 +15,11 @@ data:
|
||||
}
|
||||
flagger.app: |
|
||||
{
|
||||
"repo": "flagger",
|
||||
"urL": "https://flagger.app",
|
||||
"repo": "oam-flagger",
|
||||
"urL": "https://oam.dev/flagger/archives/",
|
||||
"name": "flagger",
|
||||
"namespace": "vela-system",
|
||||
"version": "1.2.0"
|
||||
"version": "1.1.0"
|
||||
}
|
||||
keda: |
|
||||
{
|
||||
@@ -27,4 +28,4 @@ data:
|
||||
"name": "keda",
|
||||
"namespace": "keda",
|
||||
"version": "2.0.0-rc3"
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
replicaCount: 1
|
||||
useWebhook: true
|
||||
# By default, don't disable any builtin capabilities
|
||||
disableCaps: ""
|
||||
image:
|
||||
repository: oamdev/vela-core
|
||||
tag: latest
|
||||
|
||||
@@ -12,12 +12,10 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/oam-dev/kubevela/version"
|
||||
|
||||
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
|
||||
"github.com/crossplane/crossplane-runtime/pkg/logging"
|
||||
oamcore "github.com/crossplane/oam-kubernetes-runtime/apis/core"
|
||||
oamcontroller "github.com/crossplane/oam-kubernetes-runtime/pkg/controller"
|
||||
oamv1alpha2 "github.com/crossplane/oam-kubernetes-runtime/pkg/controller/v1alpha2"
|
||||
oamwebhook "github.com/crossplane/oam-kubernetes-runtime/pkg/webhook/v1alpha2"
|
||||
"github.com/go-logr/logr"
|
||||
injectorv1alpha1 "github.com/oam-dev/trait-injector/api/v1alpha1"
|
||||
injectorcontroller "github.com/oam-dev/trait-injector/controllers"
|
||||
@@ -35,11 +33,15 @@ import (
|
||||
"sigs.k8s.io/controller-runtime/pkg/healthz"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log/zap"
|
||||
|
||||
velacoreoamdev "github.com/oam-dev/kubevela/api/core.oam.dev/v1alpha2"
|
||||
velacore "github.com/oam-dev/kubevela/api/v1alpha1"
|
||||
oamcore "github.com/oam-dev/kubevela/apis/core.oam.dev"
|
||||
velacore "github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
velacontroller "github.com/oam-dev/kubevela/pkg/controller"
|
||||
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/dependency"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/utils"
|
||||
velawebhook "github.com/oam-dev/kubevela/pkg/webhook"
|
||||
oamwebhook "github.com/oam-dev/kubevela/pkg/webhook/core.oam.dev/v1alpha2"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -59,7 +61,6 @@ func init() {
|
||||
_ = oamcore.AddToScheme(scheme)
|
||||
_ = monitoring.AddToScheme(scheme)
|
||||
_ = velacore.AddToScheme(scheme)
|
||||
_ = velacoreoamdev.AddToScheme(scheme)
|
||||
_ = injectorv1alpha1.AddToScheme(scheme)
|
||||
_ = certmanager.AddToScheme(scheme)
|
||||
_ = kedav1alpha1.AddToScheme(scheme)
|
||||
@@ -67,7 +68,7 @@ func init() {
|
||||
}
|
||||
|
||||
func main() {
|
||||
var metricsAddr, logFilePath string
|
||||
var metricsAddr, logFilePath, leaderElectionNamespace string
|
||||
var enableLeaderElection, logCompress bool
|
||||
var logRetainDate int
|
||||
var certDir string
|
||||
@@ -75,6 +76,7 @@ func main() {
|
||||
var useWebhook, useTraitInjector bool
|
||||
var controllerArgs oamcontroller.Args
|
||||
var healthAddr string
|
||||
var disableCaps string
|
||||
|
||||
flag.BoolVar(&useWebhook, "use-webhook", false, "Enable Admission Webhook")
|
||||
flag.BoolVar(&useTraitInjector, "use-trait-injector", false, "Enable TraitInjector")
|
||||
@@ -83,12 +85,17 @@ func main() {
|
||||
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
|
||||
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
|
||||
"Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")
|
||||
flag.StringVar(&logFilePath, "log-file-path", "", "The address the metric endpoint binds to.")
|
||||
flag.StringVar(&leaderElectionNamespace, "leader-election-namespace", "",
|
||||
"Determines the namespace in which the leader election configmap will be created.")
|
||||
flag.StringVar(&logFilePath, "log-file-path", "", "The file to write logs to.")
|
||||
flag.IntVar(&logRetainDate, "log-retain-date", 7, "The number of days of logs history to retain.")
|
||||
flag.BoolVar(&logCompress, "log-compress", true, "Enable compression on the rotated logs.")
|
||||
flag.IntVar(&controllerArgs.RevisionLimit, "revision-limit", 50,
|
||||
"RevisionLimit is the maximum number of revisions that will be maintained. The default value is 50.")
|
||||
flag.StringVar(&healthAddr, "health-addr", ":9440", "The address the health endpoint binds to.")
|
||||
flag.BoolVar(&controllerArgs.ApplyOnceOnly, "apply-once-only", false,
|
||||
"For the purpose of some production environment that workload or trait should not be affected if no spec change")
|
||||
flag.StringVar(&disableCaps, "disable-caps", "", "To be disabled builtin capability list.")
|
||||
flag.Parse()
|
||||
|
||||
// setup logging
|
||||
@@ -108,6 +115,9 @@ func main() {
|
||||
o.DestWritter = w
|
||||
}))
|
||||
|
||||
setupLog.Info(fmt.Sprintf("KubeVela Version: %s, GIT Revision: %s.", version.VelaVersion, version.GitRevision))
|
||||
setupLog.Info(fmt.Sprintf("Disable Capabilities: %s.", disableCaps))
|
||||
|
||||
// install dependency charts first
|
||||
k8sClient, err := client.New(ctrl.GetConfigOrDie(), client.Options{Scheme: scheme})
|
||||
if err != nil {
|
||||
@@ -117,13 +127,14 @@ func main() {
|
||||
go dependency.Install(k8sClient)
|
||||
|
||||
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
|
||||
Scheme: scheme,
|
||||
MetricsBindAddress: metricsAddr,
|
||||
LeaderElection: enableLeaderElection,
|
||||
LeaderElectionID: kubevelaName,
|
||||
Port: webhookPort,
|
||||
CertDir: certDir,
|
||||
HealthProbeBindAddress: healthAddr,
|
||||
Scheme: scheme,
|
||||
MetricsBindAddress: metricsAddr,
|
||||
LeaderElection: enableLeaderElection,
|
||||
LeaderElectionNamespace: leaderElectionNamespace,
|
||||
LeaderElectionID: kubevelaName,
|
||||
Port: webhookPort,
|
||||
CertDir: certDir,
|
||||
HealthProbeBindAddress: healthAddr,
|
||||
})
|
||||
if err != nil {
|
||||
setupLog.Error(err, "unable to create a controller manager")
|
||||
@@ -135,13 +146,18 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := utils.CheckDisabledCapabilities(disableCaps); err != nil {
|
||||
setupLog.Error(err, "unable to get enabled capabilities")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if useWebhook {
|
||||
setupLog.Info("vela webhook enabled, will serving at :" + strconv.Itoa(webhookPort))
|
||||
if err = oamwebhook.Add(mgr); err != nil {
|
||||
setupLog.Error(err, "unable to setup oam runtime webhook")
|
||||
os.Exit(1)
|
||||
}
|
||||
velawebhook.Register(mgr)
|
||||
velawebhook.Register(mgr, disableCaps)
|
||||
if err := waitWebhookSecretVolume(certDir, waitSecretTimeout, waitSecretInterval); err != nil {
|
||||
setupLog.Error(err, "unable to get webhook secret")
|
||||
os.Exit(1)
|
||||
@@ -153,7 +169,7 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err = velacontroller.Setup(mgr); err != nil {
|
||||
if err = velacontroller.Setup(mgr, disableCaps); err != nil {
|
||||
setupLog.Error(err, "unable to setup the vela core controller")
|
||||
os.Exit(1)
|
||||
}
|
||||
@@ -177,6 +193,10 @@ func main() {
|
||||
}
|
||||
|
||||
setupLog.Info("starting the vela controller manager")
|
||||
|
||||
if controllerArgs.ApplyOnceOnly {
|
||||
setupLog.Info("applyOnceOnly is enabled that means workload or trait only apply once if no spec change even they are changed by others")
|
||||
}
|
||||
if err := mgr.Start(makeSignalHandler(setupLog, k8sClient)); err != nil {
|
||||
setupLog.Error(err, "problem running manager")
|
||||
os.Exit(1)
|
||||
@@ -209,14 +229,18 @@ func waitWebhookSecretVolume(certDir string, timeout, interval time.Duration) er
|
||||
int64(time.Since(start).Seconds()), int64(timeout.Seconds())))
|
||||
if _, err := os.Stat(certDir); !os.IsNotExist(err) {
|
||||
ready := func() bool {
|
||||
f, _ := os.Open(certDir)
|
||||
f, err := os.Open(filepath.Clean(certDir))
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
// nolint
|
||||
defer f.Close()
|
||||
// check if dir is empty
|
||||
if _, err := f.Readdir(1); err == io.EOF {
|
||||
if _, err := f.Readdir(1); errors.Is(err, io.EOF) {
|
||||
return false
|
||||
}
|
||||
// check if secret files are empty
|
||||
err := filepath.Walk(certDir, func(path string, info os.FileInfo, err error) error {
|
||||
err = filepath.Walk(certDir, func(path string, info os.FileInfo, err error) error {
|
||||
// even Cert dir is created, cert files are still empty for a while
|
||||
if info.Size() == 0 {
|
||||
return errors.New("secret is not ready")
|
||||
@@ -237,6 +261,7 @@ func waitWebhookSecretVolume(certDir string, timeout, interval time.Duration) er
|
||||
}
|
||||
}
|
||||
|
||||
//nolint:unparam
|
||||
func makeSignalHandler(log logr.Logger, kubecli client.Client) (stopCh <-chan struct{}) {
|
||||
stop := make(chan struct{})
|
||||
c := make(chan os.Signal, 2)
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default:
|
||||
threshold: 0.5%
|
||||
patch: off
|
||||
|
||||
146
config/samples/vela-server/README.md
Normal file
146
config/samples/vela-server/README.md
Normal file
@@ -0,0 +1,146 @@
|
||||
# Vela Server
|
||||
## example
|
||||
|
||||
In this Demo, Application application-sample will be converted to appconfig and component
|
||||
|
||||
The fields in the application spec come from the parametes defined in the definition template
|
||||
, so we must install Definition at first
|
||||
|
||||
Step 1: Install Workload Definition & Trait Definition
|
||||
```
|
||||
kubectl apply -f template.yaml
|
||||
```
|
||||
Step 2: Create a sample application in the cluster
|
||||
```
|
||||
kubectl apply -f application-sample.yaml
|
||||
```
|
||||
Step 3: View the application status
|
||||
```
|
||||
kubectl get -f application-sample.yaml -oyaml
|
||||
|
||||
// You can see the following
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: Application
|
||||
metadata:
|
||||
annotations:
|
||||
kubectl.kubernetes.io/last-applied-configuration: |
|
||||
{"apiVersion":"core.oam.dev/v1alpha2","kind":"Application","metadata":{"annotations":{},"name":"application-sample","namespace":"oam-test"},"spec":{"template":"services:\n myweb:\n type: worker\n image: \"busybox\"\n cmd:\n - sleep\n - \"1000\"\n scaler:\n replicas: 10"}}
|
||||
name: application-sample
|
||||
namespace: oam-test
|
||||
spec:
|
||||
services:
|
||||
myweb:
|
||||
cmd:
|
||||
- sleep
|
||||
- "1000"
|
||||
image: busybox
|
||||
scaler:
|
||||
replicas: 10
|
||||
type: worker
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2020-12-02T12:12:52Z"
|
||||
reason: Available
|
||||
status: "True"
|
||||
type: Parsed
|
||||
- lastTransitionTime: "2020-12-02T12:12:52Z"
|
||||
reason: Available
|
||||
status: "True"
|
||||
type: Built
|
||||
- lastTransitionTime: "2020-12-02T12:12:52Z"
|
||||
reason: Available
|
||||
status: "True"
|
||||
type: Applied
|
||||
status: running
|
||||
|
||||
```
|
||||
|
||||
Step 4: View the oam CR generated by application
|
||||
|
||||
```
|
||||
kubectl get appconfig/application-sample -oyaml
|
||||
|
||||
// appconfig is as follows
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
labels:
|
||||
application.oam.dev: application-sample
|
||||
name: application-sample
|
||||
namespace: oam-test
|
||||
ownerReferences:
|
||||
- apiVersion: core.oam.dev/v1alpha2
|
||||
controller: true
|
||||
kind: Application
|
||||
name: application-sample
|
||||
uid: dca7acc3-664c-422b-aa52-4fe012e37974
|
||||
spec:
|
||||
components:
|
||||
- componentName: myweb
|
||||
traits:
|
||||
- trait:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ManualScalerTrait
|
||||
spec:
|
||||
replicaCount: 10
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2020-12-02T12:12:52Z"
|
||||
reason: Successfully reconciled resource
|
||||
status: "True"
|
||||
type: Synced
|
||||
dependency: {}
|
||||
workloads:
|
||||
- componentName: myweb
|
||||
componentRevisionName: myweb-v1
|
||||
traits:
|
||||
- traitRef:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ManualScalerTrait
|
||||
name: myweb-trait-78fdd467d6
|
||||
workloadRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: myweb
|
||||
|
||||
kubectl get component/myweb -oyaml
|
||||
|
||||
// component is as follows
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: Component
|
||||
metadata:
|
||||
labels:
|
||||
application.oam.dev: application-sample
|
||||
name: myweb
|
||||
namespace: oam-test
|
||||
ownerReferences:
|
||||
- apiVersion: core.oam.dev/v1alpha2
|
||||
controller: true
|
||||
kind: Application
|
||||
name: application-sample
|
||||
uid: dca7acc3-664c-422b-aa52-4fe012e37974
|
||||
spec:
|
||||
workload:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app.oam.dev/component: myweb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.oam.dev/component: myweb
|
||||
spec:
|
||||
containers:
|
||||
- command:
|
||||
- sleep
|
||||
- "1000"
|
||||
image: busybox
|
||||
name: myweb
|
||||
status:
|
||||
latestRevision:
|
||||
name: myweb-v1
|
||||
revision: 1
|
||||
```
|
||||
|
||||
14
config/samples/vela-server/application-sample.yaml
Normal file
14
config/samples/vela-server/application-sample.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: Application
|
||||
metadata:
|
||||
name: application-sample
|
||||
spec:
|
||||
services:
|
||||
myweb:
|
||||
type: worker
|
||||
image: "busybox"
|
||||
cmd:
|
||||
- sleep
|
||||
- "1000"
|
||||
scaler:
|
||||
replicas: 10
|
||||
76
config/samples/vela-server/template.yaml
Normal file
76
config/samples/vela-server/template.yaml
Normal file
@@ -0,0 +1,76 @@
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: WorkloadDefinition
|
||||
metadata:
|
||||
name: worker
|
||||
annotations:
|
||||
definition.oam.dev/description: "Long-running scalable backend worker without network endpoint"
|
||||
spec:
|
||||
definitionRef:
|
||||
name: deployments.apps
|
||||
extension:
|
||||
template: |
|
||||
output: {
|
||||
apiVersion: "apps/v1"
|
||||
kind: "Deployment"
|
||||
spec: {
|
||||
selector: matchLabels: {
|
||||
"app.oam.dev/component": context.name
|
||||
}
|
||||
|
||||
template: {
|
||||
metadata: labels: {
|
||||
"app.oam.dev/component": context.name
|
||||
}
|
||||
|
||||
spec: {
|
||||
containers: [{
|
||||
name: context.name
|
||||
image: parameter.image
|
||||
|
||||
if parameter["cmd"] != _|_ {
|
||||
command: parameter.cmd
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
selector:
|
||||
matchLabels:
|
||||
"app.oam.dev/component": context.name
|
||||
}
|
||||
}
|
||||
|
||||
parameter: {
|
||||
// +usage=Which image would you like to use for your service
|
||||
// +short=i
|
||||
image: string
|
||||
|
||||
cmd?: [...string]
|
||||
}
|
||||
---
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: "Manually scale the app"
|
||||
name: scaler
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- webservice
|
||||
- worker
|
||||
definitionRef:
|
||||
name: manualscalertraits.core.oam.dev
|
||||
workloadRefPath: spec.workloadRef
|
||||
extension:
|
||||
template: |-
|
||||
output: {
|
||||
apiVersion: "core.oam.dev/v1alpha2"
|
||||
kind: "ManualScalerTrait"
|
||||
spec: {
|
||||
replicaCount: parameter.replicas
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
//+short=r
|
||||
replicas: *1 | int
|
||||
}
|
||||
@@ -426,7 +426,7 @@ Please also specify `traits` values if need to attach a trait to several traits
|
||||
"workload_name": "poc5",
|
||||
"flags": [
|
||||
{
|
||||
"name": "replica",
|
||||
"name": "replicas",
|
||||
"value": "4"
|
||||
}
|
||||
]
|
||||
@@ -444,7 +444,7 @@ sample response
|
||||
"data": {
|
||||
"name": "podspecworkload",
|
||||
"type": "workload",
|
||||
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"PodSpecWorkload\"\n\tmetadata: name: podspecworkload.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=specify app image\n\t// +short=i\n\timage: string\n\t// +usage=specify port for container\n\t// +short=p\n\tport: *6379 | int\n}\n",
|
||||
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"PodSpecWorkload\"\n\tmetadata: name: podspecworkload.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=Which image would you like to use for your service\n\t// +short=i\n\timage: string\n\t// +usage=Which port do you want customer traffic sent to\n\t// +short=p\n\tport: *6379 | int\n}\n",
|
||||
"parameters": [{
|
||||
"name": "name",
|
||||
"required": true,
|
||||
@@ -455,13 +455,13 @@ sample response
|
||||
"short": "i",
|
||||
"required": true,
|
||||
"default": "",
|
||||
"usage": "specify app image",
|
||||
"usage": "Which image would you like to use for your service",
|
||||
"type": 16
|
||||
}, {
|
||||
"name": "port",
|
||||
"short": "p",
|
||||
"default": 6379,
|
||||
"usage": "specify port for container",
|
||||
"usage": "Which port do you want customer traffic sent to",
|
||||
"type": 4
|
||||
}],
|
||||
"definition": "/Users/zhouzhengxi/.vela/capabilities/containerizedworkloads.core.oam.dev.cue",
|
||||
@@ -492,13 +492,13 @@ sample response
|
||||
"short": "i",
|
||||
"required": true,
|
||||
"default": "",
|
||||
"usage": "specify app image",
|
||||
"usage": "Which image would you like to use for your service",
|
||||
"type": 16
|
||||
}, {
|
||||
"name": "port",
|
||||
"short": "p",
|
||||
"default": 6379,
|
||||
"usage": "specify port for container",
|
||||
"usage": "Which port do you want customer traffic sent to",
|
||||
"type": 4
|
||||
}]
|
||||
}, {
|
||||
@@ -534,7 +534,7 @@ sample request
|
||||
"name": "scale",
|
||||
"flags": [
|
||||
{
|
||||
"name": "replica",
|
||||
"name": "replicas",
|
||||
"value": "4"
|
||||
}
|
||||
]
|
||||
@@ -556,9 +556,9 @@ sample response
|
||||
"data": {
|
||||
"name": "manualscaler",
|
||||
"type": "trait",
|
||||
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ManualScalerTrait\"\n\tspec: {\n\t\treplicaCount: manualscaler.replica\n\t}\n}\nmanualscaler: {\n\t//+short=r\n\treplica: *2 | int\n}\n",
|
||||
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ManualScalerTrait\"\n\tspec: {\n\t\treplicaCount: manualscaler.replicas\n\t}\n}\nmanualscaler: {\n\t//+short=r\n\treplicas: *2 | int\n}\n",
|
||||
"parameters": [{
|
||||
"name": "replica",
|
||||
"name": "replicas",
|
||||
"short": "r",
|
||||
"default": 2,
|
||||
"type": 4
|
||||
@@ -675,7 +675,7 @@ sample response
|
||||
"data": [{
|
||||
"name": "podspecworkload",
|
||||
"type": "workload",
|
||||
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ContainerizedWorkload\"\n\tmetadata: name: podspecworkload.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=specify app image\n\t// +short=i\n\timage: string\n\t// +usage=specify port for container\n\t// +short=p\n\tport: *6379 | int\n}\n",
|
||||
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ContainerizedWorkload\"\n\tmetadata: name: podspecworkload.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=Which image would you like to use for your service\n\t// +short=i\n\timage: string\n\t// +usage=Which port do you want customer traffic sent to\n\t// +short=p\n\tport: *6379 | int\n}\n",
|
||||
"parameters": [{
|
||||
"name": "name",
|
||||
"required": true,
|
||||
@@ -686,13 +686,13 @@ sample response
|
||||
"short": "i",
|
||||
"required": true,
|
||||
"default": "",
|
||||
"usage": "specify app image",
|
||||
"usage": "Which image would you like to use for your service",
|
||||
"type": 16
|
||||
}, {
|
||||
"name": "port",
|
||||
"short": "p",
|
||||
"default": 6379,
|
||||
"usage": "specify port for container",
|
||||
"usage": "Which port do you want customer traffic sent to",
|
||||
"type": 4
|
||||
}],
|
||||
"definition": "/Users/zhouzhengxi/.vela/centers/c1/.tmp/containerizedworkloads.core.oam.dev.cue",
|
||||
@@ -702,9 +702,9 @@ sample response
|
||||
},{
|
||||
"name": "rollout",
|
||||
"type": "trait",
|
||||
"template": "#Template: {\n\tapiVersion: \"extend.oam.dev/v1alpha2\"\n\tkind: \"SimpleRolloutTrait\"\n\tspec: {\n\t\treplica: rollout.replica\n\t\tmaxUnavailable: rollout.maxUnavailable\n\t\tbatch: rollout.batch\n\t}\n}\nrollout: {\n\treplica: *3 | int\n\tmaxUnavailable: *1 | int\n\tbatch: *2 | int\n}\n",
|
||||
"template": "#Template: {\n\tapiVersion: \"extend.oam.dev/v1alpha2\"\n\tkind: \"SimpleRolloutTrait\"\n\tspec: {\n\t\treplicas: rollout.replicas\n\t\tmaxUnavailable: rollout.maxUnavailable\n\t\tbatch: rollout.batch\n\t}\n}\nrollout: {\n\treplicas: *3 | int\n\tmaxUnavailable: *1 | int\n\tbatch: *2 | int\n}\n",
|
||||
"parameters": [{
|
||||
"name": "replica",
|
||||
"name": "replicas",
|
||||
"default": 3,
|
||||
"type": 4
|
||||
}, {
|
||||
@@ -50,14 +50,14 @@ services:
|
||||
- /mnt/path=sec:my-secret
|
||||
|
||||
scale:
|
||||
replica: 2
|
||||
replicas: 2
|
||||
auto: # automatic scale up and down based on given metrics
|
||||
range: "1-10"
|
||||
cpu: 80 # if cpu utilization is above 80%, scale up
|
||||
qps: 1000 # if qps is higher than 1k, scale up
|
||||
|
||||
canary: # Auto-create canary deployment. Only upgrade after verify successfully.
|
||||
replica: 1 # canary deployment size
|
||||
replicas: 1 # canary deployment size
|
||||
headers:
|
||||
- "foo:bar.*"
|
||||
```
|
||||
@@ -72,7 +72,7 @@ It will build container image, render deployment manifests in yaml, and apply th
|
||||
|
||||
### Extensible Design
|
||||
|
||||
The Appfile could be extended with more configurations by adding more capabilities to the OAM system. The config fields in Appfile are strongly correlated to the [capabilities system of OAM](https://github.com/oam-dev/kubevela/blob/master/DESIGN.md#capability-register-and-discovery) – Config fields are registered in the capabilities system and exposed via a [CUE template](https://cuelang.org/).
|
||||
The Appfile could be extended with more configurations by adding more capabilities to the OAM system. The config fields in Appfile are strongly correlated to the [capabilities system of OAM](../../docs/en/design.md#capability-oriented) – Config fields are registered in the capabilities system and exposed via a [CUE template](https://cuelang.org/).
|
||||
|
||||
Here is an example of a capability definition that platform builders register:
|
||||
|
||||
@@ -140,7 +140,7 @@ In the following, we will discuss technical details of the proposed design.
|
||||
|
||||
### Registration via Definition/Capability
|
||||
|
||||
Vela allows platform builders to extend Appfile config fields by registering them via [capabilities system of OAM](https://github.com/oam-dev/kubevela/blob/master/DESIGN.md#capability-register-and-discovery).
|
||||
Vela allows platform builders to extend Appfile config fields by registering them via [capabilities system of OAM](../../docs/en/design.md#capability-oriented).
|
||||
|
||||
The entire template should be put under `spec.extension.template` as raw string:
|
||||
|
||||
@@ -356,4 +356,4 @@ spec:
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
129
design/vela-core/apply-once-only.md
Normal file
129
design/vela-core/apply-once-only.md
Normal file
@@ -0,0 +1,129 @@
|
||||
# Apply-Once-Only: Apply workload/trait only when spec is changed
|
||||
|
||||
- Owner: Yue Wang(@captainroy-hy), Jianbo Sun(@wonderflow)
|
||||
- Date: 11/24/2020
|
||||
- Status: Implemented
|
||||
|
||||
## Intro
|
||||
When an ApplicationConfiguration is deployed,
|
||||
vela-core will create(apply) corresponding workload/trait instances and keep them stay align with the `spec` defined in ApplicationConfiguration through periodical reconciliation.
|
||||
|
||||
If we run vela-core with `--apply-once-only` flag enabled, vela-core will never apply the workload and trait instance after they are applied once. Even if they are changed by others (e.g., trait controller, workload controller,etc).
|
||||
Since the create operation is the only one apply operation occurring on workload/trait, we call this mechanism as `Apply Once Only`.
|
||||
|
||||
## A Motivational Example
|
||||
Here is a scenario from production environment to demonstrate how `Apply Once Only` works.
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
name: example-appconfig
|
||||
spec:
|
||||
components:
|
||||
- componentName: example-component
|
||||
---
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: Component
|
||||
metadata:
|
||||
name: example-component
|
||||
spec:
|
||||
workload:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
spec:
|
||||
...
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- image: sample/app:1.0
|
||||
name: sample-app
|
||||
```
|
||||
|
||||
After deploying above ApplicationConfiguration, vela-core will create a Deployment with corresponding `PodTemplateSpec`.
|
||||
|
||||
In production env, it's possible to change the Deployment according to particular requirements, e.g., RolloutTrait, AutoscalerTrait,etc.
|
||||
Currently, we just use `kubectl` to simulate workload is changed bypass changing the ApplicationConfiguration.
|
||||
Below cmd changes `spec.template.spec.containers[0].image` of the Deployment from `sample/app:1.0` to `sample/app:2.0`.
|
||||
```shell
|
||||
cat <<EOF | kubectl patch deployment example-deploy --patch
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: sample-app
|
||||
image: sample/app:2.0
|
||||
EOF
|
||||
```
|
||||
|
||||
Above change will trigger recreate of Pods owned by the Deployment.
|
||||
But vela-core will change it back to `sample/app:1.0` in the following reconciliation soon or late.
|
||||
That's not what we expect in some scenarios.
|
||||
|
||||
Instead, we hope vela-core ignore reconciling the workload we changed and leave them as what they are now until we change the `spec` of their parent ApplicationConfiguration .
|
||||
|
||||
## Goals
|
||||
|
||||
Add a startup parameter for vela-core controller to allow users choose whether to enable apply only once or not.
|
||||
|
||||
If enabled, workload/trait will be applied only one time for each resource generation (only when the corresponding appconfig/component is created or updated).
|
||||
After workload/trait created/updated and aligned to the generation of appconfig, vela-core will not apply them EXCEPT below situations:
|
||||
|
||||
- The `spec` of ApplicationConfiguration is changed (new generation created)
|
||||
- The revision of Component is changed
|
||||
|
||||
By default, the mechanism is disabled, vela-core will always reconcile and apply workload/trait periodically as usual.
|
||||
|
||||
## Implementation
|
||||
|
||||
In each round of reconciliation, vela-core compares below Labels & Annotations of existing workload/trait with newly rendered ones before applying.
|
||||
|
||||
After deploying the ApplicationConfiguration in the motivational example, the Deployment created by vela-core will have such lables and annotations.
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
deployment.kubernetes.io/revision: "1"
|
||||
app.oam.dev/generation: "1"
|
||||
generation: 1
|
||||
labels:
|
||||
app.oam.dev/component: example-component
|
||||
app.oam.dev/name: example-appconfig
|
||||
app.oam.dev/resourceType: WORKLOAD
|
||||
app.oam.dev/revision: example-component-v1
|
||||
...
|
||||
```
|
||||
|
||||
- `annotations["app.oam.dev/generation"]:"1" ` refers to the generation of AppConfig
|
||||
- `labels["app.oam.dev/revision"]:"example-component-v1" ` refers to the revision of Component
|
||||
|
||||
These crucial two are propogated from AppConfig and Component during reconciliation.
|
||||
Any change applied to the Deployment directly has no impact on these labels and annotations, e.g., change the Deployment spec just like what we do in the [motivational example](#a-motivational-example).
|
||||
If `--apply-once-only` is enabled, since no discrepancy is found on lables and annotations,
|
||||
vela-core controller will ignore applying the Deployment and leave it as what it is at that moment.
|
||||
|
||||
By contrast, changes on AppConfig (changing `spec` creates new generation) and Component (updating Component creates new revision) will change the value of these labels and annotations.
|
||||
For example, if we update the spec of AppConfig, newly rendered workload is supposed to contain such labels and annotations.
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
annotations:
|
||||
deployment.kubernetes.io/revision: "1"
|
||||
app.oam.dev/generation: "2" # generation of AppConfig changed
|
||||
generation: 1
|
||||
labels:
|
||||
app.oam.dev/component: example-component
|
||||
app.oam.dev/name: example-appconfig
|
||||
app.oam.dev/resourceType: WORKLOAD
|
||||
app.oam.dev/revision: example-component-v1
|
||||
...
|
||||
```
|
||||
Since discrepancy is found, vela-core controller will apply(update) the Deployment with newly rendered one.
|
||||
Thus, the changes we made to the Deployment before will also be eliminated.
|
||||
|
||||
The same mechanism also works for Trait as well as Workload.
|
||||
155
design/vela-core/componenttrait-composing-and-trait-CR-naming.md
Normal file
155
design/vela-core/componenttrait-composing-and-trait-CR-naming.md
Normal file
@@ -0,0 +1,155 @@
|
||||
# ComponentTrait Composing and Trait CR Naming
|
||||
|
||||
* Owner: Jianbo Sun (@wonderflow), Zhou Zheng Xi (@zzxwill)
|
||||
* Reviewers: KubeVela/Crossplane Maintainers
|
||||
* Status: Draft
|
||||
|
||||
## Background
|
||||
|
||||
Now definition name is no longer coupled with CRD name, it's align to capability name in KubeVela,
|
||||
and two TraitDefinition resources can both refer to the same CRD. So it's necessary to specify how to assemble trait CR
|
||||
in ApplicationConfiguration and to set the CR name in a friendly way.
|
||||
|
||||
## Several ways to assemble trait CR in ApplicationConfiguration
|
||||
|
||||
- If the name of TraitDefinition is the same with the referenced CRD
|
||||
|
||||
The normal way to assemble a trait CR works as below.
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
name: example-appconfig
|
||||
spec:
|
||||
components:
|
||||
- componentName: example-component
|
||||
traits:
|
||||
- trait:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ManualScalerTrait
|
||||
spec:
|
||||
replicaCount: 3
|
||||
```
|
||||
|
||||
- If the name of TraitDefinition is different to that of Trait CRD
|
||||
|
||||
The definition name `autoscale` is different to the trait name `autoscalers.standard.oam.dev`, we have two ways to compose ComponentTrait.
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: autoscale
|
||||
spec:
|
||||
definitionRef:
|
||||
name: autoscalers.standard.oam.dev
|
||||
```
|
||||
|
||||
1) Use label `trait.oam.dev/type`
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
name: example-appconfig
|
||||
spec:
|
||||
components:
|
||||
- componentName: example-component
|
||||
traits:
|
||||
- trait:
|
||||
apiVersion: standard.oam.dev/v1alpha2
|
||||
kind: Autoscalers
|
||||
metadata:
|
||||
labels:
|
||||
trait.oam.dev/type: autoscale
|
||||
spec:
|
||||
replicaCount: 3
|
||||
```
|
||||
|
||||
When rendering trait, the TraitDefinition could be retrieved by the label.
|
||||
|
||||
2) Use `name` field
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
name: example-appconfig
|
||||
spec:
|
||||
components:
|
||||
- componentName: example-component
|
||||
traits:
|
||||
- trait:
|
||||
apiVersion: standard.oam.dev/v1alpha2
|
||||
kind: Autoscalers
|
||||
name: autoscale
|
||||
spec:
|
||||
replicaCount: 3
|
||||
```
|
||||
|
||||
The mutating handler will, at the very beginning, convert `name:autoscale` to the labels above.
|
||||
|
||||
In summary, among these two ways to compose ComponentTrait, using labeling is recommended.
|
||||
|
||||
While in KubeVela, you don't need to worry about either `label` or `name`, just use command `vela TraitType` or `vela up` to attach the trait to
|
||||
a component.
|
||||
|
||||
## Set the CR name in a friendly way
|
||||
|
||||
Currently, we named all trait name in the format of `${ComponentName}-trait-${HashTag}`. This will lead to confusions
|
||||
when listing CRs of all Traits of a component.
|
||||
|
||||
In this proposal, we propose to change the naming rule to `${ComponentName}-${TraitDefinitionName}-${HashTag}`.
|
||||
|
||||
For example, if the name of TraitDefinition is `autoscale`, we name the trait CR to `example-component-autoscale-xyzfa32r`.
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
name: example-appconfig
|
||||
spec:
|
||||
components:
|
||||
- componentName: example-component
|
||||
traits:
|
||||
- trait:
|
||||
apiVersion: standard.oam.dev/v1alpha2
|
||||
kind: Autoscalers
|
||||
metadata:
|
||||
labels:
|
||||
trait.oam.dev/type: autoscale
|
||||
spec:
|
||||
replicaCount: 3
|
||||
```
|
||||
|
||||
If the name is the same as the CRD name, like `manualscalertraits.core.oam.dev`, we name it to `example-component-manualscalertraits-rq234rrw`
|
||||
by choosing the first part.
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
name: example-appconfig
|
||||
spec:
|
||||
components:
|
||||
- componentName: example-component
|
||||
traits:
|
||||
- trait:
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ManualScalerTrait
|
||||
spec:
|
||||
replicaCount: 3
|
||||
|
||||
---
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
name: manualscalertraits.core.oam.dev
|
||||
spec:
|
||||
workloadRefPath: spec.workloadRef
|
||||
definitionRef:
|
||||
name: manualscalertraits.core.oam.dev
|
||||
```
|
||||
|
||||
After OAM Kubernetes Runtime is upgraded, the old trait CR name `example-component-trait-uewf77eu` will stay unchanged for previous version compatibility.
|
||||
152
design/vela-core/migrate-from-oam-runtime.md
Normal file
152
design/vela-core/migrate-from-oam-runtime.md
Normal file
@@ -0,0 +1,152 @@
|
||||
# How to upgrade to KubeVela
|
||||
|
||||
What if I want to upgrade from [oam-kubernetes-runtime](https://github.com/crossplane/oam-kubernetes-runtime) to KubeVela? Here's a detailed guide!
|
||||
|
||||
## For users who are using OAM runtime as standalone controller
|
||||
|
||||
If you are using OAM Runtime as Standalone Controller, upgrading to KubeVela to KubeVela is very straight forward.
|
||||
|
||||
Server-side KubeVela(We call it `vela-core` for convenience) now includes following **BUILT-IN** CRDs and controllers.
|
||||
|
||||
| Type | CRD | Controller | From |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
| Control Plane Object | `applicationconfigurations.core.oam.dev` | Yes | OAM Runtime |
|
||||
| Control Plane Object | `components.core.oam.dev` | Yes | OAM Runtime |
|
||||
| Workload Type | `containerizedworklaods.core.oam.dev` | Yes | OAM Runtime |
|
||||
| Scope | `healthscope.core.oam.dev` | Yes | OAM Runtime |
|
||||
| Trait | `manualscalertraits.core.oam.dev` | Yes | OAM Runtime |
|
||||
| Control Plane Object | `scopedefinitions.core.oam.dev` | No | OAM Runtime |
|
||||
| Control Plane Object | `traitdefinitions.core.oam.dev` | No | OAM Runtime |
|
||||
| Control Plane Object | `workloaddefinitions.core.oam.dev` | No | OAM Runtime |
|
||||
| Trait | `autoscalers.standard.oam.dev` | Yes | New in KubeVela |
|
||||
| Trait | `metricstraits.standard.oam.dev` | Yes | New in KubeVela |
|
||||
| Workload Type | `podspecworkloads.standard.oam.dev` | Yes | New in KubeVela |
|
||||
| Trait | `route.standard.oam.dev` | Yes | New in KubeVela |
|
||||
|
||||
CRDs and Controllers in the table from 'OAM Runtime' are exactly the same to those in `oam-kubernetes-runtime`.
|
||||
So in KubeVela we have added 4 more new CRDs with controller.
|
||||
|
||||
### Option 1: I only want to have OAM control plane objects only, no additional traits and workload types.
|
||||
|
||||
1. Find you deployment
|
||||
|
||||
```shell script
|
||||
$ kubectl -n oam-system get deployment -l app.kubernetes.io/name=oam-kubernetes-runtime
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
oam-kubernetes-runtime-oam 1/1 1 1 62s
|
||||
```
|
||||
|
||||
2. Update the deployment
|
||||
|
||||
In this case, the deployment name of OAM runtime is `oam-kubernetes-runtime-oam`, let's edit it to update the image:
|
||||
|
||||
```shell script
|
||||
$ kubectl -n oam-system edit deployment oam-kubernetes-runtime-oam
|
||||
```
|
||||
|
||||
There are two changes:
|
||||
|
||||
- update the image from `crossplane/oam-kubernetes-runtime:latest` to `oamdev/vela-core:latest`
|
||||
- add an args `- "--disable-caps=all"`, which will disable all additional workloads and traits built in vela-core described in the following table.
|
||||
|
||||
| Type | Current KubeVela Additional CRD |
|
||||
| ---- | ---- |
|
||||
| Trait | `autoscalers.standard.oam.dev` |
|
||||
| Trait | `metricstraits.standard.oam.dev` |
|
||||
| Workload | `podspecworkloads.standard.oam.dev` |
|
||||
| Trait | `route.standard.oam.dev` |
|
||||
|
||||
```yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: oam-kubernetes-runtime-oam
|
||||
...
|
||||
containers:
|
||||
- name: oam
|
||||
args:
|
||||
- "--metrics-addr=:8080"
|
||||
- "--enable-leader-election"
|
||||
+ - "--disable-caps=all"
|
||||
- image: crossplane/oam-kubernetes-runtime:latest
|
||||
+ image: oamdev/vela-core:latest
|
||||
imagePullPolicy: "Always"
|
||||
...
|
||||
```
|
||||
|
||||
### Option 2: I want full featured KubeVela, including its built-in workload types and traits.
|
||||
|
||||
1. Install Additional CRDs
|
||||
|
||||
```shell script
|
||||
$ kubectl apply -f charts/vela-core/crds
|
||||
```
|
||||
|
||||
2. Install Definition files
|
||||
|
||||
```shell script
|
||||
$ kubectl apply -f charts/vela-core/templates/defwithtemplate
|
||||
```
|
||||
|
||||
3. Create namespace, vela-core use `vela-system` as default
|
||||
|
||||
```shell script
|
||||
$ kubectl create ns vela-system
|
||||
```
|
||||
|
||||
4. Install Cert Manager
|
||||
|
||||
```shell script
|
||||
$ kubectl apply -f charts/vela-core/templates/cert-manager.yaml
|
||||
```
|
||||
|
||||
5. Install Vela Dependency ConfigMap
|
||||
|
||||
```shell script
|
||||
$ kubectl apply -f charts/vela-core/templates/velaConfig.yaml
|
||||
```
|
||||
|
||||
6. Delete your old oam-runtime deployment
|
||||
|
||||
Find the running deployment.
|
||||
|
||||
```shell script
|
||||
$ kubectl -n oam-system get deployment -l app.kubernetes.io/name=oam-kubernetes-runtime
|
||||
NAME READY UP-TO-DATE AVAILABLE AGE
|
||||
oam-kubernetes-runtime-oam 1/1 1 1 62s
|
||||
```
|
||||
|
||||
Delete the deployment found.
|
||||
|
||||
```shell script
|
||||
$ kubectl -n oam-system delete deployment oam-kubernetes-runtime-oam
|
||||
```
|
||||
|
||||
7. Install Certificate and Webhook for the new controller
|
||||
|
||||
```shell script
|
||||
$ helm template --release-name kubevela -n vela-system -s templates/webhook.yaml charts/vela-core/ | kubectl apply -f -
|
||||
```
|
||||
|
||||
8. Install the new controller
|
||||
|
||||
```shell script
|
||||
$ helm template --release-name kubevela -n vela-system -s templates/kubevela-controller.yaml charts/vela-core/ | kubectl apply -f -
|
||||
```
|
||||
|
||||
> TIPS: If you want to disable webhook, change 'useWebhook' to be 'false' in `charts/vela-core/values.yaml`
|
||||
|
||||
Then you have successfully migrate from oam-kubernetes-runtime to KubeVela.
|
||||
|
||||
## For users who are importing OAM runtime as library
|
||||
|
||||
If you are importing `oam-kubernetes-runtime` as library, you can update your import headers.
|
||||
|
||||
Files are refactored as below:
|
||||
|
||||
| OLD | NEW | Usage |
|
||||
| ---- | ---- | ---- |
|
||||
| `github.com/crossplane/oam-kubernetes-runtime/apis/core` | `github.com/oam-dev/kubevela/apis/core.oam.dev` | API Spec Code |
|
||||
| `github.com/crossplane/oam-kubernetes-runtime/pkg/controller` | `github.com/oam-dev/kubevela/pkg/controller/core.oam.dev` | OAM Controller Code |
|
||||
| `github.com/crossplane/oam-kubernetes-runtime/pkg/oam` | `github.com/oam-dev/kubevela/pkg/oam` | OAM Common Lib Code |
|
||||
| `github.com/crossplane/oam-kubernetes-runtime/pkg/webhook` | `github.com/oam-dev/kubevela/pkg/webhook/core.oam.dev` | OAM Webhook Code |
|
||||
27
design/vela-core/rollout.md
Normal file
27
design/vela-core/rollout.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# Rollout
|
||||
|
||||
## Conflicts With
|
||||
|
||||
### `Autoscale`
|
||||
|
||||
When `Rollout` and `Autoscle` traits are attached to the same service, they two will fight over the number of instances during rollout. Thus, it's by design that `Rollout` will take over replicas control (specified by `.replicas` field) during rollout.
|
||||
|
||||
> Note: in up coming releases, KubeVela will introduce a separate section in Appfile to define release phase configurations such as `Rollout`.
|
||||
|
||||
## How `Rollout` works?
|
||||
|
||||
`Rollout` trait implements progressive release process to rollout your app following [Canary strategy](https://martinfowler.com/bliki/CanaryRelease.html).
|
||||
|
||||
In detail, `Rollout` controller will create a canary of your app , and then gradually shift traffic to the canary while measuring key performance indicators like HTTP requests success rate at the same time.
|
||||
|
||||
|
||||

|
||||
|
||||
In this sample, for every `10s`, `5%` traffic will be shifted to canary from the primary, until the traffic on canary reached `50%`. At the mean time, the instance number of canary will automatically scale to `replicas: 2` per configured in Appfile.
|
||||
|
||||
|
||||
Based on analysis result of the KPIs during this traffic shifting, a canary will be promoted or aborted if analysis is failed. If promoting, the primary will be upgraded from v1 to v2, and traffic will be fully shifted back to the primary instances. So as result, canary instances will be deleted after the promotion finished.
|
||||
|
||||

|
||||
|
||||
> Note: KubeVela's `Rollout` trait is implemented with [Weaveworks Flagger](https://flagger.app/) operator.
|
||||
@@ -94,9 +94,34 @@ It's required and will be used to generate mTLS secrets.
|
||||
Route Trait designed to be compatible with different ingress controller implementations, the `provider` field will allow
|
||||
you to give a specified ingress controller type. Currently, only nginx-ingress is supported.
|
||||
|
||||
The `tls` field allow you to specify a TLS for this route with an IssuerName, the IssuerName pointing to an Issuer Object
|
||||
The `tls` field allow you to specify a TLS for this route with an IssuerName, the IssuerName pointing to an [Issuer Object](https://cert-manager.io/docs/concepts/issuer/)
|
||||
created by cert-manager. Cert-manager and ingress controller will handle certificate creation and binding.
|
||||
If not specified, mTLS was disabled and you can only visit by http.
|
||||
|
||||
Currently, vela-cli will create an Issuer Object automatically by using the email defined in `vela init` workflow.
|
||||
|
||||
```yaml
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Issuer
|
||||
metadata:
|
||||
name: oam-env-<env.name>
|
||||
namespace: <env.namespace>
|
||||
spec:
|
||||
acme:
|
||||
# Email address used for ACME registration
|
||||
email: <env.email>
|
||||
# The ACME server URL
|
||||
server: https://acme-v02.api.letsencrypt.org/directory
|
||||
# Name of a secret used to store the ACME account private key, the key will be automatically created by cert-manager
|
||||
privateKeySecretRef:
|
||||
name: oam-env-<env.name>.key
|
||||
# Enable the HTTP-01 challenge provider, there are many other solvers besides http01.
|
||||
solvers:
|
||||
- http01:
|
||||
ingress:
|
||||
class: nginx
|
||||
```
|
||||
|
||||
If `tls` field in route trait not specified, mTLS will be disabled by default. You can also manually configure ingress later.
|
||||
|
||||
If no rule specified, route trait will create one rule automatically and match with the port.
|
||||
|
||||
0
docs/.nojekyll
Normal file
0
docs/.nojekyll
Normal file
1
docs/CNAME
Normal file
1
docs/CNAME
Normal file
@@ -0,0 +1 @@
|
||||
kubevela.io
|
||||
@@ -1,34 +1,31 @@
|
||||
# KubeVela Documentation
|
||||
# KubeVela Website
|
||||
[kubevela.io](https://kubevela.io)
|
||||
|
||||
Learn and use KubeVela with tutorials and user stories.
|
||||
## Contributing
|
||||
|
||||
**Overview**
|
||||
- [Introduction](introduction.md)
|
||||
- [Installation](./install.md)
|
||||
- [Quick Start](quick-start.md)
|
||||
- [Concepts](concepts.md)
|
||||
- Fork and clone
|
||||
|
||||
**For Developers**
|
||||
- [Setting Up Deployment Environment](developers/config-enviroments.md)
|
||||
- [Initializing Application](developers/app-init.md)
|
||||
- [Setting Routes](developers/set-route.md)
|
||||
- [Setting Auto-scaling Policy](developers/set-autoscale.md)
|
||||
- [Setting Rollout Strategy](developers/set-rollout.md)
|
||||
- [Monitoring Application](developers/set-metrics.md)
|
||||
- [Using Appfile](developers/devex/appfile.md)
|
||||
- [Check Application Logs](developers/check-logs.md)
|
||||
- [Execute Commands in Container](developers/exec-cmd.md)
|
||||
- [Port Forward to Container](developers/port-forward.md)
|
||||
- [Configuring data/env in Application](developers/config-app.md)
|
||||
- [Consuming Cloud Services](developers/cloud-service.md)
|
||||
- [Managing Capabilities](developers/cap-center.md)
|
||||
- [Capability References](developers/references/README.md)
|
||||
```
|
||||
$ git clone git@github.com:oam-dev/kubevela.git
|
||||
$ cd kubevela/docs
|
||||
```
|
||||
|
||||
**For Platform Engineers**
|
||||
- [Extending KubeVela](platform-engineers/extending-kubevela.md)
|
||||
- Install docsify-cli
|
||||
```
|
||||
$ npm i docsify-cli -g
|
||||
```
|
||||
|
||||
**Internals**
|
||||
- [Design and Architecture](design.md)
|
||||
- Make your changes
|
||||
|
||||
**Roadmap**
|
||||
- [Roadmap of KubeVela](roadmap.md)
|
||||
- Local preview
|
||||
```
|
||||
$ docsify serve
|
||||
Serving /xxx/kubevela.io now.
|
||||
Listening at http://localhost:3000
|
||||
```
|
||||
|
||||
Preview your changes at [http://127.0.0.1:3000/](http://127.0.0.1:3000/).
|
||||
|
||||
- Push your commit
|
||||
|
||||
Thanks for your contribution!
|
||||
|
||||
9
docs/_coverpage.md
Normal file
9
docs/_coverpage.md
Normal file
@@ -0,0 +1,9 @@
|
||||
<p align="center">
|
||||
<img src="static/logo.svg" alt="kubevela logo" width=300 height=300 />
|
||||
</p>
|
||||
|
||||
> Make shipping applications more enjoyable.
|
||||
|
||||
|
||||
[GitHub](https://github.com/oam-dev/kubevela)
|
||||
[Get Started](en/quick-start)
|
||||
6
docs/_navbar.md
Normal file
6
docs/_navbar.md
Normal file
@@ -0,0 +1,6 @@
|
||||
- [Home](/)
|
||||
- [Docs](/en/quick-start)
|
||||
- [Blog](/blog/en/)
|
||||
<!-- - Language
|
||||
- [中文](/zh-cn/)
|
||||
- [English](/en/) -->
|
||||
6
docs/blog/_navbar.md
Normal file
6
docs/blog/_navbar.md
Normal file
@@ -0,0 +1,6 @@
|
||||
- [Home](/)
|
||||
- [Docs](/en/quick-start)
|
||||
- [Blog](/blog/en/)
|
||||
- Language
|
||||
- [中文](/blog/zh/)
|
||||
- [English](/blog/en/)
|
||||
4
docs/blog/en/README.md
Normal file
4
docs/blog/en/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Blog
|
||||
|
||||
|
||||
- [KubeVela: The Extensible App Platform Based on Open Application Model and Kubernetes](/blog/en/kubevela-the-extensible-app-platform-based-on-open-application-model-and-kubernetes.md)
|
||||
2
docs/blog/en/_sidebar.md
Normal file
2
docs/blog/en/_sidebar.md
Normal file
@@ -0,0 +1,2 @@
|
||||
- Blog
|
||||
- [KubeVela: The Extensible App Platform Based on Open Application Model and Kubernetes](/blog/en/kubevela-the-extensible-app-platform-based-on-open-application-model-and-kubernetes.md)
|
||||
@@ -0,0 +1,138 @@
|
||||
# KubeVela: The Extensible App Platform Based on Open Application Model and Kubernetes
|
||||
|
||||
>7 Dec 2020 12:33pm, by Lei Zhang and Fei Guo
|
||||
|
||||

|
||||
|
||||
Last month at KubeCon+CloudNativeCon 2020, the [Open Application Model (OAM)](https://github.com/oam-dev/spec) community launched [KubeVela](https://github.com/oam-dev/kubevela/), an easy-to-use yet highly extensible application platform based on OAM and Kubernetes.
|
||||
|
||||
For developers, KubeVela is an easy-to-use tool that enables you to describe and ship applications to Kubernetes with minimal effort, yet for platform builders, KubeVela serves as a framework that empowers them to create developer-facing yet fully extensible platforms at ease.
|
||||
|
||||
The trend of cloud native technology is moving towards pursuing consistent application delivery across clouds and on-premises infrastructures using Kubernetes as the common abstraction layer. Kubernetes, although excellent in abstracting low-level infrastructure details, does introduce extra complexity to application developers, namely understanding the concepts of pods, port exposing, privilege escalation, resource claims, CRD, and so on. We’ve seen the nontrivial learning curve and the lack of developer-facing abstraction have impacted user experiences, slowed down productivity, led to unexpected errors or misconfigurations in production.
|
||||
|
||||
Abstracting Kubernetes to serve developers’ requirements is a highly opinionated process, and the resultant abstractions would only make sense had the decision-makers been the platform builders. Unfortunately, the platform builders today face the following dilemma: There is no tool or framework for them to easily extend the abstractions if any.
|
||||
|
||||
Thus, many platforms today introduce restricted abstractions and add-on mechanisms despite the extensibility of Kubernetes. This makes easily extending such platforms for developers’ requirements or to wider scenarios almost impossible.
|
||||
|
||||
In the end, developers complain those platforms are too rigid and slow in response to feature requests or improvements. The platform builders 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.
|
||||
|
||||
## Introducing KubeVela
|
||||
|
||||
With KubeVela, we aim to solve these two challenges in an approach that separates concerns of developers and platform builders.
|
||||
|
||||
For developers, KubeVela is an easy-to-use yet extensible tool that enables you to describe and deploy microservices applications with minimal effort. And instead of managing a handful of Kubernetes YAML files, a simple docker-compose style `appfile` is all you need.
|
||||
|
||||
### A Sample Appfile
|
||||
|
||||
In this example, we will create a vela.yaml along with your app. This file describes how to build the image, how to deploy the image to Kubernetes, how to access the application and how the system would scale it automatically.
|
||||
|
||||
```yaml
|
||||
name: testapp
|
||||
|
||||
services:
|
||||
express-server:
|
||||
image: oamdev/testapp:v1
|
||||
build:
|
||||
docker:
|
||||
file: Dockerfile
|
||||
contrxt: .
|
||||
cmd: ["node", "server.js"]
|
||||
port: 8080
|
||||
cpu: "0.01"
|
||||
|
||||
route:
|
||||
domain: example.com
|
||||
rules:
|
||||
- path: /testapp
|
||||
rewriteTarget: /
|
||||
|
||||
autoscale:
|
||||
min: 1
|
||||
max: 4
|
||||
cpuPercent: 5
|
||||
```
|
||||
|
||||
Just do: `$ vela up`, your app will then be alive on https://example.com/testapp.
|
||||
|
||||
### Behind the Appfile
|
||||
|
||||
The `appfile` in KubeVela does not have a fixed schema specification, instead, what you can define in this file is determined by what kind of workload types and traits are available in your platform. These two concepts are core concepts from OAM, in detail:
|
||||
|
||||
- [Workload type](https://kubevela.io/%23/en/concepts?id=workload-type-amp-trait), which declares the characteristics that runtime infrastructure should take into account in application deployment. In the sample above, it defines a “Web Service” workload named `express-server` as part of your application.
|
||||
- [Trait](https://kubevela.io/%23/en/concepts?id=workload-type-amp-trait), which represents the operation configurations that are attached to an instance of workload type. Traits augment a workload type instance with operational features. In the sample above, it defines a route trait to access the application and an autoscale trait for the CPU based horizontal automatic scaling policy.
|
||||
|
||||
Whenever a new workload type or trait is added, it would become immediately available to be declared in the `appfile`. Let’s say, a new trait named metrics is added, developers could check the schema of this trait by simply `$ vela show metrics` and define it in the previous sample `appfile`:
|
||||
|
||||
```yaml
|
||||
name: testapp
|
||||
|
||||
services:
|
||||
express-server:
|
||||
type: webservice
|
||||
image: oamdev/testapp:v1
|
||||
build:
|
||||
docker:
|
||||
file: Dockerfile
|
||||
contrxt: .
|
||||
cmd: ["node", "server.js"]
|
||||
port: 8080
|
||||
cpu: "0.01"
|
||||
|
||||
route:
|
||||
domain: example.com
|
||||
rules:
|
||||
- path: /testapp
|
||||
rewriteTarget: /
|
||||
|
||||
autoscale:
|
||||
min: 1
|
||||
max: 4
|
||||
cpuPercent: 5
|
||||
|
||||
metrices:
|
||||
port: 8080
|
||||
path: "/metrics"
|
||||
scheme: "http"
|
||||
enabled: true
|
||||
```
|
||||
|
||||
## Vela Up
|
||||
|
||||
The `vela up` command deploys the application defined in `appfile` to Kubernetes. After deployment, you can use `vela status` to check how to access your application following the `route` trait declared in `appfile`.
|
||||
|
||||

|
||||
|
||||
Apps deployed with KubeVela will receive a URL (and versioned pre-release URLs) with valid TLS certificate automatically generated via [cert-manager](https://cert-manager.io/docs/). KubeVela also provides a set of commands (i.e. `vela logs, vela exec`) to best support your application management without becoming a Kubernetes expert. [Learn more about vela up and appfile](https://kubevela.io/%23/en/developers/learn-appfile).
|
||||
|
||||
## KubeVela for Platform Builders
|
||||
|
||||
The above experience cannot be achieved without KubeVela’s innovative offerings to the platform builders as an extensible platform engine. These features are the hidden gems that make KubeVela unique. In details, KubeVela relieves the pains of building developer facing platforms on Kubernetes by doing the following:
|
||||
|
||||
- **Application Centric**. Behind the appfile, KubeVela enforces “application” as its main API and all KubeVela’s capabilities serve the applications’ requirements only. This is how KubeVela brings application-centric context to the platform by default and changes building such platforms into working around application architecture.
|
||||
- **Extending Natively**. As mentioned in the developer section, an application described by appfile is composed of various pluggable workload types and operation features (i.e. traits). Capabilities from Kubernetes ecosystem can be added to KubeVela as new workload types or traits through Kubernetes CRD registry mechanism at any time.
|
||||
- **Simple yet Extensible User Interface**. Behind the `appfile`, KubeVela uses [CUELang](https://github.com/cuelang/cue) as the “last mile” abstraction engine between user-facing schema and the control plane objects. KubeVela provides a set of built-in abstractions to start with and the platform builders are free to modify them at any time. Capability adding/updating or abstraction changes will all take effect at runtime, neither recompilation nor redeployment of KubeVela is required.
|
||||
|
||||
Under the hood, KubeVela core is built on top of Crossplane OAM Kubernetes Runtime with KEDA, Flagger, Prometheus, etc as dependencies, yet its feature pool is “unlimited” and can be extended at any time.
|
||||
|
||||

|
||||
|
||||
With KubeVela, platform builders now have the tooling support to design and ship any new capabilities with abstractions to end-users with high confidence and low turnaround time. And for a developer, you only need to learn these abstractions, describe the app with them in a single file, and then ship it.
|
||||
|
||||
## Not Another PaaS System
|
||||
|
||||
Most typical Platform-as-a-Service (PaaS) systems also provide full application management capabilities and aim to improve developer experience and efficiency. In this context, KubeVela shares the same goal.
|
||||
|
||||
Though unlike most typical PaaS systems which are either inextensible or create their own addon systems maintained by their own communities. KubeVela is designed to fully leverage the Kubernetes ecosystems as its capability pool. Hence, there’s no additional addon system introduced in this project. For platform builders, a new capability can be installed in KubeVela at any time by simply registering its API resource to OAM and providing a CUE template. We hope and expect that with the help of the open source community, the number of the KubeVela’s capabilities will grow dramatically over time. [Learn more about using community capabilities by $vela cap](https://kubevela.io/%23/en/developers/cap-center).
|
||||
|
||||
So in a nutshell, KubeVela is a Kubernetes plugin for building application-centric abstractions. It leverages the native Kubernetes extensibility and capabilities to resolve a hard problem – making application management enjoyable on Kubernetes.
|
||||
|
||||
## Learn More
|
||||
|
||||
KubeVela is incubated by the OAM community as the successor of [Rudr](https://github.com/oam-dev/rudr) project, while rather than being a reference implementation, KubeVela intends to be an end-to-end implementation that could be used in wider scenarios. The design of KubeVela’s appfile is also part of the experimental attempt in OAM specification to bring a simplified user experience to developers.
|
||||
|
||||
To learn more about KubeVela, please visit KubeVela’s [documentation site](https://kubevela.io/). The following content are also good next steps:
|
||||
|
||||
- Try out KubeVela following the [step-by-step tutorial](https://kubevela.io/%23/en/quick-start) in its Quick Start page.
|
||||
- Give us feedback! KubeVela is still in its early stage and we are happy to ask the community for feedback via OAM [Gitter](https://gitter.im/oam-dev/community) or [Slack channel](https://cloud-native.slack.com/archives/C01BLQ3HTJA).
|
||||
- [Extend KubeVela](https://kubevela.io/%23/en/platform-engineers/trait) to build your own platforms. If you have an idea for a new workload type, trait or try to build something more complex like a database or AI PaaS with KubeVela, post your idea as a GitHub Issue or propose it to the OAM community, we are eager to know.
|
||||
- [Contribute to KubeVela](https://github.com/oam-dev/kubevela/blob/master/CONTRIBUTING.md). KubeVela is initialized by the open source community with [bootstrap contributors](https://github.com/oam-dev/kubevela/blob/bbb2c527d96d3e1a0694e2f49b3d1d1168e72c53/OWNERS_ALIASES%23L35) from 8+ different organizations. We intend to donate this project to a neutral foundation as soon as it gets stable.
|
||||
4
docs/blog/zh/README.md
Normal file
4
docs/blog/zh/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# 博客
|
||||
|
||||
|
||||
- [KubeVela 正式开源:一个高可扩展的云原生应用平台与核心引擎](/blog/zh/kubevela-the-extensible-app-platform-based-on-open-application-model-and-kubernetes.md)
|
||||
2
docs/blog/zh/_sidebar.md
Normal file
2
docs/blog/zh/_sidebar.md
Normal file
@@ -0,0 +1,2 @@
|
||||
- 博客
|
||||
- [KubeVela 正式开源:一个高可扩展的云原生应用平台与核心引擎](/blog/zh/kubevela-the-extensible-app-platform-based-on-open-application-model-and-kubernetes.md)
|
||||
@@ -0,0 +1,180 @@
|
||||
# KubeVela 正式开源:一个高可扩展的云原生应用平台与核心引擎
|
||||
|
||||
>2020年12月7日 12:33, by Lei Zhang and Fei Guo
|
||||
|
||||

|
||||
|
||||
美国西部时间 2020 年 11 月 18 日,在云原生技术“最高盛宴”的 KubeCon 北美峰会 2020 上,CNCF 应用交付领域小组(CNCF SIG App Delivery) 与 Open Application Model (OAM) 社区,以及来自阿里云、微软云的 OAM 项目维护者们在演讲中共同宣布了 KubeVela 开源项目的正式发布。
|
||||
|
||||
从 11 月 18 号到 20 号,在为期三天的 KubeCon 北美峰会上有连续 3 场技术演讲,会从不同维度介绍关于 KubeVela 项目的具体细节,其中还包括一个长达 1 个半小时的 KubeVela 互动教学环节。多个重量级组织以如此规模和密度在 KubeCon 北美峰会演讲中介绍一个首次发布的社区开源项目,在 KubeCon 诞生以来并不多见。
|
||||
|
||||
KubeVela Github 地址:[https://github.com/oam-dev/kubevela/](https://github.com/oam-dev/kubevela/)
|
||||
|
||||
## 什么是 KubeVela ?
|
||||
|
||||
一言以蔽之,**KubeVela 是一个简单易用且高度可扩展的应用管理平台与核心引擎**。KubeVela 是基于 Kubernetes 与 OAM 技术构建的。
|
||||
|
||||
详细的说,对于应用开发人员来讲,KubeVela 是一个非常低心智负担的云原生应用管理平台,核心功能是让开发人员方便快捷地在 Kubernetes 上定义与交付现代微服务应用,无需了解任何 Kubernetes 本身相关的细节。在这一点上,KubeVela 可以被认为是**云原生社区的 Heroku**。
|
||||
|
||||
另一方面,对于平台团队来讲,KubeVela 是一个强大并且高可扩展的云原生应用平台核心引擎。基于这样一个引擎,平台团队可以快速、高效地以 Kubernetes 原生的方式在 KubeVela 中植入任何来自云原生社区的应用管理能力,从而基于 KubeVela 打造出自己需要的云原生平台,比如:云原生数据库 PaaS、云原生 AI 平台、甚至 Serverless 服务。在这一点上,KubeVela 可以被认为是**一个“以应用为中心”的 Kubernetes 发行版**,以 OAM 为核心,让平台团队可以基于 KubeVela 快速打造出属于自己的 PaaS、Serverless 乃至任何面向用户的云原生平台项目。
|
||||
|
||||
## KubeVela 解决了什么问题?
|
||||
|
||||
现如今,云原生技术的迅猛发展可能让很多人都感觉到眼花缭乱,但实际上,这个生态的总体发展趋势和主旋律,是通过 Kubernetes 搭建了一个统一的基础设施抽象层,为平台团队屏蔽掉了“计算”、“网络”、“存储”等过去我们不得不关注的基础设施概念,使得我们能够基于 Kubernetes 方便地构建出任何我们想要的垂直业务系统而无需关心任何基础设施层的细节。这正是 Kubernetes 被称为云计算界的 Linux 以及 “Platform for Platforms” 的根本原因。
|
||||
|
||||
但是,当我们把视角从平台团队提升到垂直业务系统的最终用户(如:应用开发人员)的时候,我们会发现 Kubernetes 这样的定位和设计在解决了平台团队的大问题之后,却也为应用开发者们带来了挑战和困扰。比如,太多的用户都在抱怨 Kubernetes “太复杂了”。究其原因,其实在于 Kubernetes 中的核心概念与体系,如:Pod、sidecar、Service、资源管理、调度算法和 CRD 等等,主要是面向平台团队而非最终用户设计的。缺乏面向用户的设计不仅带来了陡峭的学习曲线,影响了用户的使用体验,拖慢了研发效能,甚至在很多情况下还会引发错误操作乃至生产故障(毕竟不可能每个业务开发人员都是 Kubernetes 专家)。
|
||||
|
||||
这也是为什么在云原生生态中,几乎每一个平台团队都会基于 Kubernetes 构建一个上层平台给用户使用。最简单的也会给 Kubernetes 做一个图形界面,稍微正式一些的则往往会基于 Kubernetes 开发一个类 PaaS 平台来满足自己的需求。理论上讲,在 Kubernetes 生态中各种能力已经非常丰富的今天,开发一个类 PaaS 平台应该是比较容易的。
|
||||
|
||||
然而现实却往往不尽如人意。在大量的社区访谈当中,我们发现在云原生技术极大普及的今天,基于 Kubernetes 构建一个功能完善、用户友好的上层应用平台,依然是中大型公司们的“专利”。这里的原因在于:
|
||||
|
||||
> Kubernetes 生态本身的能力池固然丰富,但是社区里却并没有一个可扩展的、方便快捷的方式,能够帮助平台团队把这些能力快速“组装”成面向最终用户的功能(Feature)。
|
||||
|
||||
这种困境带来的结果,就是尽管大家今天都在基于 Kubernetes 在构建上层应用平台,但这些平台本质上却并不能够与 Kubernetes 生态完全打通,而都变成一个又一个的垂直“烟囱”。
|
||||
|
||||
在开源社区中,这个问题会更加明显。在今天的 Kubernetes 社区中,不乏各种“面向用户”、“面向应用”的 Kubernetes 上层系统。但正如前文所述,这些平台都无一例外的引入了自己的专属上层抽象、用户界面和插件机制。这里最典型的例子包括经典 PaaS 项目比如 Cloud Foundry,也包括各种 Serverless 平台。作为一个公司的平台团队,我们实际上只有两个选择:要么把自己局限在某种垂直的场景中来适配和采纳某个开源上层平台项目;要么就只能自研一个符合自己诉求的上层平台并且造无数个社区中已经存在的“轮子”。
|
||||
|
||||
那么,有没有”第三种选择”能够让平台团队在不造轮子、完全打通 Kubernetes 生态的前提下,轻松的构建面向用户的上层平台呢?
|
||||
|
||||
## KubeVela 如何解决上述问题?
|
||||
|
||||
KubeVela 项目的创立初衷,就是以一个统一的方式同时解决上述最终用户与平台团队所面临的困境。这也是为何在设计中,KubeVela 对最终用户和平台团队这两种群体进行了单独的画像,以满足他们不同的诉求。
|
||||
|
||||
由于 KubeVela 默认的功能集与“Heroku”类似(即:主要面向应用开发人员),所以在下文中,我们会以应用开发人员或者开发者来代替最终用户。但我们很快也会讲到,KubeVela 里的每一个功能,都是一个插件,作为平台团队,你可以轻松地“卸载”它的所有内置能力、然后“安装”自己需要的任何社区能力,让 KubeVela 变成一个完全不一样的系统。
|
||||
|
||||
### 1. 应用开发者眼中的 KubeVela
|
||||
|
||||
前面已经提到,对于开发者来说,KubeVela 是一个简单、易用、又高可扩展的云原生应用管理工具,它可以让开发者以极低的心智负担和上手成本在 Kubernetes 上定义与部署应用。而关于整个系统的使用,开发者只需要编写一个 docker-compose 风格应用描述文件 Appfile 即可,不需要接触和学习任何 Kubernetes 层的相关细节。
|
||||
|
||||
#### 1)一个 Appfile 示例
|
||||
|
||||
在下述例子中,我们会将一个叫做 vela.yaml 的 Appfile 放在你的应用代码目录中(比如应用的 GitHub Repo)。这个 Appfile 定义了如何将这个应用编译成 Docker 镜像,如何将镜像部署到 Kubernetes,如何配置外界访问应用的路由和域名,又如何让 Kubernetes 自动根据 CPU 使用量来水平扩展这个应用。
|
||||
|
||||
```yaml
|
||||
name: testapp
|
||||
|
||||
services:
|
||||
express-server:
|
||||
image: oamdev/testapp:v1
|
||||
build:
|
||||
docker:
|
||||
file: Dockerfile
|
||||
contrxt: .
|
||||
cmd: ["node", "server.js"]
|
||||
port: 8080
|
||||
cpu: "0.01"
|
||||
|
||||
route:
|
||||
domain: example.com
|
||||
rules:
|
||||
- path: /testapp
|
||||
rewriteTarget: /
|
||||
|
||||
autoscale:
|
||||
min: 1
|
||||
max: 4
|
||||
cpuPercent: 5
|
||||
```
|
||||
|
||||
只要有了这个 20 行的配置文件,你接下来唯一需要的事情就是 $ vela up,这个应用就会被部署到 Kubernetes 中然后被外界以 https://example.com/testapp 的方式访问到。
|
||||
|
||||
#### 2)Appfile 是如何工作的?
|
||||
|
||||
在 KubeVela 的 Appfile 背后,有着非常精妙的设计。首先需要指出的就是,**这个 Appfile 是没有固定的 Schema 的**。
|
||||
|
||||
什么意思呢?这个 Appfile 里面你能够填写的每一个字段,都是直接取决于当前平台中有哪些工作负载类型(Workload Types)和应用特征(Traits)是可用的。而熟悉 OAM 的同学都知道,这两个概念,正是 OAM 规范的核心内容,其中:
|
||||
|
||||
- [工作负载类型(Workload Type)](https://kubevela.io/#/en/concepts?id=workload-type-amp-trait),定义的是底层基础设施如何运行这个应用。在上面的例子中,我们声明:名叫 testapp 的应用会启动一个类型为“在线 Web 服务(Web Service)” 的工作负载,其实例的名字是 express-server。
|
||||
|
||||
- [应用特征(Traits)](https://kubevela.io/#/en/concepts?id=workload-type-amp-trait),则为工作负载实例加上了运维时配置。在上面的例子中,我们定义了一个 Route Trait 来描述应用如何被从外界访问,以及一个 Autoscale Trait 来描述应用如何根据 CPU 使用量进行自动的水平扩容。
|
||||
|
||||
而正是基于这种模块化的设计,这个 Appfile 本身是高度可扩展的。当任何一个新的 Workload Type 或者 Trait 被安装到平台后,用户就可以立刻在 Appfile 里声明使用这个新增的能力。举个例子,比如后面平台团队新开发了一个用来配置应用监控属性的运维侧能力,叫做 Metrics。那么只需要举手之捞,应用开发者就可以立刻使用 $ vela show metrics 命令查看这个新增能力的详情,并且在 Appfile 中使用它,如下所示:
|
||||
|
||||
```yaml
|
||||
name: testapp
|
||||
|
||||
services:
|
||||
express-server:
|
||||
type: webservice
|
||||
image: oamdev/testapp:v1
|
||||
build:
|
||||
docker:
|
||||
file: Dockerfile
|
||||
contrxt: .
|
||||
cmd: ["node", "server.js"]
|
||||
port: 8080
|
||||
cpu: "0.01"
|
||||
|
||||
route:
|
||||
domain: example.com
|
||||
rules:
|
||||
- path: /testapp
|
||||
rewriteTarget: /
|
||||
|
||||
autoscale:
|
||||
min: 1
|
||||
max: 4
|
||||
cpuPercent: 5
|
||||
|
||||
metrices:
|
||||
port: 8080
|
||||
path: "/metrics"
|
||||
scheme: "http"
|
||||
enabled: true
|
||||
```
|
||||
|
||||
这种简单友好、又高度敏捷的使用体验,正是 KubeVela 在最终用户侧提供的主要体感。
|
||||
|
||||
#### 3)Vela Up 命令
|
||||
|
||||
前面提到,一旦 Appfile 准备好,开发者只需要一句 vela up 命令就可以把整个应用连同它的运维特征部署到 Kubernetes 中。部署成功后,你可以使用 vela status 来查看整个应用的详情,包括如何访问这个应用。
|
||||
|
||||

|
||||
|
||||
通过 KubeVela 部署的应用会被自动设置好访问 URL(以及不同版本对应的不同 URL),并且会由 cert-manager 生成好证书。与此同时,KubeVela 还提供了一系列辅助命令(比如:vela logs 和 vela exec)来帮助你在无需成为 Kubernetes 专家的情况下更好地管理和调试你的应用。如果你对上述由 KubeVela 带来的开发者体验感兴趣的话,欢迎前往 KubeVela 项目的用户使用文档来了解更多。
|
||||
|
||||
而接下来,我们要切换一下视角,感受一下平台团队眼中的 KubeVela 又是什么样子的。
|
||||
|
||||
### 2. 平台工程师眼中的 KubeVela
|
||||
|
||||
实际上,前面介绍到的所有开发者侧体验,都离不开 KubeVela 在平台侧进行的各种创新性设计与实现。也正是这些设计的存在,才使得 KubeVela 不是一个简单的 PaaS 或者 Serverless,**而是一个可以由平台工程师扩展成任意垂直系统的云原生平台内核**。
|
||||
|
||||
具体来说,KubeVela 为平台工程师提供了三大核心能力,使得基于 Kubernetes 构建上述面向用户的云原生平台从“阳春白雪”变成了“小菜一碟”:
|
||||
|
||||
**第一:以应用为中心**。在 Appfile 背后,其实就是“应用”这个概念,它是基于 OAM 模型实现的。通过这样的方式,KubeVela 让“应用”这个概念成为了整个平台对用户暴露的核心 API。KubeVela 中的所有能力,都是围绕着“应用”展开的。这正是为何基于 KubeVela 扩展和构建出来的平台,天然是用户友好的:对于一个开发者来说,他只关心“应用”,而不是容器或者 Kubernetes;而 KubeVela 会确保构建整个平台的过程,也只与应用层的需求有关。
|
||||
|
||||
**第二:Kubernetes 原生的高可扩展性**。在前面我们已经提到过,Appfile 是一个由 Workload Type 和 Trait 组成的、完全模块化的对象。而 OAM 模型的一个特点,就是任意一个 Kubernetes API 资源,都可以直接基于 Kubernetes 的 CRD 发现机制注册为一个 Workload Type 或者 Trait。这种可扩展性,使得 KubeVela 并不需要设计任何“插件系统”:**KubeVela 里的每一个能力,都是插件,而整个 Kubernetes 社区,就是 KubeVela 原生的插件中心**。
|
||||
|
||||
**第三:简单友好但高度可扩展的用户侧抽象体系**。在了解了 Appfile 之后,你可能已经对这个对象的实现方式产生了好奇。实际上,KubeVela 中并不是简单的实现了一个 Appfile。在平台层,KubeVela 在 OAM 模型层实现中集成了CUELang 这种简洁强大的模板语言,从而为平台工程师基于 Kubernetes API 对象定义用户侧抽象(即:“最后一公里”抽象)提供了一个标准、通用的配置工具。更重要的是,平台工程师或者系统管理员,可以随时随地的每个能力对应的 CUE 模板进行修改,这些修改一旦提交到 Kubernetes,用户在 Appfile 里就可以立刻使用到新的抽象,不需要重新部署或者安装 KubeVela。
|
||||
|
||||
在具体实现层,KubeVela 是基于 OAM Kubernetes Runtime 构建的,同时采用 KEDA ,Flagger,Prometheus 等生态项目作为 Trait 的背后的依赖。当然,这些依赖只是 KubeVela 的选型,你可以随时为 KubeVela 定制和安装你喜欢的任何能力作为 Workload Type 或者 Trait。综合以上讲解,KubeVela 项目的整体架构由**用户界面层,模型层,和能力管理层**三部分组成,如下所示:
|
||||
|
||||

|
||||
|
||||
有了 KubeVela,平台工程师终于拥有了一个可以方便快捷地将任何一个 Kubernetes 社区能力封装抽象成一个面向用户的上层平台特性的强大工具。而作为这个平台的最终用户,应用开发者们只需要学习这些上层抽象,在一个配置文件中描述应用,就可以一键交付出去。
|
||||
|
||||
### 3. KubeVela VS 经典 PaaS
|
||||
|
||||
很多人可能会问,KubeVela 跟经典 PaaS 的主要区别和联系是什么呢?
|
||||
|
||||
事实上,大多数经典 PaaS 都能提供完整的应用生命周期管理功能,同时也非常关注提供简单友好的用户体验,提升研发效能。在这些点上,KubeVela 跟经典 PaaS 的目标,是非常一致的。
|
||||
|
||||
但另一方面,经典 PaaS 往往是不可扩展的(比如 Rancher 的 Rio 项目),或者会引入属于自己的插件生态(哪怕这个 PaaS 是完全基于 Kubernetes 构建的),以此来确保平台本身的用户体验和能力的可控制性(比如 Cloud Foundry 或者 Heroku 的[插件中心](https://elements.heroku.com/addons))。
|
||||
|
||||
|
||||
相比之下,KubeVela 的设计是完全不同的。KubeVela 的目标,从一开始就是利用整个 Kubernetes 社区作为自己的“插件中心”,并且“故意”把它的每一个内置能力都设计成是独立的、可插拔的插件。这种高度可扩展的模型,背后其实有着精密的设计与实现。比如,KubeVela 如何确保某个完全独立的 Trait 一定能够绑定于某种 Workload Type?如何检查这些相互独立的 Trait 是否冲突?这些挑战,正是 Open Application Model(OAM)作为 KubeVela 模型层的起到的关键作用,一言以蔽之:OAM 是一个高度可扩展的应用定义与能力管理模型。
|
||||
|
||||
KubeVela 和 OAM 社区欢迎大家设计和制作任何 Workload Type 和 Trait 的定义文件。只要把它们存放在 GitHub 上,全世界任何一个 KubeVela 用户就都可以在自己的 Appfile 里使用你所设计的能力。具体的方式,请参考 `$ vela cap` (即:插件能力管理命令)的[使用文档](https://kubevela.io/#/en/developers/cap-center)。
|
||||
|
||||
## 了解更多
|
||||
|
||||
KubeVela 项目是 OAM 社区的官方项目,旨在取代原先的 Rudr 项目。不过,与 [Rudr](https://github.com/oam-dev/rudr) 主要作为“参考实现”的定位不同,KubeVela 既是一个端到端、面向全量场景的 OAM Kubernetes 完整实现,同时也是阿里云 EDAS 服务和内部多个核心 PaaS/Serverless 生产系统底层的核心组件。 此外,KubeVela 中 Apppfile 的设计,也是 OAM 社区在 OAM 规范中即将引入的“面向用户侧对象”的核心部分。
|
||||
|
||||
如果你想要更好的了解 KubeVela 项目,欢迎前往其官方网站上[学习具体的示例和手册](https://kubevela.io/)。以下也是一些非常好的学习内容和方式:
|
||||
|
||||
- 前往学习 [KubeVela Quick Start(新手教程)](https://kubevela.io/#/en/quick-start),一步步了解 KubeVela 的使用方法。
|
||||
- 前往 OAM 社区深入交流和反馈。中文:钉钉群 23310022,英文:[Gitter](https://gitter.im/oam-dev/community) 和 [CNCF Slack](https://cloud-native.slack.com/archives/C01BLQ3HTJA)。
|
||||
- 尝试为 [KubeVela 添加来自开源社区的插件能力](https://kubevela.io/#/en/platform-engineers/trait)。此外,如果你有任何关于扩展 KubeVela 的奇妙想法,比如,基于 KubeVela 开发一个自己的云原生数据库 PaaS 或者 AI PaaS,欢迎前往 OAM 社区通过 Issue 来进行讨论。
|
||||
- 为 KubeVela 贡献代码. KubeVela 项目是一个诞生自云原生社区的开源项目(感谢来自 8 家不同公司的[初始贡献者](https://github.com/oam-dev/kubevela/blob/bbb2c527d96d3e1a0694e2f49b3d1d1168e72c53/OWNERS_ALIASES#L35),并特别鸣谢 KubeVela 网站的发起者 [guoxudong](https://github.com/sunny0826))。
|
||||
|
||||
**KubeVela 项目的维护者会在项目稳定后,即将整个项目所有权捐赠给中立开源基金会。**
|
||||
@@ -1,35 +0,0 @@
|
||||
## vela system update
|
||||
|
||||
Sync definition from cluster
|
||||
|
||||
### Synopsis
|
||||
|
||||
Refresh and sync definition files from cluster
|
||||
|
||||
```
|
||||
vela system update
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```
|
||||
vela system update
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
```
|
||||
-h, --help help for update
|
||||
```
|
||||
|
||||
### Options inherited from parent commands
|
||||
|
||||
```
|
||||
-e, --env string specify environment name for application
|
||||
```
|
||||
|
||||
### SEE ALSO
|
||||
|
||||
* [vela system](vela_system.md) - System management utilities
|
||||
|
||||
###### Auto generated by spf13/cobra on 6-Nov-2020
|
||||
159
docs/design.md
159
docs/design.md
@@ -1,159 +0,0 @@
|
||||
# KubeVela Design
|
||||
|
||||
This document is the detailed design and architecture of the KubeVela being built in this repository.
|
||||
|
||||
> All the diagram in this documentation could be found in [this slides](https://docs.google.com/presentation/d/1Y3gnKrd7fUZGgee7Ia9vBsRIYhcZLQwMUCDkk1RJvQc/edit?usp=sharing).
|
||||
|
||||
## Overview
|
||||
|
||||
KubeVela is a simple, complete, but highly extensible cloud native application platform based on Kubernetes. KubeVela intends to bring application-centric experience to end users and democratize building cloud native application platforms for platform engineers.
|
||||
|
||||
## User Stories
|
||||
|
||||
As a end user (e.g. application developers, operators etc) of the platform, I only want to focus on coding my business logic and ship them to various environments at ease. Let's say:
|
||||
- Here's my source code.
|
||||
- Here's my application configuration (described in end user PoV).
|
||||
- Deploy it in test environment.
|
||||
- Deploy it in production environment.
|
||||
- Monitoring, debugging, rollout/rollback the application.
|
||||
- Dockerfile is fine, but please keep it simple.
|
||||
|
||||
As a platform engineer, I want to build a easy-to-use platform for end users. In detail, the platform should be:
|
||||
- Heroku-like (_in terms of both user experience and functionality_).
|
||||
- and I prefer to build my own version with OSS tools, particularly, with Kubernetes (for obvious reason).
|
||||
- Easy to build.
|
||||
- I am too busy to reinvent any wheel, I want to reuse every capability in Kubernetes community as possible, with minimal effort. Writing some simple CRD and controllers is fine, but please, just the simple ones like copy-paste.
|
||||
- Powerful and highly extensible.
|
||||
- I don't want to lock users with restricted abstractions and capabilities like traditional PaaS or FaaS/Serverless. I love Kubernetes and what it has enabled. So in terms of capability, I hope my platform is fully open and has unlimited possibilities like Kubernetes itself, rather than another opinionated close system like traditional PaaS.
|
||||
|
||||
|
||||
## Core Principles
|
||||
|
||||
In nutshell, the principles for KubeVela project are:
|
||||
|
||||
- For end users, it out-of-the-box provides a fully featured PaaS-like experience, nothing special.
|
||||
- For platform builders, it works like a special Kubernetes "distro" or extensible PaaS core that could be used to build something more complex on top of. It allows platform builders to integrate any existing capabilities in Kubernetes ecosystem to end users with minimal effort, or develop a new capability at ease in a standardized and Kubernetes-native approach.
|
||||
|
||||
## Design Details
|
||||
|
||||
### 1. Application Centric
|
||||
|
||||
The API and interfaces of KubeVela intends to make users think in terms of application, not containers or infrastructure.
|
||||
|
||||
Lacking application context impacts the user experience and significantly raised the bar to adopt cloud native stack. We believe "application" is the natural mindset of developers and it's the core concept an application platform should expose.
|
||||
|
||||

|
||||
|
||||
KubeVela intends to let developers push code, define application in developer facing primitives, and make daily operations as configurations of the application.
|
||||
|
||||
Thus, KubeVela choose to:
|
||||
1. Introduce "application" as first class citizen and main API.
|
||||
2. Build the whole system around "application", i.e. model capabilities of Kubernetes as application configuration, with clarity and manageability.
|
||||
|
||||
#### Solution
|
||||
|
||||
Instead of creating a in-house "application CRD", KubeVela adopts [Open Application Model (OAM)](https://github.com/oam-dev/spec) as its application definition, since OAM:
|
||||
1. defines micro-services application by default.
|
||||
2. models day 2 operations as part of the application (i.e. `Application Traits`).
|
||||
2. is highly extensible: every workload and trait in OAM is a independent definition, no abstraction or capability lock-in.
|
||||
|
||||
### 2. Capability Oriented Architecture
|
||||
|
||||
To enable platform builders use KubeVela to create their own application platforms in an easy and Kubernetes native approach, KubeVela intends to make its every capability a standalone "plug-in".
|
||||
|
||||

|
||||
|
||||
For example, there are several "built-in" workload types in KubeVela such as `Web Service` or `Task`. It is by design that they are all independent CRD controllers that abstract Kubernetes built-in workloads and create Service automatically if needed. KubeVela itself is **NOT** aware of the specification or implementation of these workload types.
|
||||
|
||||
This means platform builders are free to bring their own workload types by simply install a CRD controller, or even just reference a k8s built-in resource like StatefulSet as new workload type.
|
||||
|
||||
Similarly, all the "built-in" operations such as `scaling` or `rollout` (i.e. "traits" in KubeVela) are also independent CRD controllers which are **NOT** bound with specific workload types. Platform builders are free to bring their own traits implementations by simply providing a CRD controller, reference a k8s built-in resource like `HPA` or `NetworkPolicy` as trait is also possible.
|
||||
|
||||
This loosely coupled design of KubeVela adopts the idea of Capability Oriented Architecture (COA), i.e. instead of creating a close system like traditional PaaS, KubeVela intends to become an application-centric framework to connect end users with underlying infrastructure capabilities.
|
||||
|
||||
#### Solution
|
||||
|
||||
KubeVela core is built with [OAM Kubernetes Runtime](https://github.com/crossplane/oam-kubernetes-runtime) which met the requirements of KubeVela such as supporting bring in standalone controllers as workload type and trait, it also defined a clear interface between how a trait could operate a workload instance in a generic approach. Overall, this library defined a set of abstraction and interfaces for platform builder to assemble various Kubernetes capabilities into a PaaS without coupling them together or introducing any glue code.
|
||||
|
||||
##### Capability Register and Discovery
|
||||
|
||||
KubeVela leverages [OAM definition objects](https://github.com/oam-dev/spec/blob/master/4.workload_definitions.md) to register and discover workloads and traits:
|
||||
|
||||
|
||||
```console
|
||||
$ kubectl apply -f workload-definition.yaml # register a new workload type
|
||||
$ kubectl apply -f trait-definition.yaml # register a new trait
|
||||
```
|
||||
|
||||
Note that OAM definition objects only care about API resource, not including the controllers. Thus KubeVela intends to include a **CRD registry** so whenever a new API resource is installed as workload or trait, KubeVela could install its controller automatically from the registry. That of course means we envision the CRD registry could register a CRD and Helm chart (which contains the manifest of the controller). In practice, we are currently evaluating RedHat's Operator Lifecycle Manager (OLM) but no the final conclusion yet.
|
||||
|
||||
##### Cloud Services Integration
|
||||
|
||||
For capabilities like cloud services, KubeVela intends to leverage Kubernetes as the universal control plane so [Crossplane](https://github.com/crossplane/crossplane) core will be used to register cloud services as workload types.
|
||||
|
||||
|
||||
### 3. Extensible User Interface
|
||||
|
||||
KubeVela is built with Kubernetes and OAM (which adopts Kubernetes API model). So in nutshell, **ALL** functionalities of KubeVela core can be handled by simple `kubectl`, for example:
|
||||
|
||||
```yaml
|
||||
$ kubectl apply -f frontend-component.yaml # create frontend component
|
||||
$ kubectl apply -f backend-component.yaml # create backend component
|
||||
$ kubectl apply -f application-config.yaml # assign operational traits to components and deploy the whole application
|
||||
```
|
||||
|
||||
We call these server side objects "the application model of KubeVela", they are essentially the Kubernetes API objects KubeVela exposes.
|
||||
|
||||
However, we also agree that Kubernetes API model is great to build platforms like KubeVela with but when directly exposed to end users, it creates heavy mental burden and high learning curve. Hence, as any other user facing platforms, KubeVela intend to introduce a lightweight user facing layer with following goals in mind:
|
||||
|
||||
- Shorten the learning curve of new developers. Most capabilities in KubeVela are developed by big
|
||||
companies that run very complex workloads. However, for the bigger developer community, the new user facing layer will provide a much simpler path to on-board KubeVela.
|
||||
- Developers can describe their applications and behavior of their components without making assumptions on availability of specific Kubernetes API. For instance, a developer will be able to model auto-scaling needs without referring to the CRD of auto-scaling trait.
|
||||
- Provides a single source of truth of the application description. The user facing layer allows developers to work with a single artifact to capture the application definition. This artifact is the definitive truth of how the application is supposed to look like. It simplifies administrative tasks such as change management. It also serves as an anchor for application truth to avoid configuration drifts during operation.
|
||||
- Highly extensible. For example, when a new workload type or trait is installed, the end users could access this new capability directly from user interface layer, no re-compile or re-deploy of KubeVela is required.
|
||||
|
||||
#### Solution
|
||||
|
||||
We concluded such "highly extensible user interface layer" as a need for a dynamic "modeling language" on top of the KubeVela's application model objects. After evaluation, we decided to adopt [CUElang](https://github.com/cuelang/cue) since it's perfect as a pure data configuration language that allow us to build developer facing tools, nothing more, nothing less.
|
||||
|
||||
In detail, we integrated CUE based abstraction as part of OAM implementation since the *abstraction* and *model* are closely related. For platform builders, every workload or trait definition in KubeVela references a CUE template as its abstraction between human and the underlying Kubernetes capability, platform builders are free to modify those templates at any time
|
||||
|
||||
On the other hand, it's by intention that the end users of KubeVela don't need to learn or write CUE. Instead, we created following tools for them by leveraging above OAM + CUE user interface layer:
|
||||
|
||||
1. A command line tool.
|
||||
2. A GUI dashboard.
|
||||
3. A Docker Compose style `appfile`.
|
||||
|
||||
For example, the `vela cli`:
|
||||
|
||||
```console
|
||||
$ vela svc deploy frontend -t webservice --image oamdev/testapp:v1 --port 80 --app helloworld
|
||||
```
|
||||
|
||||
The `-t webservice --image oamdev/testapp:v1 --port 80` arguments are not hard coded, they are schema defined by in-line CUE template of `WebService` workload definition.
|
||||
|
||||
The `appfile` is essentially a YAML version of command line tool but it can support more complex structures with a single command like `$ vela up`:
|
||||
|
||||

|
||||
|
||||
The schema of above `appfile` is not hard coded as well, they are organized following OAM and enforced by CUE templates of `WebService` workload definition, `Scaling` trait definition and `Canary` trait definition.
|
||||
|
||||
> Appfile has its [independent design doc](./design/appfile-design.md) which includes more details. There's also [an example](./design/appfile-design.md#multiple-outputs-in-traitdefinition) showing how platform builder could use CUE to define a `route` capability in KubeVela.
|
||||
|
||||
We will skip the example of dashboard, but similarly, the schema of GUI forms are defined by in-lined CUE template of definition objects.
|
||||
|
||||
## Architecture
|
||||
|
||||

|
||||
|
||||
From highest level, KubeVela is composed by only two components:
|
||||
|
||||
### 1. User interface layer
|
||||
Including: `cli`, `dashboard`, `appfile`, they are all client side tools based on the CUE based abstractions mentioned above.
|
||||
### 2. KubeVela core
|
||||
Including:
|
||||
- [OAM Kubernetes runtime](https://github.com/crossplane/oam-kubernetes-runtime) to provide application-centric building blocks such as `Component` and `Application` etc.
|
||||
- [Built-in workload and trait controllers](https://github.com/oam-dev/kubevela/tree/master/pkg/controller/v1alpha1) to provide core capabilities such as `webservice`, `route` and `rollout` etc.
|
||||
- Capability Management: manage features of KubeVela following Capability Oriented Architecture.
|
||||
- Every feature of KubeVela is a "addon", and it is registered by Kubernetes API resource (including CRD) leveraging OAM definition objects.
|
||||
- CRD Registry: register controllers of Kubernetes add-ons and discover them by CRD. This will enable automatically install controllers/operators when CRD is missing in the cluster.
|
||||
@@ -1,94 +0,0 @@
|
||||
# Initializating Application
|
||||
|
||||
## `vela init`
|
||||
|
||||
To initialize and deploy an application with one service, run:
|
||||
|
||||
> If you only want to initialize without deploying the app, add `--render-only` flag
|
||||
|
||||
```console
|
||||
$ vela init
|
||||
Welcome to use KubeVela CLI! We're going to help you run applications through a couple of questions.
|
||||
|
||||
Environment: default, namespace: default
|
||||
|
||||
? What is the domain of your application service (optional): example.com
|
||||
? What is your email (optional, used to generate certification):
|
||||
? What would you like to name your application (required): testapp
|
||||
? Choose the workload type for your application (required, e.g., webservice): webservice
|
||||
? What would you like to name this webservice (required): testsvc
|
||||
? specify app image crccheck/hello-world
|
||||
? specify port for container 8000
|
||||
|
||||
...
|
||||
✅ Application Deployed Successfully!
|
||||
- Name: testsvc
|
||||
Type: webservice
|
||||
HEALTHY Ready: 1/1
|
||||
Routes:
|
||||
|
||||
Last Deployment:
|
||||
Created at: ...
|
||||
Updated at: ...
|
||||
```
|
||||
|
||||
Check the application:
|
||||
|
||||
```console
|
||||
$ vela show testapp
|
||||
About:
|
||||
|
||||
Name: testapp
|
||||
Created at: ...
|
||||
Updated at: ...
|
||||
|
||||
|
||||
Environment:
|
||||
|
||||
Namespace: default
|
||||
|
||||
Services:
|
||||
|
||||
- Name: testsvc
|
||||
WorkloadType: webservice
|
||||
Arguments:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
Traits:
|
||||
```
|
||||
|
||||
## Deploy Multiple Services
|
||||
|
||||
You can also use KubeVela CLI to deploy multiple services for an application.
|
||||
|
||||
Check the available workload types.
|
||||
|
||||
```console
|
||||
$ vela workloads
|
||||
NAME DESCRIPTION
|
||||
worker Backend worker without ports exposed
|
||||
webservice Long running service with network routes
|
||||
```
|
||||
|
||||
Deploy the first service named `frontend` with `Web Service` type:
|
||||
|
||||
```console
|
||||
$ vela svc deploy frontend --app testapp -t webservice --image crccheck/hello-world
|
||||
App testapp deployed
|
||||
```
|
||||
|
||||
> TODO auto generate a random application name, so --app testapp becomes optional
|
||||
|
||||
Deploy the second service named `backend` with "Backend Worker" type:
|
||||
|
||||
```console
|
||||
$ vela svc deploy backend --app testapp2 -t worker --image crccheck/hello-world
|
||||
App testapp2 deployed
|
||||
```
|
||||
|
||||
```console
|
||||
$ vela ls
|
||||
SERVICE APP TYPE TRAITS STATUS CREATED-TIME
|
||||
frontend testapp ...
|
||||
backend testapp ...
|
||||
```
|
||||
@@ -1,71 +0,0 @@
|
||||
# Managing Capabilities
|
||||
|
||||
This tutorial talks about how to install capabilities (caps) from remote centers.
|
||||
|
||||
## Add Cap Center
|
||||
|
||||
Add and sync a remote center:
|
||||
|
||||
```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
|
||||
|
||||
$ vela cap center sync my-center
|
||||
successfully sync 1/1 from my-center remote center
|
||||
sync finished
|
||||
```
|
||||
|
||||
## List Cap Centers
|
||||
|
||||
```console
|
||||
$ vela cap center ls
|
||||
NAME ADDRESS
|
||||
my-center https://github.com/oam-dev/catalog/tree/master/registry
|
||||
```
|
||||
|
||||
## [Optional] Remove Cap Center
|
||||
|
||||
```console
|
||||
$ vela cap center remove my-center
|
||||
```
|
||||
|
||||
## List Caps
|
||||
|
||||
```console
|
||||
$ vela cap ls my-center
|
||||
NAME CENTER TYPE DEFINITION STATUS APPLIES-TO
|
||||
kubewatch my-center trait kubewatches.labs.bitnami.com uninstalled []
|
||||
```
|
||||
|
||||
## Install Cap
|
||||
|
||||
```console
|
||||
$ vela cap install my-center/kubewatch
|
||||
Installing trait capability kubewatch
|
||||
"my-repo" has been added to your repositories
|
||||
2020/11/06 16:19:30 [debug] creating 1 resource(s)
|
||||
2020/11/06 16:19:30 [debug] CRD kubewatches.labs.bitnami.com is already present. Skipping.
|
||||
2020/11/06 16:19:37 [debug] creating 3 resource(s)
|
||||
Successfully installed chart (kubewatch) with release name (kubewatch)
|
||||
Successfully installed capability kubewatch from my-center
|
||||
```
|
||||
|
||||
Check traits installed:
|
||||
```console
|
||||
$ vela traits
|
||||
Synchronizing capabilities from cluster⌛ ...
|
||||
Sync capabilities successfully ✅ (no changes)
|
||||
TYPE CATEGORY DESCRIPTION
|
||||
kubewatch trait Add a watch for resource
|
||||
...
|
||||
```
|
||||
|
||||
## Uninstall Cap
|
||||
|
||||
> Note: make sure no apps are using the capability before uninstalling.
|
||||
|
||||
```console
|
||||
$ vela cap uninstall my-center/kubewatch
|
||||
Successfully removed chart (kubewatch) with release name (kubewatch)
|
||||
```
|
||||
@@ -1,68 +0,0 @@
|
||||
# Cloud service
|
||||
|
||||
In this demo, we will add an RDS database from Alibaba Cloud to our application.
|
||||
|
||||
## What is cloud service
|
||||
|
||||
Cloud service refers to the managed cloud resources. For example, you can buy a PostgreSql database from a cloud vendor instead of setting up your own. Cloud service are normally outside of your Kubernetes cluster, but logically they are still part of your application. KubeVela provides application centric view of your applications. It will treat every service the same.
|
||||
|
||||
## Crossplane
|
||||
|
||||
Crossplane is an open source Kubernetes add-on that extends any cluster with the ability to provision and manage cloud infrastructure, services, and applications using kubectl, GitOps, or any tool that works with the Kubernetes API. The benefit of using Crossplane is it will provide centralized control plane disregard where your cluster is.
|
||||
|
||||
KubeVela will delegate the lifecycle management of cloud service to Crossplane.
|
||||
|
||||
## Install Crossplane (This demo uses crossplane version 0.13)
|
||||
|
||||
You will need a Kubernetes cluster ver> 1.16 (Minikube and Kind clusters are fine).
|
||||
Also you will need to have KubeVela installed on the cluster.
|
||||
The folder that containes all the demo scripts are under `../../examples/kubecondemo/`. For your convience, cd to that folder first:
|
||||
`cd ../../examples/kubecondemo/`
|
||||
To provision a cloud resource, you need to have the Access Key and Secret to your Alibaba cloud account.
|
||||
|
||||
* Create crossplane namespace: `kubectl create ns crossplane-system`
|
||||
* Install crossplane helm chart: `helm install crossplane charts/crossplane/ --namespace crossplane-system`
|
||||
* Install crossplane cli: `curl -sL https://raw.githubusercontent.com/crossplane/crossplane/release-0.13/install.sh | sh`
|
||||
* Add crossplane to `PATH`: `sudo mv kubectl-crossplane /usr/local/bin`
|
||||
* Configure cloud provider(Alibaba Cloud)
|
||||
* Add cloud provider: `kubectl crossplane install provider crossplane/provider-alibaba:v0.3.0`
|
||||
* Create provider secret: `kubectl create secret generic alibaba-creds --from-literal=accessKeyId=<change here> --from-literal=accessKeySecret=<change here> -n crossplane-system`
|
||||
* Configure the provider: `kubectl apply -f script/provider.yaml`
|
||||
* Configure infrastructure: `kubectl crossplane install configuration crossplane/getting-started-with-alibaba:v0.13`
|
||||
|
||||
So far we have configured Crossplane on the cluster.
|
||||
|
||||
## Import the database workload definition
|
||||
|
||||
First, register the db workload definition:
|
||||
`kubectl apply -f script/def_db.yaml`
|
||||
The webservice workload is different from the default version so we have to overwrite it.
|
||||
`kubectl apply -f cript/webservice.yaml`
|
||||
Don't forget to update vela:
|
||||
`vela system update`
|
||||
|
||||
## Apply the appfile
|
||||
|
||||
In the Appfile, we claim an RDS instance just like other services:
|
||||
|
||||
``` yaml
|
||||
database:
|
||||
type: rds
|
||||
name: alibabaRds
|
||||
...
|
||||
```
|
||||
|
||||
Next, we start the application:
|
||||
`vela up`
|
||||
|
||||
## Verify the database status
|
||||
|
||||
Under the hood, we can verify the status of database(usually takes >6 min to be ready):
|
||||
`kubectl get postgresqlinstance`
|
||||
|
||||
When the database is ready, you can see the `READY: True` output.
|
||||
|
||||
## Access the web-ui
|
||||
|
||||
In the Appfile we added a route trait. To access the web-ui, please check out the [route](set-route.md) documentation.
|
||||
|
||||
@@ -1,242 +0,0 @@
|
||||
# Using Appfile for More Flexible Configuration
|
||||
|
||||
Appfile supports more flexible options than CLI/UI to configure appliation deployment on Vela.
|
||||
A detailed design doc could be found [here](../../design/appfile-design.md).
|
||||
|
||||
In this tutorial, we will build and deploy an example NodeJS app under [examples/testapp/](https://github.com/oam-dev/kubevela/tree/master/examples/testapp).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [docker](https://docs.docker.com/get-docker/) installed on the host
|
||||
- [vela](../../install.md) installed and configured
|
||||
|
||||
## 1. Download test app code
|
||||
|
||||
git clone and go to the testapp directory:
|
||||
|
||||
```console
|
||||
$ git clone https://github.com/oam-dev/kubevela.git
|
||||
$ cd kubevela/examples/testapp
|
||||
```
|
||||
|
||||
The example contains NodeJS app code, Dockerfile to build the app.
|
||||
|
||||
## 2. Deploy app in one command
|
||||
|
||||
In the directory there is a [vela.yaml](../../../examples/testapp/vela.yaml) which follows Appfile format supported by Vela.
|
||||
We are going to use it to build and deploy the app.
|
||||
|
||||
ATTENTION: change the image field in vela.yaml to something you can push to on your host:
|
||||
|
||||
> Or you may try the local testing option introduced in the following section.
|
||||
|
||||
```yaml
|
||||
image: oamdev/testapp:v1
|
||||
```
|
||||
|
||||
Run the following command:
|
||||
|
||||
```console
|
||||
$ vela up
|
||||
Parsing vela.yaml ...
|
||||
Loading templates ...
|
||||
|
||||
Building service (express-server)...
|
||||
Sending build context to Docker daemon 71.68kB
|
||||
Step 1/10 : FROM mhart/alpine-node:12
|
||||
---> 9d88359808c3
|
||||
...
|
||||
|
||||
pushing image (oamdev/testapp:v1)...
|
||||
...
|
||||
|
||||
Rendering configs for service (express-server)...
|
||||
Writing deploy config to (.vela/deploy.yaml)
|
||||
|
||||
Applying deploy configs ...
|
||||
Checking if app has been deployed...
|
||||
App has not been deployed, creating a new deployment...
|
||||
✅ App has been deployed 🚀🚀🚀
|
||||
Port forward: vela port-forward testapp
|
||||
SSH: vela exec testapp
|
||||
Logging: vela logs testapp
|
||||
App status: vela status testapp
|
||||
Service status: vela status testapp --svc express-server
|
||||
```
|
||||
|
||||
|
||||
Check the status of the service:
|
||||
|
||||
```console
|
||||
$ vela status testapp
|
||||
About:
|
||||
|
||||
Name: testapp
|
||||
Namespace: default
|
||||
Created at: 2020-11-02 11:08:32.138484 +0800 CST
|
||||
Updated at: 2020-11-02 11:08:32.138485 +0800 CST
|
||||
|
||||
Services:
|
||||
|
||||
- Name: express-server
|
||||
Type: webservice
|
||||
HEALTHY Ready: 1/1
|
||||
Last Deployment:
|
||||
Created at: 2020-11-02 11:08:33 +0800 CST
|
||||
Updated at: 2020-11-02T11:08:32+08:00
|
||||
Routes:
|
||||
|
||||
```
|
||||
|
||||
### Alternative: Local testing without pushing image remotely
|
||||
|
||||
If you have local [kind](../../install.md#kind) cluster running, you may try the local push option without pushing image remotely.
|
||||
|
||||
Add local option to `build`:
|
||||
|
||||
```yaml
|
||||
build:
|
||||
# push image into local kind cluster without remote transfer
|
||||
push:
|
||||
local: kind
|
||||
|
||||
docker:
|
||||
file: Dockerfile
|
||||
context: .
|
||||
```
|
||||
|
||||
Then deploy the app to kind:
|
||||
|
||||
```console
|
||||
$ vela up
|
||||
```
|
||||
|
||||
### [Optional] Check rendered manifests
|
||||
|
||||
By default, Vela renders the final manifests in `.vela/deploy.yaml`:
|
||||
|
||||
```yaml
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: ApplicationConfiguration
|
||||
metadata:
|
||||
name: testapp
|
||||
namespace: default
|
||||
spec:
|
||||
components:
|
||||
- componentName: express-server
|
||||
---
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: Component
|
||||
metadata:
|
||||
name: express-server
|
||||
namespace: default
|
||||
spec:
|
||||
workload:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: express-server
|
||||
...
|
||||
---
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: HealthScope
|
||||
metadata:
|
||||
name: testapp-default-health
|
||||
namespace: default
|
||||
spec:
|
||||
...
|
||||
```
|
||||
|
||||
## 3. Add routing
|
||||
|
||||
Add routing config under `express-server`:
|
||||
|
||||
```yaml
|
||||
servcies:
|
||||
express-server:
|
||||
...
|
||||
|
||||
route:
|
||||
domain: example.com
|
||||
rules:
|
||||
- path: /testapp
|
||||
rewriteTarget: /
|
||||
```
|
||||
|
||||
Apply again:
|
||||
|
||||
```console
|
||||
$ vela up
|
||||
```
|
||||
|
||||
Check the status until we see route trait ready:
|
||||
```console
|
||||
$ vela status testapp
|
||||
About:
|
||||
|
||||
Name: testapp
|
||||
Namespace: default
|
||||
Created at: ...
|
||||
Updated at: ...
|
||||
|
||||
Services:
|
||||
|
||||
- Name: express-server
|
||||
Type: webservice
|
||||
HEALTHY Ready: 1/1
|
||||
Last Deployment:
|
||||
Created at: ...
|
||||
Updated at: ...
|
||||
Routes:
|
||||
- route: Visiting URL: http://example.com IP: localhost
|
||||
```
|
||||
|
||||
**In [kind cluster setup](../../install.md#kind)**, you can visit the service via localhost:
|
||||
|
||||
> If not in kind cluster, replace localhost with ingress address
|
||||
|
||||
```
|
||||
$ curl -H "Host:example.com" http://localhost/testapp
|
||||
Hello World
|
||||
```
|
||||
|
||||
## 4. Add monitoring metrics
|
||||
|
||||
TODO
|
||||
|
||||
## [Optional] Configure "task" workload type
|
||||
|
||||
By now we have deployed a *webservice* workload. We can also add a *task* workload in appfile:
|
||||
|
||||
> Below is a simplified [k8s job example](https://kubernetes.io/docs/concepts/workloads/controllers/job/#running-an-example-job) using Vela:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
pi:
|
||||
image: perl
|
||||
cmd: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
|
||||
|
||||
express-server:
|
||||
...
|
||||
```
|
||||
|
||||
Then deploy appfile again:
|
||||
|
||||
```console
|
||||
$ vela up
|
||||
```
|
||||
|
||||
## What's Next?
|
||||
|
||||
Congratulations! You have just deployed an app using Vela.
|
||||
|
||||
Here are some next steps that you can have more play with your app:
|
||||
|
||||
- [Check Application Logs](../check-logs.md)
|
||||
- [Execute Commands in Container](../exec-cmd.md)
|
||||
- [Port Forward to Container](../port-forward.md)
|
||||
|
||||
|
||||
## References
|
||||
|
||||
For more configuration options of built-in capabilities, check [references](../references/README.md)
|
||||
@@ -1,12 +0,0 @@
|
||||
# Port Forward to Container
|
||||
|
||||
Run:
|
||||
|
||||
```
|
||||
$ vela port-forward testapp
|
||||
Forwarding from 127.0.0.1:8080 -> 8080
|
||||
Forwarding from [::1]:8080 -> 8080
|
||||
|
||||
Forward successfully! Opening browser ...
|
||||
Handling connection for 8080
|
||||
```
|
||||
@@ -1,9 +0,0 @@
|
||||
# KubeVela Capability References
|
||||
|
||||
- [workload types](https://github.com/oam-dev/kubevela/tree/master/docs/developers/references/workload-types)
|
||||
- [trait](https://github.com/oam-dev/kubevela/tree/master/docs/developers/references/traits)
|
||||
|
||||
|
||||
Note: All the contents under this directory are designed to be referenced by other documentations as the full schema or usage of specific workload types or traits.
|
||||
|
||||
In the upcoming releases, we plan to auto-generate all these reference documentations from the CUE templates in KubeVela's definition objects.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user