Compare commits

..

490 Commits

Author SHA1 Message Date
Jianbo Sun
816b7d2d6f Merge pull request #637 from wonderflow/display
add tips about vela install capability not ready instead of directly fail
2020-11-20 10:21:35 +08:00
Jianbo Sun
050b66b5d0 Merge pull request #636 from wonderflow/check
check helm release first before add repo and install chart
2020-11-20 09:53:08 +08:00
天元
6862435594 add tips about vela install capability not ready instead of directly fail, it could self-heal after background installation succeed
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-20 09:51:22 +08:00
天元
c195580126 check helm release first before add repo and install chart 2020-11-20 09:39:59 +08:00
Hongchao Deng
0747b03c50 Merge pull request #635 from hongchaodeng/hide_ui
hide dashboard command
2020-11-19 17:27:27 -08:00
Jianbo Sun
25558b2c86 Merge pull request #633 from zzxwill/docs-cli
Update vela Cli description
2020-11-20 09:22:56 +08:00
Hongchao Deng
f1ff1564fb hide dashboard command 2020-11-19 17:12:31 -08:00
Hongchao Deng
ebfd1dfe15 Merge pull request #634 from resouer/doc
Fix broken link in introduction
2020-11-19 15:38:55 -08:00
Harry Zhang
51873e0b4d Fix broken link in introduction 2020-11-19 15:32:25 -08:00
zzxwill
bcd6fb08cc Update vela Cli description
To make it consistent to the description of KubeVela repo
2020-11-19 16:22:34 +08:00
Jianbo Sun
7a81bba7ca Merge pull request #627 from wonderflow/newname
change demo app name to avoid see unhealthy status too quick
2020-11-18 17:03:57 +08:00
天元
5a4b70479c change demo app name to avoid see unhealthy status too quick 2020-11-18 17:00:40 +08:00
Jianbo Sun
2becbebceb Merge pull request #624 from oam-dev/wonderflow-patch-1
Update install.md
2020-11-18 16:40:13 +08:00
Jianbo Sun
cf57610e20 Update install.md
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-18 16:39:21 +08:00
Hongchao Deng
244b3f7f48 Merge pull request #622 from wonderflow/gosec
fix go sec and remove unnecessary code
2020-11-17 20:34:21 -08:00
天元
42c9e68512 fix go sec and remove unnecessary code
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-18 10:34:22 +08:00
Jianbo Sun
17b4a2c966 Merge pull request #623 from resouer/fix
Update design description
2020-11-18 10:15:54 +08:00
Harry Zhang
5266274c60 Update design description 2020-11-17 16:47:18 -08:00
Hongchao Deng
00ee2bfad4 Merge pull request #621 from hongchaodeng/fix-config
fix config in webservice template
2020-11-17 11:49:40 -08:00
Hongchao Deng
e6445f7458 fix config in webservice template
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-17 11:38:16 -08:00
Hongchao Deng
debc0da3b6 Merge pull request #620 from wonderflow/golint
add description for export const variable and function
2020-11-17 11:15:14 -08:00
Hongchao Deng
ea823db8ea Merge pull request #619 from wonderflow/goimports
fix go imports lint complain
2020-11-17 11:14:18 -08:00
天元
fb8c33af8d add description for export const variable and function, fix golint
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-17 21:04:53 +08:00
天元
974027e233 fix go imports lint complain
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-17 20:40:08 +08:00
Jianbo Sun
cb946bff95 Merge pull request #618 from zzxwill/docs-webservice-autoscale
Minor updates on webservice/autoscale docs/comments
2020-11-17 13:25:11 +08:00
zzxwill
f22c8995f4 Minor updates on webservice/autoscale docs/comments
based on the comments https://github.com/oam-dev/kubevela/pull/566#discussion_r522385511
and https://github.com/oam-dev/kubevela/issues/585#issuecomment-726253432,
update docs and comments on webservice and autoscale
2020-11-17 13:10:49 +08:00
Jianbo Sun
550d708637 Merge pull request #617 from wonderflow/fixci
update KIND action to fix CI
2020-11-17 11:11:51 +08:00
天元
1a592496a1 update KIND action to fix CI
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-17 10:47:44 +08:00
Jianbo Sun
a5eb3161eb Merge pull request #613 from wonderflow/ext1
refactor extend trait feature and doc
2020-11-17 10:16:39 +08:00
Hongchao Deng
ffa965d637 Merge pull request #616 from resouer/badge
Remove duplicated badges
2020-11-16 17:34:34 -08:00
Harry Zhang
ef16da72f5 Remove duplicated badges 2020-11-16 15:42:40 -08:00
Hongchao Deng
19657d488f Merge pull request #615 from szihai/master
add README badges
2020-11-16 13:36:44 -08:00
andy shi
b9fc2180c5 add README badges 2020-11-16 12:38:25 -08:00
天元
daef0523fa refactor extend trait feature and doc
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-16 19:22:38 +08:00
Jianbo Sun
3269c4f48f Merge pull request #612 from wonderflow/rollout1
tunning docs
2020-11-16 14:32:44 +08:00
Hongchao Deng
2526760080 Merge pull request #611 from resouer/readme
Use doc site for quick start
2020-11-15 22:30:02 -08:00
Harry Zhang
5ec22917a1 Use doc site for quick start 2020-11-15 22:07:49 -08:00
天元
efb76ee5ee tunning docs 2020-11-16 14:07:38 +08:00
andy shi
47222606dd Fix cloud service doc (#607)
* first version cloud-service

* revise cloud service doc

* remove sensitive information

* update document

* add cloud service to sidebar

* add cloud service to sidebar

* formatting instructions

* fix syntax
2020-11-16 10:39:56 +08:00
Jianbo Sun
fe81ed1653 Merge pull request #593 from wonderflow/upd
refactor crd generate mode
2020-11-16 10:39:04 +08:00
Jianbo Sun
51fe5e7c7b Merge pull request #610 from resouer/roadmap
Update roadmap a bit
2020-11-15 14:31:55 +08:00
Harry Zhang
3e6002cc95 Update roadmap 2020-11-14 21:52:10 -08:00
Hongchao Deng
6792d7ded1 Merge pull request #608 from resouer/cap
Add details in cap mgmt
2020-11-14 13:23:38 -08:00
Hongchao Deng
2b2eb9701c Merge pull request #606 from resouer/dev
Refactor workload type doc
2020-11-14 13:23:07 -08:00
Harry Zhang
93559a2f01 Add details in cap mgmt 2020-11-13 23:17:35 -08:00
Harry Zhang
ecf3f5d664 Refactor workload type doc 2020-11-13 22:32:48 -08:00
Hongchao Deng
54e30b1f8b Merge pull request #605 from resouer/dev
Add better rollout trait doc
2020-11-13 18:35:52 -08:00
Harry Zhang
de7bb9ba46 Add better rollout trait doc 2020-11-13 17:23:05 -08:00
Hongchao Deng
c1d6dedb5d Merge pull request #604 from hongchaodeng/doc-extend
extend kubevela: add openfaas workload
2020-11-13 17:13:07 -08:00
天元
9a89699691 refactor crd generate mode
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-14 09:10:39 +08:00
Hongchao Deng
34819f8d80 Update docs/en/platform-engineers/workload-type.md
Co-authored-by: Jianbo Sun <wonderflow.sun@gmail.com>
2020-11-13 17:10:27 -08:00
Hongchao Deng
6486b7878f extend kubevela: add openfaas workload 2020-11-13 16:14:33 -08:00
Hongchao Deng
9fcfb7e1df Merge pull request #603 from resouer/rollout
Fix nits in rollout ref doc
2020-11-13 16:07:01 -08:00
Harry Zhang
8d4fe38cc3 Fix nits in rollout ref doc 2020-11-13 15:33:08 -08:00
Hongchao Deng
48052e59ee Merge pull request #599 from hongchaodeng/cli2
update descriptions of capabilities
2020-11-13 14:27:47 -08:00
Hongchao Deng
b0c9e4b78a update descriptions of capabilities 2020-11-13 12:38:45 -08:00
Hongchao Deng
4e7af35e61 Merge pull request #598 from hongchaodeng/cli
upate descriptions of commands
2020-11-13 12:38:18 -08:00
Hongchao Deng
4264a63613 Merge pull request #600 from resouer/fix
Fixe several nits in the doc and guide
2020-11-13 12:38:02 -08:00
Harry Zhang
f90140ee5b Fixe several nits in the doc and guide 2020-11-13 12:35:19 -08:00
Hongchao Deng
57dc83976d upate descriptions of commands
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-13 12:31:57 -08:00
Hongchao Deng
2a88bf271a Merge pull request #596 from resouer/dev
Hide empty docs
2020-11-13 11:39:18 -08:00
Harry Zhang
84a17764ed Hide empty docs 2020-11-13 10:59:14 -08:00
Hongchao Deng
98a6d7a8cf Merge pull request #594 from resouer/dev
Fix typos in docs
2020-11-13 10:21:28 -08:00
Harry Zhang
dd5a74235d Fix typos in docs 2020-11-13 10:18:33 -08:00
Jianbo Sun
c10cbead76 Merge pull request #592 from hongchaodeng/cli
clean up vela cli help info to be app focused
2020-11-13 15:58:29 +08:00
Hongchao Deng
28e417ef47 add init to get start
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-12 22:09:59 -08:00
Hongchao Deng
43a674b6f7 unify format 2020-11-12 21:09:47 -08:00
Hongchao Deng
cfab53f97b clean up vela cli help info to be app focused 2020-11-12 21:04:37 -08:00
Hongchao Deng
df7dca81da Merge pull request #586 from wonderflow/froute
go through rollout with kind cluster and fix bugs
2020-11-12 19:45:40 -08:00
andy shi
22b6e87d58 revise cloud service doc (#591)
* first version cloud-service

* revise cloud service doc

* remove sensitive information
2020-11-13 11:44:10 +08:00
Jianbo Sun
4b768c49a6 Merge pull request #587 from tossmilestone/add-missing-command-type
Add missing TagCommandType
2020-11-13 11:43:06 +08:00
天元
cd4615405f updated oam-k8s-runtime and go through rollout fix bugs
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-13 11:24:49 +08:00
Jianbo Sun
ccc3576a4c Merge pull request #566 from zzxwill/docs-autoscale
Revise autoscaler doc with appfile focused
2020-11-13 11:08:50 +08:00
zzxwill
3dd5e493c6 update reference doc 2020-11-13 10:22:36 +08:00
Xiaoxi He
e120e141ee Add missing TagCommandType 2020-11-13 00:14:20 +08:00
zzxwill
e794da5492 fix unit-test issue 2020-11-12 20:01:45 +08:00
zzxwill
7031e04c75 Revise Autoscaler doc with appfile focused
- Splitted autoscale docs to be appfile focused,
and add cpu utilization scaling policy for appfile
- Allow user to input parameter with int type, like
10 instead of "10"
- Change cpuRequest/cpu to proper names

To fix #564
2020-11-12 19:02:14 +08:00
Jianbo Sun
e8de0e29df Merge pull request #584 from wonderflow/remove
remove annotation for apiversion and kind, use discoverymapper instead
2020-11-12 15:58:53 +08:00
天元
d67ce4d2a1 refactor server and fix CI
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-12 15:19:50 +08:00
天元
40ab610a8e remove annotation for apiversion and kind, use discoverymapper instead
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-12 12:04:08 +08:00
Hongchao Deng
78b1c5b32c Merge pull request #582 from hongchaodeng/ci
CI: ignore all markdown changes
2020-11-11 19:54:11 -08:00
Hongchao Deng
7b957df709 Merge pull request #583 from resouer/dev
Fix typo in previous fix
2020-11-11 19:44:35 -08:00
Hongchao Deng
3edc6ed317 CI: ignore all markdown changes 2020-11-11 19:42:41 -08:00
Harry Zhang
c43dad4907 Fix typo 2020-11-11 19:42:37 -08:00
Hongchao Deng
b4b9fcfaf0 Merge pull request #579 from resouer/dev
Focus on appfile in docs part 3 (w/ ref docs)
2020-11-11 19:40:37 -08:00
Harry Zhang
3af42feb02 Focus on appfile in docs part 3 (w/ ref docs) 2020-11-11 19:19:42 -08:00
Lei Zhang (Harry)
16ddba80b3 Merge pull request #581 from hongchaodeng/image
fix metrics image and merge resource folders
2020-11-11 19:09:43 -08:00
Jianbo Sun
32bb102a86 Merge pull request #573 from wonderflow/raw
keep silence when no Capability discovered && clean code
2020-11-12 11:08:38 +08:00
Hongchao Deng
0fcc6498cb fix metrics image and merge resource folders
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-11 19:00:05 -08:00
天元
ab72ddbea4 clean code
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-12 10:54:21 +08:00
Lei Zhang (Harry)
10d360c03c Merge pull request #580 from hongchaodeng/doc
vela up support url, fix scale/rollout/metrics to focus on appfile, fix reference doc
2020-11-11 18:09:10 -08:00
Hongchao Deng
4b609e0fff vela up support url, fix scale/rollout/metrics to focus on appfile, fix reference doc
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-11 17:13:24 -08:00
Lei Zhang (Harry)
49e8aca2bd Merge pull request #571 from wonderflow/fixlink
fix link
2020-11-11 11:18:49 -08:00
天元
c5ecd0aff3 keep silence when no Capability discovered 2020-11-11 17:44:32 +08:00
Jianbo Sun
adac554333 Merge pull request #570 from wonderflow/fixrollout
update rollout doc
2020-11-11 17:24:14 +08:00
天元
c6e15fae2d add reference doc
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-11 17:19:23 +08:00
天元
7f75d22ab6 fix link
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-11 17:10:26 +08:00
Jianbo Sun
e148a901a9 Merge pull request #569 from wonderflow/redou
delete redundant example folder, it's docs/examples
2020-11-11 17:08:48 +08:00
天元
9c5e156e23 update rollout doc 2020-11-11 16:59:50 +08:00
天元
626eb5eb68 delete redundant example folder, it's docs/examples 2020-11-11 16:35:35 +08:00
Jianbo Sun
72f3d22942 Merge pull request #567 from wonderflow/init
update vela init UI
2020-11-11 16:28:19 +08:00
天元
07351d9dd7 update vela init UI
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-11 16:16:01 +08:00
Hongchao Deng
6ac7e88a63 Merge pull request #563 from resouer/fix
Focus on appfile in docs (part 2)
2020-11-10 19:14:03 -08:00
Harry Zhang
36d2b9e761 Focus on appfile in docs (part 2) 2020-11-10 17:36:56 -08:00
Hongchao Deng
1681fe7de2 Merge pull request #561 from hongchaodeng/ci
ignore dashboard build on doc change
2020-11-10 15:33:50 -08:00
Hongchao Deng
214a5ee4aa Merge pull request #562 from resouer/doc
Fix the previous missing directory
2020-11-10 15:31:30 -08:00
Harry Zhang
e69548a72a Seperate install and getting started. 2020-11-10 15:26:03 -08:00
Lei Zhang (Harry)
877b7b8cb6 Merge pull request #560 from oam-dev/revert-558-doc
Revert "Focus on appfile in docs (part 1)"
2020-11-10 15:25:14 -08:00
Hongchao Deng
2476f83b1b ignore dashboard build on doc change 2020-11-10 15:21:38 -08:00
Lei Zhang (Harry)
c9929cf7cf Revert "Focus on appfile in docs (part 1)" 2020-11-10 15:18:37 -08:00
Hongchao Deng
8b9c927572 Merge pull request #558 from resouer/doc
Focus on appfile in docs (part 1)
2020-11-10 15:04:13 -08:00
Hongchao Deng
b59fe17f4d Merge pull request #559 from Fei-Guo/master
Revise design.md
2020-11-10 15:01:34 -08:00
Harry Zhang
645fd3f917 Focus on appfile in docs (part 1) 2020-11-10 14:54:14 -08:00
Lei Zhang (Harry)
15e1564983 Merge pull request #556 from hongchaodeng/ci
make CI ignore doc change
2020-11-10 14:38:56 -08:00
Guo, Fei
c24c039b15 Address review comments 2020-11-10 14:34:26 -08:00
Guo, Fei
8e2205ef07 Revise design.md 2020-11-10 14:19:26 -08:00
Hongchao Deng
cd3c91b537 make CI ignore doc change 2020-11-10 11:01:51 -08:00
Lei Zhang (Harry)
f6e3fc31d1 Merge pull request #554 from hongchaodeng/doc
fix doc link
2020-11-10 10:10:19 -08:00
Hongchao Deng
1f5d3bde7b fix link 2020-11-10 09:21:17 -08:00
Jianbo Sun
0fc1c3132e Merge pull request #546 from zzxwill/issue-autoscaler
Fix autoscale inconsistence UI
2020-11-10 20:47:48 +08:00
Jianbo Sun
f18ee6586a Merge pull request #540 from wonderflow/rollout
support rollout trait
2020-11-10 20:39:16 +08:00
zzxwill
da8457fbf0 Fix autoscale inconsistence UI
fixed autoscale Cli and Appfile inconsistence
and refactor `vela status` output for autoscale
2020-11-10 20:30:04 +08:00
天元
29e97a6040 fix doc 2020-11-10 20:22:39 +08:00
天元
5c0f26c6f6 fix doc gen path 2020-11-10 20:16:15 +08:00
天元
fd3f300901 support rollout trait
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-10 20:13:27 +08:00
guoxudong
025ce5d74d move website & keep design md (#551)
* move website & keep design md

* fix

* update README

* fix

* fix

* rename

* fix
2020-11-10 20:09:13 +08:00
Hongchao Deng
bbb2c527d9 Merge pull request #543 from hongchaodeng/doc
README: update doc link to website
2020-11-09 13:03:26 -08:00
Hongchao Deng
65db8753de README: update doc link to website 2020-11-09 12:52:15 -08:00
Jianbo Sun
890aef14f3 Merge pull request #539 from lujinda/fix
Fix `capabilities system of OAM` links
2020-11-09 21:23:21 +08:00
lujinda
7371496f27 Fix capabilities system of OAM links 2020-11-09 20:27:36 +08:00
Jianbo Sun
f792bf2bbf Merge pull request #535 from zzxwill/issue-ls
Fix `vela ls` issue
2020-11-09 12:28:48 +08:00
zzxwill
9ca4f64030 Fix vela ls issue
By default, all svc deployed without `--staging` will appear
to be `staging` in cmd `vela ls`.
To fix #534
2020-11-09 11:34:07 +08:00
Jianbo Sun
d5909a13f3 Merge pull request #532 from resouer/typo
Minor fixes in design and readme
2020-11-09 10:31:34 +08:00
Jianbo Sun
9b5c72e5ad Merge pull request #533 from captainroy-hy/enhance-cap-list
Don't output all existing caps during vela workloads/traits
2020-11-09 10:23:02 +08:00
roy wang
88d3042767 remove vela system update command
sync caps from cluster before `vela env init`

fix e2e-test

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-11-08 16:42:40 +09:00
Harry Zhang
9f6e53269d Minor fixes in design and readme 2020-11-07 22:11:29 -08:00
roy wang
66f157cca7 not output all existing caps during vela workloads/traits
Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-11-07 17:53:26 +09:00
Hongchao Deng
94fad7229b Merge pull request #530 from hongchaodeng/doc-cap
doc: add managing caps
2020-11-06 19:11:17 -08:00
Hongchao Deng
2b71fd5201 add back traits doc 2020-11-06 18:59:49 -08:00
Hongchao Deng
a199c1f009 fix cap uninstall 2020-11-06 17:57:46 -08:00
Hongchao Deng
936b4dfa32 doc: add cap center
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-06 17:57:44 -08:00
andy shi
35f3b68d45 first version cloud-service (#517)
* first version cloud-service

* change working directory
2020-11-06 17:45:45 -08:00
Zheng Xi Zhou
91f47586cf Autoscaler for appfile (#510)
* Autoscaler for appfile

completed spec.extension.template to support autoscale in
cli and appfile

* add alias name  to cpuRequest in Cli for deploying webservice
2020-11-07 07:54:59 +08:00
Jianbo Sun
37bbc37fa2 Merge pull request #527 from furykerry/changerun
remove vela app & vela app run cli options
2020-11-06 23:24:58 +08:00
守辰
a9ea45370d remove vela app & vela app run cli options
Signed-off-by: 守辰 <shouchen.zz@alibaba-inc.com>
2020-11-06 19:23:01 +08:00
Jianbo Sun
a9d7e3844b Merge pull request #525 from wonderflow/revisonroute
only choose OAM app labels for route trait
2020-11-06 15:49:18 +08:00
天元
0d2c251b45 only choose OAM app labels for route trait
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-06 15:35:42 +08:00
Jianbo Sun
b02b0db950 Merge pull request #524 from Fei-Guo/master
Revise concepts.md
2020-11-06 15:23:30 +08:00
Guo, Fei
b2db04e8c2 Revise conecepts.md 2020-11-05 23:04:07 -08:00
Jianbo Sun
c23ff6810a Merge pull request #518 from silotrd/master
Function SyncCapabilityFromCenter Called twices.
2020-11-06 14:56:03 +08:00
Jianbo Sun
9a6523cade Merge pull request #523 from wonderflow/replica
don't specify replica in template
2020-11-06 14:44:48 +08:00
linjie.miao
e52d173d57 SyncCapabilityFromCenter This function is
called one more time.
2020-11-06 14:43:51 +08:00
天元
9a27c604b1 don't specify replica in template
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-06 14:30:17 +08:00
Jianbo Sun
d91c5b9bfe Merge pull request #520 from wonderflow/fixrace
fix datarace for map
2020-11-06 13:50:13 +08:00
天元
b7cdedd0cb fix datarace for map, fix #444 2020-11-06 13:22:00 +08:00
Jianbo Sun
1c67b6ea16 Merge pull request #519 from wonderflow/removename
don't specify name for workload object in component
2020-11-06 13:21:34 +08:00
天元
630e27f762 don't add name for workload object 2020-11-06 13:05:40 +08:00
Lei Zhang (Harry)
35ae4109bc Merge pull request #516 from resouer/concepts
Add concepts doc to kubevela
2020-11-05 21:02:45 -08:00
Harry Zhang
81df4e23af Add concepts doc to kubevela 2020-11-05 20:50:21 -08:00
Jianbo Sun
1e6c3d66c5 Merge pull request #515 from Fei-Guo/master
Some corrections for QuickStart.md
2020-11-06 09:58:09 +08:00
Hongchao Deng
86f05cf47a minor update (#514)
the copy-paste friendly thing could be handled on website.
2020-11-05 12:09:51 -08:00
Guo, Fei
f02982b6a1 Some corrections for QuickStart.md 2020-11-05 12:07:07 -08:00
Jianbo Sun
5ca9aa4ed2 Merge pull request #513 from silotrd/master
The return value of `vela ls` must contain the TYPE and TRAITS fields.
2020-11-05 18:18:00 +08:00
linjie.miao
2b47a934d3 The return value of vela ls must contain the TYPE and TRAITS fields. 2020-11-05 15:39:37 +08:00
Jianbo Sun
1736efb33c Merge pull request #512 from hongchaodeng/doc
minor update on extending vela
2020-11-05 13:49:21 +08:00
Hongchao Deng
3dcd861d0c minor update on extending vela
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-04 20:43:34 -08:00
Hongchao Deng
1809b47bb9 doc: add extending vela (#511)
* doc: add extending vela

- also rename in `system update` name -> type, type -> category

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* github action: fixed ubuntu version

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* update
2020-11-05 10:09:29 +08:00
Jianbo Sun
d621cc34b6 Merge pull request #505 from captainroy-hy/combine-sys-update
update local caps before listing workloads&traits
2020-11-05 07:48:18 +08:00
roy wang
24c7f23e8a update local caps before listing workloads&traits
refine output of `vela system update`

add e2e-test

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-11-05 01:40:03 +09:00
Hongchao Deng
6efb68f51f Merge pull request #506 from silotrd/master
Logs need to be printed in real time when vela executes docker command
2020-11-04 07:39:42 -08:00
Jianbo Sun
2121fa6cc1 Merge pull request #500 from zzxwill/docs-scale
Add Autoscaler docs and support cli and appfile
2020-11-04 14:32:20 +08:00
Jianbo Sun
f19d8be2f6 Merge pull request #509 from hongchaodeng/e2e
skip capability e2e due to rate limit
2020-11-04 14:30:56 +08:00
Hongchao Deng
ce286701a2 Merge pull request #508 from hongchaodeng/doc-extend
Update CLI printout in various docs
2020-11-03 21:46:39 -08:00
Hongchao Deng
6b4325eebc skip capability e2e due to rate limit
plan to change e2e into a mock UT to avoid remote call.

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-03 21:37:35 -08:00
Hongchao Deng
6ca3381882 update kubecon demo 2020-11-03 21:30:17 -08:00
Hongchao Deng
6ec5799ce4 update cli printout 2020-11-03 21:21:27 -08:00
Hongchao Deng
8b028fff31 Merge pull request #507 from Fei-Guo/master
Some revisions for the printed out messages
2020-11-03 21:11:15 -08:00
Guo, Fei
08c784506e fix a nit 2020-11-03 20:50:21 -08:00
Guo, Fei
e6b5e11311 Clean up for printed messages 2020-11-03 20:48:11 -08:00
linjie.miao
5c7f37f034 When executing commands such as docker build/push, logs are
required to be printed to the console in real time.
2020-11-04 11:57:46 +08:00
zzxwill
81d40a2f51 Wrongly rebased newly merged requests from comments, fixed it.
co-authored-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-04 11:39:05 +08:00
Hongchao Deng
27621463fd Merge pull request #504 from hongchaodeng/doc
doc: add app init, config, and capability references
2020-11-03 19:35:59 -08:00
Hongchao Deng
e20b6c9bf4 doc: add app init, config, and capability references
additionally:

- change backend workload type to worker
- add cue format script

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-11-03 19:25:41 -08:00
Jianbo Sun
2c7391f2d0 Merge pull request #502 from wonderflow/metrics
start promethus instance on installation
2020-11-03 16:37:20 +08:00
天元
5066320a2f start promethus instance on installation
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-03 16:15:46 +08:00
Lei Zhang (Harry)
31bc537b5d Merge pull request #501 from Fei-Guo/master
Fix some small nits for introduction
2020-11-02 21:26:20 -08:00
Guo, Fei
b2750906fa Fix some small nits for introduction 2020-11-02 21:07:43 -08:00
zzxwill
d082502406 Add Autoscaler docs and support cli and appfile
added Autoscaler docs and add spec.extension.template
for cli and appfile
2020-11-03 12:02:23 +08:00
Jianbo Sun
0afddf945a Merge pull request #487 from resouer/followup
Follow up introduction doc
2020-11-03 11:13:24 +08:00
Harry Zhang
104c33403e Follow up introduction doc 2020-11-02 18:54:34 -08:00
Hongchao Deng
3097a46a04 Merge pull request #493 from wonderflow/metrics
fix metric capability and add tutroial
2020-11-02 08:27:35 -08:00
Jianbo Sun
526712d56c Merge pull request #498 from FillZpp/fix-defer-in-main
Fix invalid defer in waitWebhookSecretVolume
2020-11-02 21:06:52 +08:00
Siyu Wang
2cfa7b7ec7 Fix invalid defer in waitWebhookSecretVolume
Signed-off-by: Siyu Wang <FillZpp.pub@gmail.com>
2020-11-02 20:13:30 +08:00
天元
26b6327919 fix metric capability and add tutroial
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-11-02 15:50:20 +08:00
Hongchao Deng
0168f5fdda Merge pull request #496 from hongchaodeng/doc-init
doc for quick start, exec/logs/port-forward; add render-only to init cmd
2020-11-01 23:46:12 -08:00
Hongchao Deng
c02e3a7b54 doc: add quickstart, exec/logs/portforward 2020-11-01 23:34:12 -08:00
Hongchao Deng
7cfc80cd41 add render-only to ini cmd and ignore route if domain is empty 2020-11-01 23:34:12 -08:00
Jianbo Sun
e043e6b764 Merge pull request #497 from zzxwill/doc-vela-status-show
Add unit-test for `vela up`
2020-11-02 14:45:05 +08:00
zzxwill
33ed0a9a20 Add unit-test for vela up
During to decrease of code coverage, added unit-test
for `vela up`
2020-11-02 14:24:38 +08:00
Jianbo Sun
7d021d6e89 Merge pull request #495 from zzxwill/doc-vela-status-show
Update `vela show/status` related docs
2020-11-02 13:07:07 +08:00
zzxwill
f77999e8dc Update related vela show/status docs
updated related `vela show/status` docs, also update
`vela ls/delete` related documentation
2020-11-02 11:49:48 +08:00
Hongchao Deng
6fb615be73 Merge pull request #445 from szihai/master
Add Kubecon demo page
2020-11-01 19:10:47 -08:00
Zheng Xi Zhou
5f34351706 Merge pull request #480 from zzxwill/app-status
Refactor "vela status"
2020-11-02 09:57:21 +08:00
szihai
b6be560ad0 use webservice based on podspecworkload 2020-11-01 13:06:36 -08:00
szihai
371cfa3a57 add webservice template 2020-11-01 09:44:09 -08:00
zzxwill
435ac44cbf fix issue 'ineffectual assignment to err' 2020-11-01 21:09:37 +08:00
zzxwill
c212ac93ff revert modification for make manifests 2020-11-01 16:25:18 +08:00
zzxwill
865c52e883 Refactor "vela status"
merged `vela app status` and `vela svc status`
to `vela status`.
To fix #474
2020-11-01 16:25:17 +08:00
Zheng Xi Zhou
e58d705a8b Merge pull request #478 from zzxwill/app-show
Refactor `vela show`
2020-11-01 11:44:04 +08:00
zzxwill
0a3b3ffdb1 address Wonderflow's offline advice 2020-11-01 10:02:49 +08:00
Jianbo Sun
a4be8bbbe1 Merge pull request #490 from hongchaodeng/doc-fix
fix installation link and minor update on intro
2020-11-01 09:00:21 +08:00
Hongchao Deng
27bb0f8844 fix installation link
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-31 15:30:18 -07:00
Ryan Zhang
7e5e2de263 Merge pull request #489 from zzxwill/null-yaml
Fix `charts/vela-core/crds/_.yaml` generation issue
2020-10-31 14:47:46 +08:00
zzxwill
cc93367b22 Fix charts/vela-core/crds/_.yaml generation issue
Fixed the issue of `charts/vela-core/crds/_.yaml` generation
by removing unkonwn struct in pkg/commands/show.go.
2020-10-31 13:43:10 +08:00
Hongchao Deng
9c5c3f879f Merge pull request #488 from hongchaodeng/ing
remove ingress from velaConfig and add it in install.md
2020-10-30 22:36:39 -07:00
Hongchao Deng
5bda371861 remove ingress from velaConfig and add it in install.md
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-30 22:22:57 -07:00
Jianbo Sun
94aa38640a Merge pull request #485 from hongchaodeng/fixing
fix check route status when using local kind
2020-10-31 13:07:48 +08:00
Hongchao Deng
d44832aa01 Merge pull request #486 from hongchaodeng/fix-scale
update manualscale cue template and appfile guide
2020-10-30 21:52:38 -07:00
Hongchao Deng
8b3c2104bc update manualscale cue to set default replica 1 and update appfile example to exclude scaler trait 2020-10-30 21:14:53 -07:00
Hongchao Deng
d003a6652d fix check route status when using local kind 2020-10-30 20:56:37 -07:00
zzxwill
6ffee730ec Update cli docs 2020-10-31 11:52:12 +08:00
zzxwill
838995e816 Refactor vela show
Merge `vela app show` and `vela svc show` in `vela show`
to display all details information of an application
2020-10-31 11:52:12 +08:00
Jianbo Sun
c51f4d5074 Merge pull request #484 from hongchaodeng/doc-exec
doc: separate appfile chapter into a few sections to gradually add traits, workloads
2020-10-31 10:33:16 +08:00
Jianbo Sun
c8fc39370e Merge pull request #483 from hongchaodeng/fix-ing
fix ingress rewrite-target
2020-10-31 10:22:54 +08:00
Hongchao Deng
9c2b75d9af update
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-30 19:07:00 -07:00
Hongchao Deng
9be4316256 doc: separate appfile chapter into a few sections to gradually add traits, workloads
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-30 19:07:00 -07:00
Hongchao Deng
854e88f385 fix ingress rewrite-target 2020-10-30 17:20:02 -07:00
Lei Zhang (Harry)
085151cf1f Merge pull request #477 from Fei-Guo/master
Revise introduction.md
2020-10-30 15:10:09 -07:00
szihai
0381b0fb95 updated crossplane charts, README, and db workload template 2020-10-30 14:51:46 -07:00
Guo, Fei
bb3111d68d Change Kubevela to KubeVela 2020-10-30 14:49:40 -07:00
Guo, Fei
cf19fed17f Revise based on review comments 2020-10-30 14:37:39 -07:00
Hongchao Deng
f94d2128d9 Merge pull request #481 from zzxwill/cli-description
Refine some minor Cli description
2020-10-30 11:10:18 -07:00
Hongchao Deng
2632617e70 Merge pull request #482 from silotrd/master
[Feature #443] should report capability not exist instead of file not found
2020-10-30 11:07:58 -07:00
root
f4f0d92a74 [Feature #443] should report capability not exist instead of file not found #433 2020-10-30 16:56:37 +00:00
zzxwill
85aa774dd4 Refine some Cli description
Refined some description and adjust cli order in `-h`
2020-10-30 23:28:02 +08:00
Hongchao Deng
aea6fd4589 Merge pull request #476 from hongchaodeng/doc-appfile
Add appfile tutorial and fix code
2020-10-30 00:19:39 -07:00
Hongchao Deng
629ceee307 fix
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-30 00:08:15 -07:00
Guo, Fei
deb73c34fa Format change 2020-10-29 23:22:52 -07:00
Guo, Fei
54ac8eb6c2 revise introduction 2020-10-29 23:06:37 -07:00
Hongchao Deng
2451236791 update install guide 2020-10-29 22:41:31 -07:00
Hongchao Deng
8fdf48eac1 Add appfile tutorial and fix code
includes:
- fix up command to save appfile to env dir
- update cue template to include cmd and config
- move design to doc/design
2020-10-29 22:41:07 -07:00
Jianbo Sun
5cc97bc2c0 Merge pull request #475 from wonderflow/newroute
merge vela app/svc delete to vela delete
2020-10-30 11:58:45 +08:00
天元
f016ada842 merge vela app/svc delete to vela delete
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-10-30 11:42:27 +08:00
Zhe Jiang
24ef896142 Spelling mistakes (#471)
* Spelling mistakes

* Update docs/install.md

Co-authored-by: Jianbo Sun <wonderflow.sun@gmail.com>
2020-10-30 09:56:45 +08:00
Lei Zhang (Harry)
488cc9d545 Merge pull request #469 from resouer/docs
Rename owners file and update design doc
2020-10-29 15:48:06 -07:00
Harry Zhang
f0fe340d7d Update design doc to reflect recent idea 2020-10-29 15:21:35 -07:00
Lei Zhang (Harry)
c87594ad04 Merge pull request #472 from hongchaodeng/doc
fix and clean up charts
2020-10-29 15:03:25 -07:00
Hongchao Deng
391a1e5e89 add codecov.yml
disable patch status
2020-10-29 14:35:55 -07:00
Hongchao Deng
72d0284454 install.md: update clean CRD section 2020-10-29 14:17:38 -07:00
Hongchao Deng
0ef3d8650b fix and clean up charts
currently the charts has following issues:
- cert-manager has manifests in multiple places. Should be combined into one.
  Prefer pure yaml since its helm chart requires `--set installCRDs=true` flag and uninstalling CRD via helm is inconvient.
- The bootstrap of vela-core will setup metrics controller. This requires Prometheus Operator CRD. Move related CRD to vela-core chart.
- move prometheus to vela-system namespace. Remove monitoring namespace.
- remove grafana. It's already a dependency of prometheus chart.
- change default image pull policy to IfNotPresent. Should not be Always.

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-29 13:56:33 -07:00
Jianbo Sun
7150d71716 Merge pull request #450 from wonderflow/newroute
add route tuturiol
2020-10-29 17:59:35 +08:00
天元
091b70deba add route tuturiol
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-10-29 17:36:51 +08:00
Jianbo Sun
8e0641baca Merge pull request #470 from captainroy-hy/vela-portforward
vela port-forward
2020-10-29 15:34:29 +08:00
Hongchao Deng
4426133c43 Fix vela install to include all dependencies (#467)
* Fix vela install to include all dependencies

rewrite server dependency component install:

- Don't rely on crd name. Continue installing all charts.
- Rewrite signal handler to uninstall dependencies before exiting.

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* fix

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-29 15:24:02 +08:00
roy wang
32daa8f280 vela port-forward
add unit test and e2e test
refresh cli doc of vela port-forward

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-29 16:21:33 +09:00
Harry Zhang
0f85f9763d Rename owners file 2020-10-28 15:00:07 -07:00
Lei Zhang (Harry)
1c3f7f925e Merge pull request #452 from resouer/dev
Add onwers file and fix typo
2020-10-28 14:58:20 -07:00
Harry Zhang
aae80847a1 Add onwers file and fix typo 2020-10-28 14:30:50 -07:00
Lei Zhang (Harry)
4d30423d55 Add introducation doc (#459) 2020-10-28 11:45:43 -07:00
Jianbo Sun
e9b4257107 Merge pull request #456 from captainroy-hy/refresh-cli-docs
refresh cli docs
2020-10-28 13:29:49 +08:00
Hongchao Deng
b52fc92e93 change podspec workload to deployment in built-in templates (#458)
* change podspec workload to deployment in built-in templates

* fix

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-28 13:28:27 +08:00
roy wang
1522280e50 refresh cli docs
Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-28 14:16:19 +09:00
Hongchao Deng
5f4a55f594 Merge pull request #457 from hongchaodeng/kind
e2e: delete kind cluster at the end
2020-10-27 21:10:09 -07:00
Hongchao Deng
42115e7774 e2e: delete kind cluster in setup
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-27 20:55:50 -07:00
Jianbo Sun
137b56cb03 Merge pull request #455 from hongchaodeng/runner
setup and use self hosted runner
2020-10-28 10:00:10 +08:00
Jianbo Sun
c25a22a17d Merge pull request #449 from captainroy-hy/term-service
change term "component" to "service" in commands
2020-10-28 09:51:11 +08:00
Hongchao Deng
cf22e96b37 Merge pull request #454 from resouer/roadmap
Add roadmap doc and update extending doc
2020-10-27 18:30:40 -07:00
Hongchao Deng
82f5ee0bd3 setup and use self hosted runner 2020-10-27 15:49:43 -07:00
Harry Zhang
e827da2db2 Add roadmap doc and update extending doc 2020-10-27 14:36:18 -07:00
szihai
ac4b948a4e Merge branch 'master' of https://github.com/szihai/kubevela 2020-10-27 10:40:37 -07:00
szihai
782664696f move to /example folder 2020-10-27 10:38:31 -07:00
roy wang
69944f9dad change term "component" to "service" in commands
Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-27 19:31:24 +09:00
Jianbo Sun
5dd91add89 Merge pull request #447 from wonderflow/fixdoc
fix doc gen path
2020-10-27 17:06:21 +08:00
Jianbo Sun
d2452ad8ef Merge pull request #446 from wonderflow/oam-runtime
upgrade oam-k8s-runtime dependency
2020-10-27 17:06:01 +08:00
Hongchao Deng
b8cb0565a8 Merge pull request #439 from hongchaodeng/template
update templates
2020-10-27 02:00:46 -07:00
Hongchao Deng
ac9a2a2b81 fix e2e
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-27 01:38:10 -07:00
天元
4d4ea8f3c4 fix doc gen path 2020-10-27 15:48:44 +08:00
天元
4c70136ba1 upgrade oam-k8s-runtime dependency 2020-10-27 15:32:42 +08:00
Hongchao Deng
f962dc0f11 fix ut 2020-10-26 23:38:11 -07:00
Hongchao Deng
95823cdcdb fix 2020-10-26 23:19:59 -07:00
Hongchao Deng
182805c9ca move and remove extra parameter def
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-26 23:14:48 -07:00
Jianbo Sun
1c1508b0c3 Merge branch 'master' into master 2020-10-27 13:52:11 +08:00
Hongchao Deng
cba72cb6e6 fix e2e
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-26 21:52:18 -07:00
Hongchao Deng
cff6a74430 capability: use def name as name
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-26 20:51:16 -07:00
Hongchao Deng
e9186fa8eb fix plugin test 2020-10-26 20:51:16 -07:00
Hongchao Deng
3d17464c44 fix trait definition
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-26 20:51:16 -07:00
Hongchao Deng
eed2e2f219 fix
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-26 20:51:16 -07:00
Hongchao Deng
16d3cbd5a4 add readme 2020-10-26 20:51:16 -07:00
Hongchao Deng
80cf81e4d5 update templates
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-26 20:51:16 -07:00
szihai
f92cdcefe4 polish for pr 2020-10-26 20:10:36 -07:00
Jianbo Sun
ea836ee2eb Merge pull request #438 from wonderflow/scale
Implement Autoscaler Trait
2020-10-27 10:45:00 +08:00
天元
0990e6fa64 fix autoscaler
Signed-off-by: 天元 <jianbo.sjb@alibaba-inc.com>
2020-10-27 10:19:26 +08:00
Lei Zhang (Harry)
2b0759bcff Minor fix on doc framework (#442) 2020-10-26 16:31:38 -07:00
Lei Zhang (Harry)
d425ded75c Merge pull request #440 from resouer/init-doc
Bootstrap docs for kubevela
2020-10-26 15:02:00 -07:00
Harry Zhang
ec5b45a428 Init docs for kubevela
Move non user facint things into e2e
2020-10-26 14:34:22 -07:00
szihai
2e71e21991 add route 2020-10-26 01:45:11 -07:00
Jianbo Sun
24a92c9cbc Merge pull request #437 from captainroy-hy/app-centric
refact cmds from comp-centric into app-centric style
2020-10-26 15:29:35 +08:00
roy wang
410eb2be2b refact cmds from comp-centric into app-centric style
Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-26 15:05:37 +09:00
zzxwill
fecf1a710d Implement Autoscaler Trait
Support Cron type and resource usages (cpu) type
scalling

integrate with OAM by getting child deployment resource via OAM util library

support scaling PodSpecWorkload

support deployment scaling

remove unnecessary comment

support KEDA cron + resource metrics with Keda context

fix ownerreference issue

reorg imports

address part of commemts and refactor code

revert ownerRef settings as somehome leaving spec.replicas doesn't work
2020-10-26 13:39:31 +08:00
szihai
75a7ad4139 formatting 2020-10-25 22:10:53 -07:00
szihai
e874f68f39 formatting 2020-10-25 22:09:59 -07:00
szihai
4bd850853f add sections 2020-10-25 22:00:22 -07:00
Jianbo Sun
fe5f4b1680 Merge pull request #434 from ryanzhang-oss/add-scale
Add Flagger OAM integration example README
2020-10-26 12:33:56 +08:00
Jianbo Sun
297131d23d Merge pull request #435 from captainroy-hy/cap-template-URI
fix getting CUE template from remote
2020-10-26 12:33:04 +08:00
Jianbo Sun
6cf7a30dd4 Merge pull request #436 from hongchaodeng/master
make default appfile as vela.yaml
2020-10-26 12:31:56 +08:00
Jianbo Sun
755e134b87 Merge pull request #428 from captainroy-hy/vela-exec
vela exec
2020-10-26 11:40:27 +08:00
Hongchao Deng
192f435cfc make default appfile as vela.yaml 2020-10-25 19:34:28 -07:00
szihai
c5baa3ea19 update workload type 2020-10-25 19:32:38 -07:00
szihai
45f4e7d575 change db port 2020-10-25 11:09:48 -07:00
Ryan Zhang
64da6af3dc add podSpec test 2020-10-25 22:53:06 +08:00
roy wang
879427176d fix getting CUE template through URI
fix e2e-test

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-25 23:42:32 +09:00
szihai
0962a6f776 add vela.yml 2020-10-25 01:42:50 -07:00
szihai
11d8f63e63 fix typo 2020-10-25 01:21:23 -07:00
szihai
f3e17ef90a fix typo 2020-10-25 00:38:28 -07:00
szihai
fbca8aab49 fix comp names for lab 2020-10-25 00:26:56 -07:00
szihai
770ecb3848 corrects to steps 2020-10-24 23:24:35 -07:00
roy wang
be6122edc3 vela exec
Signed-off-by: roy wang <seiwy2010@gmail.com>

add unit test

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-25 14:56:37 +09:00
szihai
26ca8b85da working template 2020-10-24 10:59:11 -07:00
szihai
791578ee0c modify readme 2020-10-24 10:51:46 -07:00
Ryan Zhang
109e807d17 add flagger rollout example README 2020-10-24 19:26:27 +08:00
Ryan Zhang
d3466a0c4a document 2020-10-24 17:14:07 +08:00
szihai
c810e9494c add demo scripts 2020-10-24 00:18:05 -07:00
Hongchao Deng
037f14806a Merge pull request #431 from hongchaodeng/configcmd
vela config command
2020-10-23 20:09:02 -07:00
Hongchao Deng
941f5a973a add unit test for config cmd 2020-10-23 19:50:07 -07:00
Hongchao Deng
b11ccee60d add unit test for config in appfile
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-23 19:28:50 -07:00
Hongchao Deng
1b82e3ae2a vela config command
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-23 13:49:10 -07:00
Hongchao Deng
da05d71014 Merge pull request #429 from hongchaodeng/fix-image
remove image constraint
2020-10-23 13:43:52 -07:00
Hongchao Deng
f2825f2181 remove image constraint
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-23 13:14:14 -07:00
Hongchao Deng
125a0ce081 Merge pull request #426 from hongchaodeng/configcmd
fix naming
2020-10-22 20:03:46 -07:00
Hongchao Deng
c4a8d31073 fix naming 2020-10-22 17:05:30 -07:00
Jianbo Sun
e286862c59 Merge pull request #422 from mosesyou/feature-up-file
add support for `vela up` specify file path
2020-10-22 23:09:35 +08:00
mosesyou
faaaf5fd59 add support for vela up specify file path 2020-10-22 14:35:41 +08:00
Jianbo Sun
cbc8a90152 Merge pull request #423 from wonderflow/fix
fix label not int
2020-10-22 13:20:00 +08:00
天元
3082b7b9dd fix label not int 2020-10-22 12:22:50 +08:00
Hongchao Deng
6675b8a806 Merge pull request #421 from hongchaodeng/master
fix codecov
2020-10-21 18:49:51 -07:00
Hongchao Deng
8b0764e170 fix codecov
Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-21 17:15:13 -07:00
Jianbo Sun
204a578aaa Merge pull request #401 from captainroy-hy/check-oam-pod
wait until runtime ready during vela install
2020-10-21 17:42:54 +08:00
roy wang
de28c06af5 wait until runtime ready during vela install
check runtime ready before vela dashboard

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-21 17:43:24 +09:00
Hongchao Deng
20a5457d5f refactor pkg/application to use Appfile (#402)
* refactor pkg/application to use Appfile

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* fix build

* fix workload

* refactor pkg/application to use Appfile

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* rebase

* fix

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* e2e

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* update design

* add test coverage for appfile

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* comment

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>
2020-10-21 13:01:46 +08:00
Hongchao Deng
fa575a0103 Merge pull request #414 from wonderflow/logs
support vela logs
2020-10-20 08:45:29 -07:00
Hongchao Deng
841ce47ecd Merge pull request #415 from wonderflow/fixroutedef
fix route trait definition
2020-10-20 08:44:10 -07:00
Jianbo Sun
df495d9c04 Update pkg/commands/logs.go
Co-authored-by: Ryan Zhang <yangzhangrice@hotmail.com>
2020-10-20 23:24:47 +08:00
天元
5f755d4ec9 fix route trait definition 2020-10-20 20:58:36 +08:00
天元
a195d25546 support vela logs 2020-10-20 20:45:28 +08:00
Jianbo Sun
177e89a399 Merge pull request #410 from wonderflow/docgen
refactor command and add vela generate-doc for cli
2020-10-20 15:13:48 +08:00
天元
04fcad21d4 refactor command and add vela generate-doc for cli 2020-10-20 14:54:02 +08:00
Zheng Xi Zhou
13dea58e35 Refine help and error message (#345)
* Refine help and error message

refined error message for `vela app run`
and correct help message for `vela comp ls`

To fix #320

* fix make issue
2020-10-20 14:34:19 +08:00
Hongchao Deng
38dc6fe73e fix bugs on pkg/appfile (#409)
* fix bugs on pkg/appfile

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* fix
2020-10-20 13:55:57 +08:00
Jianbo Sun
33c9a1dade Merge pull request #408 from ryanzhang-oss/fix-local
fix local dev environment
2020-10-20 11:46:53 +08:00
Ryan Zhang
b13677363f install CRD manually 2020-10-20 11:30:34 +08:00
Ryan Zhang
50e5c6a25c Merge pull request #403 from wonderflow/fixrace
fix race and update oam-runtime dependency
2020-10-19 13:41:13 +08:00
天元
3812ed2488 fix race and update oam-runtime dependency 2020-10-19 13:19:08 +08:00
Jianbo Sun
1cc8a3980c Merge pull request #387 from wonderflow/route1
give route trait new discovery port way with podspecable design
2020-10-18 11:24:38 +08:00
Hongchao Deng
b08c6b9441 Appfile: Extensible, User-friendly Application Config Format (#390)
* design doc

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* Support deployment via appfile

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* design update

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* comments

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* update

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* refactor

* add multi services example in design doc
2020-10-18 11:22:17 +08:00
Ryan Zhang
8de3ee27f4 Merge pull request #392 from oam-dev/rollout-design
rollout trait high level design
2020-10-17 19:52:33 +08:00
Hongchao Deng
82714d163d Merge pull request #398 from hongchaodeng/codecov
move codecov upload to github workflow
2020-10-16 16:58:15 -07:00
Hongchao Deng
4fa3fb6486 move codecov upload to github workflow 2020-10-16 16:44:35 -07:00
Hongchao Deng
62de2e4d50 test codecov 2020-10-16 16:19:40 -07:00
Hongchao Deng
146dcb5e41 Merge pull request #397 from hongchaodeng/codecov
Setup codecov
2020-10-16 16:18:52 -07:00
Hongchao Deng
4889e458d4 add token 2020-10-16 16:07:47 -07:00
Hongchao Deng
8f4d9b37d2 fix 2020-10-16 15:24:59 -07:00
Hongchao Deng
0e83ff303c add codecov 2020-10-16 15:16:58 -07:00
天元
3d2bd9a898 add a design doc for route trait, along with fix and tests 2020-10-16 20:50:08 +08:00
Ryan Zhang
96f6a38869 rough rollout trait design 2020-10-15 21:06:50 +08:00
Jianbo Sun
4ef766c05d Merge pull request #395 from wonderflow/definition
move definition files to a separate dir
2020-10-15 17:30:05 +08:00
天元
2c721e5177 move definition files to a separate dir 2020-10-15 16:40:00 +08:00
Jianbo Sun
f58617f733 Merge pull request #394 from wonderflow/fixcert
covert certmanager to v1 and use wonderflow/cert-manager-api to reduce dependency collision
2020-10-15 12:13:50 +08:00
天元
1166c5b526 covert certmanager to v1 and use wonderflow/cert-manager-api to reduce dependency collision 2020-10-15 11:52:40 +08:00
Jianbo Sun
a5cacbe383 Merge pull request #393 from wonderflow/fix
add args for vela install and fix E2E with fresh image build
2020-10-14 23:41:33 +08:00
天元
d9302ff982 add args for vela install and fix E2E with fresh image build 2020-10-14 23:22:15 +08:00
Jianbo Sun
3751b98e7a Merge pull request #389 from wonderflow/initappdeploy
bootstrap application deployment for app level rollout/traffic management
2020-10-14 12:49:16 +08:00
天元
a66938eee8 add more to contributing guide 2020-10-14 12:01:52 +08:00
Ryan Zhang
529d150737 add an example on how to use flagger and fix some minor bugs (#381) 2020-10-14 11:43:57 +08:00
天元
395e2d55f7 bootstrap application deployment for app level rollout/traffic management 2020-10-14 11:41:31 +08:00
Jianbo Sun
4cb677418f Merge pull request #388 from captainroy-hy/fix-e2e-setup-2
revert commented e2e cases
2020-10-14 10:05:56 +08:00
roy wang
ad819b354a fix e2e-setup
revert commented e2e cases

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-13 21:56:44 +09:00
Jianbo Sun
48404bde98 Merge pull request #386 from wonderflow/fixconfig
fix make core-run panic
2020-10-13 19:57:22 +08:00
Jianbo Sun
a36e6fc14b Merge pull request #379 from captainroy-hy/add-probes
add liveness & readiness probes
2020-10-13 19:46:44 +08:00
天元
f3eed5f283 fix make core-run panic 2020-10-13 19:35:01 +08:00
roy wang
53fc9e5b71 add ready/health probes
add waiting for webhook secret ready

add unit tests

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-13 18:57:58 +09:00
Jianbo Sun
1479109324 move chart build to source file, allow chart CRD switching to V1 of cert-manager (#382)
* add chart_source

* generate chart to fake file

* switching to V1 of cert-manager

make exec time longer
2020-10-13 17:20:59 +08:00
Hongchao Deng
f106752b48 Merge pull request #385 from wonderflow/route
align to oam-k8s-runtime v0.3.0-rc1 and its CRD file
2020-10-12 21:20:59 -07:00
Hongchao Deng
467d3ab59c Merge pull request #384 from hongchaodeng/data
cue: rename 'data' to 'output'
2020-10-12 21:12:26 -07:00
天元
6076516c24 align to oam-k8s-runtime v0.3.0-rc1 and its CRD file 2020-10-13 12:11:55 +08:00
Hongchao Deng
af91fdf21e cue: rename 'data' to 'output' 2020-10-12 21:02:33 -07:00
Jianbo Sun
4bb8492f43 Merge pull request #383 from captainroy-hy/fix-block-e2e
comment out e2e blocking cases
2020-10-13 11:41:55 +08:00
roy wang
4428a6e738 remove e2e blocking cases
Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-13 12:12:17 +09:00
silenceper
1f3548eee4 fix check resource exists (#373)
* fix check resource exists

* fix go lint

* add tests, fix DoesCRDExist

* remove init func

* fix should return err
2020-10-13 07:54:19 +08:00
Jianbo Sun
64d77656cf Merge pull request #380 from zzxwill/env-args
Update env init API doc
2020-10-12 15:46:43 +08:00
zzxwill
21f191b889 Update env init API doc 2020-10-12 15:32:07 +08:00
Jianbo Sun
60402414f1 Merge pull request #372 from zzxwill/fix-link
Fix code of conduct link
2020-10-10 18:28:35 +08:00
zzxwill
6fb9d02e8d Fix code of conduct link
renamed:    CODE_OF_CONDUCT.md  -> CODE_OF_CONDUCT.md
2020-10-10 17:35:16 +08:00
Jianbo Sun
eaac01b58c Merge pull request #366 from wonderflow/descirption
add description for workload and trait
2020-10-10 14:47:45 +08:00
Zheng Xi Zhou
af724ad58a Update appliesToWorkloads field in traitdefinition (#368)
* Update appliesToWorkloads field in traitdefintion

updated appliesToWorkloads fileds in traitdefinition
for three workloads, webservice, task and backend.
fix issue #346

* remove duplication
2020-10-10 14:27:34 +08:00
天元
590918af32 add description for workload and trait 2020-10-10 10:15:30 +08:00
Jianbo Sun
0b59db8fb0 Merge pull request #367 from resouer/fix-typo
Fix typos in design doc [part 2]
2020-10-10 09:59:38 +08:00
Harry Zhang
04deadd684 Fix typos in design doc [part 2] 2020-10-09 10:45:19 -07:00
Jianbo Sun
dd08aa4d45 Merge pull request #329 from captainroy-hy/track-comp-status
track status changing in vela init
2020-10-09 19:12:35 +08:00
roy wang
8b3bda82f7 add e2e test for vela init
modify e2e setup to wait oam-runtime pod running

add k8sclient in e2e test

refine tracking status of vela init

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-09 19:36:33 +09:00
roy wang
6aafb90acd track status changing in vela init
fix e2e-test

update oam-k8s-runtime dependency to latest tag

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-09 18:41:53 +09:00
Jianbo Sun
a0e12b84c7 Merge pull request #364 from resouer/update-project
Add design doc to kubevela and update readme
2020-10-09 14:48:55 +08:00
Harry Zhang
e56eb2fa67 Complete detailed design (part 1) 2020-10-08 22:38:08 -07:00
Jianbo Sun
28e75551ed Merge pull request #363 from hanxie-crypto/feature07
bug fix
2020-10-09 10:10:30 +08:00
hanxie
045a4aae2d bug fix 2020-10-09 09:58:48 +08:00
Jianbo Sun
53a9e9284d Merge pull request #359 from wonderflow/fixroute
Some fixes
2020-10-09 08:31:37 +08:00
天元
189175c4db using Environment intead of ENV fixes #350 2020-10-09 08:21:31 +08:00
Jianbo Sun
aa9c96d0b5 Merge pull request #360 from captainroy-hy/fix-hack-generate
fix minor bug in generate.go
2020-10-08 19:32:32 +08:00
roy wang
ceaf6db82c fix minor bugs in generate.go
Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-10-08 19:09:22 +09:00
天元
e4570e22ae fix podspec workload not create service anymore 2020-10-08 16:09:04 +08:00
天元
c9a28309b2 fix trait detach not work 2020-10-08 16:08:42 +08:00
天元
6d50eed4f9 fix temparory chart dir created when develop locally 2020-10-08 15:58:43 +08:00
天元
e922666d5f rename 'vela comp run' to 'vela comp deploy' 2020-10-08 15:46:30 +08:00
天元
43223f0759 fix helm chart release name to kubevela 2020-10-08 15:31:05 +08:00
Harry Zhang
2641630b97 Init commit on design doc 2020-10-07 10:31:55 -07:00
Ryan Zhang
f4d5a13934 Merge pull request #356 from oam-dev/rename
rename containerized to podspecworkload
2020-10-06 10:13:54 -07:00
Ryan Zhang
61544a0be6 rename containerized to podspecworkload 2020-10-06 00:25:16 -07:00
Ryan Zhang
e422d0ba86 Merge pull request #352 from oam-dev/install-helm
Hack the Helm install client and improve the helm chart
2020-10-02 23:14:12 -07:00
Ryan Zhang
d0d8d77337 fix the test 2020-10-02 20:26:50 -07:00
Ryan Zhang
3f468e4752 improve helm install 2020-10-02 19:29:31 -07:00
Jianbo Sun
3b6ced2a58 Merge pull request #351 from resouer/readme
Add details for the project
2020-10-02 11:47:05 +08:00
Harry Zhang
f29bb26880 Add details for the project 2020-10-01 19:22:15 -07:00
Jianbo Sun
6ede8601b4 Merge pull request #343 from zzxwill/api
Refine and fix API
2020-09-30 14:44:38 +08:00
zzxwill
8a15d19348 Refine and fix API
- fixed trait attach issue
- allow leaving out `/` to make API more friendly
- merge similar struct
2020-09-29 19:30:52 +08:00
Zheng Xi Zhou
e0b4e5f76f Merge pull request #342 from hanxie-crypto/feature06
update applist
2020-09-29 19:27:30 +08:00
hanxie
6c04af02cb update applist 2020-09-29 19:08:04 +08:00
Zheng Xi Zhou
351049b74f Merge pull request #337 from hanxie-crypto/feature05
Component module related
2020-09-29 16:58:07 +08:00
hanxie
30127f8a3e Component module related 2020-09-28 19:37:33 +08:00
Ryan Zhang
6863ac02a1 add back the test after the cue templates are updated (#328)
* add back the test

* enhance e2e test
2020-09-28 17:51:06 +08:00
silenceper
24c30e65fb Determine whether it is necessary to create a service (#333)
* Determine whether it is necessary to create a service

* add checkContainerPortsSpecified func

* add check workload is nil
2020-09-28 10:08:51 +08:00
silenceper
c4dd02761a support delete multi env (#331)
* support delete multi env

* fix golint
2020-09-27 15:44:46 +08:00
Hongchao Deng
72b7a89e9a Merge pull request #332 from silenceper/fix-break
use return instead of break
2020-09-26 23:41:37 -07:00
silenceper
453976e28f use return instead of break 2020-09-27 14:31:03 +08:00
Jianbo Sun
914fa61819 Merge pull request #325 from zzxwill/component-api
Implemente Component api
2020-09-27 12:19:52 +08:00
zzxwill
e1a2edb604 fix naming issue 2020-09-27 11:35:46 +08:00
zzxwill
d245f3f939 implemented component delete API 2020-09-26 21:43:32 +08:00
zzxwill
433296d718 Update trait attach/detach with the introduction of component 2020-09-26 21:43:32 +08:00
zzxwill
28c3c683a0 Implement component related API
Update app list/show, implmented
component show
2020-09-26 21:41:15 +08:00
Jianbo Sun
50ba36eb1e Merge pull request #319 from oam-dev/cue-improve
Tweak the cue template format
2020-09-26 13:12:08 +08:00
Ryan Zhang
c69c809264 improve CUE format 2020-09-25 21:58:30 -07:00
Sun Jianbo
fac05a3bd1 Merge pull request #326 from zzxwill/naming
Fix naming in `json` of struct fields
2020-09-25 15:39:43 +08:00
zzxwill
60e34d5b03 Fix naming in json of struct fields
almost all of names in `json` of struct fileds
should be in `lowerUpper` format
2020-09-25 14:55:24 +08:00
Hongchao Deng
8b480df72d Merge pull request #318 from hongchaodeng/gomod
fixed dep should be put under 'replace'
2020-09-23 21:00:44 -07:00
Sun Jianbo
5deef1c098 Merge pull request #314 from captainroy-hy/fix-comp-status
fix bug: handle exception cases in `vela comp status`
2020-09-24 10:15:59 +08:00
roy wang
11d4fcd56f handle exception cases of vela comp status
Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-09-24 10:59:53 +09:00
Hongchao Deng
d78648b73c fixed dep should be put under 'replace' 2020-09-23 09:12:09 -07:00
Sun Jianbo
525c228bd7 Merge pull request #311 from wonderflow/fix
fix env exist but issuer not exist
2020-09-23 11:22:11 +08:00
天元
ba6a53c6f5 fix env exist but issuer not exist 2020-09-23 10:38:59 +08:00
Sun Jianbo
0d1dd62b8a Merge pull request #308 from wonderflow/init
vela init to create and run application in one command
2020-09-22 20:23:41 +08:00
天元
5ac7265474 vela init to create and run application in one command 2020-09-22 20:07:53 +08:00
Zheng Xi Zhou
08701568a1 Fix OpenAPIV3Schema Validation Issue (#300)
* Fix OpenAPIV3Schema Validation Issue

Temporarily corrects spec.validation.openAPIV3Schema issue, and it would be removed
after this issue was fixed https://github.com/oam-dev/kubevela/issues/284.

* fix vela install issue

* return error during fixing APIV3SchemaValidation issue
2020-09-22 15:51:38 +08:00
roy wang
faedce906a fix #128 | sync deleted workload locally
Signed-off-by: roy wang <seiwy2010@gmail.com>

fix & add unit tests

Signed-off-by: roy wang <seiwy2010@gmail.com>

fix info output & unit test

Signed-off-by: roy wang <seiwy2010@gmail.com>

fix e2e-test

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-09-21 19:22:34 +08:00
Sun Jianbo
f5908741d3 Update pkg/commands/system.go 2020-09-21 19:22:34 +08:00
mosesyou
5414cc1f86 fix duplicate vela system info failure message 2020-09-21 19:22:34 +08:00
天元
371a989f9b add move readme 2020-09-21 19:22:34 +08:00
天元
8b3af3be93 temporarily add containerized to chart 2020-09-21 19:22:34 +08:00
hanxie
d6e519f1c4 Components static page,bugfix,capability delete 2020-09-21 19:22:34 +08:00
Sun Jianbo
90fd0a5055 Merge pull request #295 from wonderflow/production-issuer
add production certificate issuer and fix route trait
2020-09-18 21:45:14 +08:00
天元
3af41f6515 add production certificate issuer and fix route trait 2020-09-18 19:06:51 +08:00
Yue Wang
ee39054537 get cue temp from remote through URI (#287)
* get cue template of capabilities from remote by URI

Signed-off-by: roy wang <seiwy2010@gmail.com>

* add e2e tests

Signed-off-by: roy wang <seiwy2010@gmail.com>

* fix type conversion

Signed-off-by: roy wang <seiwy2010@gmail.com>
2020-09-18 15:59:36 +08:00
Ryan Zhang
b5218d371a Merge pull request #293 from wonderflow/iamge
use image from docker hub instead of quay.io
2020-09-17 19:23:41 -07:00
天元
7f5298a802 use image from docker hub instead of quay.io 2020-09-17 17:30:33 +08:00
Sun Jianbo
2ffd56a993 Merge pull request #291 from wonderflow/zip
use compressed file for release
2020-09-17 15:07:00 +08:00
天元
e0d7eed9d3 update readme 2020-09-17 14:52:33 +08:00
Sun Jianbo
b0ec26bca0 Merge pull request #290 from wonderflow/image
update image tag to latest and change image pull policy
2020-09-17 14:44:19 +08:00
天元
2116c9ad0e use compressed file for release 2020-09-17 14:42:00 +08:00
天元
d02d6675ab update image tag to latest and change image pull policy 2020-09-17 14:08:33 +08:00
Sun Jianbo
1a43c0e540 Merge pull request #276 from wonderflow/routetrait
add route trait as vela api gateway
2020-09-17 14:06:00 +08:00
Sun Jianbo
e6b46c6c1b Merge pull request #288 from mosesyou/bugfix-comp-run
fix `vela comp run` panic when args empty
2020-09-17 11:57:27 +08:00
mosesyou
387afaa2c2 fix vela comp run panic when args empty 2020-09-17 11:08:55 +08:00
Ryan Zhang
f9fea8b53a Merge pull request #285 from wonderflow/dockerpackage
Add Image upload for Docker Hub and Github Docker package
2020-09-16 19:32:07 -07:00
Hongchao Deng
21c58c0aa2 Merge pull request #286 from oam-dev/warning
Add warning for not play around it for now
2020-09-16 16:43:43 -07:00
Lei Zhang (Harry)
d5a8b54503 Add warning for not play around it for now 2020-09-16 16:39:06 -07:00
天元
c390928368 split release and daily build 2020-09-16 22:57:56 +08:00
天元
c4897008dc add docker image build 2020-09-16 21:50:56 +08:00
天元
fe09a85e53 add docker build 2020-09-16 21:34:20 +08:00
天元
1b9ee5c882 add route trait as vela apigate 2020-09-16 19:42:01 +08:00
Sun Jianbo
cc5e3dc6a2 Merge pull request #281 from oam-dev/install-dependency
vela core install dependencies
2020-09-16 17:29:02 +08:00
Ryan Zhang
8a9470b9b3 fix build error 2020-09-16 01:12:50 -07:00
Ryan Zhang
e0a21b2bd4 Merge pull request #268 from wonderflow/template
update chart and refactor default workload type
2020-09-15 22:52:32 -07:00
Ryan Zhang
dfeff25a31 install dependencies 2020-09-15 22:04:52 -07:00
天元
9510db0ace update chart and refactor default workload 2020-09-16 12:09:29 +08:00
Sun Jianbo
1576d1ff2b Merge pull request #280 from hanxie-crypto/feature03
Update code and page optimization ,fix bug
2020-09-16 11:37:03 +08:00
hanxie
764e1bbb79 Update code and page optimization ,fix bug 2020-09-16 11:03:16 +08:00
Sun Jianbo
83e718c4cd Merge pull request #261 from hanxie-crypto/feature01
update dashboard ux
2020-09-16 10:50:13 +08:00
Ryan Zhang
16fd51a213 adjust the helm setting and README (#269)
* add dependancy installer and fix e2e

* fix build

* add kubebuilder
2020-09-15 15:08:17 +08:00
Sun Jianbo
1744b4752c Merge pull request #270 from zzxwill/website
Remove website related files
2020-09-13 11:44:31 +08:00
zzxwill
7ad7848856 Remove website related files
Removed website related files and planning moving
the website to oam-dev/kubevela.io
2020-09-13 11:29:44 +08:00
Sun Jianbo
6df4e192f9 Merge pull request #267 from zzxwill/env
Rename `vela env switch` to `vela env set`
2020-09-11 21:40:36 +08:00
zzxwill
bc3169a1b5 Rename vela env switch to vela env set
Renaming and update cli documentation
Fix #235
2020-09-11 19:46:45 +08:00
hanxie
b026cf20f4 update dashboard ux 2020-09-11 14:43:08 +08:00
574 changed files with 51789 additions and 30310 deletions

View File

@@ -4,6 +4,10 @@ on:
push:
branches: [ master ]
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
- '**.md'
defaults:
run:
working-directory: ./dashboard

25
.github/workflows/docker.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Publish to Registry
on:
push:
branches:
- master
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
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
with:
name: oamdev/vela-core
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tags: "latest"

View File

@@ -5,18 +5,15 @@ on:
branches: [master]
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
- '**.md'
jobs:
build:
name: Build
runs-on: ubuntu-latest
name: e2e-tests
runs-on: aliyun
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@@ -24,22 +21,31 @@ jobs:
run: |
go get -v -t -d ./...
- name: Install ginkgo
run: |
sudo apt-get update
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"
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
make e2e-cleanup

View File

@@ -5,16 +5,19 @@ on:
branches: [master]
pull_request:
branches: [master]
paths-ignore:
- 'docs/**'
- '**.md'
jobs:
build:
name: Build
runs-on: ubuntu-latest
name: unit-tests
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.13
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.14
id: go
- name: Check out code into the Go module directory
@@ -22,13 +25,23 @@ jobs:
- name: Install ginkgo
run: |
sudo apt-get update
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"
- name: install Kubebuilder
uses: wonderflow/kubebuilder-action@v1.1
- name: Run Make test
run: make test
- name: Upload coverage report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.txt
flags: unittests
name: codecov-umbrella

View File

@@ -13,10 +13,10 @@ jobs:
VELA_VERSION: ${{ github.ref }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set up Go 1.13
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.13
go-version: 1.14
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
@@ -32,6 +32,8 @@ jobs:
run: make generate-source
- name: Run cross-build
run: make cross-build
- name: Run compress binary
run: make compress
- name: Create Release
id: create_release
uses: actions/create-release@v1
@@ -41,24 +43,67 @@ jobs:
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Upload Linux
- name: Upload Linux tar.gz
uses: actions/upload-release-asset@v1.0.2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/vela-linux-amd64
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64
asset_path: ./_bin/vela-linux-amd64.tar.gz
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz
asset_content_type: binary/octet-stream
- name: Upload MacOS
- name: Upload Linux zip
uses: actions/upload-release-asset@v1.0.2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/vela-darwin-amd64
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64
asset_path: ./_bin/vela-linux-amd64.zip
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64.zip
asset_content_type: binary/octet-stream
- name: Upload Windows
- name: Upload MacOS tar.gz
uses: actions/upload-release-asset@v1.0.2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/vela-windows-amd64.exe
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-windows-amd64.exe
asset_content_type: binary/octet-stream
asset_path: ./_bin/vela-darwin-amd64.tar.gz
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz
asset_content_type: binary/octet-stream
- name: Upload MacOS zip
uses: actions/upload-release-asset@v1.0.2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./_bin/vela-darwin-amd64.zip
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.zip
asset_content_type: binary/octet-stream
- name: Upload Windows tar.gz
uses: actions/upload-release-asset@v1.0.2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./_bin/vela-windows-amd64.tar.gz
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-windows-amd64.tar.gz
asset_content_type: binary/octet-stream
- name: Upload Windows zip
uses: actions/upload-release-asset@v1.0.2
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./_bin/vela-windows-amd64.zip
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-windows-amd64.zip
asset_content_type: binary/octet-stream
- name: Upload Checksums
uses: actions/upload-release-asset@v1.0.2
with:
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 }}"

9
.gitignore vendored
View File

@@ -5,6 +5,7 @@
*.so
*.dylib
bin
_bin
e2e/vela
# Test binary, build with `go test -c`
@@ -12,6 +13,7 @@ e2e/vela
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
coverage.txt
# Kubernetes Generated files - skip generated files, except for vendored files
@@ -35,9 +37,14 @@ config/crd/bases
tmp/
cmd/vela/fake/source.go
cmd/vela/fake/chart_source.go
charts/vela-core/crds/_.yaml
.test_vela
.vela/
# Dashboard
dashboard/node_modules/
node_modules/
.eslintcache
dashboard/dist/
dashboard/package-lock.json

3
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,3 @@
# Code of Conduct
KubeVela follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).

View File

@@ -1,114 +1,157 @@
# CONTRIBUTING
## About KubeVela
KubeVela project is initialized and maintained by the cloud native community since day 0 with [bootstrapping contributors from 8+ different organizations](https://github.com/oam-dev/kubevela/graphs/contributors). We intend for KubeVela to have a open governance since the very beginning and donate the project to neutral foundation as soon as it's released.
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
1. Golang version 1.12+
2. Kubernetes version v1.15+ with `~/.kube/config` configured.
3. OAM Kubernetes Runtime installed.
4. Kustomize version 3.8+
5. ginkgo 1.14.0+ (just for [E2E test](https://github.com/oam-dev/kubevela/blob/master/DEVELOPMENT.md#e2e-test))
6. 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.
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.
We also recommend you to learn about KubeVela's [design](docs/en/design.md) before dive into its code.
## Build
* Clone this project
```shell script
git clone git@github.com:oam-dev/kubevela.git
```
* Install Template CRD into your cluster
* Build Vela CLI
```shell script
make install
make
```
* Install template object
* Configure vela to PATH
after build, make will create `vela` binary to `bin/`, Set this path to PATH.
```shell script
kubectl apply -f config/samples/
export PATH=$PATH:/your/path/to/project/kubevela/bin
```
## Develop & Debug
If you change Template CRD, remember to rerun `make install`.
Then you can use `vela` command directly.
Use the following command to develop and debug.
* Build Vela Core
```shell script
$ cd cmd/vela
$ go run main.go COMMAND [FLAG]
make manager
```
* Run Vela Core
Firstly make sure your cluster has CRDs.
```shell script
make core-install
```
Run locally:
```shell script
make core-run
```
This command will run controller locally, it will use your local KubeConfig which means you need to have a k8s cluster
locally. If you don't have a one, we suggest that you could setup up a cluster with [kind](https://kind.sigs.k8s.io/).
## Use
* Create environment
```shell script
vela env init myenv --namespace myenv --email my@email.com --domain kubevela.io
```
* Create Component
For example, use the following command to create and run an application.
```shell script
$ go run main.go run containerized app2057 nginx:1.9.4
Creating AppConfig app2057
SUCCEED
$ kubectl get oam
NAME WORKLOAD-KIND
component.core.oam.dev/app2057 ContainerizedWorkload
NAME AGE
containerizedworkload.core.oam.dev/poc 53m
NAME AGE
applicationconfiguration.core.oam.dev/app2057 69s
NAME DEFINITION-NAME
traitdefinition.core.oam.dev/simplerollouttraits.extend.oam.dev simplerollouttraits.extend.oam.dev
NAME DEFINITION-NAME
workloaddefinition.core.oam.dev/containerizedworkloads.core.oam.dev containerizedworkloads.core.oam.dev
workloaddefinition.core.oam.dev/deployments.apps deployments.apps
workloaddefinition.core.oam.dev/statefulsets.apps statefulsets.apps
$ vela svc deploy mysvc -t webservice --image crccheck/hello-world --port 8000 -a abc
App abc deployed
```
## E2E test
```
$ make e2e-test
Running Suite: Trait Suite
==========================
Random Seed: 1596559178
Will run 5 of 5 specs
* Add Trait
Trait env init
should print env initiation successful message
kubevela/e2e/commonContext.go:14
Create env succeed, current env is default
------------------------------
Trait env switch
should show env switch message
kubevela/e2e/commonContext.go:40
Switch env succeed, current env is default
------------------------------
Trait run
should print successful creation information
kubevela/e2e/commonContext.go:76
Creating AppConfig app-trait-basic
SUCCEED
------------------------------
Trait kubevela attach trait
should print successful attached information
kubevela/e2e/trait/trait_test.go:24
Applying trait for app
Succeeded!
------------------------------
Trait delete
should print successful deletion information
kubevela/e2e/commonContext.go:85
Deleting AppConfig "app-trait-basic"
DELETE SUCCEED
Ran 5 of 5 Specs in 9.717 seconds
SUCCESS! -- 5 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS
```shell script
$ vela route abc
Adding route for app mysvc
⠋ Deploying ...
✅ Application Deployed Successfully!
- Name: mysvc
Type: webservice
HEALTHY Ready: 1/1
Last Deployment:
Created at: 2020-11-02 11:17:28 +0800 CST
Updated at: 2020-11-02T11:21:23+08:00
Routes:
- route: Visiting URL: http://abc.kubevela.io IP: 47.242.68.137
```
* Check Status
```
$ vela status abc
About:
Name: abc
Namespace: default
Created at: 2020-11-02 11:17:28.067738 +0800 CST
Updated at: 2020-11-02 11:28:13.490986 +0800 CST
Services:
- Name: mysvc
Type: webservice
HEALTHY Ready: 1/1
Last Deployment:
Created at: 2020-11-02 11:17:28 +0800 CST
Updated at: 2020-11-02T11:28:13+08:00
Routes:
- route: Visiting URL: http://abc.kubevela.io IP: 47.242.68.137
```
* Delete App
```shell script
$ vela ls
SERVICE APP TYPE TRAITS STATUS CREATED-TIME
mysvc abc Deployed 2020-11-02 11:17:28 +0800 CST
$ vela delete abc
Deleting Application "abc"
delete apps succeed abc from default
```
## Tests
### Unit test
```shell script
make test
```
### E2E test
**Before e2e test start, make sure you have vela-core running.**
```shell script
make core-run
```
Start to test.
```
make e2e-test
```
## Make a pull request

View File

@@ -1,13 +1,14 @@
# Vela version
VELA_VERSION ?= 0.1.0
# 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)
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) -X main.chartTGZSource=$$(cat -) -s -w"
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
GOX = go run github.com/mitchellh/gox
TARGETS := darwin/amd64 linux/amd64 windows/amd64
DIST_DIRS := find * -type d -exec
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
@@ -19,12 +20,17 @@ endif
all: build
# Run tests
test: fmt vet lint
go test ./pkg/... -coverprofile cover.out
test: vet lint
go test -race -coverprofile=coverage.txt -covermode=atomic ./pkg/... ./cmd/...
# Build manager binary
build: fmt vet lint
go run hack/chart/generate.go | go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
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
vela-cli:
go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
npm-build:
cd dashboard && npm run build && cd ./..
@@ -32,26 +38,43 @@ npm-build:
npm-install:
cd dashboard && npm install && cd ./..
doc-gen:
rm -r docs/en/cli/*
go run hack/docgen/gen.go
generate-source:
go run hack/frontend/source.go
cross-build:
go run hack/chart/generate.go | GO111MODULE=on CGO_ENABLED=0 $(GOX) -ldflags $(LDFLAGS) -parallel=3 -output="bin/vela-{{.OS}}-{{.Arch}}" -osarch='$(TARGETS)' ./cmd/vela/
go run hack/chart/generate.go
GO111MODULE=on CGO_ENABLED=0 $(GOX) -ldflags $(LDFLAGS) -parallel=3 -output="_bin/{{.OS}}-{{.Arch}}/vela" -osarch='$(TARGETS)' ./cmd/vela/
compress:
( \
cd _bin && \
$(DIST_DIRS) cp ../LICENSE {} \; && \
$(DIST_DIRS) cp ../README.md {} \; && \
$(DIST_DIRS) tar -zcf vela-{}.tar.gz {} \; && \
$(DIST_DIRS) zip -r vela-{}.zip {} \; && \
sha256sum vela-* > sha256sums.txt \
)
# Run against the configured Kubernetes cluster in ~/.kube/config
run: fmt vet
go run ./cmd/core/main.go
# Run go fmt against code
fmt:
fmt: goimports
go fmt ./...
$(GOIMPORTS) -local github.com/oam-dev/kubevela -w ./pkg ./cmd
./hack/cue-fmt.sh
# Run go vet against code
vet:
go vet ./...
lint: golangci
$(GOLANGCILINT) run -E golint,goimports ./...
$(GOLANGCILINT) run --timeout 10m -E golint,goimports ./...
# Build the docker image
docker-build: test
@@ -62,13 +85,15 @@ docker-push:
docker push ${IMG}
e2e-setup:
bin/vela install --image-pull-policy IfNotPresent --image-repo vela-core-test --image-tag $(GIT_COMMIT)
ginkgo version
ginkgo -v -r e2e/setup
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=vela-core,app.kubernetes.io/instance=kubevela -n vela-system --timeout=600s
bin/vela dashboard &
e2e-test:
# Run e2e test
ginkgo -v -skipPackage setup,apiserver -r e2e
ginkgo -v -skipPackage capability,setup,apiserver -r e2e
e2e-api-test:
# Run e2e test
@@ -76,7 +101,12 @@ e2e-api-test:
e2e-cleanup:
# Clean up
rm -rf ~/.vela
# load docker image to the kind cluster
kind-load:
docker build -t vela-core-test:$(GIT_COMMIT) .
kind load docker-image vela-core-test:$(GIT_COMMIT) || { echo >&2 "kind not installed or error loading image: $(IMAGE)"; exit 1; }
# Image URL to use all building/pushing image targets
IMG ?= vela-core:latest
@@ -88,29 +118,33 @@ core-test: generate fmt vet manifests
go test ./pkg/... -coverprofile cover.out
# Build manager binary
manager: generate fmt vet
manager: generate 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
go run ./cmd/core/main.go
# Install CRDs into a cluster
# Install CRDs and Definitions of Vela Core into a cluster, this is for develop convenient.
core-install: manifests
kustomize build config/crd | kubectl apply -f -
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/
kubectl apply -f charts/vela-core/templates/velaConfig.yaml
bin/vela workloads
# Uninstall CRDs from a cluster
# Uninstall CRDs and Definitions of Vela Core from a cluster, this is for develop convenient.
core-uninstall: manifests
kustomize build config/crd | kubectl delete -f -
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
core-deploy: manifests
cd config/manager && kustomize edit set image controller=${IMG}
kustomize build config/default | kubectl apply -f -
kubectl delete -f charts/vela-core/templates/definitions/
kubectl delete -f charts/vela-core/templates/defwithtemplate/
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/crds
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=charts/vela-core/crds
go generate $(foreach t,pkg api,./$(t)/...)
./hack/vela-templates/gen_definitions.sh
# Generate code
generate: controller-gen
@@ -152,3 +186,15 @@ 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

9
OWNERS Normal file
View File

@@ -0,0 +1,9 @@
approvers:
- kubevela-controller
- kubevela-devex
reviewers:
- kubevela-controller
- kubevela-dashboard
- oam-k8s-runtime
- oam-spec

49
OWNERS_ALIASES Normal file
View File

@@ -0,0 +1,49 @@
aliases:
kubevela-devex:
- hongchaodeng
- wonderflow
kubevela-dashboard:
- zzxwill
- hanxie-crypto
- hongchaodeng
kubevela-controller:
- resouer
- wonderflow
- 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
- resouer
- vturecek
community-collaborators:
- Fei-Guo
- szihai
bootstrap-contributors: # thank you for bootstrapping KubeVela at the very early stage!
- xiaoyuaiheshui
- Ghostbaby
- wenxinnnnn
- silenceper
- erdun
- sunny0826
- mosesyou
- artursouza
- wonderflow
- hongchaodeng
- ryanzhang-oss
- woshilanren11
- hanxie-crypto
- zzxwill

View File

@@ -1,3 +1,7 @@
domain: oam.dev
repo: github.com/oam-dev/kubevela
resources:
- group: standard
kind: Route
version: v1alpha1
version: "2"

149
README.md
View File

@@ -1,134 +1,37 @@
![Build status](https://github.com/oam-dev/kubevela/workflows/E2E/badge.svg)
[![Go Report Card](https://goreportcard.com/badge/github.com/oam-dev/kubevela)](https://goreportcard.com/report/github.com/oam-dev/kubevela)
![Docker Pulls](https://img.shields.io/docker/pulls/oamdev/vela-core)
[![codecov](https://codecov.io/gh/oam-dev/kubevela/branch/master/graph/badge.svg)](https://codecov.io/gh/oam-dev/kubevela)
[![LICENSE](https://img.shields.io/github/license/oam-dev/kubevela.svg?style=flat-square)](/LICENSE)
[![Releases](https://img.shields.io/github/release/oam-dev/kubevela/all.svg?style=flat-square)](https://github.com/oam-dev/kubevela/releases)
[![TODOs](https://img.shields.io/endpoint?url=https://api.tickgit.com/badge?repo=github.com/oam-dev/kubevela)](https://www.tickgit.com/browse?repo=github.com/oam-dev/kubevela)
[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Ftwitter.com%2Foam_dev)](https://twitter.com/oam_dev)
![alt](docs/resources/KubeVela-03.png)
*Make shipping applications more enjoyable.*
# KubeVela
The Open Application Platform based on Kubernetes and OAM.
For developers, KubeVela is an easy-to-use tool that enables them to describe and ship their applications to Kubernetes with minimal effort.
## Install
For platform builders, KubeVela serves as a framework that empowers them to create developer facing yet highly extensible platforms at ease.
### Prerequisites
- Kubernetes cluster running Kubernetes v1.15.0 or greater
- kubectl current context is configured for the target cluster install
- ```kubectl config current-context```
- Slack: [Discuss](https://cloud-native.slack.com/archives/C01BLQ3HTJA)
- Gitter: [Community](https://gitter.im/oam-dev/community)
### Get the Vela CLI
> NOTE: KubeVela is still in early stage and iterating quickly. It's currently under preview release.
Download the `vela` binary from the [Releases page](https://github.com/oam-dev/kubevela/releases). Change file mod and add it to `$PATH` to get started.
## Quick Start
For exmaple:
```shell
chmod a+x vela-v0.0.2-darwin-amd64
sudo mv ./vela-v0.0.2-darwin-amd64 /usr/local/bin/vela
```
Quick start guides are available on [this section](https://kubevela.io/#/en/quick-start).
### Install Vela Core
## Documentation
```shell script
$ vela install
- Installing Vela Core:
- Installing builtin capabilities:
Successful applied 4 kinds of Workloads and Traits: deployments.apps,containerizedworkloads.core.oam.dev,manualscalertraits.core.oam.dev,simplerollouttraits.extend.oam.dev.
syncing workload definitions from cluster...
[WARN]handle template task: #Template.metadata.name: reference "task" not found
get 5 workload definitions from cluster, syncing...5 workload definitions successfully synced
syncing trait definitions from cluster...
[WARN]handle template metricstraits.standard.oam.dev: #Template.metadata.name: reference "metricstraits" not found
get 2 trait definitions from cluster, syncing...2 trait definitions successfully synced
- Finished.
```
For full documentation, please visit the KubeVela website: [https://kubevela.io](https://kubevela.io/).
## Demos
#### Create ENV
```
$ vela env init test --namespace test
Create env succeed, current env is test
$ vela env ls
NAME CURRENT NAMESPACE
default default
test * test
$ vela env switch default
Switch env succeed, current env is default
$ vela env delete test
test deleted
$ vela env delete default
Error: you can't delete current using default
```
#### workload run
```shell script
$ vela comp run -t deployment app123 -p 80 --image nginx:1.9.4
Creating AppConfig app123
SUCCEED
$ vela comp status app123
```
#### app
```
$ vela app ls
app123
poc08032042
poc1039
$ vela comp ls
NAME APP WORKLOAD TRAITS STATUS CREATED-TIME
ccc ccc deployment Deployed 2020-08-27 10:56:41 +0800 CST
com1 com1 Deployed 2020-08-26 16:45:50 +0800 CST
com2 com1 Deployed 2020-08-26 16:45:50 +0800 CST
myapp myapp route,scale Deployed 2020-08-19 15:11:17 +0800 CST
$ vela app delete app123
Deleting AppConfig "app123"
DELETE SUCCEED
```
#### Auto-Completion
##### bash
```shell script
To load completions in your current shell session:
$ source <(vela completion bash)
To load completions for every new session, execute once:
Linux:
$ vela completion bash > /etc/bash_completion.d/vela
MacOS:
$ vela completion bash > /usr/local/etc/bash_completion.d/vela
```
##### zsh
```shell script
To load completions in your current shell session:
$ source <(vela completion zsh)
To load completions for every new session, execute once:
$ vela completion zsh > "${fpath[1]}/_vela"
```
### Clean your environment
```shell script
$ helm uninstall vela-core -n oam-system
release "vela-core" uninstalled
```
```shell script
$ kubectl delete crd workloaddefinitions.core.oam.dev traitdefinitions.core.oam.dev
customresourcedefinition.apiextensions.k8s.io "workloaddefinitions.core.oam.dev" deleted
customresourcedefinition.apiextensions.k8s.io "traitdefinitions.core.oam.dev" deleted
```
```shell script
$ rm -r ~/.vela
```
## CONTRIBUTING
Check out [CONTRIBUTING.md](./CONTRIBUTING.md) to see how to develop with KubeVela.
## 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.

2
api/api.go Normal file
View File

@@ -0,0 +1,2 @@
// package api contains all api types of KubeVela
package api

View File

@@ -0,0 +1,59 @@
/*
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"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// ApplicationDeploymentSpec defines the desired state of ApplicationDeployment
type ApplicationDeploymentSpec struct {
//TODO add spec here
}
// ApplicationDeploymentStatus defines the observed state of ApplicationDeployment
type ApplicationDeploymentStatus struct {
//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
type ApplicationDeployment struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ApplicationDeploymentSpec `json:"spec,omitempty"`
Status ApplicationDeploymentStatus `json:"status,omitempty"`
}
// 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{})
}

View File

@@ -0,0 +1,35 @@
/*
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
)

View File

@@ -0,0 +1,115 @@
// +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
}

8
api/generate.go Normal file
View File

@@ -0,0 +1,8 @@
// +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
//go:generate go run ../hack/crd/update.go ../charts/vela-core/crds/
package api

View File

@@ -5,6 +5,7 @@ import (
"k8s.io/client-go/rest"
)
// Args is args for controller-runtime client
type Args struct {
Config *rest.Config
Schema *runtime.Scheme

View File

@@ -21,16 +21,19 @@ import (
"fmt"
"cuelang.org/go/cue"
"github.com/google/go-cmp/cmp"
"github.com/spf13/pflag"
"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"`
}
@@ -40,11 +43,13 @@ type Capability struct {
Name string `json:"name"`
Type CapType `json:"type"`
CueTemplate string `json:"template,omitempty"`
CueTemplateURI string `json:"templateURI,omitempty"`
Parameters []Parameter `json:"parameters,omitempty"`
DefinitionPath string `json:"definition"`
CrdName string `json:"crdName,omitempty"`
Center string `json:"center,omitempty"`
Status string `json:"status,omitempty"`
Description string `json:"description,omitempty"`
//trait only
AppliesTo []string `json:"appliesTo,omitempty"`
@@ -52,28 +57,38 @@ type Capability struct {
// 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"`
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"`
@@ -81,17 +96,15 @@ type Parameter struct {
Default interface{} `json:"default,omitempty"`
Usage string `json:"usage,omitempty"`
Type cue.Kind `json:"type,omitempty"`
Alias string `json:"alias,omitempty"`
}
// ConvertTemplateJSON2Object convert spec.extension to object
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 {
@@ -100,7 +113,12 @@ 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
}
switch v.Type {
case cue.IntKind:
var vv int64
@@ -114,11 +132,11 @@ func SetFlagBy(flags *pflag.FlagSet, v Parameter) {
case float64:
vv = int64(val)
}
flags.Int64P(v.Name, v.Short, vv, v.Usage)
flags.Int64P(name, v.Short, vv, v.Usage)
case cue.StringKind:
flags.StringP(v.Name, v.Short, v.Default.(string), v.Usage)
flags.StringP(name, v.Short, v.Default.(string), v.Usage)
case cue.BoolKind:
flags.BoolP(v.Name, v.Short, v.Default.(bool), v.Usage)
flags.BoolP(name, v.Short, v.Default.(bool), v.Usage)
case cue.NumberKind, cue.FloatKind:
var vv float64
switch val := v.Default.(type) {
@@ -131,6 +149,73 @@ func SetFlagBy(flags *pflag.FlagSet, v Parameter) {
case float64:
vv = val
}
flags.Float64P(v.Name, v.Short, vv, v.Usage)
flags.Float64P(name, v.Short, vv, v.Usage)
}
}
// 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
}
switch a.Type {
case cue.IntKind:
var va, vb int64
switch vala := a.Default.(type) {
case int64:
va = vala
case json.Number:
va, _ = vala.Int64()
case int:
va = int64(vala)
case float64:
va = int64(vala)
}
switch valb := b.Default.(type) {
case int64:
vb = valb
case json.Number:
vb, _ = valb.Int64()
case int:
vb = int64(valb)
case float64:
vb = int64(valb)
}
return va == vb
case cue.StringKind:
return a.Default.(string) == b.Default.(string)
case cue.BoolKind:
return a.Default.(bool) == b.Default.(bool)
case cue.NumberKind, cue.FloatKind:
var va, vb float64
switch vala := a.Default.(type) {
case int64:
va = float64(vala)
case json.Number:
va, _ = vala.Float64()
case int:
va = float64(vala)
case float64:
va = vala
}
switch valb := b.Default.(type) {
case int64:
vb = float64(valb)
case json.Number:
vb, _ = valb.Float64()
case int:
vb = float64(valb)
case float64:
vb = valb
}
return va == vb
}
return true
})}
// EqualCapability will check whether two capabilities is equal
func EqualCapability(a, b Capability) bool {
return cmp.Equal(a, b, CapabilityCmpOptions...)
}

View File

@@ -1,43 +1,53 @@
package types
const (
DefaultOAMNS = "oam-system"
DefaultOAMReleaseName = "vela-core"
DefaultOAMRuntimeChartName = "vela-core"
DefaultOAMVersion = ">0.0.0-0"
DefaultEnvName = "default"
// 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 (
AnnAPIVersion = "definition.oam.dev/apiVersion"
AnnKind = "definition.oam.dev/kind"
// Indicate which workloadDefinition generate from
AnnWorkloadDef = "workload.oam.dev/name"
// Indicate which traitDefinition generate from
AnnTraitDef = "trait.oam.dev/name"
// 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 = "Staging"
// 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"`
Current string `json:"current,omitempty"`
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 = "Getting Started"
TypeApp = "Applications"
TypeTraits = "Traits"
TypeRelease = "Release"
TypeOthers = "Others"
TypeSystem = "System"
// 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"
)

View File

@@ -0,0 +1,122 @@
/*
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 v1alpha1
import (
"github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// Protocol defines network protocols supported for things like container ports.
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}
type Autoscaler struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec AutoscalerSpec `json:"spec"`
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
}
// Trigger defines the trigger of Autoscaler
type Trigger struct {
// Name is the trigger name, if not set, it will be automatically generated and make it globally unique
Name string `json:"name,omitempty"`
// Type allows value in [cpu/memory/storage/ephemeral-storage、cron、pps、qps/rps、custom]
Type TriggerType `json:"type"`
// Condition set the condition when to trigger scaling
Condition map[string]string `json:"condition"`
}
// AutoscalerSpec defines the desired state of Autoscaler
type AutoscalerSpec struct {
// MinReplicas is the minimal replicas
// +optional
MinReplicas *int32 `json:"minReplicas,omitempty"`
// MinReplicas is the maximal replicas
// +optional
MaxReplicas *int32 `json:"maxReplicas,omitempty"`
// Triggers lists all triggers
Triggers []Trigger `json:"triggers"`
// TargetWorkload specify the workload which is going to be scaled,
// it could be WorkloadReference or the child resource of it
TargetWorkload TargetWorkload `json:"targetWorkload,omitempty"`
// WorkloadReference marks the owner of the workload
WorkloadReference runtimev1alpha1.TypedReference `json:"workloadRef,omitempty"`
}
// TargetWorkload holds the a reference to the scale target Object
type TargetWorkload struct {
Name string `json:"name"`
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// +optional
Kind string `json:"kind,omitempty"`
}
// AutoscalerStatus defines the observed state of Autoscaler
type AutoscalerStatus struct {
runtimev1alpha1.ConditionedStatus `json:",inline"`
}
// +kubebuilder:object:root=true
// AutoscalerList contains a list of Autoscaler
type AutoscalerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Autoscaler `json:"items"`
}
func init() {
SchemeBuilder.Register(&Autoscaler{}, &AutoscalerList{})
}

View File

@@ -39,12 +39,11 @@ type ScapeServiceEndPoint struct {
// The default and only supported format is "prometheus" for now
Format string `json:"format,omitempty"`
// Number or name of the port to access on the pods targeted by the service.
// When this field has value implies that we need to create a service for the workload
// Mutually exclusive with port.
// The default is discovered automatically from podTemplate, metricTrait will create a service for the workload
TargetPort intstr.IntOrString `json:"port,omitempty"`
// Route service traffic to pods with label keys and values matching this
// The default is the labels in the workload
// Mutually exclusive with port.
// The default is discovered automatically from podTemplate.
// If no podTemplate, use the labels specified here, or use the labels of the workload
TargetSelector map[string]string `json:"selector,omitempty"`
// HTTP path to scrape for metrics.
// default is /metrics
@@ -63,8 +62,13 @@ type ScapeServiceEndPoint struct {
type MetricsTraitStatus struct {
runtimev1alpha1.ConditionedStatus `json:",inline"`
// ServiceMonitorNames managed by this trait
ServiceMonitorNames []string `json:"serviceMonitorName,omitempty"`
// ServiceMonitorName managed by this trait
ServiceMonitorName string `json:"serviceMonitorName,omitempty"`
// Port is the real port monitoring
Port intstr.IntOrString `json:"port,omitempty"`
// SelectorLabels is the real labels selected
SelectorLabels map[string]string `json:"selectorLabels,omitempty"`
}
// +kubebuilder:object:root=true
@@ -95,20 +99,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
}

View File

@@ -23,20 +23,20 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ContainerizedSpec defines the desired state of Containerized
type ContainerizedSpec struct {
// PodSpecWorkloadSpec defines the desired state of PodSpecWorkload
type PodSpecWorkloadSpec struct {
// Replicas is the desired number of replicas of the given podSpec.
// These are replicas in the sense that they are instantiations of the same podSpec.
// If unspecified, defaults to 1.
Replicas *int32 `json:"replicas"`
Replicas *int32 `json:"replicas,omitempty"`
// PodSpec describes the pods that will be created,
// we omit the meta part as it will be exactly the same as the containerized
// we omit the meta part as it will be exactly the same as the PodSpecWorkload
PodSpec v1.PodSpec `json:"podSpec"`
}
// ContainerizedStatus defines the observed state of Containerized
type ContainerizedStatus struct {
// PodSpecWorkloadStatus defines the observed state of PodSpecWorkload
type PodSpecWorkloadStatus struct {
cpv1alpha1.ConditionedStatus `json:",inline"`
// Resources managed by this workload.
@@ -45,36 +45,40 @@ type ContainerizedStatus struct {
// +kubebuilder:object:root=true
// Containerized is the Schema for the containerizeds API
// PodSpecWorkload is the Schema for the PodSpec API
// +genclient:method=GetScale,verb=get,subresource=scale,result=k8s.io/api/autoscaling/v1.Scale
// +genclient:method=UpdateScale,verb=update,subresource=scale,input=k8s.io/api/autoscaling/v1.Scale,result=k8s.io/api/autoscaling/v1.Scale
// +kubebuilder:resource:categories={oam}
// +kubebuilder:subresource:status
type Containerized struct {
type PodSpecWorkload struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ContainerizedSpec `json:"spec,omitempty"`
Status ContainerizedStatus `json:"status,omitempty"`
Spec PodSpecWorkloadSpec `json:"spec,omitempty"`
Status PodSpecWorkloadStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// ContainerizedList contains a list of Containerized
type ContainerizedList struct {
// PodSpecWorkloadList contains a list of PodSpecWorkload
type PodSpecWorkloadList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Containerized `json:"items"`
Items []PodSpecWorkload `json:"items"`
}
func init() {
SchemeBuilder.Register(&Containerized{}, &ContainerizedList{})
SchemeBuilder.Register(&PodSpecWorkload{}, &PodSpecWorkloadList{})
}
var _ oam.Workload = &Containerized{}
var _ oam.Workload = &PodSpecWorkload{}
func (in *Containerized) SetConditions(c ...cpv1alpha1.Condition) {
// SetConditions set condition for this CR
func (in *PodSpecWorkload) SetConditions(c ...cpv1alpha1.Condition) {
in.Status.SetConditions(c...)
}
func (in *Containerized) GetCondition(c cpv1alpha1.ConditionType) cpv1alpha1.Condition {
// GetCondition set condition for this CR
func (in *PodSpecWorkload) GetCondition(c cpv1alpha1.ConditionType) cpv1alpha1.Condition {
return in.Status.GetCondition(c)
}

161
api/v1alpha1/route_types.go Normal file
View File

@@ -0,0 +1,161 @@
/*
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 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"
)
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// RouteSpec defines the desired state of Route
type RouteSpec struct {
// WorkloadReference to the workload whose metrics needs to be exposed
WorkloadReference runtimev1alpha1.TypedReference `json:"workloadRef,omitempty"`
// Host is the host of the route
Host string `json:"host"`
// 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
TLS *TLS `json:"tls,omitempty"`
// Rules contain multiple rules of route
Rules []Rule `json:"rules,omitempty"`
// Provider indicate which ingress controller implementation the route trait will use, by default it's nginx-ingress
Provider string `json:"provider,omitempty"`
}
// Rule defines to route rule
type Rule struct {
// Name will become the suffix of underlying ingress created by this rule, if not, will use index as suffix.
Name string `json:"name,omitempty"`
// Path is location Path, default for "/"
Path string `json:"path,omitempty"`
// RewriteTarget will rewrite request from Path to RewriteTarget path.
RewriteTarget string `json:"rewriteTarget,omitempty"`
// CustomHeaders pass a custom list of headers to the backend service.
CustomHeaders map[string]string `json:"customHeaders,omitempty"`
// DefaultBackend will become the ingress default backend if the backend is not available
DefaultBackend *runtimev1alpha1.TypedReference `json:"defaultBackend,omitempty"`
// Backend indicate how to connect backend service
// If it's nil, will auto discovery
Backend *Backend `json:"backend,omitempty"`
}
// TLS defines certificate issuer and type for mTLS configuration
type TLS struct {
IssuerName string `json:"issuerName,omitempty"`
// Type indicate the issuer is ClusterIssuer or Issuer(namespace issuer), by default, it's Issuer
// +kubebuilder:default:=Issuer
Type IssuerType `json:"type,omitempty"`
}
// IssuerType defines the type of issuer
type IssuerType string
const (
// 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.
type Backend struct {
// ReadTimeout used for setting read timeout duration for backend service, the unit is second.
ReadTimeout int `json:"readTimeout,omitempty"`
// SendTimeout used for setting send timeout duration for backend service, the unit is second.
SendTimeout int `json:"sendTimeout,omitempty"`
// BackendService specifies the backend K8s service and port, it's optional
BackendService *BackendServiceRef `json:"backendService,omitempty"`
}
// BackendServiceRef specifies the backend K8s service and port, if specified, the two fields are all required
type BackendServiceRef struct {
// Port allow you direct specify backend service port.
Port intstr.IntOrString `json:"port"`
// ServiceName allow you direct specify K8s service for backend service.
ServiceName string `json:"serviceName"`
}
// RouteStatus defines the observed state of Route
type RouteStatus struct {
Ingresses []runtimev1alpha1.TypedReference `json:"ingresses,omitempty"`
Service *runtimev1alpha1.TypedReference `json:"service,omitempty"`
Status string `json:"status,omitempty"`
runtimev1alpha1.ConditionedStatus `json:",inline"`
}
// Route is the Schema for the routes API
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories={oam}
// +kubebuilder:subresource:status
type Route struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RouteSpec `json:"spec,omitempty"`
Status RouteStatus `json:"status,omitempty"`
}
// RouteList contains a list of Route
// +kubebuilder:object:root=true
type RouteList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Route `json:"items"`
}
func init() {
SchemeBuilder.Register(&Route{}, &RouteList{})
}
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 Route Trait.
func (r *Route) GetWorkloadReference() runtimev1alpha1.TypedReference {
return r.Spec.WorkloadReference
}
// SetWorkloadReference of this Route Trait.
func (r *Route) SetWorkloadReference(rt runtimev1alpha1.TypedReference) {
r.Spec.WorkloadReference = rt
}

View File

@@ -26,7 +26,7 @@ import (
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Containerized) DeepCopyInto(out *Containerized) {
func (in *Autoscaler) DeepCopyInto(out *Autoscaler) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
@@ -34,18 +34,18 @@ func (in *Containerized) DeepCopyInto(out *Containerized) {
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Containerized.
func (in *Containerized) DeepCopy() *Containerized {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Autoscaler.
func (in *Autoscaler) DeepCopy() *Autoscaler {
if in == nil {
return nil
}
out := new(Containerized)
out := new(Autoscaler)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Containerized) DeepCopyObject() runtime.Object {
func (in *Autoscaler) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
@@ -53,31 +53,31 @@ func (in *Containerized) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerizedList) DeepCopyInto(out *ContainerizedList) {
func (in *AutoscalerList) DeepCopyInto(out *AutoscalerList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Containerized, len(*in))
*out = make([]Autoscaler, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerizedList.
func (in *ContainerizedList) DeepCopy() *ContainerizedList {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutoscalerList.
func (in *AutoscalerList) DeepCopy() *AutoscalerList {
if in == nil {
return nil
}
out := new(ContainerizedList)
out := new(AutoscalerList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ContainerizedList) DeepCopyObject() runtime.Object {
func (in *AutoscalerList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
@@ -85,43 +85,87 @@ func (in *ContainerizedList) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerizedSpec) DeepCopyInto(out *ContainerizedSpec) {
func (in *AutoscalerSpec) DeepCopyInto(out *AutoscalerSpec) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int32)
**out = **in
}
in.PodSpec.DeepCopyInto(&out.PodSpec)
if in.MaxReplicas != nil {
in, out := &in.MaxReplicas, &out.MaxReplicas
*out = new(int32)
**out = **in
}
if in.Triggers != nil {
in, out := &in.Triggers, &out.Triggers
*out = make([]Trigger, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
out.TargetWorkload = in.TargetWorkload
out.WorkloadReference = in.WorkloadReference
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerizedSpec.
func (in *ContainerizedSpec) DeepCopy() *ContainerizedSpec {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutoscalerSpec.
func (in *AutoscalerSpec) DeepCopy() *AutoscalerSpec {
if in == nil {
return nil
}
out := new(ContainerizedSpec)
out := new(AutoscalerSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerizedStatus) DeepCopyInto(out *ContainerizedStatus) {
func (in *AutoscalerStatus) DeepCopyInto(out *AutoscalerStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]corev1alpha1.TypedReference, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerizedStatus.
func (in *ContainerizedStatus) DeepCopy() *ContainerizedStatus {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AutoscalerStatus.
func (in *AutoscalerStatus) DeepCopy() *AutoscalerStatus {
if in == nil {
return nil
}
out := new(ContainerizedStatus)
out := new(AutoscalerStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Backend) DeepCopyInto(out *Backend) {
*out = *in
if in.BackendService != nil {
in, out := &in.BackendService, &out.BackendService
*out = new(BackendServiceRef)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend.
func (in *Backend) DeepCopy() *Backend {
if in == nil {
return nil
}
out := new(Backend)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BackendServiceRef) DeepCopyInto(out *BackendServiceRef) {
*out = *in
out.Port = in.Port
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendServiceRef.
func (in *BackendServiceRef) DeepCopy() *BackendServiceRef {
if in == nil {
return nil
}
out := new(BackendServiceRef)
in.DeepCopyInto(out)
return out
}
@@ -206,10 +250,13 @@ func (in *MetricsTraitSpec) DeepCopy() *MetricsTraitSpec {
func (in *MetricsTraitStatus) DeepCopyInto(out *MetricsTraitStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.ServiceMonitorNames != nil {
in, out := &in.ServiceMonitorNames, &out.ServiceMonitorNames
*out = make([]string, len(*in))
copy(*out, *in)
out.Port = in.Port
if in.SelectorLabels != nil {
in, out := &in.SelectorLabels, &out.SelectorLabels
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
@@ -223,6 +270,252 @@ func (in *MetricsTraitStatus) DeepCopy() *MetricsTraitStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSpecWorkload) DeepCopyInto(out *PodSpecWorkload) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkload.
func (in *PodSpecWorkload) DeepCopy() *PodSpecWorkload {
if in == nil {
return nil
}
out := new(PodSpecWorkload)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodSpecWorkload) 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 *PodSpecWorkloadList) DeepCopyInto(out *PodSpecWorkloadList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PodSpecWorkload, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkloadList.
func (in *PodSpecWorkloadList) DeepCopy() *PodSpecWorkloadList {
if in == nil {
return nil
}
out := new(PodSpecWorkloadList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodSpecWorkloadList) 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 *PodSpecWorkloadSpec) DeepCopyInto(out *PodSpecWorkloadSpec) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(int32)
**out = **in
}
in.PodSpec.DeepCopyInto(&out.PodSpec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkloadSpec.
func (in *PodSpecWorkloadSpec) DeepCopy() *PodSpecWorkloadSpec {
if in == nil {
return nil
}
out := new(PodSpecWorkloadSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSpecWorkloadStatus) DeepCopyInto(out *PodSpecWorkloadStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]corev1alpha1.TypedReference, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkloadStatus.
func (in *PodSpecWorkloadStatus) DeepCopy() *PodSpecWorkloadStatus {
if in == nil {
return nil
}
out := new(PodSpecWorkloadStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Route) DeepCopyInto(out *Route) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Route.
func (in *Route) DeepCopy() *Route {
if in == nil {
return nil
}
out := new(Route)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Route) 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 *RouteList) DeepCopyInto(out *RouteList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Route, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteList.
func (in *RouteList) DeepCopy() *RouteList {
if in == nil {
return nil
}
out := new(RouteList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *RouteList) 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 *RouteSpec) DeepCopyInto(out *RouteSpec) {
*out = *in
out.WorkloadReference = in.WorkloadReference
if in.TLS != nil {
in, out := &in.TLS, &out.TLS
*out = new(TLS)
**out = **in
}
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]Rule, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteSpec.
func (in *RouteSpec) DeepCopy() *RouteSpec {
if in == nil {
return nil
}
out := new(RouteSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RouteStatus) DeepCopyInto(out *RouteStatus) {
*out = *in
if in.Ingresses != nil {
in, out := &in.Ingresses, &out.Ingresses
*out = make([]corev1alpha1.TypedReference, len(*in))
copy(*out, *in)
}
if in.Service != nil {
in, out := &in.Service, &out.Service
*out = new(corev1alpha1.TypedReference)
**out = **in
}
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RouteStatus.
func (in *RouteStatus) DeepCopy() *RouteStatus {
if in == nil {
return nil
}
out := new(RouteStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Rule) DeepCopyInto(out *Rule) {
*out = *in
if in.CustomHeaders != nil {
in, out := &in.CustomHeaders, &out.CustomHeaders
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
if in.DefaultBackend != nil {
in, out := &in.DefaultBackend, &out.DefaultBackend
*out = new(corev1alpha1.TypedReference)
**out = **in
}
if in.Backend != nil {
in, out := &in.Backend, &out.Backend
*out = new(Backend)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Rule.
func (in *Rule) DeepCopy() *Rule {
if in == nil {
return nil
}
out := new(Rule)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ScapeServiceEndPoint) DeepCopyInto(out *ScapeServiceEndPoint) {
*out = *in
@@ -250,3 +543,55 @@ func (in *ScapeServiceEndPoint) DeepCopy() *ScapeServiceEndPoint {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TLS) DeepCopyInto(out *TLS) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TLS.
func (in *TLS) DeepCopy() *TLS {
if in == nil {
return nil
}
out := new(TLS)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *TargetWorkload) DeepCopyInto(out *TargetWorkload) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetWorkload.
func (in *TargetWorkload) DeepCopy() *TargetWorkload {
if in == nil {
return nil
}
out := new(TargetWorkload)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Trigger) DeepCopyInto(out *Trigger) {
*out = *in
if in.Condition != nil {
in, out := &in.Condition, &out.Condition
*out = make(map[string]string, len(*in))
for key, val := range *in {
(*out)[key] = val
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Trigger.
func (in *Trigger) DeepCopy() *Trigger {
if in == nil {
return nil
}
out := new(Trigger)
in.DeepCopyInto(out)
return out
}

View File

@@ -1,4 +0,0 @@
#!/bin/bash
# Download and unpack operator Lifecycle Manager (coreos)
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/0.15.1/install.sh | bash -s 0.15.1

View File

@@ -1,24 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: my-grafana-operator
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: operatorgroup
namespace: my-grafana-operator
spec:
targetNamespaces:
- my-grafana-operator
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: my-grafana-operator
namespace: my-grafana-operator
spec:
channel: alpha
name: grafana-operator
source: operatorhubio-catalog
sourceNamespace: olm

View File

@@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
mornitoring: oam
name: monitoring

View File

@@ -1,265 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: podmonitors.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: PodMonitor
listKind: PodMonitorList
plural: podmonitors
singular: podmonitor
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: PodMonitor defines monitoring for a set of pods.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Specification of desired Pod selection for target discovery
by Prometheus.
properties:
jobLabel:
description: The label to use to retrieve the job name from.
type: string
namespaceSelector:
description: Selector to select which namespaces the Endpoints objects
are discovered from.
properties:
any:
description: Boolean describing whether all namespaces are selected
in contrast to a list restricting them.
type: boolean
matchNames:
description: List of namespace names.
items:
type: string
type: array
type: object
podMetricsEndpoints:
description: A list of endpoints allowed as part of this PodMonitor.
items:
description: PodMetricsEndpoint defines a scrapeable endpoint of
a Kubernetes Pod serving Prometheus metrics.
properties:
honorLabels:
description: HonorLabels chooses the metric's labels on collisions
with target labels.
type: boolean
honorTimestamps:
description: HonorTimestamps controls whether Prometheus respects
the timestamps present in scraped data.
type: boolean
interval:
description: Interval at which metrics should be scraped
type: string
metricRelabelings:
description: MetricRelabelConfigs to apply to samples before
ingestion.
items:
description: 'RelabelConfig allows dynamic rewriting of the
label set, being applied to samples before ingestion. It
defines `<metric_relabel_configs>`-section of Prometheus
configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
description: Action to perform based on regex matching.
Default is 'replace'
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
description: Replacement value against which a regex replace
is performed if the regular expression matches. Regex
capture groups are available. Default is '$1'
type: string
separator:
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular
expression for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
params:
additionalProperties:
items:
type: string
type: array
description: Optional HTTP URL parameters
type: object
path:
description: HTTP path to scrape for metrics.
type: string
port:
description: Name of the pod port this endpoint refers to. Mutually
exclusive with targetPort.
type: string
proxyUrl:
description: ProxyURL eg http://proxyserver:2195 Directs scrapes
to proxy through this endpoint.
type: string
relabelings:
description: 'RelabelConfigs to apply to samples before ingestion.
More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config'
items:
description: 'RelabelConfig allows dynamic rewriting of the
label set, being applied to samples before ingestion. It
defines `<metric_relabel_configs>`-section of Prometheus
configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
description: Action to perform based on regex matching.
Default is 'replace'
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
description: Replacement value against which a regex replace
is performed if the regular expression matches. Regex
capture groups are available. Default is '$1'
type: string
separator:
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular
expression for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
scheme:
description: HTTP scheme to use for scraping.
type: string
scrapeTimeout:
description: Timeout after which the scrape is ended
type: string
targetPort:
anyOf:
- type: integer
- type: string
description: 'Deprecated: Use ''port'' instead.'
x-kubernetes-int-or-string: true
type: object
type: array
podTargetLabels:
description: PodTargetLabels transfers labels on the Kubernetes Pod
onto the target.
items:
type: string
type: array
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted.
format: int64
type: integer
selector:
description: Selector to select Pod objects.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
required:
- podMetricsEndpoints
- selector
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,212 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: probes.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: Probe
listKind: ProbeList
plural: probes
singular: probe
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Probe defines monitoring for a set of static targets or ingresses.
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Specification of desired Ingress selection for target discovery
by Prometheus.
properties:
interval:
description: Interval at which targets are probed using the configured
prober. If not specified Prometheus' global scrape interval is used.
type: string
jobName:
description: The job name assigned to scraped metrics by default.
type: string
module:
description: 'The module to use for probing specifying how to probe
the target. Example module configuring in the blackbox exporter:
https://github.com/prometheus/blackbox_exporter/blob/master/example.yml'
type: string
prober:
description: Specification for the prober to use for probing targets.
The prober.URL parameter is required. Targets cannot be probed if
left empty.
properties:
path:
description: Path to collect metrics from. Defaults to `/probe`.
type: string
scheme:
description: HTTP scheme to use for scraping. Defaults to `http`.
type: string
url:
description: Mandatory URL of the prober.
type: string
required:
- url
type: object
scrapeTimeout:
description: Timeout for scraping metrics from the Prometheus exporter.
type: string
targets:
description: Targets defines a set of static and/or dynamically discovered
targets to be probed using the prober.
properties:
ingress:
description: Ingress defines the set of dynamically discovered
ingress objects which hosts are considered for probing.
properties:
namespaceSelector:
description: Select Ingress objects by namespace.
properties:
any:
description: Boolean describing whether all namespaces
are selected in contrast to a list restricting them.
type: boolean
matchNames:
description: List of namespace names.
items:
type: string
type: array
type: object
relabelingConfigs:
description: 'RelabelConfigs to apply to samples before ingestion.
More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config'
items:
description: 'RelabelConfig allows dynamic rewriting of
the label set, being applied to samples before ingestion.
It defines `<metric_relabel_configs>`-section of Prometheus
configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
description: Action to perform based on regex matching.
Default is 'replace'
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
description: Replacement value against which a regex
replace is performed if the regular expression matches.
Regex capture groups are available. Default is '$1'
type: string
separator:
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular
expression for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
selector:
description: Select Ingress objects by labels.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector
that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: operator represents a key's relationship
to a set of values. Valid operators are In, NotIn,
Exists and DoesNotExist.
type: string
values:
description: values is an array of string values.
If the operator is In or NotIn, the values array
must be non-empty. If the operator is Exists or
DoesNotExist, the values array must be empty.
This array is replaced during a strategic merge
patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs.
A single {key,value} in the matchLabels map is equivalent
to an element of matchExpressions, whose key field is
"key", the operator is "In", and the values array contains
only "value". The requirements are ANDed.
type: object
type: object
type: object
staticConfig:
description: 'StaticConfig defines static targets which are considers
for probing. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config.'
properties:
labels:
additionalProperties:
type: string
description: Labels assigned to all metrics scraped from the
targets.
type: object
static:
description: Targets is a list of URLs to probe using the
configured prober.
items:
type: string
type: array
type: object
type: object
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,94 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: prometheusrules.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: PrometheusRule
listKind: PrometheusRuleList
plural: prometheusrules
singular: prometheusrule
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: PrometheusRule defines alerting rules for a Prometheus instance
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Specification of desired alerting rule definitions for Prometheus.
properties:
groups:
description: Content of Prometheus rule file
items:
description: 'RuleGroup is a list of sequentially evaluated recording
and alerting rules. Note: PartialResponseStrategy is only used
by ThanosRuler and will be ignored by Prometheus instances. Valid
values for this field are ''warn'' or ''abort''. More info: https://github.com/thanos-io/thanos/blob/master/docs/components/rule.md#partial-response'
properties:
interval:
type: string
name:
type: string
partial_response_strategy:
type: string
rules:
items:
description: Rule describes an alerting or recording rule.
properties:
alert:
type: string
annotations:
additionalProperties:
type: string
type: object
expr:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
for:
type: string
labels:
additionalProperties:
type: string
type: object
record:
type: string
required:
- expr
type: object
type: array
required:
- name
- rules
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,82 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
rules:
- apiGroups:
- monitoring.coreos.com
resources:
- alertmanagers
- alertmanagers/finalizers
- prometheuses
- prometheuses/finalizers
- thanosrulers
- thanosrulers/finalizers
- servicemonitors
- podmonitors
- probes
- prometheusrules
verbs:
- '*'
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- '*'
- apiGroups:
- ""
resources:
- configmaps
- secrets
verbs:
- '*'
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- delete
- apiGroups:
- ""
resources:
- services
- services/finalizers
- endpoints
verbs:
- get
- create
- update
- delete
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create

View File

@@ -1,34 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus-operator
subjects:
- kind: ServiceAccount
name: prometheus-operator
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: "cluster-admin"
subjects:
- kind: ServiceAccount
name: prometheus-operator
namespace: monitoring

View File

@@ -1,60 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
template:
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
spec:
containers:
- args:
- --kubelet-service=kube-system/kubelet
- --logtostderr=true
- --config-reloader-image=jimmidyson/configmap-reload:v0.4.0
- --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.41.1
image: quay.io/coreos/prometheus-operator:v0.41.1
name: prometheus-operator
ports:
- containerPort: 8080
name: http
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
- args:
- --logtostderr
- --secure-listen-address=:8443
- --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- --upstream=http://127.0.0.1:8080/
image: quay.io/coreos/kube-rbac-proxy:v0.4.1
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
securityContext:
runAsUser: 65534
nodeSelector:
beta.kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
runAsUser: 65534
serviceAccountName: prometheus-operator

View File

@@ -1,18 +0,0 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
namespace: monitoring
spec:
clusterIP: None
ports:
- name: https
port: 8443
targetPort: https
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator

View File

@@ -1,9 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
namespace: monitoring

View File

@@ -1,6 +1,6 @@
apiVersion: v2
name: vela-core
description: A Helm chart for Kubernetes
description: A Helm chart for Kube Vela core
# A chart can be either an 'application' or a 'library' chart.
#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -101,16 +101,29 @@ spec:
to match a value.
properties:
fieldPath:
description: FieldPath specifies got value from
workload/trait object
type: string
op:
description: ConditionOperator specifies the operator
to match a value.
type: string
value:
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
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
required:
- op
- value
type: object
type: array
fieldPath:
@@ -233,16 +246,29 @@ spec:
requirement to match a value.
properties:
fieldPath:
description: FieldPath specifies got value
from workload/trait object
type: string
op:
description: ConditionOperator specifies the
operator to match a value.
type: string
value:
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
properties:
fieldPath:
type: string
required:
- fieldPath
type: object
required:
- op
- value
type: object
type: array
fieldPath:
@@ -338,6 +364,8 @@ spec:
- kind
- name
type: object
reason:
type: string
to:
description: DependencyToObject represents the object that
dependency data goes to.
@@ -365,10 +393,47 @@ spec:
type: object
required:
- from
- reason
- to
type: object
type: array
type: object
historyWorkloads:
description: HistoryWorkloads will record history but still working
revision workloads.
items:
description: HistoryWorkload contain the old component revision
that are still running
properties:
revision:
description: component revision of this workload
type: string
workloadRef:
description: Reference to running workload.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
type: object
type: array
observedGeneration:
description: The generation observed by the appConfig controller.
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
@@ -482,8 +547,6 @@ spec:
type: object
type: object
type: array
required:
- dependency
type: object
type: object
served: true

View File

@@ -0,0 +1,90 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: applicationdeployments.core.oam.dev
spec:
group: core.oam.dev
names:
categories:
- oam
kind: ApplicationDeployment
listKind: ApplicationDeploymentList
plural: applicationdeployments
singular: applicationdeployment
scope: Namespaced
versions:
- name: v1alpha2
schema:
openAPIV3Schema:
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'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ApplicationDeploymentSpec defines the desired state of ApplicationDeployment
type: object
status:
description: ApplicationDeploymentStatus defines the observed state of
ApplicationDeployment
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
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -72,6 +72,7 @@ spec:
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.
type: boolean
@@ -82,7 +83,9 @@ spec:
type: array
workload:
description: A Workload that will be created for each ApplicationConfiguration
that includes this Component. Workloads must be defined by a WorkloadDefinition.
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
@@ -137,6 +140,10 @@ spec:
- name
- revision
type: object
observedGeneration:
description: The generation observed by the component controller.
format: int64
type: integer
type: object
type: object
served: true

View File

@@ -119,10 +119,76 @@ spec:
- type
type: object
type: array
health:
type: string
healthConditions:
description: WorkloadHealthConditions represents health condition
of workloads in the scope
items:
description: WorkloadHealthCondition represents informative health
condition.
properties:
componentName:
description: ComponentName represents the component name if
target is a workload
type: string
diagnosis:
type: string
healthStatus:
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.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
workloadStatus:
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
properties:
healthStatus:
description: HealthStatus represents health status strings.
type: string
healthyWorkloads:
format: int64
type: integer
total:
format: int64
type: integer
unhealthyWorkloads:
format: int64
type: integer
unknownWorkloads:
format: int64
type: integer
required:
- healthStatus
type: object
required:
- health
- scopeHealthCondition
type: object
type: object
served: true

View File

@@ -85,6 +85,16 @@ spec:
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.
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).
type: string
required:
- definitionRef
type: object

View File

@@ -0,0 +1,155 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: autoscalers.standard.oam.dev
spec:
group: standard.oam.dev
names:
categories:
- oam
kind: Autoscaler
listKind: AutoscalerList
plural: autoscalers
singular: autoscaler
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
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'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: AutoscalerSpec defines the desired state of Autoscaler
properties:
maxReplicas:
description: MinReplicas is the maximal replicas
format: int32
type: integer
minReplicas:
description: MinReplicas is the minimal replicas
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
properties:
apiVersion:
type: string
kind:
type: string
name:
type: string
required:
- name
type: object
triggers:
description: Triggers lists all triggers
items:
description: Trigger defines the trigger of Autoscaler
properties:
condition:
additionalProperties:
type: string
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
type: string
type:
description: Type allows value in [cpu/memory/storage/ephemeral-storage、cron、pps、qps/rps、custom]
type: string
required:
- condition
- type
type: object
type: array
workloadRef:
description: WorkloadReference marks the owner of the workload
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
required:
- triggers
type: object
status:
description: AutoscalerStatus defines the observed state of Autoscaler
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
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -56,9 +56,9 @@ spec:
- type: integer
- type: string
description: Number or name of the port to access on the pods
targeted by the service. When this field has value implies that
we need to create a service for the workload Mutually exclusive
with port.
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
@@ -68,8 +68,9 @@ spec:
additionalProperties:
type: string
description: Route service traffic to pods with label keys and
values matching this The default is the labels in the workload
Mutually exclusive with port.
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:
@@ -132,11 +133,20 @@ spec:
- type
type: object
type: array
serviceMonitorName:
description: ServiceMonitorNames managed by this trait
items:
port:
anyOf:
- type: integer
- type: string
description: Port is the real port monitoring
x-kubernetes-int-or-string: true
selectorLabels:
additionalProperties:
type: string
type: array
description: SelectorLabels is the real labels selected
type: object
serviceMonitorName:
description: ServiceMonitorName managed by this trait
type: string
type: object
required:
- spec

View File

@@ -6,22 +6,22 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: containerizeds.standard.oam.dev
name: podspecworkloads.standard.oam.dev
spec:
group: standard.oam.dev
names:
categories:
- oam
kind: Containerized
listKind: ContainerizedList
plural: containerizeds
singular: containerized
kind: PodSpecWorkload
listKind: PodSpecWorkloadList
plural: podspecworkloads
singular: podspecworkload
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Containerized is the Schema for the containerizeds API
description: PodSpecWorkload is the Schema for the PodSpec API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@@ -36,11 +36,11 @@ spec:
metadata:
type: object
spec:
description: ContainerizedSpec defines the desired state of Containerized
description: PodSpecWorkloadSpec defines the desired state of PodSpecWorkload
properties:
podSpec:
description: PodSpec describes the pods that will be created, we omit
the meta part as it will be exactly the same as the containerized
the meta part as it will be exactly the same as the PodSpecWorkload
properties:
activeDeadlineSeconds:
description: Optional duration in seconds the pod may be active
@@ -1230,6 +1230,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP,
or SCTP. Defaults to "TCP".
type: string
@@ -2364,6 +2365,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP,
or SCTP. Defaults to "TCP".
type: string
@@ -3503,6 +3505,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP,
or SCTP. Defaults to "TCP".
type: string
@@ -5691,10 +5694,9 @@ spec:
type: integer
required:
- podSpec
- replicas
type: object
status:
description: ContainerizedStatus defines the observed state of Containerized
description: PodSpecWorkloadStatus defines the observed state of PodSpecWorkload
properties:
conditions:
description: Conditions of the resource.

View File

@@ -0,0 +1,257 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: routes.standard.oam.dev
spec:
group: standard.oam.dev
names:
categories:
- oam
kind: Route
listKind: RouteList
plural: routes
singular: route
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
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'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: RouteSpec defines the desired state of Route
properties:
host:
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
type: string
rules:
description: Rules contain multiple rules of route
items:
description: Rule defines to route rule
properties:
backend:
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
properties:
port:
anyOf:
- type: integer
- type: string
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.
type: string
required:
- port
- serviceName
type: object
readTimeout:
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.
type: integer
type: object
customHeaders:
additionalProperties:
type: string
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
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
name:
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.
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
properties:
issuerName:
type: string
type:
default: 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
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
required:
- host
type: object
status:
description: RouteStatus defines the observed state of Route
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
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.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
type: 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.
properties:
apiVersion:
description: APIVersion of the referenced object.
type: string
kind:
description: Kind of the referenced object.
type: string
name:
description: Name of the referenced object.
type: string
uid:
description: UID of the referenced object.
type: string
required:
- apiVersion
- kind
- name
type: object
status:
type: string
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,42 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: backend-service
annotations:
definition.oam.dev/apiVersion: "core.oam.dev/v1alpha2"
definition.oam.dev/kind: "ContainerizedWorkload"
spec:
definitionRef:
name: containerizeds.standard.oam.dev
childResourceKinds:
- apiVersion: apps/v1
kind: Deployment
- apiVersion: v1
kind: Service
extension:
template: |
#Template: {
apiVersion: "core.oam.dev/v1alpha2"
kind: "ContainerizedWorkload"
metadata: name: containerized.name
spec: {
containers: [{
image: containerized.image
name: containerized.name
ports: [{
containerPort: containerized.port
protocol: "TCP"
name: "default"
}]
}]
}
}
containerized: {
name: string
// +usage=specify app image
// +short=i
image: string
// +usage=specify port for container
// +short=p
port: *6379 | int
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,43 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: containerizeds.standard.oam.dev
annotations:
definition.oam.dev/apiVersion: "core.oam.dev/v1alpha2"
definition.oam.dev/kind: "ContainerizedWorkload"
spec:
definitionRef:
name: containerizeds.standard.oam.dev
childResourceKinds:
- apiVersion: apps/v1
kind: Deployment
- apiVersion: v1
kind: Service
extension:
template: |
#Template: {
apiVersion: "core.oam.dev/v1alpha2"
kind: "ContainerizedWorkload"
metadata:
name: containerized.name
spec: {
containers: [{
image: containerized.image
name: containerized.name
ports: [{
containerPort: containerized.port
protocol: "TCP"
name: "default"
}]
}]
}
}
containerized: {
name: string
// +usage=specify app image
// +short=i
image: string
// +usage=specify port for container
// +short=p
port: *6379 | int
}

View File

@@ -2,6 +2,7 @@ apiVersion: core.oam.dev/v1alpha2
kind: ScopeDefinition
metadata:
name: healthscopes.core.oam.dev
namespace: default
spec:
workloadRefsPath: spec.workloadRefs
allowComponentOverlap: true

View File

@@ -0,0 +1,82 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: autoscale
annotations:
definition.oam.dev/description: "Automatically scale the app following certain triggers or metrics"
spec:
appliesToWorkloads:
- webservice
- 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["cpuPercent"] != _|_ && parameter["cron"] != _|_ {
triggers: [cpuScaler, cronScaler]
}
if parameter["cpuPercent"] != _|_ && parameter["cron"] == _|_ {
triggers: [cpuScaler]
}
if parameter["cpuPercent"] == _|_ && parameter["cron"] != _|_ {
triggers: [cronScaler]
}
}
}
cpuScaler: {
type: "cpu"
condition: {
type: "Utilization"
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"] != _|_ && 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
min: int
// +usage=maximal replicas of the workload
max: int
// +usage=specify the value for CPU utilization, like 80, which means 80%
// +alias=cpu-percent
cpuPercent?: int
// +usage=just for `appfile`, not available for Cli usage
cron?: {
// +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
// +usage=the target replicas to be scaled to
replicas: int
// +usage=timezone, like "America/Los_Angeles"
timezone: string
}
}

View File

@@ -1,25 +1,27 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: manualscalertraits.core.oam.dev
annotations:
definition.oam.dev/apiVersion: "core.oam.dev/v1alpha2"
definition.oam.dev/kind: "ManualScalerTrait"
definition.oam.dev/description: "Manually scale the app"
name: scaler
spec:
appliesToWorkloads:
- core.oam.dev/v1alpha2.ContainerizedWorkload
- webservice
- worker
definitionRef:
name: manualscalertraits.core.oam.dev
workloadRefPath: spec.workloadRef
extension:
template: |
#Template: {
template: |-
output: {
apiVersion: "core.oam.dev/v1alpha2"
kind: "ManualScalerTrait"
spec: {
replicaCount: scale.replica
replicaCount: parameter.replicas
}
}
scale: {
parameter: {
//+short=r
replica: *2 | int
replicas: *1 | int
}

View File

@@ -0,0 +1,37 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: metrics
annotations:
definition.oam.dev/description: "Configure metrics targets to be monitored for the app"
spec:
appliesToWorkloads:
- webservice
- backend
- task
definitionRef:
name: metricstraits.standard.oam.dev
workloadRefPath: spec.workloadRef
extension:
template: |-
output: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "MetricsTrait"
spec: {
scrapeService: parameter
}
}
parameter: {
// +usage=format of the metrics, default as prometheus
// +short=f
format: *"prometheus" | string
// +usage= the metrics path of the service
path: *"/metrics" | string
scheme: *"http" | string
enabled: *true | bool
// +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
selector?: [string]: string
}

View File

@@ -0,0 +1,51 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: rollout
annotations:
definition.oam.dev/description: "Configure canary deployment strategy to release the app"
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
interval: *"30s" | string
}

View File

@@ -0,0 +1,40 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: route
annotations:
definition.oam.dev/description: "Configure route policy to the app"
spec:
appliesToWorkloads:
- webservice
workloadRefPath: spec.workloadRef
definitionRef:
name: routes.standard.oam.dev
extension:
template: |
output: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Route"
spec: {
host: parameter.domain
if parameter.issuer != "" {
tls: {
issuerName: parameter.issuer
}
}
if parameter["rules"] != _|_ {
rules: parameter.rules
}
}
}
parameter: {
domain: *"" | string
issuer: *"" | string
rules?: [...{
path: string
rewriteTarget: *"" | string
}]
}

View File

@@ -0,0 +1,41 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: task
annotations:
definition.oam.dev/description: "One-off task to run a piece of code or script to completion"
spec:
definitionRef:
name: jobs
extension:
template: |
output: {
apiVersion: "v1"
kind: "Job"
spec: {
parallelism: parameter.count
completions: parameter.count
template: spec: {
containers: [{
name: context.name
image: parameter.image
if parameter["cmd"] != _|_ {
command: parameter.cmd
}
}]
}
}
}
parameter: {
// +usage=specify number of tasks to run in parallel
// +short=c
count: *1 | int
// +usage=Which image would you like to use for your service
// +short=i
image: string
cmd?: [...string]
}

View File

@@ -0,0 +1,83 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: webservice
annotations:
definition.oam.dev/description: "Long-running scalable service with stable endpoint to receive external traffic"
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
}
if parameter["env"] != _|_ {
env: parameter.env
}
if context["config"] != _|_ {
env: context.config
}
ports: [{
containerPort: parameter.port
}]
if parameter["cpu"] != _|_ {
resources: {
limits:
cpu: parameter.cpu
requests:
cpu: parameter.cpu
}
}
}]
}
}
}
}
parameter: {
// +usage=Which image would you like to use for your service
// +short=i
image: string
cmd?: [...string]
// +usage=Which port do you want customer traffic sent to
// +short=p
port: *80 | int
env?: [...{
name: string
value?: string
valueFrom?: {
secretKeyRef: {
name: string
key: string
}
}
}]
// +usage=Number of CPU units for the service, like `0.5` (0.5 CPU core), `1` (1 CPU core)
cpu?: string
}

View File

@@ -0,0 +1,50 @@
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]
}

View File

@@ -18,7 +18,7 @@ metadata:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: manager-rolebinding
name: {{ include "kubevela.fullname" . }}:manager-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
@@ -33,7 +33,7 @@ subjects:
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: leader-election-role
name: {{ include "kubevela.fullname" . }}:leader-election-role
rules:
- apiGroups:
- ""
@@ -66,11 +66,11 @@ rules:
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: leader-election-rolebinding
name: {{ include "kubevela.fullname" . }}:leader-election-rolebinding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: leader-election-role
name: {{ include "kubevela.fullname" . }}:leader-election-role
subjects:
- kind: ServiceAccount
name: {{ include "kubevela.serviceAccountName" . }}
@@ -80,6 +80,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "kubevela.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubevela.labels" . | nindent 4 }}
spec:
@@ -110,6 +111,7 @@ spec:
- "--use-webhook=true"
- "--webhook-port={{ .Values.webhookService.port }}"
- "--webhook-cert-dir={{ .Values.certificate.mountPath }}"
- "--health-addr=:{{ .Values.healthCheck.port }}"
{{ end }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ quote .Values.image.pullPolicy }}
@@ -120,6 +122,21 @@ spec:
- containerPort: {{ .Values.webhookService.port }}
name: webhook-server
protocol: TCP
- containerPort: {{ .Values.healthCheck.port }}
name: healthz
protocol: TCP
readinessProbe:
httpGet:
path: /readyz
port: healthz
initialDelaySeconds: 90
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: healthz
initialDelaySeconds: 90
periodSeconds: 5
volumeMounts:
- mountPath: {{ .Values.certificate.mountPath }}
name: tls-cert-vol
@@ -141,4 +158,4 @@ spec:
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}

View File

@@ -1,41 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: metricstraits.standard.oam.dev
spec:
appliesToWorkloads:
- containerizedworkloads.core.oam.dev
- clonesetworkloads.apps.kruise.io
- deployments.apps
- statefulsets.apps
definitionRef:
name: metricstraits.standard.oam.dev
workloadRefPath: spec.workloadRef
extension:
template: |
#Template: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "MetricsTrait"
metadata:
name: metricstraits.name
spec: {
containers: [{
image: containerized.image
name: containerized.name
ports: [{
containerPort: containerized.port
protocol: "TCP"
name: "default"
}]
}]
}
}
containerized: {
name: string
// +usage=specify app image
// +short=i
image: string
// +usage=specify port for container
// +short=p
port: *6379 | int
}

View File

@@ -1,47 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: task
annotations:
definition.oam.dev/apiVersion: "v1"
definition.oam.dev/kind: "Job"
spec:
definitionRef:
name: jobs
extension:
defaultTraits:
- monitor
- logging
template: |
#Template: {
apiVersion: "v1"
kind: "Job"
metadata: name: task
spec: {
parallelism: taskSpec.count
completions: taskSpec.count
template:
spec:
containers: [{
image: taskSpec.image
name: taskSpec.name
ports: [{
containerPort: taskSpec.port
protocol: "TCP"
name: "default"
}]
}]
}
}
taskSpec: {
// +usage=specify number of tasks to run in parallel
// +short=c
count: *1 | int
name: string
// +usage=specify app image
// +short=i
image: string
// +usage=specify port for container
// +short=p
port: *6379 | int
}

View File

@@ -0,0 +1,31 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: vela-config
# TODO: Currently namespace MUST be vela-system
namespace: vela-system
data:
servicemonitors.monitoring.coreos.com: |
{
"repo": "prometheus-community",
"urL": "https://prometheus-community.github.io/helm-charts",
"name": "kube-prometheus-stack",
"namespace": "monitoring",
"version": "9.4.4"
}
flagger.app: |
{
"repo": "oam-flagger",
"urL": "https://oam.dev/flagger/archives/",
"name": "flagger",
"namespace": "vela-system",
"version": "1.1.0"
}
keda: |
{
"repo": "kedacore",
"urL": "https://kedacore.github.io/charts",
"name": "keda",
"namespace": "keda",
"version": "2.0.0-rc3"
}

View File

@@ -3,8 +3,8 @@
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
creationTimestamp: null
name: mutating-webhook-configuration
namespace: {{ .Release.Namespace }}
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.certificate.certificateName }}
webhooks:
@@ -31,7 +31,7 @@ webhooks:
service:
name: {{ template "kubevela.name" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-standard-oam-dev-v1alpha1-containerized
path: /mutate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: mcontainerized.kb.io
rules:
@@ -43,14 +43,14 @@ webhooks:
- CREATE
- UPDATE
resources:
- Containerized
- podspecworkloads
---
apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
creationTimestamp: null
name: validating-webhook-configuration
namespace: {{ .Release.Namespace }}
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/{{ .Values.certificate.certificateName }}
webhooks:
@@ -78,7 +78,7 @@ webhooks:
service:
name: {{ template "kubevela.name" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-standard-oam-dev-v1alpha1-containerized
path: /validate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: vcontainerized.kb.io
rules:
@@ -89,15 +89,15 @@ webhooks:
operations:
- CREATE
- UPDATE
- DELETE
resources:
- Containerized
- podspecworkloads
---
apiVersion: v1
kind: Service
metadata:
name: {{ template "kubevela.name" . }}-webhook
namespace: {{ .Release.Namespace }}
labels:
{{- include "kubevela.labels" . | nindent 4 }}
spec:
@@ -113,7 +113,7 @@ spec:
---
# The following manifests contain a self-signed issuer CR and a certificate CR.
# More document can be found at https://docs.cert-manager.io
apiVersion: cert-manager.io/v1alpha2
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: {{ .Values.certificate.issuerName | quote }}
@@ -121,7 +121,7 @@ spec:
selfSigned: {}
---
apiVersion: cert-manager.io/v1alpha2
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ .Values.certificate.certificateName }}

View File

@@ -1,43 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: web-service
annotations:
definition.oam.dev/apiVersion: "core.oam.dev/v1alpha2"
definition.oam.dev/kind: "ContainerizedWorkload"
spec:
definitionRef:
name: containerizeds.standard.oam.dev
childResourceKinds:
- apiVersion: apps/v1
kind: Deployment
- apiVersion: v1
kind: Service
extension:
template: |
#Template: {
apiVersion: "core.oam.dev/v1alpha2"
kind: "ContainerizedWorkload"
metadata:
name: containerized.name
spec: {
containers: [{
image: containerized.image
name: containerized.name
ports: [{
containerPort: containerized.port
protocol: "TCP"
name: "default"
}]
}]
}
}
containerized: {
name: string
// +usage=specify app image
// +short=i
image: string
// +usage=specify port for container
// +short=p
port: *6379 | int
}

View File

@@ -6,7 +6,7 @@ replicaCount: 1
useWebhook: true
image:
repository: oamdev/vela-core
tag: 0.1
tag: latest
pullPolicy: IfNotPresent
imagePullSecrets: []
@@ -63,6 +63,9 @@ webhookService:
type: ClusterIP
port: 9443
healthCheck:
port: 9440
nodeSelector: {}
tolerations: []

View File

@@ -1,10 +1,16 @@
package main
import (
"errors"
"flag"
"fmt"
"io"
"os"
"os/signal"
"path/filepath"
"strconv"
"syscall"
"time"
monitoring "github.com/coreos/prometheus-operator/pkg/apis/monitoring/v1"
"github.com/crossplane/crossplane-runtime/pkg/logging"
@@ -12,30 +18,51 @@ import (
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"
"github.com/oam-dev/trait-injector/pkg/injector"
"github.com/oam-dev/trait-injector/pkg/plugin"
certmanager "github.com/wonderflow/cert-manager-api/pkg/apis/certmanager/v1"
kedav1alpha1 "github.com/wonderflow/keda-api/api/v1alpha1"
"go.uber.org/zap/zapcore"
"gopkg.in/natefinch/lumberjack.v2"
crdv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"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"
velacontroller "github.com/oam-dev/kubevela/pkg/controller"
"github.com/oam-dev/kubevela/pkg/controller/dependency"
velawebhook "github.com/oam-dev/kubevela/pkg/webhook"
)
var scheme = runtime.NewScheme()
const (
kubevelaName = "kubevela"
)
var (
setupLog = ctrl.Log.WithName(kubevelaName)
scheme = runtime.NewScheme()
waitSecretTimeout = 90 * time.Second
waitSecretInterval = 2 * time.Second
)
func init() {
_ = clientgoscheme.AddToScheme(scheme)
_ = crdv1.AddToScheme(scheme)
_ = oamcore.AddToScheme(scheme)
_ = monitoring.AddToScheme(scheme)
_ = velacore.AddToScheme(scheme)
_ = velacoreoamdev.AddToScheme(scheme)
_ = injectorv1alpha1.AddToScheme(scheme)
_ = certmanager.AddToScheme(scheme)
_ = kedav1alpha1.AddToScheme(scheme)
// +kubebuilder:scaffold:scheme
}
@@ -47,6 +74,7 @@ func main() {
var webhookPort int
var useWebhook, useTraitInjector bool
var controllerArgs oamcontroller.Args
var healthAddr string
flag.BoolVar(&useWebhook, "use-webhook", false, "Enable Admission Webhook")
flag.BoolVar(&useTraitInjector, "use-trait-injector", false, "Enable TraitInjector")
@@ -60,6 +88,7 @@ func main() {
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.Parse()
// setup logging
@@ -79,24 +108,44 @@ func main() {
o.DestWritter = w
}))
setupLog := ctrl.Log.WithName("vela-runtime")
// install dependency charts first
k8sClient, err := client.New(ctrl.GetConfigOrDie(), client.Options{Scheme: scheme})
if err != nil {
setupLog.Error(err, "unable to create a kubernetes client")
os.Exit(1)
}
go dependency.Install(k8sClient)
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "vela-runtime",
Port: webhookPort,
CertDir: certDir,
Scheme: scheme,
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: kubevelaName,
Port: webhookPort,
CertDir: certDir,
HealthProbeBindAddress: healthAddr,
})
if err != nil {
setupLog.Error(err, "unable to create a controller manager")
os.Exit(1)
}
if err := registerHealthChecks(mgr); err != nil {
setupLog.Error(err, "unable to register ready/health checks")
os.Exit(1)
}
if useWebhook {
setupLog.Info("vela webhook enabled, will serving at :" + strconv.Itoa(webhookPort))
oamwebhook.Add(mgr)
if err = oamwebhook.Add(mgr); err != nil {
setupLog.Error(err, "unable to setup oam runtime webhook")
os.Exit(1)
}
velawebhook.Register(mgr)
if err := waitWebhookSecretVolume(certDir, waitSecretTimeout, waitSecretInterval); err != nil {
setupLog.Error(err, "unable to get webhook secret")
os.Exit(1)
}
}
if err = oamv1alpha2.Setup(mgr, controllerArgs, logging.NewLogrLogger(setupLog)); err != nil {
@@ -128,8 +177,88 @@ func main() {
}
setupLog.Info("starting the vela controller manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
if err := mgr.Start(makeSignalHandler(setupLog, k8sClient)); err != nil {
setupLog.Error(err, "problem running manager")
os.Exit(1)
}
setupLog.Info("program safely stops...")
}
// registerHealthChecks is used to create readiness&liveness probes
func registerHealthChecks(mgr ctrl.Manager) error {
setupLog.Info("creating readiness/health check")
if err := mgr.AddReadyzCheck("ping", healthz.Ping); err != nil {
return err
}
if err := mgr.AddHealthzCheck("ping", healthz.Ping); err != nil {
return err
}
return nil
}
// waitWebhookSecretVolume waits for webhook secret ready to avoid mgr running crash
func waitWebhookSecretVolume(certDir string, timeout, interval time.Duration) error {
start := time.Now()
for {
time.Sleep(interval)
if time.Since(start) > timeout {
return fmt.Errorf("getting webhook secret timeout after %s", timeout.String())
}
setupLog.Info(fmt.Sprintf("waiting webhook secret, time consumed: %d/%d seconds ...",
int64(time.Since(start).Seconds()), int64(timeout.Seconds())))
if _, err := os.Stat(certDir); !os.IsNotExist(err) {
ready := func() bool {
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 {
return false
}
// check if secret files are empty
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")
}
return nil
})
if err == nil {
setupLog.Info(fmt.Sprintf("webhook secret is ready (time consumed: %d seconds)",
int64(time.Since(start).Seconds())))
return true
}
return false
}()
if ready {
return nil
}
}
}
}
func makeSignalHandler(log logr.Logger, kubecli client.Client) (stopCh <-chan struct{}) {
stop := make(chan struct{})
c := make(chan os.Signal, 2)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
// Do not uninstall when vela-core terminating.
// When running on K8s, old pod will terminate after new pod running, it will cause charts uninstalled.
// https://github.com/oam-dev/kubevela/issues/499
// dependency.Uninstall(kubecli)
close(stop)
// second signal. Exit directly.
<-c
os.Exit(1)
}()
return stop
}

66
cmd/core/main_test.go Normal file
View File

@@ -0,0 +1,66 @@
package main
import (
"io/ioutil"
"os"
"testing"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var (
testdir = "testdir"
testTimeout = 2 * time.Second
testInterval = 1 * time.Second
)
func TestGinkgo(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "test main")
}
var _ = Describe("test waitSecretVolume", func() {
BeforeEach(func() {
err := os.MkdirAll(testdir, 0755)
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
os.RemoveAll(testdir)
})
When("dir not exist or empty", func() {
It("return timeout error", func() {
err := waitWebhookSecretVolume(testdir, testTimeout, testInterval)
Expect(err).To(HaveOccurred())
By("remove dir")
os.RemoveAll(testdir)
err = waitWebhookSecretVolume(testdir, testTimeout, testInterval)
Expect(err).To(HaveOccurred())
})
})
When("dir contains empty file", func() {
It("return timeout error", func() {
By("add empty file")
_, err := os.Create(testdir + "/emptyFile")
Expect(err).NotTo(HaveOccurred())
err = waitWebhookSecretVolume(testdir, testTimeout, testInterval)
Expect(err).To(HaveOccurred())
})
})
When("files in dir are not empty", func() {
It("return nil", func() {
By("add non-empty file")
_, err := os.Create(testdir + "/file")
Expect(err).NotTo(HaveOccurred())
err = ioutil.WriteFile(testdir+"/file", []byte("test"), os.ModeAppend)
Expect(err).NotTo(HaveOccurred())
err = waitWebhookSecretVolume(testdir, testTimeout, testInterval)
Expect(err).NotTo(HaveOccurred())
})
})
})

View File

@@ -0,0 +1,5 @@
package fake
// ChartSource is a base64-encoded, gzipped tarball of the default Helm chart(charts/vela-core).
// Its value is initialized at build time. This whole file will be rewrite at that time, please don't change this file.
var ChartSource string

View File

@@ -1,174 +1,19 @@
package main
import (
"flag"
"fmt"
"math/rand"
"os"
"runtime"
"time"
"github.com/oam-dev/kubevela/api/types"
"github.com/oam-dev/kubevela/cmd/vela/fake"
"github.com/oam-dev/kubevela/pkg/commands"
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
"github.com/oam-dev/kubevela/pkg/utils/system"
"github.com/oam-dev/kubevela/version"
"github.com/crossplane/oam-kubernetes-runtime/apis/core"
"github.com/gosuri/uitable"
"github.com/spf13/cobra"
k8sruntime "k8s.io/apimachinery/pkg/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/klog"
"sigs.k8s.io/controller-runtime/pkg/client/config"
)
var (
scheme = k8sruntime.NewScheme()
)
// chartTGZSource is a base64-encoded, gzipped tarball of the default Helm chart.
// Its value is initialized at build time.
var chartTGZSource string
func init() {
_ = clientgoscheme.AddToScheme(scheme)
_ = core.AddToScheme(scheme)
// +kubebuilder:scaffold:scheme
}
func main() {
rand.Seed(time.Now().UnixNano())
command := newCommand()
command := commands.NewCommand()
if err := command.Execute(); err != nil {
os.Exit(1)
}
}
func newCommand() *cobra.Command {
ioStream := cmdutil.IOStreams{In: os.Stdin, Out: os.Stdout, ErrOut: os.Stderr}
cmds := &cobra.Command{
Use: "vela",
DisableFlagParsing: true,
Run: func(cmd *cobra.Command, args []string) {
allCommands := cmd.Commands()
cmd.Printf("✈️ A Micro App Platform for Kubernetes.\n\nUsage:\n vela [flags]\n vela [command]\n\nAvailable Commands:\n\n")
PrintHelpByTag(cmd, allCommands, types.TypeStart)
PrintHelpByTag(cmd, allCommands, types.TypeApp)
PrintHelpByTag(cmd, allCommands, types.TypeTraits)
PrintHelpByTag(cmd, allCommands, types.TypeOthers)
PrintHelpByTag(cmd, allCommands, types.TypeSystem)
cmd.Println("Flags:")
cmd.Println(" -h, --help help for vela")
cmd.Println()
cmd.Println(`Use "vela [command] --help" for more information about a command.`)
},
SilenceUsage: true,
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveNoFileComp
},
}
cmds.PersistentFlags().StringP("env", "e", "", "specify env name for application")
restConf, err := config.GetConfig()
if err != nil {
fmt.Println("get kubeconfig err", err)
os.Exit(1)
}
commandArgs := types.Args{
Config: restConf,
Schema: scheme,
}
if err := system.InitDirs(); err != nil {
fmt.Println("InitDir err", err)
os.Exit(1)
}
cmds.AddCommand(
// Getting Start
commands.NewInstallCommand(commandArgs, chartTGZSource, ioStream),
commands.NewEnvCommand(commandArgs, ioStream),
// Getting Start
NewVersionCommand(),
// Apps
commands.NewAppsCommand(commandArgs, ioStream),
// Workloads
commands.AddCompCommands(commandArgs, ioStream),
// Capability Systems
commands.CapabilityCommandGroup(commandArgs, ioStream),
// System
commands.SystemCommandGroup(commandArgs, ioStream),
commands.NewCompletionCommand(),
commands.NewTraitsCommand(ioStream),
commands.NewWorkloadsCommand(ioStream),
commands.NewDashboardCommand(commandArgs, ioStream, fake.FrontendSource),
commands.NewLogsCommand(commandArgs, ioStream),
)
// Traits
if err = commands.AddTraitCommands(cmds, commandArgs, ioStream); err != nil {
fmt.Println("Add trait commands from traitDefinition err", err)
os.Exit(1)
}
// this is for mute klog
fset := flag.NewFlagSet("logs", flag.ContinueOnError)
klog.InitFlags(fset)
_ = fset.Set("v", "-1")
return cmds
}
func PrintHelpByTag(cmd *cobra.Command, all []*cobra.Command, tag string) {
cmd.Printf(" %s:\n\n", tag)
table := uitable.New()
for _, c := range all {
if val, ok := c.Annotations[types.TagCommandType]; ok && val == tag {
table.AddRow(" "+c.Use, c.Long)
for _, subcmd := range c.Commands() {
table.AddRow(" "+subcmd.Use, " "+subcmd.Long)
}
}
}
cmd.Println(table.String())
if tag == types.TypeTraits {
if len(table.Rows) > 0 {
cmd.Println()
}
cmd.Println(" Want more? < install more capabilities by `vela cap` >")
}
cmd.Println()
}
func NewVersionCommand() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Prints out build version information",
Long: "Prints out build version information",
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf(`Version: %v
GitRevision: %v
GolangVersion: %v
`,
version.VelaVersion,
version.GitRevision,
runtime.Version())
},
Annotations: map[string]string{
types.TagCommandType: types.TypeStart,
},
}
}

3
codecov.yml Normal file
View File

@@ -0,0 +1,3 @@
coverage:
status:
patch: off

View File

@@ -1,42 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: ingresses.networking.k8s.io
annotations:
"definition.oam.dev/apiVersion": "networking.k8s.io/v1beta1"
"definition.oam.dev/kind": "Ingress"
spec:
revisionEnabled: true
appliesToWorkloads:
- core.oam.dev/v1alpha2.ContainerizedWorkload
- deployments.apps
definitionRef:
name: ingresses.networking.k8s.io
extension:
install:
helm:
repo: stable
name: nginx-ingress
url: https://kubernetes-charts.storage.googleapis.com/
version: 1.41.2
template: |
#Template: {
apiVersion: "networking.k8s.io/v1beta1"
kind: "Ingress"
spec: {
rules: [{
host: route.domain
http: paths: [{
backend: {
serviceName: route.service
servicePort: route.port
}}]
}]
}
}
route: {
domain: string
port: *80 | int
service: string
}

View File

@@ -1,30 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: TraitDefinition
metadata:
name: simplerollouttraits.extend.oam.dev
annotations:
"definition.oam.dev/apiVersion": "extend.oam.dev/v1alpha2"
"definition.oam.dev/kind": "SimpleRolloutTrait"
spec:
revisionEnabled: true
appliesToWorkloads:
- core.oam.dev/v1alpha2.ContainerizedWorkload
- deployments.apps
definitionRef:
name: simplerollouttraits.extend.oam.dev
extension:
template: |
#Template: {
apiVersion: "extend.oam.dev/v1alpha2"
kind: "SimpleRolloutTrait"
spec: {
replica: rollout.replica
maxUnavailable: rollout.maxUnavailable
batch: rollout.batch
}
}
rollout: {
replica: *3 | int
maxUnavailable: *1 | int
batch: *2 | int
}

View File

@@ -1,43 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: containerizedworkloads.core.oam.dev
annotations:
definition.oam.dev/apiVersion: "core.oam.dev/v1alpha2"
definition.oam.dev/kind: "ContainerizedWorkload"
spec:
definitionRef:
name: containerizedworkloads.core.oam.dev
childResourceKinds:
- apiVersion: apps/v1
kind: Deployment
- apiVersion: v1
kind: Service
extension:
template: |
#Template: {
apiVersion: "core.oam.dev/v1alpha2"
kind: "ContainerizedWorkload"
metadata: name: containerized.name
spec: {
containers: [{
image: containerized.image
name: containerized.name
ports: [{
containerPort: containerized.port
protocol: "TCP"
name: "default"
}]
}]
}
}
containerized: {
name: string
// +usage=specify app image
// +short=i
image: string
// +usage=specify port for container
// +short=p
port: *6379 | int
}

View File

@@ -1,52 +0,0 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: deployments.apps
annotations:
definition.oam.dev/apiVersion: "apps/v1"
definition.oam.dev/kind: "Deployment"
spec:
definitionRef:
name: deployments.apps
extension:
template: |
#Template: {
apiVersion: "apps/v1"
kind: "Deployment"
metadata: name: deployment.name
spec: {
selector:
matchLabels:
app: deployment.name
template: {
metadata:
labels:
app: deployment.name
spec: containers: [{
image: deployment.image
name: deployment.name
env: deployment.env
ports: [{
containerPort: deployment.port
protocol: "TCP"
name: "default"
}]
}]
}
}
}
deployment: {
name: string
// +usage=specify app image
// +short=i
image: string
// +usage=specify port for container
// +short=p
port: *8080 | int
env: [...{
name: string
value: string
}]
}

View File

@@ -29,9 +29,9 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /mutate-standard-oam-dev-v1alpha1-containerized
path: /mutate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: mcontainerized.kb.io
name: mpodspecworkload.kb.io
rules:
- apiGroups:
- standard.oam.dev
@@ -41,7 +41,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- Containerized
- PodSpecWorkload
---
apiVersion: admissionregistration.k8s.io/v1beta1
@@ -74,9 +74,9 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /validate-standard-oam-dev-v1alpha1-containerized
path: /validate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: vcontainerized.kb.io
name: vpodspecworkload.kb.io
rules:
- apiGroups:
- standard.oam.dev
@@ -87,4 +87,4 @@ webhooks:
- UPDATE
- DELETE
resources:
- Containerized
- PodSpecWorkload

View File

@@ -12,9 +12,7 @@ export default defineConfig({
hmr: true,
},
locale: {
// default zh-CN
default: 'en-US',
// default true, when it is true, will use `navigator.language` overwrite default
antd: false,
baseNavigator: false,
},
@@ -36,22 +34,14 @@ export default defineConfig({
routes: [
{
path: '/',
// redirect: `/${envname}/ApplicationList`,
redirect: `/ApplicationList`,
},
{
name: 'ApplicationList',
icon: 'table',
// path: `/${envname}/ApplicationList`,
path: `/ApplicationList`,
component: './ApplicationList',
},
{
name: 'ApplicationList.ApplicationListDetail',
hideInMenu: true,
path: '/ApplicationList/ApplicationListDetail',
component: './ApplicationList/ApplicationListDetail',
},
{
name: 'ApplicationList.WorkloadDetail',
icon: 'smile',
@@ -67,35 +57,22 @@ export default defineConfig({
hideInMenu: true,
},
{
name: 'ApplicationList.CreateApplication',
name: 'ApplicationList.Components',
hideInMenu: true,
path: '/ApplicationList/CreateApplication',
component: './ApplicationList/CreateApplication',
path: '/ApplicationList/:appName/Components',
component: './ApplicationList/Components',
},
{
name: 'ApplicationList.Components.createComponent',
hideInMenu: true,
path: '/ApplicationList/:appName/createComponent',
component: './ApplicationList/CreateComponent',
},
{
name: 'Workload',
icon: 'table',
path: '/Workload',
routes: [
// {
// name: 'Deployment',
// icon: 'table',
// path: '/Workload/Deployment',
// component: './Workload/Deployment',
// },
// {
// name: 'Containerized',
// icon: 'smile',
// path: '/Workload/Containerized',
// component: './Workload/Containerized',
// },
// {
// name: 'Detail',
// icon: 'smile',
// path: '/Workload/Detail',
// component: './Workload/Detail',
// hideInMenu: true,
// },
{
name: 'WorkloadItem',
icon: 'smile',
@@ -109,25 +86,6 @@ export default defineConfig({
name: 'Traits',
icon: 'table',
routes: [
// {
// name: 'Scale',
// icon: 'table',
// path: '/Traits/Scale',
// component: './Traits/Scale',
// },
// {
// name: 'Rollout',
// icon: 'smile',
// path: '/Traits/Rollout',
// component: './Traits/Rollout',
// },
// {
// name: 'Detail',
// icon: 'smile',
// path: '/Traits/Detail',
// component: './Traits/Detail',
// hideInMenu: true,
// },
{
name: 'TraitItem',
icon: 'smile',
@@ -136,12 +94,6 @@ export default defineConfig({
},
],
},
// {
// name: 'Release',
// icon: 'table',
// path: '/Release',
// component: './Release',
// },
{
name: 'Capability',
icon: 'table',
@@ -183,8 +135,13 @@ export default defineConfig({
],
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
theme: {
// ...darkTheme,
// 主题配置
'primary-color': defaultSettings.primaryColor,
'link-color': defaultSettings.linkColor,
'link-hover-color': defaultSettings.linkHoverColor,
'disabled-bg': defaultSettings.disabledBg,
'disabled-color': defaultSettings.disabledColor,
'btn-disable-color': defaultSettings.btnDisableColor,
},
// @ts-ignore
title: false,

View File

@@ -1,14 +1,19 @@
const proSettings = {
navTheme: 'dark',
// 拂晓蓝
primaryColor: '#1890ff',
// 主题颜色配置
primaryColor: '#1B58F4', // 全局主色
linkColor: '#1B58F4', // 链接色
linkHoverColor: '#1B58F4',
disabledBg: '#EBEBEB', // 失效背景色,
disabledColor: '#BEBEBE', // 失效文本色,
btnDisableColor: '#A4A4A4', // 禁用btn文字颜色
layout: 'side',
contentWidth: 'Fluid',
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
menu: {
locale: true,
locale: false,
},
title: 'Micro App Engine',
pwa: false,

View File

@@ -8,11 +8,8 @@
export default {
dev: {
'/api': {
target: 'http://123.56.222.218:8081/',
target: 'http://127.0.0.1:38081/',
changeOrigin: true,
// pathRewrite: {
// "^/api": "",
// },
},
},
test: {

View File

@@ -35,34 +35,44 @@ export default class CreateTraitItem extends React.PureComponent {
return this.formRefStep2.current.getFieldsValue();
};
resetFields = () => {
return this.formRefStep2.current.resetFields();
};
validateFields = () => {
return this.formRefStep2.current.validateFields();
};
setDefaultValue = (traitType) => {
this.formRefStep2.current.setFieldsValue({ name: traitType });
this.traitSelectChange(traitType);
};
traitSelectChange = async (value, isType = 1) => {
const res = await this.props.dispatch({
type: 'trait/getTraitByName',
payload: {
traitName: value,
},
});
this.setState({
parameters: res.parameters,
});
if (isType === 2) {
this.formRefStep2.current.setFieldsValue(this.props.initialValues);
} else if (isType) {
// 进行默认值填写
const parameters = _.get(res, 'parameters', []);
if (parameters.length) {
const initialObj = {};
parameters.forEach((item) => {
if (item.default) {
initialObj[item.name] = item.default;
}
});
this.formRefStep2.current.setFieldsValue(initialObj);
if (value) {
const res = await this.props.dispatch({
type: 'trait/getTraitByName',
payload: {
traitName: value,
},
});
this.setState({
parameters: res.parameters,
});
if (isType === 2) {
this.formRefStep2.current.setFieldsValue(this.props.initialValues);
} else if (isType) {
// 进行默认值填写
const parameters = _.get(res, 'parameters', []);
if (parameters.length) {
const initialObj = {};
parameters.forEach((item) => {
if (item.default) {
initialObj[item.name] = item.default;
}
});
this.formRefStep2.current.setFieldsValue(initialObj);
}
}
}
};
@@ -77,8 +87,12 @@ export default class CreateTraitItem extends React.PureComponent {
name="control-ref"
className="traitItem"
>
<Form.Item name="name" label="Trait">
<Select placeholder="Select a Trait" allowClear onChange={this.traitSelectChange}>
<Form.Item
name="name"
label="Trait"
rules={[{ required: true, message: 'Please Select a Trait!' }]}
>
<Select placeholder="Select a Trait" onChange={this.traitSelectChange}>
{availableTraitList.map((item) => {
return (
<Option value={item.name} key={item.name}>
@@ -92,8 +106,34 @@ export default class CreateTraitItem extends React.PureComponent {
<div className="relativeBox">
{this.state.parameters ? (
this.state.parameters.map((item) => {
return (
<Form.Item name={item.name} label={item.name} key={item.name}>
return item.type === 4 ? (
<Form.Item
name={item.name}
label={item.name}
key={item.name}
rules={[
{
required: item.required || false,
message: `Please input ${item.name} !`,
},
{ pattern: /^[0-9]*$/, message: `${item.name} only use digits(0-9).` },
]}
>
<Input />
</Form.Item>
) : (
<Form.Item
name={item.name}
label={item.name}
key={item.name}
rules={[
{
required: item.required || false,
message: `Please input ${item.name} !`,
},
{ pattern: /^[^\s]*$/, message: 'Spaces are not allowed!' },
]}
>
<Input />
</Form.Item>
);

View File

@@ -23,9 +23,8 @@ export default class WorkSpaceDropDown extends React.Component {
return env.current === '*';
});
this.setState({
envs: envs,
workSpaceName: envName,
namespace: namespace,
namespace,
});
this.props.dispatch({
type: 'globalData/currentEnv',

View File

@@ -1,23 +1,36 @@
import React, { Fragment } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Row, Col, Modal, Select, message } from 'antd';
import { Button, Row, Col, Modal, Select, message, Breadcrumb, Form, Input } from 'antd';
import './index.less';
import { connect } from 'dva';
import { Link } from 'umi';
import _ from 'lodash';
const { Option } = Select;
const layout = {
labelCol: {
span: 8,
},
wrapperCol: {
span: 16,
},
};
@connect(({ loading, applist, globalData }) => ({
loadingAll: loading.models.applist,
currentEnv: globalData.currentEnv,
returnObj: applist.returnObj,
}))
class Trait extends React.Component {
formRefStep2 = React.createRef();
constructor(props) {
super(props);
this.state = {
visible: false,
selectValue: null,
compList: [],
};
}
@@ -25,6 +38,19 @@ class Trait extends React.Component {
this.getInitialData();
}
shouldComponentUpdate(nextProps) {
if (nextProps.currentEnv === this.props.currentEnv) {
return true;
}
this.props.dispatch({
type: 'applist/getList',
payload: {
url: `/api/envs/${nextProps.currentEnv}/apps/`,
},
});
return true;
}
getInitialData = async () => {
if (this.props.currentEnv) {
await this.props.dispatch({
@@ -37,28 +63,64 @@ class Trait extends React.Component {
};
showModal = () => {
this.setState({
visible: true,
});
this.setState(
{
visible: true,
},
() => {
if (this.formRefStep2.current) {
this.formRefStep2.current.resetFields();
}
},
);
};
handleOk = () => {
const { selectValue } = this.state;
if (selectValue) {
this.setState({
visible: false,
handleOk = async () => {
await this.formRefStep2.current.validateFields();
const { title } = this.props.propsObj;
if (title) {
const submitObj = {
name: title,
flags: [],
};
const submitData = this.formRefStep2.current.getFieldValue();
Object.keys(submitData).forEach((currentKey) => {
if (
currentKey !== 'name' &&
currentKey !== 'appName' &&
currentKey !== 'compName' &&
submitData[currentKey]
) {
submitObj.flags.push({
name: currentKey,
value: submitData[currentKey].toString(),
});
}
});
const { history } = this.props.propsObj;
history.push({
pathname: '/ApplicationList/ApplicationListDetail',
state: {
appName: selectValue,
envName: this.props.currentEnv,
traitType: this.props.propsObj.title,
},
});
} else {
message.warn('please select a application');
const { currentEnv: envName } = this.props;
const { appName, compName } = submitData;
if (envName && appName && compName) {
const res = await this.props.dispatch({
type: 'trait/attachOneTraits',
payload: {
envName,
appName,
compName,
params: submitObj,
},
});
if (res) {
this.setState({
visible: false,
});
message.success(res);
const { history } = this.props.propsObj;
history.push({
pathname: `/ApplicationList/${appName}/Components`,
state: { appName, envName },
});
}
}
}
};
@@ -68,107 +130,231 @@ class Trait extends React.Component {
});
};
onChange = (value) => {
onChange = async (value) => {
this.setState({
selectValue: value,
compList: [],
});
const res = await this.props.dispatch({
type: 'applist/getAppDetail',
payload: {
envName: this.props.currentEnv,
appName: value,
},
});
if (res) {
const compData = _.get(res, 'components', []);
const compList = [];
compData.forEach((item) => {
compList.push({
compName: item.name,
});
});
this.setState({
compList,
});
}
};
onSearch = () => {};
render() {
const { btnValue, title, settings, btnIsShow, crdInfo, appliesTo } = this.props.propsObj;
const appList = _.get(this.props, 'returnObj', []);
const { btnValue, title, settings = [], btnIsShow, crdInfo, appliesTo } = this.props.propsObj;
const initialObj = {};
if (settings.length) {
settings.forEach((item) => {
if (item.default) {
initialObj[item.name] = item.default;
}
});
}
let appList = _.get(this.props, 'returnObj', []);
if (!appList) {
appList = [];
}
const { compList = [] } = this.state;
return (
<PageContainer>
<Row>
<Col span="11">
<div className="deployment">
<Row>
<Col span="22">
<p className="title">{title}</p>
{crdInfo ? (
<p>
{crdInfo.apiVersion}
<span>,kind=</span>
{crdInfo.kind}
</p>
) : (
<p />
)}
</Col>
</Row>
<Row>
<Col span="22">
<p className="title">Applies To</p>
<p>{Array.isArray(appliesTo) ? appliesTo.join(', ') : appliesTo}</p>
</Col>
</Row>
<p className="title">Configurable Properties:</p>
{settings.map((item, index) => {
return (
<Row key={index.toString()}>
<Col span="8">
<p>{item.name}</p>
</Col>
<Col span="16">
<p>{item.default || item.usage}</p>
</Col>
</Row>
);
})}
</div>
<Button
type="primary"
className="create-button"
onClick={this.showModal}
style={{ display: btnIsShow ? 'block' : 'none' }}
>
{btnValue}
</Button>
<Modal
title="Select a Application"
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" onClick={this.handleCancel}>
Cancel
</Button>,
<Button key="submit" type="primary" onClick={this.handleOk}>
Next
</Button>,
]}
>
<Select
showSearch
allowClear
value={this.state.selectValue}
style={{ width: '100%' }}
placeholder="Select a Application"
optionFilterProp="children"
onChange={this.onChange}
onSearch={this.onSearch}
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
<div>
<div className="breadCrumb">
<Breadcrumb>
<Breadcrumb.Item>
<Link to="/ApplicationList">Home</Link>
</Breadcrumb.Item>
<Breadcrumb.Item>Traits</Breadcrumb.Item>
<Breadcrumb.Item>{title}</Breadcrumb.Item>
</Breadcrumb>
</div>
<PageContainer>
<Row>
<Col span="11">
<div className="deployment">
<Row>
<Col span="22">
<p className="title">{title}</p>
{crdInfo ? (
<p>
{crdInfo.apiVersion}
<span>,kind=</span>
{crdInfo.kind}
</p>
) : (
<p />
)}
</Col>
</Row>
<Row>
<Col span="22">
<p className="title">Applies To:</p>
<p>{Array.isArray(appliesTo) ? appliesTo.join(', ') : appliesTo}</p>
</Col>
</Row>
<p className="title">Configurable Properties:</p>
{settings.map((item, index) => {
return (
<Row key={index.toString()}>
<Col span="8">
<p>{item.name}</p>
</Col>
<Col span="16">
<p>{item.default || item.usage}</p>
</Col>
</Row>
);
})}
</div>
<Button
type="primary"
className="create-button"
onClick={this.showModal}
style={{ display: btnIsShow ? 'block' : 'none' }}
>
{appList.length ? (
appList.map((item) => {
return (
<Option key={item.name} value={item.name}>
{item.name}
</Option>
);
})
) : (
<Fragment />
)}
</Select>
</Modal>
</Col>
</Row>
</PageContainer>
{btnValue}
</Button>
<Modal
title="Attach Trait"
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" onClick={this.handleCancel}>
Cancel
</Button>,
<Button key="submit" type="primary" onClick={this.handleOk}>
Submit
</Button>,
]}
>
<Form
labelAlign="left"
{...layout}
ref={this.formRefStep2}
name="control-ref"
className="traitItem"
initialValues={initialObj}
>
<Form.Item
label="App"
name="appName"
rules={[{ required: true, message: 'Please Select a Application!' }]}
>
<Select
showSearch
value={this.state.selectValue}
style={{ width: '100%' }}
placeholder="Select a Application"
optionFilterProp="children"
onChange={this.onChange}
onSearch={this.onSearch}
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{appList.length ? (
appList.map((item, index) => {
return (
<Option key={index.toString()} value={item.name}>
{item.name}
</Option>
);
})
) : (
<Fragment />
)}
</Select>
</Form.Item>
<Form.Item
label="Component"
name="compName"
rules={[{ required: true, message: 'Please Select a Component!' }]}
>
<Select
allowClear
// value={this.state.selectValue}
style={{ width: '100%' }}
placeholder="Select a Component"
>
{compList.length ? (
compList.map((item) => {
return (
<Option key={item.compName} value={item.compName}>
{item.compName}
</Option>
);
})
) : (
<Fragment />
)}
</Select>
</Form.Item>
<div className="relativeBox">
<Form.Item label="Properties" />
{settings ? (
settings.map((item) => {
return item.type === 4 ? (
<Form.Item
name={item.name}
label={item.name}
key={item.name}
rules={[
{
required: item.required || false,
message: `Please input ${item.name} !`,
},
{
pattern: /^[0-9]*$/,
message: `${item.name} only use digits(0-9).`,
},
]}
>
<Input />
</Form.Item>
) : (
<Form.Item
name={item.name}
label={item.name}
key={item.name}
rules={[
{
required: item.required || false,
message: `Please input ${item.name} !`,
},
{ pattern: /^[^\s]*$/, message: 'Spaces are not allowed!' },
]}
>
<Input />
</Form.Item>
);
})
) : (
<></>
)}
</div>
</Form>
</Modal>
</Col>
</Row>
</PageContainer>
</div>
);
}
}

View File

@@ -1,69 +1,226 @@
import React, { Fragment } from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import { Button, Row, Col } from 'antd';
import { Button, Row, Col, Modal, Select, Breadcrumb, Form } from 'antd';
import { connect } from 'dva';
import { Link } from 'umi';
import _ from 'lodash';
import './index.less';
export default class Workload extends React.PureComponent {
const { Option } = Select;
const layout = {
labelCol: {
span: 8,
},
wrapperCol: {
span: 16,
},
};
@connect(({ loading, applist, globalData }) => ({
loadingAll: loading.models.applist,
currentEnv: globalData.currentEnv,
returnObj: applist.returnObj,
}))
export default class Workload extends React.Component {
formRefStep2 = React.createRef();
constructor(props) {
super(props);
this.state = {
visible: false,
};
}
componentDidMount() {
this.getInitialData();
}
shouldComponentUpdate(nextProps) {
if (nextProps.currentEnv === this.props.currentEnv) {
return true;
}
this.props.dispatch({
type: 'applist/getList',
payload: {
url: `/api/envs/${nextProps.currentEnv}/apps/`,
},
});
return true;
}
getInitialData = async () => {
if (this.props.currentEnv) {
await this.props.dispatch({
type: 'applist/getList',
payload: {
url: `/api/envs/${this.props.currentEnv}/apps/`,
},
});
}
};
showModal = () => {
this.setState(
{
visible: true,
},
() => {
if (this.formRefStep2.current) {
this.formRefStep2.current.resetFields();
}
},
);
};
handleOk = async () => {
const submitData = await this.formRefStep2.current.validateFields();
const { history } = this.props.propsObj;
history.push({
pathname: `/ApplicationList/${submitData.appName}/createComponent`,
state: {
...submitData,
isCreate: false,
envName: this.props.currentEnv,
WorkloadType: this.props.propsObj.title,
},
});
};
handleCancel = () => {
this.setState({
visible: false,
});
};
onChange = () => {};
onSearch = () => {};
render() {
const {
btnValue,
pathname,
title,
crdInfo,
state,
settings,
hrefAddress,
btnIsShow,
} = this.props.propsObj;
const { btnValue, title, crdInfo, settings, btnIsShow } = this.props.propsObj;
let appList = _.get(this.props, 'returnObj', []);
if (!appList) {
appList = [];
}
return (
<PageContainer>
<Row>
<Col span="11">
<div className="deployment">
<a href={hrefAddress}>?</a>
<Row>
<Col span="22">
<p className="title">{title}</p>
{crdInfo ? (
<p>
{crdInfo.apiVersion}
<span>,kind=</span>
{crdInfo.kind}
</p>
) : (
<p />
)}
</Col>
</Row>
<p className="title">Configurable Settings:</p>
{settings.map((item, index) => {
if (item.name === 'name') {
return <Fragment key={index.toString()} />;
}
return (
<Row key={index.toString()}>
<Col span="8">
<p>{item.name}</p>
</Col>
<Col span="16">
{
// eslint-disable-next-line consistent-return
}
<p>{item.default || item.usage}</p>
</Col>
</Row>
);
})}
</div>
<Link to={{ pathname, state }} style={{ display: btnIsShow ? 'block' : 'none' }}>
<Button type="primary" className="create-button">
<div>
<div className="breadCrumb">
<Breadcrumb>
<Breadcrumb.Item>
<Link to="/ApplicationList">Home</Link>
</Breadcrumb.Item>
<Breadcrumb.Item>Workloads</Breadcrumb.Item>
<Breadcrumb.Item>{title}</Breadcrumb.Item>
</Breadcrumb>
</div>
<PageContainer>
<Row>
<Col span="11">
<div className="deployment">
<Row>
<Col span="22">
<p className="title">{title}</p>
{crdInfo ? (
<p>
{crdInfo.apiVersion}
<span>,kind=</span>
{crdInfo.kind}
</p>
) : (
<p />
)}
</Col>
</Row>
<p className="title">Configurable Settings:</p>
{settings.map((item, index) => {
if (item.name === 'name') {
return <Fragment key={index.toString()} />;
}
return (
<Row key={index.toString()}>
<Col span="8">
<p>{item.name}</p>
</Col>
<Col span="16">
{
// eslint-disable-next-line consistent-return
}
<p>{item.default || item.usage}</p>
</Col>
</Row>
);
})}
</div>
{/* <Link to={{ pathname, state }} style={{ display: btnIsShow ? 'block' : 'none' }}>
<Button type="primary" className="create-button">
{btnValue}
</Button>
</Link> */}
<Button
type="primary"
className="create-button"
onClick={() => this.showModal()}
style={{ display: btnIsShow ? 'block' : 'none' }}
>
{btnValue}
</Button>
</Link>
</Col>
</Row>
</PageContainer>
</Col>
</Row>
<Modal
title="Add Component"
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
footer={[
<Button key="back" onClick={this.handleCancel}>
Cancel
</Button>,
<Button key="submit" type="primary" onClick={this.handleOk}>
Next
</Button>,
]}
>
<Form
labelAlign="left"
{...layout}
ref={this.formRefStep2}
name="control-ref"
className="traitItem"
>
<Form.Item
label="App"
name="appName"
rules={[{ required: true, message: 'Please Select a Application!' }]}
>
<Select
showSearch
style={{ width: '100%' }}
placeholder="Select a Application"
optionFilterProp="children"
onChange={this.onChange}
onSearch={this.onSearch}
filterOption={(input, option) =>
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{appList.length ? (
appList.map((item, index) => {
return (
<Option key={index.toString()} value={item.name}>
{item.name}
</Option>
);
})
) : (
<Fragment />
)}
</Select>
</Form.Item>
</Form>
</Modal>
</PageContainer>
</div>
);
}
}

View File

@@ -29,13 +29,6 @@ beforeEach(async () => {
describe('Ant Design Pro E2E test', () => {
const testPage = (path) => async () => {
await page.goto(`${BASE_URL}${path}`);
await page.waitForSelector('footer', {
timeout: 2000,
});
const haveFooter = await page.evaluate(
() => document.getElementsByTagName('footer').length > 0,
);
expect(haveFooter).toBeTruthy();
};
const routers = formatter(RouterConfig);
@@ -46,12 +39,5 @@ describe('Ant Design Pro E2E test', () => {
it('topmenu should have footer', async () => {
const params = '?navTheme=light&layout=topmenu';
await page.goto(`${BASE_URL}${params}`);
await page.waitForSelector('footer', {
timeout: 2000,
});
const haveFooter = await page.evaluate(
() => document.getElementsByTagName('footer').length > 0,
);
expect(haveFooter).toBeTruthy();
});
});

View File

@@ -69,3 +69,35 @@ ol {
.ant-page-header-heading {
display: none !important;
}
.ant-pro-page-container-warp {
display: none;
}
.ant-pro-basicLayout-content {
margin: 0 !important;
}
.ant-pro-basicLayout-content .ant-pro-page-container {
margin: 0 !important;
}
.breadCrumb {
padding: 12px 24px;
background: #fff;
}
.ant-breadcrumb a:hover {
color: #1b58f4 !important;
}
// 对齐
.ant-form-item-label > label::before {
display: inline-block;
width: 7.09px;
height: 14px;
margin-right: 4px;
color: rgb(255, 77, 79);
font-size: 14px;
font-family: SimSun, sans-serif;
line-height: 1;
content: '';
}
.ant-spin-nested-loading {
height: calc(100% - 46px) !important;
}

View File

@@ -4,7 +4,7 @@
* https://github.com/ant-design/ant-design-pro-layout
*/
import ProLayout from '@ant-design/pro-layout';
import React, { useEffect } from 'react';
import React, { useEffect, useState, useRef } from 'react';
import { Link, useIntl, connect, history } from 'umi';
import RightContent from '@/components/GlobalHeader/RightContent';
import {
@@ -16,15 +16,6 @@ import {
} from '@ant-design/icons';
import _ from 'lodash';
// const menuDataRender = (menuList) => {
// return menuList.map((item) => {
// const localItem = {
// ...item,
// children: item.children ? menuDataRender(item.children) : undefined,
// };
// return localItem;
// });
// };
const AddIcon = (menuData) => {
return menuData.map((item) => {
const name = _.get(item, 'name', '');
@@ -52,18 +43,43 @@ const AddIcon = (menuData) => {
const BasicLayout = (props) => {
const { settings, dispatch, menus } = props;
const [currentSelectKeys, setCurrentSelectedKeys] = useState('');
const timerRef = useRef();
const getCurrentSelectKeys = () => {
const pathnameCur = props.history.location.pathname;
if (pathnameCur) {
if (pathnameCur.includes('Application')) {
setCurrentSelectedKeys(['applist']);
} else if (pathnameCur.includes('Capability')) {
setCurrentSelectedKeys(['Capability']);
} else if (pathnameCur.includes('System/Env')) {
setCurrentSelectedKeys(['Env']);
} else if (pathnameCur.includes('Workload')) {
const arr = pathnameCur.split('/');
const key = arr[arr.length - 1];
setCurrentSelectedKeys([key]);
} else if (pathnameCur.includes('Traits')) {
const arr = pathnameCur.split('/');
const key = arr[arr.length - 1];
setCurrentSelectedKeys([key]);
}
}
};
useEffect(() => {
if (dispatch) {
// dispatch({
// type: 'user/fetchCurrent',
// });
// dispatch({
// type: 'settings/getSetting',
// });
dispatch({
type: 'menus/getMenuData',
});
}
timerRef.current = props.history.listen((route) => {
getCurrentSelectKeys(route.pathname);
});
return () => {
if (timerRef.current) {
timerRef.current = null;
}
};
// setCurrentSelectedKeys('applist')
}, []);
const { formatMessage } = useIntl();
@@ -75,9 +91,19 @@ const BasicLayout = (props) => {
if (menuItemProps.isUrl || !menuItemProps.path) {
return defaultDom;
}
return <Link to={menuItemProps.path}>{defaultDom}</Link>;
// return <Link to={menuItemProps.path}>{defaultDom}</Link>;
return (
<div
onClick={() => {
setCurrentSelectedKeys([menuItemProps.key]);
history.push(menuItemProps.path);
}}
>
{defaultDom}
</div>
);
}}
selectedKeys={currentSelectKeys}
breadcrumbRender={(routers = []) => [
{
path: '/',

View File

@@ -2,17 +2,15 @@ import { getapplist, createApp, getAppDetail, deleteApp } from '@/services/appli
const TestModel = {
namespace: 'applist',
state: {
// initailState: '8880'
},
state: {},
effects: {
*getList({ payload }, { call, put }) {
const res = yield call(getapplist, payload);
// getlist是引入services层那个js文件的getlist方法payload是后台要求传递的参数res就是后台返过来的数据
yield put({
type: 'addList', // 这就是reducer的addNum方法put用来触发reducer中的方法payload是传过去的参数。同时也能触发同等级effects中的方法
type: 'addList',
payload: {
returnObj: res, // 把后台返回的数据赋值给num,假如哪个reducer中的方法是由这里effects去触发的哪个num名必须是这里的名字num如果reducer中的方法不是这触发那名字可以随意取
returnObj: res,
},
});
},

View File

@@ -10,9 +10,7 @@ import {
const TestModel = {
namespace: 'capability',
state: {
// initailState: '8880'
},
state: {},
effects: {
*getCapabilityCenterlist({ payload }, { call }) {
const res = yield call(getCapabilityCenterlist, payload);

View File

@@ -0,0 +1,22 @@
import { getComponentList, getComponentDetail, deleteComponent } from '@/services/components.js';
const TestModel = {
namespace: 'components',
state: {},
effects: {
*getComponentList({ payload }, { call }) {
const res = yield call(getComponentList, payload);
return res;
},
*getComponentDetail({ payload }, { call }) {
const res = yield call(getComponentDetail, payload);
return res;
},
*deleteComponent({ payload }, { call }) {
const res = yield call(deleteComponent, payload);
return res;
},
},
reducers: {},
};
export default TestModel;

View File

@@ -6,7 +6,7 @@ const globalModel = {
effects: {
*currentEnv({ payload }, { put }) {
yield put({
type: 'setCurrentEnv', // 这就是reducer的addNum方法put用来触发reducer中的方法payload是传过去的参数。同时也能触发同等级effects中的方法
type: 'setCurrentEnv',
payload,
});
},

View File

@@ -1,36 +1,31 @@
import { capabilityList } from '@/services/capability.js';
import { getTraits } from '@/services/trait.js';
import { getWorkload } from '@/services/workload.js';
function getMenuList(response) {
function getMenuList(workload, trait) {
let workloadList = [];
let traitList = [];
// eslint-disable-next-line no-param-reassign
response = response.filter((item) => {
return item.status === 'installed';
});
response.forEach((item) => {
if (item.type === 'workload') {
workloadList.push(item.name);
} else if (item.type === 'trait') {
traitList.push(item.name);
}
});
// 在此之前要对workloadList和traitList进行一次去重操作
workloadList = workloadList.map((item) => {
// eslint-disable-next-line no-param-reassign
item = item.charAt(0).toUpperCase() + item.slice(1);
return {
name: item,
path: `/Workload/${item}`,
};
});
traitList = traitList.map((item) => {
// eslint-disable-next-line no-param-reassign
item = item.charAt(0).toUpperCase() + item.slice(1);
return {
name: item,
path: `/Traits/${item}`,
};
});
if (workload) {
workloadList = workload.map((item) => {
let name1 = item.name;
name1 = name1.charAt(0).toUpperCase() + name1.slice(1);
return {
name: name1,
path: `/Workload/${name1}`,
key: name1,
};
});
}
if (trait) {
traitList = trait.map((item) => {
let name1 = item.name;
name1 = name1.charAt(0).toUpperCase() + name1.slice(1);
return {
name: name1,
path: `/Traits/${name1}`,
key: name1,
};
});
}
// 只是动态生成侧边栏(name,path,icon)路由还是config.js里面配置的路由
const menuList = [
{
@@ -41,6 +36,7 @@ function getMenuList(response) {
name: 'ApplicationList',
icon: 'Table',
path: `/ApplicationList`,
key: 'applist',
},
{
name: 'ApplicationList.ApplicationListDetail',
@@ -76,13 +72,10 @@ function getMenuList(response) {
},
],
},
// {
// name: 'Release',
// path: '/Release',
// },
{
name: 'Capability',
path: '/Capability',
key: 'Capability',
},
{
path: '/System',
@@ -91,6 +84,7 @@ function getMenuList(response) {
{
name: 'Env',
path: '/System/Env',
key: 'Env',
},
],
},
@@ -110,8 +104,9 @@ const TestModel = {
},
effects: {
*getMenuData({ payload }, { call, put }) {
let response = yield call(capabilityList, payload);
response = getMenuList(response);
const workloadList = yield call(getWorkload, payload);
const traitList = yield call(getTraits, payload);
const response = getMenuList(workloadList, traitList);
yield put({
type: 'saveMenuData',
payload: response,

View File

@@ -2,9 +2,7 @@ import { getTraitByName, getTraits, attachOneTraits, deleteOneTrait } from '@/se
const TestModel = {
namespace: 'trait',
state: {
// initailState: '8880'
},
state: {},
effects: {
*getTraitByName({ payload }, { call }) {
const res = yield call(getTraitByName, payload);

View File

@@ -2,9 +2,7 @@ import { createWorkload, getWorkload, getWorkloadByName } from '@/services/workl
const TestModel = {
namespace: 'workload',
state: {
// initailState: '8880'
},
state: {},
effects: {
*createWorkload({ payload }, { call }) {
const res = yield call(createWorkload, payload);

View File

@@ -43,8 +43,6 @@ const Topology = () => {
],
};
// const width = document.getElementById('container').scrollWidth;
// const height = document.getElementById('container').scrollHeight || 500;
const width = 1000;
const height = 400;

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