Compare commits

..

42 Commits

Author SHA1 Message Date
Tianxin Dong
b7683ebdfe Fix: stores workflow status in revison if it is restarted (#5604) (#5672)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2023-03-14 22:15:01 +08:00
github-actions[bot]
4bbd6c3827 Fix: replication example componentdefinition miss workload field for webhook validation (#5617)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
(cherry picked from commit c8709a2c13)

Co-authored-by: Somefive <yd219913@alibaba-inc.com>
2023-03-06 13:18:52 +08:00
suwliang3
4bc847b19f Fix: Backport #5275 to release-1.6 (#5559)
* Fix: modify the version of github.com/kubevela/pkg

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>

* Fix: solve the conflicts of unit test

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>

* Fix: replace function

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>

* Fix: make reviewable

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>

* Fix: solve ci

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>

---------

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>
2023-03-03 16:31:21 +08:00
wyike
6553a90dd4 cherry pick 5404 (#5409)
Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
2023-02-02 17:35:50 +08:00
Tianxin Dong
51d536ed12 Chore: update workflow version to fix panic (#5391)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2023-01-31 16:26:43 +08:00
Somefive
ac721a1bb1 Fix: conflict while using gc policy and shared-resource policy concurrently (#5330) (#5338)
* Fix: conflict while using gc policy and shared-resource policy concurrently

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

* Fix: github ci

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
2023-01-13 17:35:49 +08:00
github-actions[bot]
468452df16 Fix: optimize skip reconcile and expose error if the traits patch an invalid workload like terraform (#5340)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
(cherry picked from commit 3730291eff)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2023-01-13 17:09:57 +08:00
github-actions[bot]
c5493237f9 fix: fix --cluster when addon enable (#5341)
Signed-off-by: zhaowei.wang <zhaowei.wang@metabit-trading.com>
(cherry picked from commit 021ca69cfd)

Co-authored-by: zhaowei.wang <zhaowei.wang@metabit-trading.com>
2023-01-13 17:07:33 +08:00
github-actions[bot]
b11eb845b2 Fix: don't return err if subresource type is not found when listing application resources (#5311)
Signed-off-by: hnd4r7 <307365651@qq.com>
(cherry picked from commit 58a150d1d4)

Co-authored-by: hnd4r7 <307365651@qq.com>
2023-01-11 14:56:01 +08:00
github-actions[bot]
b12968c2ae fix: errorMsg when uninstall vela (#5309)
Signed-off-by: bitliu <bitliu@tencent.com>
(cherry picked from commit 771e0b5429)

Co-authored-by: bitliu <bitliu@tencent.com>
2023-01-11 14:48:54 +08:00
github-actions[bot]
d8d0c91c59 [Backport release-1.6] Fix: create a config with the same name reported an incorrect error (#5306)
* Fix: create a config with the same name reported an incorrect error

Signed-off-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com>
(cherry picked from commit 3c1759896b)

* Fix: create a config with the same name reported an incorrect error

Signed-off-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com>
(cherry picked from commit 0aa456642b)

Co-authored-by: wuzhongjian <wuzhongjian_yewu@cmss.chinamobile.com>
2023-01-11 14:24:47 +08:00
github-actions[bot]
5f6209e8de Fix: Delete appplication fails if status.workflow.endTime not specified. (#5296)
Error Details:
E0106 08:12:02.807341       1 controller.go:317] controller/application "msg"="Reconciler error" "error"="Application.core.oam.dev \"test\" is invalid: status.workflow.endTime: Invalid value: \"null\": status.workflow.endTime in body must be of type string: \"null\"" "name"="test" "namespace"="test" "reconciler group"="core.oam.dev" "reconciler kind"="Application"

If the workflow is not completed, the endtime should be null, and the deletion of the application will fail

Signed-off-by: old.prince <di7zhang@gmail.com>
(cherry picked from commit 16b6a02018)

Co-authored-by: old.prince <di7zhang@gmail.com>
2023-01-10 15:15:56 +08:00
github-actions[bot]
a198fa5f9a Test: let addon helper tests use local helm server (#5289)
Signed-off-by: Charlie Chiang <charlie_c_0129@outlook.com>
(cherry picked from commit 44eaa1d004)

Co-authored-by: Charlie Chiang <charlie_c_0129@outlook.com>
2023-01-09 13:30:37 +08:00
github-actions[bot]
f01639e175 Fix: keep the workflow data structure in MongoDB (#5283)
Signed-off-by: barnettZQG <barnett.zqg@gmail.com>
(cherry picked from commit 035d668837)

Co-authored-by: barnettZQG <barnett.zqg@gmail.com>
2023-01-06 15:13:42 +08:00
Tianxin Dong
b24b52b651 Chore: update workflow vendor to fix certain bugs in 1.6 (#5254)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>

Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2023-01-03 16:12:19 +08:00
github-actions[bot]
ae91006a3d Fix:Dry-run from revision application,Problems caused by resource version lower than the current version (#5250)
Signed-off-by: old.prince <di7zhang@gmail.com>
(cherry picked from commit d5fcb04147)

Co-authored-by: oldprince <di7zhang@gmail.com>
2023-01-03 11:37:20 +08:00
Somefive
42d6791476 Fix: gc failure cause workflow restart not working properly (#5242)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>

Signed-off-by: Somefive <yd219913@alibaba-inc.com>
2022-12-30 18:10:38 +08:00
github-actions[bot]
c85502e54a Fix: remove useless field when loading pod in top (#5230)
Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 8582ae7d93)

Co-authored-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
2022-12-26 13:17:56 +08:00
github-actions[bot]
f9a6b22294 Fix: addon ls comman does not show the componentless application (#5204)
Signed-off-by: zhaohuihui <zhaohuihui_yewu@cmss.chinamobile.com>
(cherry picked from commit 50f6347050)

Co-authored-by: zhaohuihui <zhaohuihui_yewu@cmss.chinamobile.com>
2022-12-19 13:23:43 +08:00
github-actions[bot]
5085a99a12 [Backport release-1.6] Feat: rollout support statefulsets (#5203)
* rollout support workload

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>
(cherry picked from commit ab36f3b7c3)

* modify the error output

Signed-off-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>
(cherry picked from commit 1ed43cc282)

Co-authored-by: suwanliang_yewu <suwanliang_yewu@cmss.chinamobile.com>
2022-12-19 12:10:08 +08:00
github-actions[bot]
18639ccbae Fix: The error of cannot fetch addon package breaks the loop to continue looking for addon package in the remaining registries (#5188)
Signed-off-by: zhaohuihui <zhaohuihui_yewu@cmss.chinamobile.com>
(cherry picked from commit 9263633db7)

Co-authored-by: zhaohuihui <zhaohuihui_yewu@cmss.chinamobile.com>
2022-12-14 13:36:05 +08:00
github-actions[bot]
f36c8f8fbb [Backport release-1.6] Fix: check if enabling operation will uninstall controller from some clusters (#5181)
* check clusters parameter of addon will uninstall from clusters

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit fd2962f90a)

* revert go mod

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit b93a067829)

* fix comments

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit a4574a2723)

* skip verify version check

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 1defa552ed)

* small fix for error notice

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit aede0a7077)

Co-authored-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
2022-12-12 13:41:31 +08:00
github-actions[bot]
c55ac52c4d [Backport release-1.6] Feat: add multicluster test for vela logs (#5177)
* Feat: add multicluster test for vela logs

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 8bbaf27a4c)

* reviewable

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit a08e415d94)

* fix test

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 6367aed2f1)

* fix test

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit ed4bbdd66d)

Co-authored-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
2022-12-09 10:45:34 +08:00
github-actions[bot]
4d4ab9d098 Chore(deps): Bump github.com/containerd/containerd from 1.5.13 to 1.5.16 (#5170)
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.5.13 to 1.5.16.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v1.5.13...v1.5.16)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit 6d49114177)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-08 11:06:53 +08:00
Jianbo Sun
14dfca44b4 Feat: add options for addon parameter (#5166) (#5167)
* Feat: add options for addon parameter

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>

* Fix: wrongly report disbaled when addon is not existed

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
2022-12-07 19:29:16 +08:00
github-actions[bot]
44c6267b76 [Backport release-1.6] Fix: vela show docs can't generate composition type (#5165)
* Fix: vela show can not display or result

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
(cherry picked from commit 17766091d1)

* Fix: vela show docs can't generate composition type

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
(cherry picked from commit 86bb8730a0)

Co-authored-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
2022-12-06 16:15:03 +08:00
github-actions[bot]
9c81aeed4a [Backport release-1.6] Fix: CollectLogsInPod won't work in multicluster (#5164)
* Fix: CollectLogsInPod won't work in multicluster

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 14a7688856)

* clean up

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 12ec074363)

Co-authored-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
2022-12-06 15:53:57 +08:00
github-actions[bot]
1a6b7244c8 Fix: can not logs from pod of subclusters (#5159)
Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 7a17ee459d)

Co-authored-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
2022-12-03 21:08:08 +08:00
github-actions[bot]
18a5b7c239 [Backport release-1.6] Feat: Introduce timeout mechanism into cache and update network request mechanism in vela top (#5156)
* Fix: update cache to lru cache with expire time

Signed-off-by: HanMengnan <1448189829@qq.com>
(cherry picked from commit e54abd7a40)

* Fix: add auto refresh to topology view and fix the refresh bug in resource view
Signed-off-by: HanMengnan <1448189829@qq.com>

(cherry picked from commit f6dcc8f6ed)

Co-authored-by: HanMengnan <1448189829@qq.com>
2022-12-03 14:57:55 +08:00
github-actions[bot]
65e9b549e2 Feat: support huawei cloud terraform generation (#5155)
Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit e2bfb30f75)

Co-authored-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
2022-12-03 14:57:08 +08:00
github-actions[bot]
b0a0d84030 Fix: addon upgrade command does not recognize the --clusters flag (#5154)
Signed-off-by: zhaohuihui <zhaohuihui_yewu@cmss.chinamobile.com>
(cherry picked from commit 4526400e3c)

Co-authored-by: zhaohuihui <zhaohuihui_yewu@cmss.chinamobile.com>
2022-12-03 14:56:30 +08:00
Jianbo Sun
773c4112d9 Chore: refine log and align using klog/v2 - cherry-pick #5145 (#5150)
Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
2022-12-03 12:36:28 +08:00
github-actions[bot]
a5d68b2bea fix format error (#5147)
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
(cherry picked from commit 0ad1517613)

Co-authored-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2022-12-01 16:06:50 +08:00
github-actions[bot]
353e592391 Fix: vela status --endpoint show no IP when only one master node (#5141)
Add fallback if no worker node

check app exist

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 7af0a67dee)

Co-authored-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
2022-11-30 10:47:19 +08:00
github-actions[bot]
c58e3dfea6 Fix: container image cue (#5135)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
(cherry picked from commit 447ece69e9)

Co-authored-by: Somefive <yd219913@alibaba-inc.com>
2022-11-28 11:36:17 +08:00
github-actions[bot]
a783393ebd [Backport release-1.6] Fix: bug of filter registry func will modify origin data (#5120)
* fix filter registry func flaky

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit fbdd7b7ede)

* fix comments

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 49671dd3e0)

Co-authored-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
2022-11-24 15:06:29 +08:00
github-actions[bot]
a19ed0b510 [Backport release-1.6] Chore: add definition example doc CI check (#5119)
* Chore: add definition example doc CI check

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
(cherry picked from commit 1afaaf047d)

* Fix: add example doc for trait

Signed-off-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
(cherry picked from commit 6c61643b8a)

Co-authored-by: Jianbo Sun <jianbo.sjb@alibaba-inc.com>
2022-11-24 15:05:18 +08:00
github-actions[bot]
03223aa786 [Backport release-1.6] Fix: bug when addon dependent an addon in other registry (#5115)
* fix several bugs of addon

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit eadabe6517)

* fix golint error

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 2ba81880bf)

* fix error and add tests

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 43f6925566)

* fix comments and fix apiserver test

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 96a6a3f4a3)

* fix typo

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit cafa5adb46)

* fix tests

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 3599b01aeb)

* small fix

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 30cafbc3e9)

* small fix

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 083413479e)

* add parameter in apiserver and test

Signed-off-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
(cherry picked from commit 9159749477)

Co-authored-by: 楚岳 <wangyike.wyk@alibaba-inc.com>
2022-11-24 09:46:54 +08:00
github-actions[bot]
55c8dad116 Fix: multicluster cluster scope ref (#5112)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
(cherry picked from commit 40a9a981d9)

Co-authored-by: Somefive <yd219913@alibaba-inc.com>
2022-11-24 09:16:15 +08:00
github-actions[bot]
38c57c38c8 [Backport release-1.6] Fix: end test environments (#5107)
* Fix: end test environments

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 9d573fc6a0)

* fix

Signed-off-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
(cherry picked from commit 81deb6a588)

Co-authored-by: Qiaozp <qiaozhongpei.qzp@alibaba-inc.com>
2022-11-22 19:37:12 +08:00
github-actions[bot]
7f734e9479 Fix: patchOutputs bug for multiple outputs (#5104)
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
(cherry picked from commit 4864ca3a27)

Co-authored-by: Somefive <yd219913@alibaba-inc.com>
2022-11-22 11:40:20 +08:00
github-actions[bot]
7814232b7c Fix: fix acr webhook for enterprise registry (#5098)
Signed-off-by: FogDong <dongtianxin.tx@alibaba-inc.com>
(cherry picked from commit c0519d3fba)

Co-authored-by: FogDong <dongtianxin.tx@alibaba-inc.com>
2022-11-21 14:21:58 +08:00
194 changed files with 4331 additions and 2135 deletions

View File

@@ -78,6 +78,8 @@ jobs:
- name: Install ginkgo
run: |
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y golang-ginkgo-dev
- name: Start MongoDB

44
.github/workflows/definition-lint.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
name: Definition-Lint
on:
push:
branches:
- master
- release-*
workflow_dispatch: {}
pull_request:
branches:
- master
- release-*
env:
# Common versions
GO_VERSION: '1.19'
jobs:
definition-doc:
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Setup K3d
uses: nolar/setup-k3d-k3s@v1.0.9
with:
version: v1.20
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Definition Doc generate check
run: |
go build -o docgen hack/docgen/def/gen.go
./docgen --type=comp --force-example-doc --path=./comp-def-check.md
./docgen --type=trait --force-example-doc --path=./trait-def-check.md
./docgen --type=wf --force-example-doc --path=./wf-def-check.md
./docgen --type=policy --force-example-doc --path=./policy-def-check.md

View File

@@ -58,6 +58,8 @@ jobs:
- name: Install ginkgo
run: |
sudo sed -i 's/azure\.//' /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y golang-ginkgo-dev
- name: Setup K3d

View File

@@ -333,7 +333,8 @@ type WorkflowStatus struct {
Steps []workflowv1alpha1.WorkflowStepStatus `json:"steps,omitempty"`
StartTime metav1.Time `json:"startTime,omitempty"`
EndTime metav1.Time `json:"endTime,omitempty"`
// +nullable
EndTime metav1.Time `json:"endTime,omitempty"`
}
// DefinitionType describes the type of DefinitionRevision.

View File

@@ -499,7 +499,7 @@ spec:
description: Components record the related Components created
by Application Controller
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -508,25 +508,25 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the validation
rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We
cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect
numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
particular restrictions like, \"must refer only to
types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant.
\ 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don't make new APIs embed an
underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used
type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -659,7 +659,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded
@@ -668,28 +668,28 @@ spec:
ResourceVersion and FieldPath are both very rarely
valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID
not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded
in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control.
Instead of using this type, create a locally provided
and used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types
A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't
make new APIs embed an underspecified API type they
do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -776,7 +776,7 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -785,11 +785,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -798,13 +798,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -844,6 +844,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -2414,7 +2415,7 @@ spec:
description: Components record the related Components created
by Application Controller
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -2423,25 +2424,25 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the validation
rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We
cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect
numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
particular restrictions like, \"must refer only to
types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant.
\ 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don't make new APIs embed an
underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used
type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -2574,7 +2575,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded
@@ -2583,28 +2584,28 @@ spec:
ResourceVersion and FieldPath are both very rarely
valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID
not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded
in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control.
Instead of using this type, create a locally provided
and used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types
A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't
make new APIs embed an underspecified API type they
do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -2691,7 +2692,7 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -2700,11 +2701,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -2713,13 +2714,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -2759,6 +2760,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -4752,31 +4754,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -4813,6 +4816,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean

View File

@@ -450,31 +450,31 @@ spec:
description: Components record the related Components created by Application
Controller
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -601,7 +601,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. --- New
uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -610,24 +610,24 @@ spec:
both very rarely valid in actual usage. 2. Invalid usage
help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is on the
group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this
type will affect numerous schemas. Don''t make new
APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and
used type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
like, \"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those cannot
be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules
are different by usage, which makes it hard for users to
predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a
URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency
is on the group,resource tuple and the version of the
actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make
new APIs embed an underspecified API type they do not control.
\n Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -707,31 +707,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -768,6 +769,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -1212,31 +1214,31 @@ spec:
description: Components record the related Components created by Application
Controller
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1363,7 +1365,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. --- New
uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -1372,24 +1374,24 @@ spec:
both very rarely valid in actual usage. 2. Invalid usage
help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is on the
group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this
type will affect numerous schemas. Don''t make new
APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and
used type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
like, \"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those cannot
be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules
are different by usage, which makes it hard for users to
predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a
URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency
is on the group,resource tuple and the version of the
actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make
new APIs embed an underspecified API type they do not control.
\n Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1469,31 +1471,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1530,6 +1533,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean

View File

@@ -59,7 +59,7 @@ spec:
type: string
traits:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded in
@@ -69,26 +69,26 @@ spec:
usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like,
"must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be
well described when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are both
imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most
cases, the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control. Instead
of using this type, create a locally provided and
used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
\"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many
locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified
API type they do not control. \n Instead of using
this type, create a locally provided and used type
that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -129,7 +129,7 @@ spec:
type: object
type: array
workload:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -138,11 +138,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -151,13 +151,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -213,31 +213,31 @@ spec:
description: WorkloadReferences to the workloads that are in this
scope.
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -305,7 +305,7 @@ spec:
description: HealthStatus represents health status strings.
type: string
targetWorkload:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -314,11 +314,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -327,13 +327,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -461,7 +461,7 @@ spec:
description: HealthStatus represents health status strings.
type: string
targetWorkload:
description: 'ObjectReference contains enough information to
description: "ObjectReference contains enough information to
let you inspect or modify the referred object. --- New uses
of this type are discouraged because of difficulty describing
its usage when embedded in APIs. 1. Ignored fields. It includes
@@ -469,24 +469,25 @@ spec:
ResourceVersion and FieldPath are both very rarely valid in
actual usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name
must be restricted". Those cannot be well described when
usages, there are particular restrictions like, \"must
refer only to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and the
version of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not
control. Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping. In
most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API
type they do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.

View File

@@ -72,7 +72,7 @@ spec:
}]
}
}
parameter: close(#PatchParams) | close({
parameter: *#PatchParams | close({
// +usage=Specify the container image for multiple containers
containers: [...#PatchParams]
})

View File

@@ -499,7 +499,7 @@ spec:
description: Components record the related Components created
by Application Controller
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -508,25 +508,25 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the validation
rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We
cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect
numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
particular restrictions like, \"must refer only to
types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant.
\ 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don't make new APIs embed an
underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used
type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -659,7 +659,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded
@@ -668,28 +668,28 @@ spec:
ResourceVersion and FieldPath are both very rarely
valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID
not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded
in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control.
Instead of using this type, create a locally provided
and used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types
A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't
make new APIs embed an underspecified API type they
do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -776,7 +776,7 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -785,11 +785,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -798,13 +798,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -844,6 +844,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -2414,7 +2415,7 @@ spec:
description: Components record the related Components created
by Application Controller
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -2423,25 +2424,25 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the validation
rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We
cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect
numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
particular restrictions like, \"must refer only to
types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant.
\ 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don't make new APIs embed an
underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used
type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -2574,7 +2575,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded
@@ -2583,28 +2584,28 @@ spec:
ResourceVersion and FieldPath are both very rarely
valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID
not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded
in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control.
Instead of using this type, create a locally provided
and used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types
A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't
make new APIs embed an underspecified API type they
do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -2691,7 +2692,7 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -2700,11 +2701,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -2713,13 +2714,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -2759,6 +2760,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -4752,31 +4754,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -4813,6 +4816,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean

View File

@@ -450,31 +450,31 @@ spec:
description: Components record the related Components created by Application
Controller
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -601,7 +601,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. --- New
uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -610,24 +610,24 @@ spec:
both very rarely valid in actual usage. 2. Invalid usage
help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is on the
group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this
type will affect numerous schemas. Don''t make new
APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and
used type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
like, \"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those cannot
be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules
are different by usage, which makes it hard for users to
predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a
URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency
is on the group,resource tuple and the version of the
actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make
new APIs embed an underspecified API type they do not control.
\n Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -707,31 +707,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -768,6 +769,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -1212,31 +1214,31 @@ spec:
description: Components record the related Components created by Application
Controller
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1363,7 +1365,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. --- New
uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -1372,24 +1374,24 @@ spec:
both very rarely valid in actual usage. 2. Invalid usage
help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is on the
group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this
type will affect numerous schemas. Don''t make new
APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and
used type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
like, \"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those cannot
be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules
are different by usage, which makes it hard for users to
predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a
URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency
is on the group,resource tuple and the version of the
actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make
new APIs embed an underspecified API type they do not control.
\n Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1469,31 +1471,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1530,6 +1533,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean

View File

@@ -59,7 +59,7 @@ spec:
type: string
traits:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded in
@@ -69,26 +69,26 @@ spec:
usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like,
"must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be
well described when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are both
imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most
cases, the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control. Instead
of using this type, create a locally provided and
used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
\"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many
locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified
API type they do not control. \n Instead of using
this type, create a locally provided and used type
that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -129,7 +129,7 @@ spec:
type: object
type: array
workload:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -138,11 +138,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -151,13 +151,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -213,31 +213,31 @@ spec:
description: WorkloadReferences to the workloads that are in this
scope.
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -305,7 +305,7 @@ spec:
description: HealthStatus represents health status strings.
type: string
targetWorkload:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -314,11 +314,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -327,13 +327,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -461,7 +461,7 @@ spec:
description: HealthStatus represents health status strings.
type: string
targetWorkload:
description: 'ObjectReference contains enough information to
description: "ObjectReference contains enough information to
let you inspect or modify the referred object. --- New uses
of this type are discouraged because of difficulty describing
its usage when embedded in APIs. 1. Ignored fields. It includes
@@ -469,24 +469,25 @@ spec:
ResourceVersion and FieldPath are both very rarely valid in
actual usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name
must be restricted". Those cannot be well described when
usages, there are particular restrictions like, \"must
refer only to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and the
version of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not
control. Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping. In
most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API
type they do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.

View File

@@ -72,7 +72,7 @@ spec:
}]
}
}
parameter: close(#PatchParams) | close({
parameter: *#PatchParams | close({
// +usage=Specify the container image for multiple containers
containers: [...#PatchParams]
})

View File

@@ -30,10 +30,10 @@ import (
"github.com/go-openapi/spec"
"github.com/google/uuid"
flag "github.com/spf13/pflag"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver"
"github.com/oam-dev/kubevela/pkg/apiserver/config"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/features"
"github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/version"
@@ -61,24 +61,24 @@ func main() {
func() {
swagger, err := s.buildSwagger()
if err != nil {
log.Logger.Fatal(err.Error())
klog.Fatal(err.Error())
}
outData, err := json.MarshalIndent(swagger, "", "\t")
if err != nil {
log.Logger.Fatal(err.Error())
klog.Fatal(err.Error())
}
swaggerFile, err := os.OpenFile(os.Args[2], os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600)
if err != nil {
log.Logger.Fatal(err.Error())
klog.Fatal(err.Error())
}
defer func() {
if err := swaggerFile.Close(); err != nil {
log.Logger.Errorf("close swagger file failure %s", err.Error())
klog.Errorf("close swagger file failure %s", err.Error())
}
}()
_, err = swaggerFile.Write(outData)
if err != nil {
log.Logger.Fatal(err.Error())
klog.Fatal(err.Error())
}
fmt.Println("build swagger config file success")
}()
@@ -107,11 +107,11 @@ func main() {
select {
case <-term:
log.Logger.Infof("Received SIGTERM, exiting gracefully...")
klog.Infof("Received SIGTERM, exiting gracefully...")
case err := <-errChan:
log.Logger.Errorf("Received an error: %s, exiting gracefully...", err.Error())
klog.Errorf("Received an error: %s, exiting gracefully...", err.Error())
}
log.Logger.Infof("See you next time!")
klog.Infof("See you next time!")
}
// Server apiserver
@@ -120,7 +120,7 @@ type Server struct {
}
func (s *Server) run(ctx context.Context, errChan chan error) error {
log.Logger.Infof("KubeVela information: version: %v, gitRevision: %v", version.VelaVersion, version.GitRevision)
klog.Infof("KubeVela information: version: %v, gitRevision: %v", version.VelaVersion, version.GitRevision)
server := apiserver.New(s.serverConfig)

View File

@@ -74,6 +74,12 @@ var _ = Describe("Addon Test", func() {
Expect(output).To(ContainSubstring("enabled successfully."))
})
It("Enable addon with specified registry ", func() {
output, err := e2e.LongTimeExec("vela addon enable KubeVela/test-addon", 300*time.Second)
Expect(err).NotTo(HaveOccurred())
Expect(output).To(ContainSubstring("enabled successfully."))
})
It("Disable addon test-addon", func() {
output, err := e2e.LongTimeExec("vela addon disable test-addon", 600*time.Second)
Expect(err).NotTo(HaveOccurred())

View File

@@ -0,0 +1,8 @@
name: mock-dep-addon
version: v1.0.0
description: Vela test addon named mock-dep-addon
icon: https://www.test.com/icon
url: https://www.test.com
dependencies:
- name: mock-be-dep-addon

View File

@@ -60,4 +60,13 @@ entries:
urls:
- http://127.0.0.1:9098/helm/bar-v2.0.0.tgz
version: v2.0.0
mock-be-dep-addon:
- created: "2022-10-29T09:11:16.865230605Z"
description: Vela test addon named mock-be-dep-addon
home: https://www.test.com/icon
icon: https://www.test.com
name: mock-be-dep-addon
urls:
- http://127.0.0.1:9098/helm/mock-be-dep-addon-v1.0.0.tgz
version: v1.0.0
generated: "2022-06-15T13:17:04.733573+08:00"

View File

@@ -149,6 +149,12 @@ var helmHandler http.HandlerFunc = func(rw http.ResponseWriter, req *http.Reques
_, _ = rw.Write([]byte(err.Error()))
}
rw.Write(file)
case strings.Contains(req.URL.Path, "mock-be-dep-addon-v1.0.0.tgz"):
file, err := os.ReadFile("./e2e/addon/mock/testrepo/helm-repo/mock-be-dep-addon-v1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
rw.Write(file)
}
}

174
go.mod
View File

@@ -14,11 +14,12 @@ require (
github.com/alibabacloud-go/tea v1.1.19
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b
github.com/barnettZQG/inject v0.0.1
github.com/bluele/gcache v0.0.2
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869
github.com/briandowns/spinner v1.11.1
github.com/chartmuseum/helm-push v0.10.2
github.com/cloudtty/cloudtty v0.2.0
github.com/containerd/containerd v1.5.13
github.com/containerd/containerd v1.6.6
github.com/coreos/go-oidc v2.1.0+incompatible
github.com/coreos/prometheus-operator v0.41.1
github.com/crossplane/crossplane-runtime v0.14.1-0.20210722005935-0b469fcc77cd
@@ -27,7 +28,7 @@ require (
github.com/deckarep/golang-set v1.7.1
github.com/emicklei/go-restful-openapi/v2 v2.3.0
github.com/emicklei/go-restful/v3 v3.8.0
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/evanphx/json-patch v5.6.0+incompatible
github.com/fatih/camelcase v1.0.0
github.com/fatih/color v1.13.0
github.com/fluxcd/helm-controller/api v0.21.0
@@ -37,32 +38,31 @@ require (
github.com/gertd/go-pluralize v0.1.7
github.com/getkin/kin-openapi v0.94.0
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v1.2.2
github.com/go-logr/logr v1.2.3
github.com/go-openapi/spec v0.19.8
github.com/go-playground/validator/v10 v10.9.0
github.com/go-resty/resty/v2 v2.7.0
github.com/golang/mock v1.6.0
github.com/google/go-cmp v0.5.8
github.com/google/go-cmp v0.5.9
github.com/google/go-containerregistry v0.9.0
github.com/google/go-github/v32 v32.1.0
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.4.2
github.com/gosuri/uilive v0.0.4
github.com/gosuri/uitable v0.0.4
github.com/hashicorp/go-version v1.3.0
github.com/hashicorp/golang-lru v0.5.4
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hcl/v2 v2.9.1
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174
github.com/imdario/mergo v0.3.12
github.com/klauspost/compress v1.15.11
github.com/klauspost/compress v1.15.12
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
github.com/kubevela/pkg v0.0.0-20221024115939-a103acee6db2
github.com/kubevela/pkg v0.0.0-20230105054759-263dc191bf51
github.com/kubevela/prism v1.5.1-0.20220915071949-6bf3ad33f84f
github.com/kubevela/workflow v0.3.3
github.com/kubevela/workflow v0.3.6
github.com/kyokomi/emoji v2.2.4+incompatible
github.com/mitchellh/hashstructure/v2 v2.0.1
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
github.com/oam-dev/cluster-gateway v1.4.0
github.com/oam-dev/cluster-gateway v1.7.0-alpha.1
github.com/oam-dev/cluster-register v1.0.4-0.20220928064144-5f76a9d7ca8c
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28
github.com/oam-dev/terraform-controller v0.7.0
@@ -76,43 +76,41 @@ require (
github.com/rivo/tview v0.0.0-20220709181631-73bf2902b59a
github.com/robfig/cron/v3 v3.0.1
github.com/rogpeppe/go-internal v1.9.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.7.1
github.com/stretchr/testify v1.8.0
github.com/tidwall/gjson v1.9.3
github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f
github.com/wonderflow/cert-manager-api v1.0.4-0.20210304051430-e08aa76f6c5f
github.com/xanzy/go-gitlab v0.60.0
github.com/xlab/treeprint v1.1.0
go.mongodb.org/mongo-driver v1.5.1
go.uber.org/zap v1.21.0
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be
golang.org/x/crypto v0.1.0
golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
golang.org/x/text v0.3.8
golang.org/x/term v0.1.0
golang.org/x/text v0.4.0
gomodules.xyz/jsonpatch/v2 v2.2.0
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v3 v3.0.1
gotest.tools v2.2.0+incompatible
helm.sh/helm/v3 v3.7.2
helm.sh/helm/v3 v3.10.3
istio.io/client-go v1.13.4
k8s.io/api v0.23.6
k8s.io/apiextensions-apiserver v0.23.6
k8s.io/apimachinery v0.23.6
k8s.io/apiserver v0.23.6
k8s.io/cli-runtime v0.23.6
k8s.io/client-go v0.23.6
k8s.io/component-base v0.23.6
k8s.io/api v0.25.3
k8s.io/apiextensions-apiserver v0.25.2
k8s.io/apimachinery v0.25.3
k8s.io/apiserver v0.25.3
k8s.io/cli-runtime v0.25.2
k8s.io/client-go v0.25.3
k8s.io/component-base v0.25.3
k8s.io/helm v2.17.0+incompatible
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.60.1
k8s.io/kube-aggregator v0.23.0
k8s.io/kubectl v0.23.6
k8s.io/metrics v0.23.6
k8s.io/utils v0.0.0-20220210201930-3a6ce19ff2f9
k8s.io/klog/v2 v2.70.1
k8s.io/kube-aggregator v0.25.3
k8s.io/kubectl v0.25.2
k8s.io/metrics v0.25.2
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed
open-cluster-management.io/api v0.7.0
sigs.k8s.io/controller-runtime v0.11.2
sigs.k8s.io/controller-runtime v0.12.3
sigs.k8s.io/controller-tools v0.6.2
sigs.k8s.io/gateway-api v0.4.3
sigs.k8s.io/kind v0.9.0
@@ -122,20 +120,20 @@ require (
require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.13 // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/BurntSushi/toml v0.4.1 // indirect
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
github.com/BurntSushi/toml v1.2.1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/Masterminds/squirrel v1.5.2 // indirect
github.com/Masterminds/squirrel v1.5.3 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/hcsshim v0.8.24 // indirect
github.com/Microsoft/hcsshim v0.9.3 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
@@ -154,26 +152,25 @@ require (
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
github.com/aws/aws-sdk-go v1.36.30 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/containerd/continuity v0.1.0 // indirect
github.com/containerd/continuity v0.3.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/creack/pty v1.1.11 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/docker/cli v20.10.16+incompatible // indirect
github.com/docker/cli v20.10.17+incompatible // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.16+incompatible // indirect
github.com/docker/docker v20.10.17+incompatible // indirect
github.com/docker/docker-credential-helpers v0.6.4 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/emicklei/go-restful v2.9.5+incompatible // indirect
github.com/emicklei/proto v1.10.0 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/evanphx/json-patch/v5 v5.1.0 // indirect
@@ -183,11 +180,12 @@ require (
github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect
github.com/fluxcd/pkg/apis/kustomize v0.3.3 // indirect
github.com/fluxcd/pkg/apis/meta v0.13.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/fvbommel/sortorder v1.0.1 // indirect
github.com/gdamore/encoding v1.0.0 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-logr/zapr v1.2.0 // indirect
github.com/go-gorp/gorp/v3 v3.0.2 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
@@ -197,25 +195,26 @@ require (
github.com/gobuffalo/flect v0.2.3 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmoiron/sqlx v1.3.1 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
@@ -225,14 +224,14 @@ require (
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lib/pq v1.10.3 // indirect
github.com/lib/pq v1.10.6 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.11 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
@@ -240,7 +239,7 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20210610120745-9d4ed1856297 // indirect
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/morikuni/aec v1.0.0 // indirect
@@ -250,21 +249,21 @@ require (
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect
github.com/openshift/library-go v0.0.0-20220112153822-ac82336bd076 // indirect
github.com/openshift/library-go v0.0.0-20221111030555-73ed40c0a938 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/protocolbuffers/txtpbfmt v0.0.0-20220428173112-74888fd59c2b // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rubenv/sql-migrate v0.0.0-20210614095031-55d5740dbbcc // indirect
github.com/rubenv/sql-migrate v1.1.2 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/afero v1.8.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
@@ -277,37 +276,37 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/zclconf/go-cty v1.8.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.0 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.0 // indirect
go.etcd.io/etcd/client/v3 v3.5.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.opentelemetry.io/contrib v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0 // indirect
go.opentelemetry.io/otel v0.20.0 // indirect
go.opentelemetry.io/otel v1.3.0 // indirect
go.opentelemetry.io/otel/exporters/otlp v0.20.0 // indirect
go.opentelemetry.io/otel/metric v0.20.0 // indirect
go.opentelemetry.io/otel/sdk v0.20.0 // indirect
go.opentelemetry.io/otel/sdk v1.3.0 // indirect
go.opentelemetry.io/otel/sdk/export/metric v0.20.0 // indirect
go.opentelemetry.io/otel/sdk/metric v0.20.0 // indirect
go.opentelemetry.io/otel/trace v0.20.0 // indirect
go.opentelemetry.io/proto/otlp v0.7.0 // indirect
go.opentelemetry.io/otel/trace v1.3.0 // indirect
go.opentelemetry.io/proto/otlp v0.11.0 // indirect
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
golang.org/x/mod v0.6.0-dev.0.20220818022119-ed83ed61efb9 // indirect
golang.org/x/net v0.0.0-20220906165146-f3363e06e74c // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.1.1-0.20221104162952-702349b0e862 // indirect
golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/tools v0.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
gopkg.in/gorp.v1 v1.7.2 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
@@ -315,15 +314,16 @@ require (
gopkg.in/warnings.v0 v0.1.2 // indirect
istio.io/api v0.0.0-20220512212136-561ffec82582 // indirect
istio.io/gogo-genproto v0.0.0-20211208193508-5ab4acc9eb1e // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
oras.land/oras-go v0.4.0 // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
oras.land/oras-go v1.2.0 // indirect
sigs.k8s.io/apiserver-network-proxy v0.0.30 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.30 // indirect
sigs.k8s.io/apiserver-runtime v1.1.1 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/kustomize/api v0.10.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.33 // indirect
sigs.k8s.io/apiserver-runtime v1.1.2-0.20221102045245-fb656940062f // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
require (
@@ -331,11 +331,11 @@ require (
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-retryablehttp v0.7.0 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/magiconair/properties v1.8.5
github.com/magiconair/properties v1.8.6
github.com/nacos-group/nacos-sdk-go/v2 v2.1.0
github.com/opencontainers/runc v1.1.3 // indirect
github.com/openkruise/rollouts v0.1.1-0.20220622054609-149e5a48da5e
github.com/pelletier/go-toml v1.9.4
github.com/pelletier/go-toml v1.9.5
github.com/xanzy/ssh-agent v0.3.0 // indirect
google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03 // indirect
gopkg.in/yaml.v2 v2.4.0
@@ -346,5 +346,11 @@ replace (
github.com/docker/cli => github.com/docker/cli v20.10.9+incompatible
github.com/docker/docker => github.com/moby/moby v17.12.0-ce-rc1.0.20200618181300-9dc6525e6118+incompatible
github.com/wercker/stern => github.com/oam-dev/stern v1.13.2
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0
go.opentelemetry.io/otel => go.opentelemetry.io/otel v0.20.0
go.opentelemetry.io/otel/metric => go.opentelemetry.io/otel/metric v0.20.0
go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v0.20.0
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v0.20.0
go.opentelemetry.io/proto/otlp => go.opentelemetry.io/proto/otlp v0.7.0
sigs.k8s.io/apiserver-network-proxy/konnectivity-client => sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.24
)

384
go.sum

File diff suppressed because it is too large Load Diff

View File

@@ -42,6 +42,7 @@ func main() {
defdir := flag.String("def-dir", "", "path of definition dir")
tp := flag.String("type", "", "choose one of the definition to print")
i18nfile := flag.String("i18n", "../kubevela.io/static/reference-i18n.json", "file path of i18n data")
forceExample := flag.Bool("force-example-doc", false, "example must be provided for definitions")
flag.Parse()
if *i18nfile != "" {
@@ -52,21 +53,29 @@ func main() {
fmt.Println("you must specify a type with definition ref path specified ")
os.Exit(1)
}
opt := mods.Options{
Path: *path,
Location: *location,
DefDir: *defdir,
ForceExamples: *forceExample,
}
fmt.Printf("creating docs with args path=%s, location=%s, defdir=%s, type=%s.\n", *path, *location, *defdir, *tp)
switch types.CapType(*tp) {
case types.TypeComponentDefinition, "component", "comp":
mods.ComponentDef(ctx, c, path, location, *defdir)
mods.ComponentDef(ctx, c, opt)
case types.TypeTrait:
mods.TraitDef(ctx, c, path, location, *defdir)
mods.TraitDef(ctx, c, opt)
case types.TypePolicy:
mods.PolicyDef(ctx, c, path, location, *defdir)
mods.PolicyDef(ctx, c, opt)
case types.TypeWorkflowStep, "workflow", "wf":
mods.WorkflowDef(ctx, c, path, location, *defdir)
mods.WorkflowDef(ctx, c, opt)
case "":
mods.ComponentDef(ctx, c, path, location, *defdir)
mods.TraitDef(ctx, c, path, location, *defdir)
mods.PolicyDef(ctx, c, path, location, *defdir)
mods.WorkflowDef(ctx, c, path, location, *defdir)
mods.ComponentDef(ctx, c, opt)
mods.TraitDef(ctx, c, opt)
mods.PolicyDef(ctx, c, opt)
mods.WorkflowDef(ctx, c, opt)
default:
fmt.Printf("type %s not supported\n", *tp)
os.Exit(1)

View File

@@ -19,7 +19,6 @@ package mods
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"time"
@@ -60,12 +59,13 @@ title: 内置组件列表
` + fmt.Sprintf("> 本文档由[脚本](../../contributor/cli-ref-doc)自动生成,请勿手动修改,上次更新于 %s。\n\n", time.Now().Format(time.RFC3339))
// ComponentDef generate component def reference doc
func ComponentDef(ctx context.Context, c common.Args, path, location *string, defdir string) {
if defdir == "" {
defdir = ComponentDefDir
func ComponentDef(ctx context.Context, c common.Args, opt Options) {
if opt.DefDir == "" {
opt.DefDir = ComponentDefDir
}
ref := &docgen.MarkdownReference{
AllInOne: true,
AllInOne: true,
ForceExample: opt.ForceExamples,
Filter: func(capability types.Capability) bool {
if capability.Type != types.TypeComponentDefinition || capability.Category != types.CUECategory {
return false
@@ -74,9 +74,9 @@ func ComponentDef(ctx context.Context, c common.Args, path, location *string, de
return false
}
// only print capability which contained in cue def
files, err := ioutil.ReadDir(defdir)
files, err := os.ReadDir(opt.DefDir)
if err != nil {
fmt.Println("read dir err", defdir, err)
fmt.Println("read dir err", opt.DefDir, err)
return false
}
for _, f := range files {
@@ -96,19 +96,20 @@ func ComponentDef(ctx context.Context, c common.Args, path, location *string, de
return
}
ref.DiscoveryMapper = dm
if *path != "" {
if opt.Path != "" {
ref.I18N = &docgen.En
if strings.Contains(*location, "zh") || strings.Contains(*location, "chinese") {
if strings.Contains(opt.Location, "zh") || strings.Contains(opt.Location, "chinese") {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomComponentHeaderZH
}
if err := ref.GenerateReferenceDocs(ctx, c, *path); err != nil {
if err := ref.GenerateReferenceDocs(ctx, c, opt.Path); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("component reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), *path)
fmt.Printf("component reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), opt.Path)
return
}
if *location == "" || *location == "en" {
if opt.Location == "" || opt.Location == "en" {
ref.I18N = &docgen.En
if err := ref.GenerateReferenceDocs(ctx, c, ComponentDefRefPath); err != nil {
fmt.Println(err)
@@ -116,7 +117,7 @@ func ComponentDef(ctx context.Context, c common.Args, path, location *string, de
}
fmt.Printf("component reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), ComponentDefRefPath)
}
if *location == "" || *location == "zh" {
if opt.Location == "" || opt.Location == "zh" {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomComponentHeaderZH
if err := ref.GenerateReferenceDocs(ctx, c, ComponentDefRefPathZh); err != nil {

View File

@@ -19,7 +19,6 @@ package mods
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"time"
@@ -58,12 +57,13 @@ title: 内置策略列表
` + fmt.Sprintf("> 本文档由[脚本](../../contributor/cli-ref-doc)自动生成,请勿手动修改,上次更新于 %s。\n\n", time.Now().Format(time.RFC3339))
// PolicyDef generate policy def reference doc
func PolicyDef(ctx context.Context, c common.Args, path, location *string, defdir string) {
if defdir == "" {
defdir = PolicyDefDir
func PolicyDef(ctx context.Context, c common.Args, opt Options) {
if opt.DefDir == "" {
opt.DefDir = PolicyDefDir
}
ref := &docgen.MarkdownReference{
AllInOne: true,
AllInOne: true,
ForceExample: opt.ForceExamples,
Filter: func(capability types.Capability) bool {
if capability.Type != types.TypePolicy || capability.Category != types.CUECategory {
return false
@@ -72,9 +72,9 @@ func PolicyDef(ctx context.Context, c common.Args, path, location *string, defdi
return false
}
// only print capability which contained in cue def
files, err := ioutil.ReadDir(defdir)
files, err := os.ReadDir(opt.DefDir)
if err != nil {
fmt.Println("read dir err", defdir, err)
fmt.Println("read dir err", opt.DefDir, err)
return false
}
for _, f := range files {
@@ -86,20 +86,21 @@ func PolicyDef(ctx context.Context, c common.Args, path, location *string, defdi
},
CustomDocHeader: CustomPolicyHeaderEN,
}
ref.Remote = &docgen.FromCluster{Namespace: types.DefaultKubeVelaNS}
if *path != "" {
ref.Local = &docgen.FromLocal{Path: PolicyDefDir}
if opt.Path != "" {
ref.I18N = &docgen.En
if strings.Contains(*location, "zh") || strings.Contains(*location, "chinese") {
if strings.Contains(opt.Location, "zh") || strings.Contains(opt.Location, "chinese") {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomPolicyHeaderZH
}
if err := ref.GenerateReferenceDocs(ctx, c, *path); err != nil {
if err := ref.GenerateReferenceDocs(ctx, c, opt.Path); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("policy reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), *path)
fmt.Printf("policy reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), opt.Path)
return
}
if *location == "" || *location == "en" {
if opt.Location == "" || opt.Location == "en" {
ref.I18N = &docgen.En
if err := ref.GenerateReferenceDocs(ctx, c, PolicyDefRefPath); err != nil {
fmt.Println(err)
@@ -107,7 +108,7 @@ func PolicyDef(ctx context.Context, c common.Args, path, location *string, defdi
}
fmt.Printf("policy reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), PolicyDefRefPath)
}
if *location == "" || *location == "zh" {
if opt.Location == "" || opt.Location == "zh" {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomPolicyHeaderZH
if err := ref.GenerateReferenceDocs(ctx, c, PolicyDefRefPathZh); err != nil {

View File

@@ -19,7 +19,6 @@ package mods
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"time"
@@ -58,12 +57,13 @@ title: 内置运维特征列表
` + fmt.Sprintf("> 本文档由[脚本](../../contributor/cli-ref-doc)自动生成,请勿手动修改,上次更新于 %s。\n\n", time.Now().Format(time.RFC3339))
// TraitDef generate trait def reference doc
func TraitDef(ctx context.Context, c common.Args, path, location *string, defdir string) {
if defdir == "" {
defdir = TraitDefDir
func TraitDef(ctx context.Context, c common.Args, opt Options) {
if opt.DefDir == "" {
opt.DefDir = TraitDefDir
}
ref := &docgen.MarkdownReference{
AllInOne: true,
AllInOne: true,
ForceExample: opt.ForceExamples,
Filter: func(capability types.Capability) bool {
if capability.Type != types.TypeTrait || capability.Category != types.CUECategory {
return false
@@ -72,9 +72,9 @@ func TraitDef(ctx context.Context, c common.Args, path, location *string, defdir
return false
}
// only print capability which contained in cue def
files, err := ioutil.ReadDir(defdir)
files, err := os.ReadDir(opt.DefDir)
if err != nil {
fmt.Println("read dir err", defdir, err)
fmt.Println("read dir err", opt.DefDir, err)
return false
}
for _, f := range files {
@@ -90,20 +90,20 @@ func TraitDef(ctx context.Context, c common.Args, path, location *string, defdir
Path: TraitDefDir,
}
if *path != "" {
if opt.Path != "" {
ref.I18N = &docgen.En
if strings.Contains(*location, "zh") || strings.Contains(*location, "chinese") {
if strings.Contains(opt.Location, "zh") || strings.Contains(opt.Location, "chinese") {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomTraitHeaderZH
}
if err := ref.GenerateReferenceDocs(ctx, c, *path); err != nil {
if err := ref.GenerateReferenceDocs(ctx, c, opt.Path); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), *path)
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), opt.Path)
} else {
// Generate to default path depends on language
if *location == "" || *location == "en" {
if opt.Location == "" || opt.Location == "en" {
ref.I18N = &docgen.En
if err := ref.GenerateReferenceDocs(ctx, c, TraitDefRefPath); err != nil {
fmt.Println(err)
@@ -111,7 +111,7 @@ func TraitDef(ctx context.Context, c common.Args, path, location *string, defdir
}
fmt.Printf("trait reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), TraitDefRefPath)
}
if *location == "" || *location == "zh" {
if opt.Location == "" || opt.Location == "zh" {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomTraitHeaderZH
if err := ref.GenerateReferenceDocs(ctx, c, TraitDefRefPathZh); err != nil {

View File

@@ -0,0 +1,25 @@
/*
Copyright 2022 The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package mods
// Options defines the doc generate options
type Options struct {
Path string
Location string
DefDir string
ForceExamples bool
}

View File

@@ -19,7 +19,6 @@ package mods
import (
"context"
"fmt"
"io/ioutil"
"os"
"strings"
"time"
@@ -58,12 +57,13 @@ title: 内置工作流步骤列表
` + fmt.Sprintf("> 本文档由[脚本](../../contributor/cli-ref-doc)自动生成,请勿手动修改,上次更新于 %s。\n\n", time.Now().Format(time.RFC3339))
// WorkflowDef generate workflow def reference doc
func WorkflowDef(ctx context.Context, c common.Args, path, location *string, defdir string) {
if defdir == "" {
defdir = WorkflowDefDir
func WorkflowDef(ctx context.Context, c common.Args, opt Options) {
if opt.DefDir == "" {
opt.DefDir = WorkflowDefDir
}
ref := &docgen.MarkdownReference{
AllInOne: true,
AllInOne: true,
ForceExample: opt.ForceExamples,
Filter: func(capability types.Capability) bool {
if capability.Type != types.TypeWorkflowStep || capability.Category != types.CUECategory {
@@ -74,9 +74,9 @@ func WorkflowDef(ctx context.Context, c common.Args, path, location *string, def
return false
}
// only print capability which contained in cue def
files, err := ioutil.ReadDir(defdir)
files, err := os.ReadDir(opt.DefDir)
if err != nil {
fmt.Println("read dir err", defdir, err)
fmt.Println("read dir err", opt.DefDir, err)
return false
}
for _, f := range files {
@@ -88,21 +88,22 @@ func WorkflowDef(ctx context.Context, c common.Args, path, location *string, def
},
CustomDocHeader: CustomWorkflowHeaderEN,
}
ref.Remote = &docgen.FromCluster{Namespace: types.DefaultKubeVelaNS}
ref.Local = &docgen.FromLocal{Path: WorkflowDefDir}
if *path != "" {
if opt.Path != "" {
ref.I18N = &docgen.En
if strings.Contains(*location, "zh") || strings.Contains(*location, "chinese") {
if strings.Contains(opt.Location, "zh") || strings.Contains(opt.Location, "chinese") {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomWorkflowHeaderZH
}
if err := ref.GenerateReferenceDocs(ctx, c, *path); err != nil {
if err := ref.GenerateReferenceDocs(ctx, c, opt.Path); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Printf("workflow reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), *path)
fmt.Printf("workflow reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), opt.Path)
return
}
if *location == "" || *location == "en" {
if opt.Location == "" || opt.Location == "en" {
ref.I18N = &docgen.En
if err := ref.GenerateReferenceDocs(ctx, c, WorkflowDefRefPath); err != nil {
fmt.Println(err)
@@ -110,7 +111,7 @@ func WorkflowDef(ctx context.Context, c common.Args, path, location *string, def
}
fmt.Printf("workflow reference docs (%s) successfully generated in %s \n", ref.I18N.Language(), WorkflowDefRefPath)
}
if *location == "" || *location == "zh" {
if opt.Location == "" || opt.Location == "zh" {
ref.I18N = &docgen.Zh
ref.CustomDocHeader = CustomWorkflowHeaderZH
if err := ref.GenerateReferenceDocs(ctx, c, WorkflowDefRefPathZh); err != nil {

View File

@@ -499,7 +499,7 @@ spec:
description: Components record the related Components created
by Application Controller
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -508,25 +508,25 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the validation
rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We
cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect
numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
particular restrictions like, \"must refer only to
types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant.
\ 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don't make new APIs embed an
underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used
type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -659,7 +659,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded
@@ -668,28 +668,28 @@ spec:
ResourceVersion and FieldPath are both very rarely
valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID
not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded
in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control.
Instead of using this type, create a locally provided
and used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types
A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't
make new APIs embed an underspecified API type they
do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -776,7 +776,7 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -785,11 +785,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -798,13 +798,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -844,6 +844,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -2414,7 +2415,7 @@ spec:
description: Components record the related Components created
by Application Controller
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -2423,25 +2424,25 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the validation
rules are different by usage, which makes it hard for
users to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5. We
cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect
numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
particular restrictions like, \"must refer only to
types A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST
mapping. In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is irrelevant.
\ 5. We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don't make new APIs embed an
underspecified API type they do not control. \n Instead
of using this type, create a locally provided and used
type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -2574,7 +2575,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded
@@ -2583,28 +2584,28 @@ spec:
ResourceVersion and FieldPath are both very rarely
valid in actual usage. 2. Invalid usage help. It
is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID
not honored" or "name must be restricted". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded
in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control.
Instead of using this type, create a locally provided
and used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types
A and B\" or \"UID not honored\" or \"name must
be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are
both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource
tuple and the version of the actual struct is
irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't
make new APIs embed an underspecified API type they
do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -2691,7 +2692,7 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -2700,11 +2701,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -2713,13 +2714,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -2759,6 +2760,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -4752,31 +4754,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -4813,6 +4816,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean

View File

@@ -451,31 +451,31 @@ spec:
description: Components record the related Components created by Application
Controller
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -602,7 +602,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. --- New
uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -611,24 +611,24 @@ spec:
both very rarely valid in actual usage. 2. Invalid usage
help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is on the
group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this
type will affect numerous schemas. Don''t make new
APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and
used type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
like, \"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those cannot
be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules
are different by usage, which makes it hard for users to
predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a
URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency
is on the group,resource tuple and the version of the
actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make
new APIs embed an underspecified API type they do not control.
\n Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -708,31 +708,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -769,6 +770,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean
@@ -1213,31 +1215,31 @@ spec:
description: Components record the related Components created by Application
Controller
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1364,7 +1366,7 @@ spec:
type: string
scopes:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. --- New
uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -1373,24 +1375,24 @@ spec:
both very rarely valid in actual usage. 2. Invalid usage
help. It is impossible to add specific help for individual
usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is on the
group,resource tuple and the version of the actual struct
is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this
type will affect numerous schemas. Don''t make new
APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and
used type that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
like, \"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those cannot
be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules
are different by usage, which makes it hard for users to
predict what will happen. 4. The fields are both imprecise
and overly precise. Kind is not a precise mapping to a
URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency
is on the group,resource tuple and the version of the
actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make
new APIs embed an underspecified API type they do not control.
\n Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1470,31 +1472,32 @@ spec:
appRevision:
type: string
contextBackend:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many
fields which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is not
a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don''t make
new APIs embed an underspecified API type they do not control.
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\"
or \"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are
different by usage, which makes it hard for users to predict
what will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This can produce
ambiguity during interpretation and require a REST mapping.
\ In most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded in
many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type, create a
locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -1531,6 +1534,7 @@ spec:
type: object
endTime:
format: date-time
nullable: true
type: string
finished:
type: boolean

View File

@@ -59,7 +59,7 @@ spec:
type: string
traits:
items:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object.
--- New uses of this type are discouraged because
of difficulty describing its usage when embedded in
@@ -69,26 +69,26 @@ spec:
usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like,
"must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be
well described when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are
different by usage, which makes it hard for users
to predict what will happen. 4. The fields are both
imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most
cases, the dependency is on the group,resource tuple and
the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is
embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed
an underspecified API type they do not control. Instead
of using this type, create a locally provided and
used type that is well-focused on your reference.
For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
\"must refer only to types A and B\" or \"UID not
honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent
validation. Because the usages are different, the
validation rules are different by usage, which makes
it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise.
\ Kind is not a precise mapping to a URL. This can
produce ambiguity during interpretation and require
a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many
locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified
API type they do not control. \n Instead of using
this type, create a locally provided and used type
that is well-focused on your reference. For example,
ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -129,7 +129,7 @@ spec:
type: object
type: array
workload:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -138,11 +138,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -151,13 +151,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -213,31 +213,31 @@ spec:
description: WorkloadReferences to the workloads that are in this
scope.
items:
description: 'ObjectReference contains enough information to let
description: "ObjectReference contains enough information to let
you inspect or modify the referred object. --- New uses of this
type are discouraged because of difficulty describing its usage
when embedded in APIs. 1. Ignored fields. It includes many fields
which are not generally honored. For instance, ResourceVersion
and FieldPath are both very rarely valid in actual usage. 2.
Invalid usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are particular restrictions
like, "must refer only to types A and B" or "UID not honored"
or "name must be restricted". Those cannot be well described
when embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage, which
makes it hard for users to predict what will happen. 4. The fields
are both imprecise and overly precise. Kind is not a precise
mapping to a URL. This can produce ambiguity during interpretation
and require a REST mapping. In most cases, the dependency is
on the group,resource tuple and the version of the actual
struct is irrelevant. 5. We cannot easily change it. Because
this type is embedded in many locations, updates to this type will
affect numerous schemas. Don''t make new APIs embed an underspecified
API type they do not control. Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
individual usage. In most embedded usages, there are particular
\ restrictions like, \"must refer only to types A and B\" or
\"UID not honored\" or \"name must be restricted\". Those
cannot be well described when embedded. 3. Inconsistent validation.
\ Because the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases, the
dependency is on the group,resource tuple and the version
of the actual struct is irrelevant. 5. We cannot easily change
it. Because this type is embedded in many locations, updates
to this type will affect numerous schemas. Don't make new
APIs embed an underspecified API type they do not control. \n
Instead of using this type, create a locally provided and used
type that is well-focused on your reference. For example, ServiceReferences
for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.
@@ -305,7 +305,7 @@ spec:
description: HealthStatus represents health status strings.
type: string
targetWorkload:
description: 'ObjectReference contains enough information
description: "ObjectReference contains enough information
to let you inspect or modify the referred object. ---
New uses of this type are discouraged because of difficulty
describing its usage when embedded in APIs. 1. Ignored
@@ -314,11 +314,11 @@ spec:
are both very rarely valid in actual usage. 2. Invalid
usage help. It is impossible to add specific help for
individual usage. In most embedded usages, there are
particular restrictions like, "must refer only to
types A and B" or "UID not honored" or "name must be
restricted". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the
usages are different, the validation rules are different
particular restrictions like, \"must refer only
to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described
when embedded. 3. Inconsistent validation. Because
the usages are different, the validation rules are different
by usage, which makes it hard for users to predict what
will happen. 4. The fields are both imprecise and overly
precise. Kind is not a precise mapping to a URL. This
@@ -327,13 +327,13 @@ spec:
is on the group,resource tuple and the version of
the actual struct is irrelevant. 5. We cannot easily
change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they
do not control. Instead of using this type, create a
locally provided and used type that is well-focused
updates to this type will affect numerous schemas.
\ Don't make new APIs embed an underspecified API type
they do not control. \n Instead of using this type,
create a locally provided and used type that is well-focused
on your reference. For example, ServiceReferences for
admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
."
properties:
apiVersion:
description: API version of the referent.
@@ -461,7 +461,7 @@ spec:
description: HealthStatus represents health status strings.
type: string
targetWorkload:
description: 'ObjectReference contains enough information to
description: "ObjectReference contains enough information to
let you inspect or modify the referred object. --- New uses
of this type are discouraged because of difficulty describing
its usage when embedded in APIs. 1. Ignored fields. It includes
@@ -469,24 +469,25 @@ spec:
ResourceVersion and FieldPath are both very rarely valid in
actual usage. 2. Invalid usage help. It is impossible to
add specific help for individual usage. In most embedded
usages, there are particular restrictions like, "must
refer only to types A and B" or "UID not honored" or "name
must be restricted". Those cannot be well described when
usages, there are particular restrictions like, \"must
refer only to types A and B\" or \"UID not honored\" or \"name
must be restricted\". Those cannot be well described when
embedded. 3. Inconsistent validation. Because the usages
are different, the validation rules are different by usage,
which makes it hard for users to predict what will happen. 4.
The fields are both imprecise and overly precise. Kind is
not a precise mapping to a URL. This can produce ambiguity during
interpretation and require a REST mapping. In most cases,
the dependency is on the group,resource tuple and the
version of the actual struct is irrelevant. 5. We cannot
easily change it. Because this type is embedded in many locations,
updates to this type will affect numerous schemas. Don''t
make new APIs embed an underspecified API type they do not
control. Instead of using this type, create a locally provided
and used type that is well-focused on your reference. For
example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
.'
which makes it hard for users to predict what will happen.
\ 4. The fields are both imprecise and overly precise. Kind
is not a precise mapping to a URL. This can produce ambiguity
\ during interpretation and require a REST mapping. In
most cases, the dependency is on the group,resource tuple
\ and the version of the actual struct is irrelevant. 5.
We cannot easily change it. Because this type is embedded
in many locations, updates to this type will affect numerous
schemas. Don't make new APIs embed an underspecified API
type they do not control. \n Instead of using this type, create
a locally provided and used type that is well-focused on your
reference. For example, ServiceReferences for admission registration:
https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533
."
properties:
apiVersion:
description: API version of the referent.

View File

@@ -60,7 +60,6 @@ import (
common2 "github.com/oam-dev/kubevela/apis/core.oam.dev/common"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/apis/types"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/config"
"github.com/oam-dev/kubevela/pkg/cue/script"
"github.com/oam-dev/kubevela/pkg/definition"
@@ -932,10 +931,12 @@ type Installer struct {
dryRun bool
dryRunBuff *bytes.Buffer
registries []Registry
}
// NewAddonInstaller will create an installer for addon
func NewAddonInstaller(ctx context.Context, cli client.Client, discoveryClient *discovery.DiscoveryClient, apply apply.Applicator, config *rest.Config, r *Registry, args map[string]interface{}, cache *Cache, opts ...InstallOption) Installer {
func NewAddonInstaller(ctx context.Context, cli client.Client, discoveryClient *discovery.DiscoveryClient, apply apply.Applicator, config *rest.Config, r *Registry, args map[string]interface{}, cache *Cache, registries []Registry, opts ...InstallOption) Installer {
i := Installer{
ctx: ctx,
config: config,
@@ -946,6 +947,7 @@ func NewAddonInstaller(ctx context.Context, cli client.Client, discoveryClient *
cache: cache,
dc: discoveryClient,
dryRunBuff: &bytes.Buffer{},
registries: registries,
}
for _, opt := range opts {
opt(&i)
@@ -1042,16 +1044,41 @@ func (h *Installer) installDependency(addon *InstallPackage) error {
if h.dryRun {
continue
}
// always install addon's latest version
depAddon, err := h.loadInstallPackage(dep.Name, dep.Version)
if err != nil {
return err
}
depHandler := *h
depHandler.args = nil
if err = depHandler.enableAddon(depAddon); err != nil {
return errors.Wrap(err, "fail to dispatch dependent addon resource")
var depAddon *InstallPackage
// try to install the dependent addon from the same registry with the current addon
depAddon, err = h.loadInstallPackage(dep.Name, dep.Version)
if err == nil {
if err = depHandler.enableAddon(depAddon); err != nil {
return errors.Wrap(err, "fail to dispatch dependent addon resource")
}
return nil
}
if !errors.Is(err, ErrNotExist) {
return err
}
for _, registry := range h.registries {
// try to install dependent addon from other registries
depHandler.r = &Registry{
Name: registry.Name, Helm: registry.Helm, OSS: registry.OSS, Git: registry.Git, Gitee: registry.Gitee, Gitlab: registry.Gitlab,
}
depAddon, err = depHandler.loadInstallPackage(dep.Name, dep.Version)
if err == nil {
break
}
if errors.Is(err, ErrNotExist) {
continue
}
return err
}
if err == nil {
if err = depHandler.enableAddon(depAddon); err != nil {
return errors.Wrap(err, "fail to dispatch dependent addon resource")
}
return nil
}
return fmt.Errorf("dependency addon: %s with version: %s cannot be found from all registries", dep.Name, dep.Version)
}
if h.dryRun && len(dependencies) > 0 {
klog.Warningf("dry run addon won't install dependencies, please make sure your system has already installed these addons: %v", strings.Join(dependencies, ", "))
@@ -1372,12 +1399,12 @@ func checkSemVer(actual string, require string) (bool, error) {
l := strings.ReplaceAll(require, "v", " ")
constraint, err := semver.NewConstraint(l)
if err != nil {
log.Logger.Errorf("fail to new constraint: %s", err.Error())
klog.Errorf("fail to new constraint: %s", err.Error())
return false, err
}
v, err := semver.NewVersion(semVer)
if err != nil {
log.Logger.Errorf("fail to new version %s: %s", semVer, err.Error())
klog.Errorf("fail to new version %s: %s", semVer, err.Error())
return false, err
}
if constraint.Check(v) {
@@ -1391,7 +1418,7 @@ func checkSemVer(actual string, require string) (bool, error) {
}
v, err := semver.NewVersion(semVer)
if err != nil {
log.Logger.Errorf("fail to new version %s: %s", semVer, err.Error())
klog.Errorf("fail to new version %s: %s", semVer, err.Error())
return false, err
}
if constraint.Check(v) {

View File

@@ -355,7 +355,7 @@ var _ = Describe("func addon update ", func() {
}, time.Millisecond*500, 30*time.Second).Should(BeNil())
pkg := &InstallPackage{Meta: Meta{Name: "test-update", Version: "1.3.0"}}
h := NewAddonInstaller(context.Background(), k8sClient, nil, nil, nil, &Registry{Name: "test"}, nil, nil)
h := NewAddonInstaller(context.Background(), k8sClient, nil, nil, nil, &Registry{Name: "test"}, nil, nil, nil)
h.addon = pkg
Expect(h.dispatchAddonResource(pkg)).Should(BeNil())
@@ -418,7 +418,7 @@ var _ = Describe("test dry-run addon from local dir", func() {
pkg, err := GetInstallPackageFromReader(r, &meta, UIData)
Expect(err).Should(BeNil())
h := NewAddonInstaller(ctx, k8sClient, dc, apply.NewAPIApplicator(k8sClient), cfg, &Registry{Name: LocalAddonRegistryName}, map[string]interface{}{"example": "test-dry-run"}, nil, DryRunAddon)
h := NewAddonInstaller(ctx, k8sClient, dc, apply.NewAPIApplicator(k8sClient), cfg, &Registry{Name: LocalAddonRegistryName}, map[string]interface{}{"example": "test-dry-run"}, nil, nil, DryRunAddon)
err = h.enableAddon(pkg)
Expect(err).Should(BeNil())

View File

@@ -23,7 +23,8 @@ import (
"sync"
"time"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/pkg/utils/common"
)
@@ -113,7 +114,7 @@ func (u *Cache) GetUIData(r Registry, addonName, version string) (*UIData, error
})
addon, err = versionedRegistry.GetAddonUIData(context.Background(), addonName, version)
if err != nil {
log.Logger.Errorf("fail to get addons from registry %s for cache updating, %v", utils.Sanitize(r.Name), err)
klog.Errorf("fail to get addons from registry %s for cache updating, %v", utils.Sanitize(r.Name), err)
return nil, err
}
}
@@ -278,7 +279,7 @@ func (u *Cache) putVersionedUIData2Cache(registryName, addonName, version string
func (u *Cache) discoverAndRefreshRegistry() {
registries, err := u.ds.ListRegistries(context.Background())
if err != nil {
log.Logger.Errorf("fail to get registry %v", err)
klog.Errorf("fail to get registry %v", err)
return
}
u.putRegistry2Cache(registries)
@@ -301,13 +302,13 @@ func (u *Cache) discoverAndRefreshRegistry() {
func (u *Cache) listUIDataAndCache(r Registry) ([]*UIData, error) {
registryMeta, err := r.ListAddonMeta()
if err != nil {
log.Logger.Errorf("fail to list registry %s metadata, %v", r.Name, err)
klog.Errorf("fail to list registry %s metadata, %v", r.Name, err)
return nil, err
}
u.putAddonMeta2Cache(r.Name, registryMeta)
uiData, err := r.ListUIData(registryMeta, UIMetaOptions)
if err != nil {
log.Logger.Errorf("fail to get addons from registry %s for cache updating, %v", r.Name, err)
klog.Errorf("fail to get addons from registry %s for cache updating, %v", r.Name, err)
return nil, err
}
u.putAddonUIData2Cache(r.Name, uiData)
@@ -322,13 +323,13 @@ func (u *Cache) listVersionRegistryUIDataAndCache(r Registry) ([]*UIData, error)
})
uiDatas, err := versionedRegistry.ListAddon()
if err != nil {
log.Logger.Errorf("fail to get addons from registry %s for cache updating, %v", r.Name, err)
klog.Errorf("fail to get addons from registry %s for cache updating, %v", r.Name, err)
return nil, err
}
for _, addon := range uiDatas {
uiData, err := versionedRegistry.GetAddonUIData(context.Background(), addon.Name, addon.Version)
if err != nil {
log.Logger.Errorf("fail to get addon from versioned registry %s, addon %s version %s for cache updating, %v", r.Name, addon.Name, addon.Version, err)
klog.Errorf("fail to get addon from versioned registry %s, addon %s version %s for cache updating, %v", r.Name, addon.Name, addon.Version, err)
continue
}
u.putVersionedUIData2Cache(r.Name, addon.Name, addon.Version, uiData)

View File

@@ -43,6 +43,9 @@ var (
// ErrBothCueAndYamlTmpl means yaml and cue app template are exist in addon
ErrBothCueAndYamlTmpl = NewAddonError("yaml and cue app template are exist in addon, should only keep one of them")
// ErrFetch means fetch addon package error(package not exist or parse archive error and so on)
ErrFetch = NewAddonError("cannot fetch addon package")
)
// WrapErrRateLimit return ErrRateLimit if is the situation, or return error directly

View File

@@ -22,13 +22,13 @@ import (
"fmt"
"path/filepath"
"k8s.io/client-go/discovery"
"k8s.io/klog/v2"
"github.com/pkg/errors"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/client-go/discovery"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
commontypes "github.com/oam-dev/kubevela/apis/core.oam.dev/common"
@@ -55,8 +55,8 @@ const (
)
// EnableAddon will enable addon with dependency check, source is where addon from.
func EnableAddon(ctx context.Context, name string, version string, cli client.Client, discoveryClient *discovery.DiscoveryClient, apply apply.Applicator, config *rest.Config, r Registry, args map[string]interface{}, cache *Cache, opts ...InstallOption) error {
h := NewAddonInstaller(ctx, cli, discoveryClient, apply, config, &r, args, cache, opts...)
func EnableAddon(ctx context.Context, name string, version string, cli client.Client, discoveryClient *discovery.DiscoveryClient, apply apply.Applicator, config *rest.Config, r Registry, args map[string]interface{}, cache *Cache, registries []Registry, opts ...InstallOption) error {
h := NewAddonInstaller(ctx, cli, discoveryClient, apply, config, &r, args, cache, registries, opts...)
pkg, err := h.loadInstallPackage(name, version)
if err != nil {
return err
@@ -83,7 +83,7 @@ func DisableAddon(ctx context.Context, cli client.Client, name string, config *r
return err
}
if len(usingAddonApp) != 0 {
return fmt.Errorf(fmt.Sprintf("%s please delete them first", usingAppsInfo(usingAddonApp)))
return errors.New(appsDependsOnAddonErrInfo(usingAddonApp))
}
}
@@ -113,7 +113,7 @@ func EnableAddonByLocalDir(ctx context.Context, name string, dir string, cli cli
if err != nil {
return err
}
h := NewAddonInstaller(ctx, cli, dc, applicator, config, &Registry{Name: LocalAddonRegistryName}, args, nil, opts...)
h := NewAddonInstaller(ctx, cli, dc, applicator, config, &Registry{Name: LocalAddonRegistryName}, args, nil, nil, opts...)
needEnableAddonNames, err := h.checkDependency(pkg)
if err != nil {
return err
@@ -280,8 +280,8 @@ func GetObservabilityAccessibilityInfo(ctx context.Context, k8sClient client.Cli
return domains, nil
}
// FindWholeAddonPackagesFromRegistry find addons' WholeInstallPackage from registries, empty registryName indicates matching all
func FindWholeAddonPackagesFromRegistry(ctx context.Context, k8sClient client.Client, addonNames []string, registryNames []string) ([]*WholeAddonPackage, error) {
// FindAddonPackagesDetailFromRegistry find addons' WholeInstallPackage from registries, empty registryName indicates matching all
func FindAddonPackagesDetailFromRegistry(ctx context.Context, k8sClient client.Client, addonNames []string, registryNames []string) ([]*WholeAddonPackage, error) {
var addons []*WholeAddonPackage
var registries []Registry

View File

@@ -17,9 +17,12 @@ limitations under the License.
package addon
import (
"bytes"
"context"
"errors"
"net/http"
"net/http/httptest"
"os"
"strings"
v1 "k8s.io/api/core/v1"
@@ -29,33 +32,68 @@ import (
. "github.com/onsi/gomega"
)
var _ = Describe("test FindWholeAddonPackagesFromRegistry", func() {
func setupMockServer() *httptest.Server {
var listenURL string
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
fileList := []string{
"index.yaml",
"fluxcd-test-version-1.0.0.tgz",
"fluxcd-test-version-2.0.0.tgz",
"vela-workflow-v0.3.5.tgz",
"foo-v1.0.0.tgz",
"bar-v1.0.0.tgz",
"bar-v2.0.0.tgz",
"mock-be-dep-addon-v1.0.0.tgz",
}
for _, f := range fileList {
if strings.Contains(req.URL.Path, f) {
file, err := os.ReadFile("../../e2e/addon/mock/testrepo/helm-repo/" + f)
if err != nil {
_, _ = w.Write([]byte(err.Error()))
}
if f == "index.yaml" {
// in index.yaml, url is hardcoded to 127.0.0.1:9098,
// so we need to replace it with the real random listen url
file = bytes.ReplaceAll(file, []byte("http://127.0.0.1:9098"), []byte(listenURL))
}
_, _ = w.Write(file)
}
}
}))
listenURL = s.URL
return s
}
var _ = Describe("test FindAddonPackagesDetailFromRegistry", func() {
Describe("when no registry is added, no matter what you do, it will just return error", func() {
Context("when empty addonNames and registryNames is supplied", func() {
It("should return error", func() {
_, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{}, []string{})
_, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{}, []string{})
Expect(err).To(HaveOccurred())
})
It("should return error", func() {
_, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, nil, nil)
_, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, nil, nil)
Expect(err).To(HaveOccurred())
})
})
Context("when non-empty addonNames and registryNames is supplied", func() {
It("should return error saying ErrRegistryNotExist", func() {
_, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"fluxcd"}, []string{"some-registry"})
_, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"fluxcd"}, []string{"some-registry"})
Expect(errors.Is(err, ErrRegistryNotExist)).To(BeTrue())
})
})
})
Describe("one versioned registry is added", func() {
var s *httptest.Server
BeforeEach(func() {
// Prepare KubeVela registry
s = setupMockServer()
// Prepare registry
reg := &Registry{
Name: "KubeVela",
Name: "addon_helper_test",
Helm: &HelmSource{
URL: "https://addons.kubevela.net",
URL: s.URL,
},
}
ds := NewRegistryDataStore(k8sClient)
@@ -63,44 +101,42 @@ var _ = Describe("test FindWholeAddonPackagesFromRegistry", func() {
})
AfterEach(func() {
// Clean up KubeVela registry
// Clean up registry
ds := NewRegistryDataStore(k8sClient)
Expect(ds.DeleteRegistry(context.Background(), "KubeVela")).To(Succeed())
Expect(ds.DeleteRegistry(context.Background(), "addon_helper_test")).To(Succeed())
s.Close()
})
Context("when empty addonNames and registryNames is supplied", func() {
It("should return error, empty addonNames are not allowed", func() {
_, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{}, []string{"KubeVela"})
_, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{}, []string{"addon_helper_test"})
Expect(err).To(HaveOccurred())
})
It("should return error, empty addonNames are not allowed", func() {
_, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, nil, []string{"KubeVela"})
_, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, nil, []string{"addon_helper_test"})
Expect(err).To(HaveOccurred())
})
})
Context("one existing addon name provided", func() {
It("should return one valid result, matching all registries", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"velaux"}, nil)
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"foo"}, nil)
Expect(err).To(Succeed())
Expect(res).To(HaveLen(1))
Expect(res[0].Name).To(Equal("velaux"))
Expect(res[0].InstallPackage).ToNot(BeNil())
Expect(res[0].APISchema).ToNot(BeNil())
Expect(res[0].Name).To(Equal("foo"))
})
It("should return one valid result, matching one registry", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"velaux"}, []string{"KubeVela"})
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"foo"}, []string{"addon_helper_test"})
Expect(err).To(Succeed())
Expect(res).To(HaveLen(1))
Expect(res[0].Name).To(Equal("velaux"))
Expect(res[0].InstallPackage).ToNot(BeNil())
Expect(res[0].APISchema).ToNot(BeNil())
Expect(res[0].Name).To(Equal("foo"))
})
})
Context("one non-existent addon name provided", func() {
It("should return error as ErrNotExist", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"non-existent-addon"}, nil)
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"non-existent-addon"}, nil)
Expect(errors.Is(err, ErrNotExist)).To(BeTrue())
Expect(res).To(BeNil())
})
@@ -108,26 +144,20 @@ var _ = Describe("test FindWholeAddonPackagesFromRegistry", func() {
Context("two existing addon names provided", func() {
It("should return two valid result", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"velaux", "traefik"}, nil)
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"foo", "bar"}, nil)
Expect(err).To(Succeed())
Expect(res).To(HaveLen(2))
Expect(res[0].Name).To(Equal("velaux"))
Expect(res[0].InstallPackage).ToNot(BeNil())
Expect(res[0].APISchema).ToNot(BeNil())
Expect(res[1].Name).To(Equal("traefik"))
Expect(res[1].InstallPackage).ToNot(BeNil())
Expect(res[1].APISchema).ToNot(BeNil())
Expect(res[0].Name).To(Equal("foo"))
Expect(res[1].Name).To(Equal("bar"))
})
})
Context("one existing addon name and one non-existent addon name provided", func() {
It("should return only one valid result", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"velaux", "non-existent-addon"}, nil)
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"foo", "non-existent-addon"}, nil)
Expect(err).To(Succeed())
Expect(res).To(HaveLen(1))
Expect(res[0].Name).To(Equal("velaux"))
Expect(res[0].InstallPackage).ToNot(BeNil())
Expect(res[0].APISchema).ToNot(BeNil())
Expect(res[0].Name).To(Equal("foo"))
})
})
})
@@ -151,25 +181,25 @@ var _ = Describe("test FindWholeAddonPackagesFromRegistry", func() {
Context("when empty addonNames and registryNames is supplied", func() {
It("should return error, empty addonNames are not allowed", func() {
_, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{}, []string{})
_, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{}, []string{})
Expect(err).To(HaveOccurred())
})
It("should return error, empty addonNames are not allowed", func() {
_, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, nil, []string{"testreg"})
_, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, nil, []string{"testreg"})
Expect(err).To(HaveOccurred())
})
})
Context("one existing addon name provided", func() {
It("should return one valid result, matching all registries", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"example"}, nil)
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"example"}, nil)
Expect(err).To(Succeed())
Expect(res).To(HaveLen(1))
Expect(res[0].Name).To(Equal("example"))
Expect(res[0].InstallPackage).ToNot(BeNil())
})
It("should return one valid result, matching one registry", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"example"}, []string{"testreg"})
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"example"}, []string{"testreg"})
Expect(err).To(Succeed())
Expect(res).To(HaveLen(1))
Expect(res[0].Name).To(Equal("example"))
@@ -179,7 +209,7 @@ var _ = Describe("test FindWholeAddonPackagesFromRegistry", func() {
Context("one non-existent addon name provided", func() {
It("should return error as ErrNotExist", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"non-existent-addon"}, nil)
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"non-existent-addon"}, nil)
Expect(errors.Is(err, ErrNotExist)).To(BeTrue())
Expect(res).To(BeNil())
})
@@ -187,7 +217,7 @@ var _ = Describe("test FindWholeAddonPackagesFromRegistry", func() {
Context("one existing addon name and one non-existent addon name provided", func() {
It("should return only one valid result", func() {
res, err := FindWholeAddonPackagesFromRegistry(context.Background(), k8sClient, []string{"example", "non-existent-addon"}, nil)
res, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{"example", "non-existent-addon"}, nil)
Expect(err).To(Succeed())
Expect(res).To(HaveLen(1))
Expect(res[0].Name).To(Equal("example"))

View File

@@ -187,7 +187,7 @@ func findLegacyAddonDefs(ctx context.Context, k8sClient client.Client, addonName
if registry.Name == registryName {
var uiData *UIData
if !IsVersionRegistry(registry) {
installer := NewAddonInstaller(ctx, k8sClient, nil, nil, config, &registries[i], nil, nil)
installer := NewAddonInstaller(ctx, k8sClient, nil, nil, config, &registries[i], nil, nil, nil)
metas, err := installer.getAddonMeta()
if err != nil {
return err
@@ -244,18 +244,18 @@ func findLegacyAddonDefs(ctx context.Context, k8sClient client.Client, addonName
return nil
}
func usingAppsInfo(apps []v1beta1.Application) string {
res := "addon is being used :"
appsNamespaceNameList := map[string][]string{}
func appsDependsOnAddonErrInfo(apps []v1beta1.Application) string {
var appsNamespaceNameList []string
i := 0
for _, app := range apps {
appsNamespaceNameList[app.GetNamespace()] = append(appsNamespaceNameList[app.GetNamespace()], app.GetName())
appsNamespaceNameList = append(appsNamespaceNameList, app.Namespace+"/"+app.Name)
i++
if i > 2 && len(apps) > i {
appsNamespaceNameList = append(appsNamespaceNameList, fmt.Sprintf("and other %d more", len(apps)-i))
break
}
}
for namespace, appNames := range appsNamespaceNameList {
nameStr := strings.Join(appNames, ",")
res += fmt.Sprintf("{%s} in namespace:%s,", nameStr, namespace)
}
res = strings.TrimSuffix(res, ",") + ".Please delete them before disabling the addon."
return res
return fmt.Sprintf("this addon is being used by: %s applications. Please delete all of them before removing.", strings.Join(appsNamespaceNameList, ", "))
}
// IsVersionRegistry check the repo source if support multi-version addon
@@ -502,3 +502,17 @@ func checkBondComponentExist(u unstructured.Unstructured, app v1beta1.Applicatio
}
return false
}
// FilterDependencyRegistries will return all registries besides the target registry itself
func FilterDependencyRegistries(i int, rs []Registry) []Registry {
if i >= len(rs) {
return rs
}
if i < 0 {
return rs
}
ret := make([]Registry, len(rs)-1)
copy(ret, rs[:i])
copy(ret[i:], rs[i+1:])
return ret
}

View File

@@ -155,9 +155,31 @@ func TestUsingAddonInfo(t *testing.T) {
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-1", Name: "app-1"}},
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-2", Name: "app-2"}},
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-1", Name: "app-3"}},
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-3", Name: "app-3"}},
}
res := usingAppsInfo(apps)
assert.Equal(t, true, strings.Contains(res, "Please delete them before disabling the addon"))
res := appsDependsOnAddonErrInfo(apps)
assert.Contains(t, res, "and other 1 more applications. Please delete all of them before removing.")
apps = []v1beta1.Application{
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-1", Name: "app-1"}},
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-2", Name: "app-2"}},
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-1", Name: "app-3"}},
}
res = appsDependsOnAddonErrInfo(apps)
assert.Contains(t, res, "Please delete all of them before removing.")
apps = []v1beta1.Application{
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-1", Name: "app-1"}},
}
res = appsDependsOnAddonErrInfo(apps)
assert.Contains(t, res, "this addon is being used by: namespace-1/app-1 applications. Please delete all of them before removing.")
apps = []v1beta1.Application{
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-1", Name: "app-1"}},
v1beta1.Application{ObjectMeta: metav1.ObjectMeta{Namespace: "namespace-2", Name: "app-2"}},
}
res = appsDependsOnAddonErrInfo(apps)
assert.Contains(t, res, ". Please delete all of them before removing.")
}
func TestIsAddonDir(t *testing.T) {
@@ -329,6 +351,57 @@ func TestCheckObjectBindingComponent(t *testing.T) {
}
}
func TestFilterDependencyRegistries(t *testing.T) {
testCases := []struct {
registries []Registry
index int
res []Registry
origin []Registry
}{
{
registries: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
index: 0,
res: []Registry{{Name: "r2"}, {Name: "r3"}},
origin: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
},
{
registries: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
index: 1,
res: []Registry{{Name: "r1"}, {Name: "r3"}},
origin: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
},
{
registries: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
index: 2,
res: []Registry{{Name: "r1"}, {Name: "r2"}},
origin: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
},
{
registries: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
index: 3,
res: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
origin: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
},
{
registries: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
index: -1,
res: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
origin: []Registry{{Name: "r1"}, {Name: "r2"}, {Name: "r3"}},
},
{
registries: []Registry{},
index: 0,
res: []Registry{},
origin: []Registry{},
},
}
for _, testCase := range testCases {
res := FilterDependencyRegistries(testCase.index, testCase.registries)
assert.Equal(t, res, testCase.res)
assert.Equal(t, testCase.registries, testCase.origin)
}
}
const (
compDefYaml = `
apiVersion: core.oam.dev/v1beta1

View File

@@ -26,8 +26,8 @@ import (
"github.com/pkg/errors"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/repo"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/pkg/utils/common"
"github.com/oam-dev/kubevela/pkg/utils/helm"
@@ -149,6 +149,7 @@ func (i versionedRegistry) loadAddon(ctx context.Context, name, version string)
if addonVersion == nil {
return nil, errors.Errorf("specified version %s not exist", utils.Sanitize(version))
}
klog.Infof("Addon '%s' with version '%s' found from registry '%s'", addonVersion.Name, addonVersion.Version, i.name)
for _, chartURL := range addonVersion.URLs {
if !utils.IsValidURL(chartURL) {
chartURL, err = utils.JoinURL(i.url, chartURL)
@@ -173,7 +174,7 @@ func (i versionedRegistry) loadAddon(ctx context.Context, name, version string)
addonPkg.Meta.SystemRequirements = LoadSystemRequirements(addonVersion.Annotations)
return addonPkg, nil
}
return nil, fmt.Errorf("cannot fetch addon package")
return nil, ErrFetch
}
// loadAddonVersions Load all available versions of the addon
@@ -234,7 +235,6 @@ func chooseVersion(specifiedVersion string, versions []*repo.ChartVersion) (*rep
continue
}
addonVersion = v
log.Logger.Infof("Use the latest version %s by default, you can use --version to specify", v.Version)
}
}
return addonVersion, availableVersions

View File

@@ -386,6 +386,7 @@ type ApplicationTrigger struct {
Type string `json:"type"`
PayloadType string `json:"payloadType"`
ComponentName string `json:"componentName"`
Registry string `json:"registry,omitempty"`
}
const (

View File

@@ -23,9 +23,8 @@ import (
"time"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog/v2"
"sigs.k8s.io/yaml"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
var tableNamePrefix = "vela_"
@@ -102,7 +101,7 @@ func NewJSONStructByStruct(object interface{}) (*JSONStruct, error) {
func (j *JSONStruct) JSON() string {
b, err := json.Marshal(j)
if err != nil {
log.Logger.Errorf("json marshal failure %s", err.Error())
klog.Errorf("json marshal failure %s", err.Error())
}
return string(b)
}
@@ -111,12 +110,12 @@ func (j *JSONStruct) JSON() string {
func (j *JSONStruct) RawExtension() *runtime.RawExtension {
yamlByte, err := yaml.Marshal(j)
if err != nil {
log.Logger.Errorf("yaml marshal failure %s", err.Error())
klog.Errorf("yaml marshal failure %s", err.Error())
return nil
}
b, err := yaml.YAMLToJSON(yamlByte)
if err != nil {
log.Logger.Errorf("yaml to json failure %s", err.Error())
klog.Errorf("yaml to json failure %s", err.Error())
return nil
}
return &runtime.RawExtension{Raw: b}

View File

@@ -50,7 +50,7 @@ type Workflow struct {
// WorkflowStep defines how to execute a workflow step.
type WorkflowStep struct {
WorkflowStepBase `json:",inline"`
WorkflowStepBase `json:",inline" bson:",inline"`
SubSteps []WorkflowStepBase `json:"subSteps,omitempty"`
}
@@ -123,7 +123,7 @@ type WorkflowRecord struct {
// WorkflowStepStatus is the workflow step status database model
type WorkflowStepStatus struct {
StepStatus `json:",inline"`
StepStatus `json:",inline" bson:",inline"`
SubStepsStatus []StepStatus `json:"subSteps,omitempty"`
}

View File

@@ -20,10 +20,11 @@ import (
"context"
"errors"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/utils"
)
@@ -84,14 +85,14 @@ func ListApplicationCommonPolicies(ctx context.Context, store datastore.DataStor
// DeleteApplicationEnvPolicies delete the policies via app name and env name
func DeleteApplicationEnvPolicies(ctx context.Context, store datastore.DataStore, app *model.Application, envName string) error {
log.Logger.Debugf("clear the policies via app name %s and env name %s", app.PrimaryKey(), utils.Sanitize(envName))
klog.Infof("clear the policies via app name %s and env name %s", app.PrimaryKey(), utils.Sanitize(envName))
policies, err := ListApplicationEnvPolicies(ctx, store, app, envName)
if err != nil {
return err
}
for _, policy := range policies {
if err := store.Delete(ctx, policy); err != nil && !errors.Is(err, datastore.ErrRecordNotExist) {
log.Logger.Errorf("fail to clear the policies belong to the env %w", err)
klog.Errorf("fail to clear the policies belong to the env %w", err)
continue
}
}

View File

@@ -20,12 +20,12 @@ import (
"context"
"errors"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/oam"
util "github.com/oam-dev/kubevela/pkg/utils"
velaerr "github.com/oam-dev/kubevela/pkg/utils/errors"
@@ -38,7 +38,7 @@ func CreateEnv(ctx context.Context, kubeClient client.Client, ds datastore.DataS
exist, err := ds.IsExist(ctx, tenv)
if err != nil {
log.Logger.Errorf("check if env name exists failure %s", err.Error())
klog.Errorf("check if env name exists failure %s", err.Error())
return err
}
if exist {
@@ -59,7 +59,7 @@ func CreateEnv(ctx context.Context, kubeClient client.Client, ds datastore.DataS
if velaerr.IsLabelConflict(err) {
return bcode.ErrEnvNamespaceAlreadyBound
}
log.Logger.Errorf("update namespace label failure %s", err.Error())
klog.Errorf("update namespace label failure %s", err.Error())
return bcode.ErrEnvNamespaceFail
}
if err = ds.Add(ctx, env); err != nil {

View File

@@ -19,12 +19,13 @@ package repository
import (
"context"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
assembler "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/assembler/v1"
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
const (
@@ -70,7 +71,7 @@ func ListFullEnvBinding(ctx context.Context, ds datastore.DataStore, option EnvL
for _, eb := range envBindings {
env, err := pickEnv(envs, eb.Name)
if err != nil {
log.Logger.Errorf("envbinding invalid %s", err.Error())
klog.Errorf("envbinding invalid %s", err.Error())
continue
}
list = append(list, assembler.ConvertEnvBindingModelToBase(eb, env, targets))

View File

@@ -20,12 +20,12 @@ import (
"context"
apierror "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/multicluster"
"github.com/oam-dev/kubevela/pkg/oam"
"github.com/oam-dev/kubevela/pkg/utils"
@@ -43,7 +43,7 @@ func CreateTargetNamespace(ctx context.Context, k8sClient client.Client, cluster
oam.LabelNamespaceOfTargetName: targetName,
}))
if velaerr.IsLabelConflict(err) {
log.Logger.Errorf("update namespace for target err %v", err)
klog.Errorf("update namespace for target err %v", err)
return bcode.ErrTargetNamespaceAlreadyBound
}
if err != nil {
@@ -74,7 +74,7 @@ func CreateTarget(ctx context.Context, ds datastore.DataStore, tg *model.Target)
// check Target name.
exit, err := ds.IsExist(ctx, tg)
if err != nil {
log.Logger.Errorf("check target existence failure %s", err.Error())
klog.Errorf("check target existence failure %s", err.Error())
return err
}
if exit {
@@ -82,7 +82,7 @@ func CreateTarget(ctx context.Context, ds datastore.DataStore, tg *model.Target)
}
if err = ds.Add(ctx, tg); err != nil {
log.Logger.Errorf("add target failure %s", err.Error())
klog.Errorf("add target failure %s", err.Error())
return err
}
return nil
@@ -99,7 +99,7 @@ func ListTarget(ctx context.Context, ds datastore.DataStore, project string, dsO
}
Targets, err := ds.List(ctx, &target, dsOption)
if err != nil {
log.Logger.Errorf("list target err %v", err)
klog.Errorf("list target err %v", err)
return nil, err
}
var respTargets []*model.Target

View File

@@ -25,6 +25,7 @@ import (
workflowv1alpha1 "github.com/kubevela/workflow/api/v1alpha1"
k8stypes "k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
@@ -36,7 +37,6 @@ import (
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/oam/util"
pkgUtils "github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/pkg/workflow/step"
@@ -370,20 +370,20 @@ func UpdateEnvWorkflow(ctx context.Context, kubeClient client.Client, ds datasto
created, updated, deleted := workflowSteps.getPolicies(existPolicies, policies)
for _, d := range deleted {
if err := ds.Delete(ctx, d); err != nil {
log.Logger.Errorf("fail to delete the policy %s", err.Error())
klog.Errorf("fail to delete the policy %s", err.Error())
}
log.Logger.Infof("deleted a policy %s where update the workflow", d.PrimaryKey())
klog.Infof("deleted a policy %s where update the workflow", d.PrimaryKey())
}
if err := ds.BatchAdd(ctx, created); err != nil {
log.Logger.Errorf("fail to create the policy %s", err.Error())
klog.Errorf("fail to create the policy %s", err.Error())
}
for _, d := range updated {
if err := ds.Put(ctx, d); err != nil {
log.Logger.Errorf("fail to update the policy %s", err.Error())
klog.Errorf("fail to update the policy %s", err.Error())
}
log.Logger.Infof("updated a policy %s where update the workflow", d.PrimaryKey())
klog.Infof("updated a policy %s where update the workflow", d.PrimaryKey())
}
return nil
@@ -417,10 +417,10 @@ func UpdateAppEnvWorkflow(ctx context.Context, kubeClient client.Client, ds data
}
for i := range envs {
if err := UpdateEnvWorkflow(ctx, kubeClient, ds, app, envs[i]); err != nil {
log.Logger.Errorf("fail to update the env workflow %s", envs[i].PrimaryKey())
klog.Errorf("fail to update the env workflow %s", envs[i].PrimaryKey())
}
}
log.Logger.Infof("The env workflows of app %s updated successfully", pkgUtils.Sanitize(app.PrimaryKey()))
klog.Infof("The env workflows of app %s updated successfully", pkgUtils.Sanitize(app.PrimaryKey()))
return nil
}
@@ -438,7 +438,7 @@ func HaveTerraformWorkload(ctx context.Context, kubeClient client.Client, compon
getComponentDeployType := func(component *model.ApplicationComponent) string {
definition, err := GetComponentDefinition(ctx, kubeClient, component.Type)
if err != nil {
log.Logger.Errorf("get component definition %s failure %s", component.Type, err.Error())
klog.Errorf("get component definition %s failure %s", component.Type, err.Error())
// using Deploy2Env by default
}
if definition != nil {
@@ -508,7 +508,7 @@ func GenEnvWorkflowStepsAndPolicies(ctx context.Context, kubeClient client.Clien
var policies []datastore.Entity
components, err := ds.List(ctx, &model.ApplicationComponent{AppPrimaryKey: app.PrimaryKey()}, nil)
if err != nil {
log.Logger.Errorf("list application component list failure %s", err.Error())
klog.Errorf("list application component list failure %s", err.Error())
}
userName, _ := ctx.Value(&apisv1.CtxKeyUser).(string)
terraformComponents := HaveTerraformWorkload(ctx, kubeClient, components)
@@ -521,7 +521,7 @@ func GenEnvWorkflowStepsAndPolicies(ctx context.Context, kubeClient client.Clien
}},
}})
if err != nil {
log.Logger.Errorf("fail to get the targets detail info, %s", err.Error())
klog.Errorf("fail to get the targets detail info, %s", err.Error())
}
if len(terraformComponents) > 0 {
appPolicy := &model.ApplicationPolicy{
@@ -553,7 +553,7 @@ func GenEnvWorkflowStepsAndPolicies(ctx context.Context, kubeClient client.Clien
Envs: envs,
})
if err != nil {
log.Logger.Errorf("fail to create the properties of the topology policy, %s", err.Error())
klog.Errorf("fail to create the properties of the topology policy, %s", err.Error())
} else {
appPolicy.Properties = properties
policies = append(policies, appPolicy)
@@ -591,7 +591,7 @@ func GenEnvWorkflowStepsAndPolicies(ctx context.Context, kubeClient client.Clien
Namespace: target.Cluster.Namespace,
})
if err != nil {
log.Logger.Errorf("fail to create the properties of the topology policy, %s", err.Error())
klog.Errorf("fail to create the properties of the topology policy, %s", err.Error())
continue
}
appPolicy.Properties = properties
@@ -602,7 +602,7 @@ func GenEnvWorkflowStepsAndPolicies(ctx context.Context, kubeClient client.Clien
for _, step := range workflowSteps {
base, err := convert.FromCRWorkflowStepBase(step.WorkflowStepBase)
if err != nil {
log.Logger.Errorf("workflow %s step %s properties is invalid %s", pkgUtils.Sanitize(app.Name), pkgUtils.Sanitize(step.Name), err.Error())
klog.Errorf("workflow %s step %s properties is invalid %s", pkgUtils.Sanitize(app.Name), pkgUtils.Sanitize(step.Name), err.Error())
continue
}
targetName := strings.Replace(step.Name, "-cloud-resource", "", 1)

View File

@@ -25,6 +25,7 @@ import (
. "github.com/onsi/gomega"
"github.com/stretchr/testify/assert"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
@@ -33,7 +34,6 @@ import (
"github.com/oam-dev/kubevela/apis/types"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
pkgUtils "github.com/oam-dev/kubevela/pkg/utils"
)
@@ -563,7 +563,7 @@ func CreateEnvWorkflow(ctx context.Context, store datastore.DataStore, kubeClien
EnvName: env.Name,
AppPrimaryKey: app.PrimaryKey(),
}
log.Logger.Infof("create workflow %s for app %s", pkgUtils.Sanitize(workflow.Name), pkgUtils.Sanitize(app.PrimaryKey()))
klog.Infof("create workflow %s for app %s", pkgUtils.Sanitize(workflow.Name), pkgUtils.Sanitize(app.PrimaryKey()))
if err := store.Add(ctx, workflow); err != nil {
return err
}

View File

@@ -34,6 +34,7 @@ import (
k8stypes "k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/discovery"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
common2 "github.com/oam-dev/kubevela/apis/core.oam.dev/common"
@@ -44,7 +45,6 @@ import (
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/definition"
"github.com/oam-dev/kubevela/pkg/multicluster"
"github.com/oam-dev/kubevela/pkg/oam"
@@ -206,7 +206,7 @@ func (u *addonServiceImpl) StatusAddon(ctx context.Context, name string) (*apis.
var allClusters []apis.NameAlias
clusters, err := multicluster.ListVirtualClusters(ctx, u.kubeClient)
if err != nil {
log.Logger.Errorf("err while list all clusters: %v", err)
klog.Errorf("err while list all clusters: %v", err)
}
for _, c := range clusters {
@@ -302,7 +302,7 @@ func (u *addonServiceImpl) ListAddons(ctx context.Context, registry, query strin
for _, a := range addons {
addonRes, err := AddonImpl2AddonRes(a, u.config)
if err != nil {
log.Logger.Errorf("err while converting AddonImpl to DetailAddonResponse: %v", err)
klog.Errorf("err while converting AddonImpl to DetailAddonResponse: %v", err)
continue
}
addonResources = append(addonResources, addonRes)
@@ -400,8 +400,22 @@ func (u *addonServiceImpl) EnableAddon(ctx context.Context, name string, args ap
if err != nil {
return err
}
for _, r := range registries {
err = pkgaddon.EnableAddon(ctx, name, args.Version, u.kubeClient, u.discoveryClient, u.apply, u.config, r, args.Args, u.addonRegistryCache)
if len(args.RegistryName) != 0 {
foundRegistry := false
for _, registry := range registries {
if registry.Name == args.RegistryName {
foundRegistry = true
}
}
if !foundRegistry {
return bcode.ErrAddonRegistryNotExist.SetMessage(fmt.Sprintf("specified registry %s not exist", args.RegistryName))
}
}
for i, r := range registries {
if len(args.RegistryName) != 0 && args.RegistryName != r.Name {
continue
}
err = pkgaddon.EnableAddon(ctx, name, args.Version, u.kubeClient, u.discoveryClient, u.apply, u.config, r, args.Args, u.addonRegistryCache, pkgaddon.FilterDependencyRegistries(i, registries))
if err == nil {
return nil
}
@@ -428,7 +442,7 @@ func (u *addonServiceImpl) EnableAddon(ctx context.Context, name string, args ap
func (u *addonServiceImpl) DisableAddon(ctx context.Context, name string, force bool) error {
err := pkgaddon.DisableAddon(ctx, u.kubeClient, name, u.config, force)
if err != nil {
log.Logger.Errorf("delete application fail: %s", err.Error())
klog.Errorf("delete application fail: %s", err.Error())
return err
}
return nil
@@ -471,8 +485,8 @@ func (u *addonServiceImpl) UpdateAddon(ctx context.Context, name string, args ap
return err
}
for _, r := range registries {
err = pkgaddon.EnableAddon(ctx, name, args.Version, u.kubeClient, u.discoveryClient, u.apply, u.config, r, args.Args, u.addonRegistryCache)
for i, r := range registries {
err = pkgaddon.EnableAddon(ctx, name, args.Version, u.kubeClient, u.discoveryClient, u.apply, u.config, r, args.Args, u.addonRegistryCache, pkgaddon.FilterDependencyRegistries(i, registries))
if err == nil {
return nil
}
@@ -541,7 +555,7 @@ func renderAddonCustomUISchema(ctx context.Context, cli client.Client, addonName
Name: fmt.Sprintf("addon-uischema-%s", addonName),
}, &cm); err != nil {
if !errors2.IsNotFound(err) {
log.Logger.Errorf("find uischema configmap from cluster failure %s", err.Error())
klog.Errorf("find uischema configmap from cluster failure %s", err.Error())
}
return defaultSchema
}
@@ -551,7 +565,7 @@ func renderAddonCustomUISchema(ctx context.Context, cli client.Client, addonName
}
schema := []*utils.UIParameter{}
if err := json.Unmarshal([]byte(data), &schema); err != nil {
log.Logger.Errorf("unmarshal ui schema failure %s", err.Error())
klog.Errorf("unmarshal ui schema failure %s", err.Error())
return defaultSchema
}
return patchSchema(defaultSchema, schema)

View File

@@ -33,6 +33,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
@@ -47,7 +48,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/appfile/dryrun"
"github.com/oam-dev/kubevela/pkg/oam"
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
@@ -126,7 +126,7 @@ func listApp(ctx context.Context, ds datastore.DataStore, listOptions apisv1.Lis
if listOptions.Env != "" || listOptions.TargetName != "" {
envBinding, err = repository.ListFullEnvBinding(ctx, ds, repository.EnvListOption{})
if err != nil {
log.Logger.Errorf("list envbinding for list application in env %s err %v", pkgUtils.Sanitize(listOptions.Env), err)
klog.Errorf("list envbinding for list application in env %s err %v", pkgUtils.Sanitize(listOptions.Env), err)
return nil, err
}
}
@@ -359,7 +359,7 @@ func (c *applicationServiceImpl) CreateApplication(ctx context.Context, req apis
// check app name.
exist, err := c.Store.IsExist(ctx, &application)
if err != nil {
log.Logger.Errorf("check application name is exist failure %s", err.Error())
klog.Errorf("check application name is exist failure %s", err.Error())
return nil, bcode.ErrApplicationExist
}
if exist {
@@ -418,10 +418,11 @@ func (c *applicationServiceImpl) CreateApplicationTrigger(ctx context.Context, a
Type: req.Type,
PayloadType: req.PayloadType,
ComponentName: req.ComponentName,
Registry: req.Registry,
Token: genWebhookToken(),
}
if err := c.Store.Add(ctx, trigger); err != nil {
log.Logger.Errorf("failed to create application trigger, %s", err.Error())
klog.Errorf("failed to create application trigger, %s", err.Error())
return nil, err
}
@@ -449,7 +450,7 @@ func (c *applicationServiceImpl) DeleteApplicationTrigger(ctx context.Context, a
if errors.Is(err, datastore.ErrRecordNotExist) {
return bcode.ErrApplicationTriggerNotExist
}
log.Logger.Warnf("delete app trigger failure %s", err.Error())
klog.Warningf("delete app trigger failure %s", err.Error())
return err
}
return nil
@@ -464,7 +465,7 @@ func (c *applicationServiceImpl) ListApplicationTriggers(ctx context.Context, ap
SortBy: []datastore.SortOption{{Key: "createTime", Order: datastore.SortOrderDescending}}},
)
if err != nil {
log.Logger.Errorf("failed to list application triggers, %s", err.Error())
klog.Errorf("failed to list application triggers, %s", err.Error())
return nil, err
}
@@ -604,7 +605,7 @@ func (c *applicationServiceImpl) DetailComponent(ctx context.Context, app *model
}
var cd v1beta1.ComponentDefinition
if err := c.KubeClient.Get(ctx, types.NamespacedName{Name: component.Type, Namespace: velatypes.DefaultKubeVelaNS}, &cd); err != nil {
log.Logger.Warnf("component definition %s get failure. %s", pkgUtils.Sanitize(component.Type), err.Error())
klog.Warningf("component definition %s get failure. %s", pkgUtils.Sanitize(component.Type), err.Error())
}
return &apisv1.DetailComponentResponse{
@@ -680,7 +681,7 @@ func (c *applicationServiceImpl) Deploy(ctx context.Context, app *model.Applicat
list, err := c.Store.List(ctx, &lastVersion, &datastore.ListOptions{
PageSize: 1, Page: 1, SortBy: []datastore.SortOption{{Key: "createTime", Order: datastore.SortOrderDescending}}})
if err != nil && !errors.Is(err, datastore.ErrRecordNotExist) {
log.Logger.Errorf("query app latest revision failure %s", err.Error())
klog.Errorf("query app latest revision failure %s", err.Error())
return nil, bcode.ErrDeployConflict
}
if len(list) > 0 {
@@ -698,7 +699,7 @@ func (c *applicationServiceImpl) Deploy(ctx context.Context, app *model.Applicat
status = revision.Status
}
if status != model.RevisionStatusComplete && status != model.RevisionStatusTerminated {
log.Logger.Warnf("last app revision can not complete %s/%s", list[0].(*model.ApplicationRevision).AppPrimaryKey, list[0].(*model.ApplicationRevision).Version)
klog.Warningf("last app revision can not complete %s/%s", list[0].(*model.ApplicationRevision).AppPrimaryKey, list[0].(*model.ApplicationRevision).Version)
return nil, bcode.ErrDeployConflict
}
}
@@ -726,7 +727,7 @@ func (c *applicationServiceImpl) Deploy(ctx context.Context, app *model.Applicat
if err := c.KubeClient.Get(ctx, types.NamespacedName{Name: oamApp.Namespace}, &namespace); apierrors.IsNotFound(err) {
namespace.Name = oamApp.Namespace
if err := c.KubeClient.Create(ctx, &namespace); err != nil {
log.Logger.Errorf("auto create namespace failure %s", err.Error())
klog.Errorf("auto create namespace failure %s", err.Error())
return nil, bcode.ErrCreateNamespace
}
}
@@ -736,22 +737,22 @@ func (c *applicationServiceImpl) Deploy(ctx context.Context, app *model.Applicat
appRevision.Status = model.RevisionStatusFail
appRevision.Reason = err.Error()
if err := c.Store.Put(ctx, appRevision); err != nil {
log.Logger.Warnf("update deploy event failure %s", err.Error())
klog.Warningf("update deploy event failure %s", err.Error())
}
log.Logger.Errorf("deploy app %s failure %s", app.PrimaryKey(), err.Error())
klog.Errorf("deploy app %s failure %s", app.PrimaryKey(), err.Error())
return nil, bcode.ErrDeployApplyFail
}
// step5: create workflow record
if err := c.WorkflowService.CreateWorkflowRecord(ctx, app, oamApp, workflow); err != nil {
log.Logger.Warnf("create workflow record failure %s", err.Error())
klog.Warningf("create workflow record failure %s", err.Error())
}
// step6: update app revision status
appRevision.Status = model.RevisionStatusRunning
if err := c.Store.Put(ctx, appRevision); err != nil {
log.Logger.Warnf("update app revision failure %s", err.Error())
klog.Warningf("update app revision failure %s", err.Error())
}
// step7: change the source of trust
@@ -760,7 +761,7 @@ func (c *applicationServiceImpl) Deploy(ctx context.Context, app *model.Applicat
}
app.Labels[model.LabelSourceOfTruth] = model.FromUX
if err := c.Store.Put(ctx, app); err != nil {
log.Logger.Warnf("failed to update app %s", err.Error())
klog.Warningf("failed to update app %s", err.Error())
}
return &apisv1.ApplicationDeployResponse{
@@ -963,38 +964,38 @@ func (c *applicationServiceImpl) DeleteApplication(ctx context.Context, app *mod
// delete workflow
if err := c.WorkflowService.DeleteWorkflowByApp(ctx, app); err != nil && !errors.Is(err, bcode.ErrWorkflowNotExist) {
log.Logger.Errorf("delete workflow %s failure %s", app.Name, err.Error())
klog.Errorf("delete workflow %s failure %s", app.Name, err.Error())
}
for _, component := range components {
err := c.Store.Delete(ctx, &model.ApplicationComponent{AppPrimaryKey: app.PrimaryKey(), Name: component.Name})
if err != nil && !errors.Is(err, datastore.ErrRecordNotExist) {
log.Logger.Errorf("delete component %s in app %s failure %s", component.Name, app.Name, err.Error())
klog.Errorf("delete component %s in app %s failure %s", component.Name, app.Name, err.Error())
}
}
for _, policy := range policies {
err := c.Store.Delete(ctx, &model.ApplicationPolicy{AppPrimaryKey: app.PrimaryKey(), Name: policy.Name})
if err != nil && errors.Is(err, datastore.ErrRecordNotExist) {
log.Logger.Errorf("delete policy %s in app %s failure %s", policy.Name, app.Name, err.Error())
klog.Errorf("delete policy %s in app %s failure %s", policy.Name, app.Name, err.Error())
}
}
for _, entity := range revisions {
revision := entity.(*model.ApplicationRevision)
if err := c.Store.Delete(ctx, &model.ApplicationRevision{AppPrimaryKey: app.PrimaryKey(), Version: revision.Version}); err != nil {
log.Logger.Errorf("delete revision %s in app %s failure %s", revision.Version, app.Name, err.Error())
klog.Errorf("delete revision %s in app %s failure %s", revision.Version, app.Name, err.Error())
}
}
for _, trigger := range triggers {
if err := c.Store.Delete(ctx, &model.ApplicationTrigger{AppPrimaryKey: app.PrimaryKey(), Name: trigger.Name, Token: trigger.Token}); err != nil {
log.Logger.Errorf("delete trigger %s in app %s failure %s", trigger.Name, app.Name, err.Error())
klog.Errorf("delete trigger %s in app %s failure %s", trigger.Name, app.Name, err.Error())
}
}
if err := c.EnvBindingService.BatchDeleteEnvBinding(ctx, app); err != nil {
log.Logger.Errorf("delete envbindings in app %s failure %s", app.Name, err.Error())
klog.Errorf("delete envbindings in app %s failure %s", app.Name, err.Error())
}
return c.Store.Delete(ctx, app)
@@ -1047,7 +1048,7 @@ func (c *applicationServiceImpl) UpdateComponent(ctx context.Context, app *model
func (c *applicationServiceImpl) createComponent(ctx context.Context, app *model.Application, com apisv1.CreateComponentRequest, main bool) (*apisv1.ComponentBase, error) {
var cd v1beta1.ComponentDefinition
if err := c.KubeClient.Get(ctx, types.NamespacedName{Name: com.ComponentType, Namespace: velatypes.DefaultKubeVelaNS}, &cd); err != nil {
log.Logger.Warnf("component definition %s get failure. %s", pkgUtils.Sanitize(com.ComponentType), err.Error())
klog.Warningf("component definition %s get failure. %s", pkgUtils.Sanitize(com.ComponentType), err.Error())
return nil, bcode.ErrComponentTypeNotSupport
}
userName, _ := ctx.Value(&apisv1.CtxKeyUser).(string)
@@ -1075,7 +1076,7 @@ func (c *applicationServiceImpl) createComponent(ctx context.Context, app *model
traitTypes[trait.Type] = true
properties, err := model.NewJSONStructByString(trait.Properties)
if err != nil {
log.Logger.Errorf("new trait failure,%s", err.Error())
klog.Errorf("new trait failure,%s", err.Error())
return nil, bcode.ErrInvalidProperties
}
traits = append(traits, model.ApplicationTrait{
@@ -1102,7 +1103,7 @@ func (c *applicationServiceImpl) createComponent(ctx context.Context, app *model
if errors.Is(err, datastore.ErrRecordExist) {
return nil, bcode.ErrApplicationComponentExist
}
log.Logger.Warnf("add component for app %s failure %s", pkgUtils.Sanitize(app.PrimaryKey()), err.Error())
klog.Warningf("add component for app %s failure %s", pkgUtils.Sanitize(app.PrimaryKey()), err.Error())
return nil, err
}
// update the env workflow, the automatically generated workflow is determined by the component type.
@@ -1143,7 +1144,7 @@ func (c *applicationServiceImpl) DeleteComponent(ctx context.Context, app *model
if errors.Is(err, datastore.ErrRecordNotExist) {
return bcode.ErrApplicationComponentNotExist
}
log.Logger.Warnf("delete app component %s failure %s", app.PrimaryKey(), err.Error())
klog.Warningf("delete app component %s failure %s", app.PrimaryKey(), err.Error())
return err
}
if err := repository.UpdateAppEnvWorkflow(ctx, c.KubeClient, c.Store, app); err != nil {
@@ -1172,7 +1173,7 @@ func (c *applicationServiceImpl) CreatePolicy(ctx context.Context, app *model.Ap
if errors.Is(err, datastore.ErrRecordExist) {
return nil, bcode.ErrApplicationPolicyExist
}
log.Logger.Warnf("add policy for app %s failure %s", app.PrimaryKey(), err.Error())
klog.Warningf("add policy for app %s failure %s", app.PrimaryKey(), err.Error())
return nil, err
}
if err = c.handlePolicyBindingWorkflowStep(ctx, app, createPolicy.Name, createPolicy.WorkflowPolicyBindings); err != nil {
@@ -1199,7 +1200,7 @@ func (c *applicationServiceImpl) DeletePolicy(ctx context.Context, app *model.Ap
if errors.Is(err, datastore.ErrRecordNotExist) {
return bcode.ErrApplicationPolicyNotExist
}
log.Logger.Warnf("delete app policy %s failure %s", app.PrimaryKey(), err.Error())
klog.Warningf("delete app policy %s failure %s", app.PrimaryKey(), err.Error())
return err
}
return c.handlePolicyBindingWorkflowStep(ctx, app, policyName, nil)
@@ -1215,7 +1216,7 @@ func (c *applicationServiceImpl) UpdatePolicy(ctx context.Context, app *model.Ap
if errors.Is(err, datastore.ErrRecordNotExist) {
return nil, bcode.ErrApplicationPolicyNotExist
}
log.Logger.Warnf("update app policy %s failure %s", app.PrimaryKey(), err.Error())
klog.Warningf("update app policy %s failure %s", app.PrimaryKey(), err.Error())
return nil, err
}
policy.Type = policyUpdate.Type
@@ -1254,7 +1255,7 @@ func (c *applicationServiceImpl) CreateApplicationTrait(ctx context.Context, app
}
properties, err := model.NewJSONStructByString(req.Properties)
if err != nil {
log.Logger.Errorf("new trait failure,%s", err.Error())
klog.Errorf("new trait failure,%s", err.Error())
return nil, bcode.ErrInvalidProperties
}
trait := model.ApplicationTrait{CreateTime: time.Now(), Type: req.Type, Properties: properties, Alias: req.Alias, Description: req.Description}
@@ -1297,7 +1298,7 @@ func (c *applicationServiceImpl) UpdateApplicationTrait(ctx context.Context, app
if trait.Type == traitType {
properties, err := model.NewJSONStructByString(req.Properties)
if err != nil {
log.Logger.Errorf("update trait failure,%s", err.Error())
klog.Errorf("update trait failure,%s", err.Error())
return nil, bcode.ErrInvalidProperties
}
updatedTrait := model.ApplicationTrait{CreateTime: trait.CreateTime, UpdateTime: time.Now(), Properties: properties, Type: traitType, Alias: req.Alias, Description: req.Description}
@@ -1380,7 +1381,7 @@ func (c *applicationServiceImpl) Statistics(ctx context.Context, app *model.Appl
var targetMap = make(map[string]int)
envbinding, err := c.EnvBindingService.GetEnvBindings(ctx, app)
if err != nil {
log.Logger.Errorf("query app envbinding failure %s", err.Error())
klog.Errorf("query app envbinding failure %s", err.Error())
}
for _, env := range envbinding {
for _, target := range env.TargetNames {
@@ -1408,7 +1409,7 @@ func (c *applicationServiceImpl) CompareApp(ctx context.Context, appModel *model
case compareReq.CompareLatestWithRunning != nil:
base, err = c.renderOAMApplication(ctx, appModel, "", compareReq.CompareLatestWithRunning.Env, "")
if err != nil {
log.Logger.Errorf("failed to build the latest application %s", err.Error())
klog.Errorf("failed to build the latest application %s", err.Error())
break
}
case compareReq.CompareRevisionWithRunning != nil || compareReq.CompareRevisionWithLatest != nil:
@@ -1421,7 +1422,7 @@ func (c *applicationServiceImpl) CompareApp(ctx context.Context, appModel *model
}
base, envNameByRevision, err = c.getAppModelFromRevision(ctx, appModel.Name, revision)
if err != nil {
log.Logger.Errorf("failed to get the app model from the revision %s", err.Error())
klog.Errorf("failed to get the app model from the revision %s", err.Error())
break
}
}
@@ -1440,13 +1441,13 @@ func (c *applicationServiceImpl) CompareApp(ctx context.Context, appModel *model
}
compareTarget, err = c.GetApplicationCRInEnv(ctx, appModel, envName)
if err != nil {
log.Logger.Errorf("failed to query the application CR %s", err.Error())
klog.Errorf("failed to query the application CR %s", err.Error())
break
}
case compareReq.CompareRevisionWithLatest != nil:
compareTarget, err = c.renderOAMApplication(ctx, appModel, "", envNameByRevision, "")
if err != nil {
log.Logger.Errorf("failed to build the latest application %s", err.Error())
klog.Errorf("failed to build the latest application %s", err.Error())
break
}
}
@@ -1482,7 +1483,7 @@ func (c *applicationServiceImpl) CompareApp(ctx context.Context, appModel *model
args.SetClient(c.KubeClient)
diffResult, buff, err := compare(ctx, args, compareTarget, base)
if err != nil {
log.Logger.Errorf("fail to compare the app %s", err.Error())
klog.Errorf("fail to compare the app %s", err.Error())
compareResponse.IsDiff = false
return compareResponse, nil
}
@@ -1512,6 +1513,13 @@ func (c *applicationServiceImpl) DryRunAppOrRevision(ctx context.Context, appMod
}
case "REVISION":
app, _, err = c.getAppModelFromRevision(ctx, appModel.Name, dryRunReq.Version)
originalApp := &v1beta1.Application{}
if err := c.KubeClient.Get(ctx, types.NamespacedName{
Name: app.Name,
Namespace: app.Namespace,
}, originalApp); err == nil {
app.ResourceVersion = originalApp.ResourceVersion
}
if err != nil {
return nil, err
}
@@ -1590,7 +1598,7 @@ func (c *applicationServiceImpl) resetApp(ctx context.Context, targetApp *v1beta
if errors.Is(err, datastore.ErrRecordNotExist) {
continue
}
log.Logger.Warnf("delete app %s comp %s failure %s", appPrimaryKey, compName, err.Error())
klog.Warningf("delete app %s comp %s failure %s", appPrimaryKey, compName, err.Error())
}
}
@@ -1610,11 +1618,11 @@ func (c *applicationServiceImpl) resetApp(ctx context.Context, targetApp *v1beta
if errors.Is(err, datastore.ErrRecordExist) {
err := c.Store.Put(ctx, &compModel)
if err != nil {
log.Logger.Warnf("update comp %s for app %s failure %s", comp.Name, pkgUtils.Sanitize(appPrimaryKey), err.Error())
klog.Warningf("update comp %s for app %s failure %s", comp.Name, pkgUtils.Sanitize(appPrimaryKey), err.Error())
}
return &apisv1.AppResetResponse{IsReset: true}, err
}
log.Logger.Warnf("add comp %s for app %s failure %s", comp.Name, pkgUtils.Sanitize(appPrimaryKey), err.Error())
klog.Warningf("add comp %s for app %s failure %s", comp.Name, pkgUtils.Sanitize(appPrimaryKey), err.Error())
return &apisv1.AppResetResponse{}, err
}
}

View File

@@ -33,6 +33,7 @@ import (
kerrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
@@ -42,7 +43,6 @@ import (
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
const (
@@ -424,7 +424,7 @@ func getDexConfig(ctx context.Context, kubeClient client.Client) (*model.DexConf
config := &model.DexConfig{}
if err := yaml.Unmarshal(dexConfigSecret.Data[secretDexConfigKey], config); err != nil {
log.Logger.Errorf("failed to unmarshal dex config: %s", err.Error())
klog.Errorf("failed to unmarshal dex config: %s", err.Error())
return nil, bcode.ErrInvalidDexConfig
}
if len(config.StaticClients) < 1 || len(config.StaticClients[0].RedirectURIs) < 1 {
@@ -487,7 +487,7 @@ func (d *dexHandlerImpl) login(ctx context.Context) (*apisv1.UserBase, error) {
} else {
systemInfo, err := d.systemInfoService.GetSystemInfo(ctx)
if err != nil {
log.Logger.Errorf("failed to get the system info %s", err.Error())
klog.Errorf("failed to get the system info %s", err.Error())
}
user := &model.User{
Email: claims.Email,
@@ -500,7 +500,7 @@ func (d *dexHandlerImpl) login(ctx context.Context) (*apisv1.UserBase, error) {
user.UserRoles = systemInfo.DexUserDefaultPlatformRoles
}
if err := d.Store.Add(ctx, user); err != nil {
log.Logger.Errorf("failed to save the user from the dex: %s", err.Error())
klog.Errorf("failed to save the user from the dex: %s", err.Error())
return nil, err
}
if systemInfo != nil {
@@ -510,7 +510,7 @@ func (d *dexHandlerImpl) login(ctx context.Context) (*apisv1.UserBase, error) {
UserRoles: project.Roles,
})
if err != nil {
log.Logger.Errorf("failed to add a user to project %s", err.Error())
klog.Errorf("failed to add a user to project %s", err.Error())
}
}
}

View File

@@ -26,7 +26,7 @@ import (
"strings"
"time"
v1alpha1 "github.com/cloudtty/cloudtty/pkg/apis/cloudshell/v1alpha1"
"github.com/cloudtty/cloudtty/pkg/apis/cloudshell/v1alpha1"
"github.com/ghodss/yaml"
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -36,6 +36,7 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/clientcmd/api"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
kubevelatypes "github.com/oam-dev/kubevela/apis/types"
@@ -43,7 +44,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/auth"
)
@@ -144,7 +144,7 @@ func (c *cloudShellServiceImpl) Prepare(ctx context.Context) (*apisv1.CloudShell
} else {
if cloudShell.Status.Phase == v1alpha1.PhaseFailed {
if err := c.KubeClient.Delete(ctx, &cloudShell); err != nil {
log.Logger.Errorf("failed to clear the failed cloud shell:%s", err.Error())
klog.Errorf("failed to clear the failed cloud shell:%s", err.Error())
}
res.Status = StatusFailed
}
@@ -234,7 +234,7 @@ func (c *cloudShellServiceImpl) prepareKubeConfig(ctx context.Context) error {
// The kubernetes permission set is generated based on simple rules, but this is not completely strict.
var readOnly bool
if err != nil {
log.Logger.Errorf("failed to get the user permissions %s", err.Error())
klog.Errorf("failed to get the user permissions %s", err.Error())
readOnly = true
} else {
readOnly = checkReadOnly(p.Name, permissions)
@@ -242,7 +242,7 @@ func (c *cloudShellServiceImpl) prepareKubeConfig(ctx context.Context) error {
if readOnly {
groupName, err := c.managePrivilegesForProject(ctx, p, true)
if err != nil {
log.Logger.Errorf("failed to privileges the user %s", err.Error())
klog.Errorf("failed to privileges the user %s", err.Error())
}
if groupName != "" {
groups = append(groups, groupName)
@@ -250,7 +250,7 @@ func (c *cloudShellServiceImpl) prepareKubeConfig(ctx context.Context) error {
} else {
groupName, err := c.managePrivilegesForProject(ctx, p, false)
if err != nil {
log.Logger.Errorf("failed to privileges the user %s", err.Error())
klog.Errorf("failed to privileges the user %s", err.Error())
}
if groupName != "" {
groups = append(groups, groupName)
@@ -275,7 +275,7 @@ func (c *cloudShellServiceImpl) prepareKubeConfig(ctx context.Context) error {
if len(c.CACert) == 0 {
caFromServiceAccount, err := os.ReadFile(CAFilePathInCluster)
if err != nil {
log.Logger.Errorf("failed to read the ca file from the service account dir,%s", err.Error())
klog.Errorf("failed to read the ca file from the service account dir,%s", err.Error())
return err
}
c.CACert = caFromServiceAccount
@@ -296,7 +296,7 @@ func (c *cloudShellServiceImpl) prepareKubeConfig(ctx context.Context) error {
Groups: groups,
}))
if err != nil {
log.Logger.Errorf("failed to generate the kube config:%s Message: %s", err.Error(), strings.ReplaceAll(buffer.String(), "\n", "\t"))
klog.Errorf("failed to generate the kube config:%s Message: %s", err.Error(), strings.ReplaceAll(buffer.String(), "\n", "\t"))
return err
}
bs, err := clientcmd.Write(*cfg)
@@ -388,7 +388,7 @@ func (c *cloudShellServiceImpl) managePrivilegesForProject(ctx context.Context,
projectName := project.Name
targets, err := c.TargetService.ListTargets(ctx, 0, 0, projectName)
if err != nil {
log.Logger.Infof("failed to list the targets by the project name %s :%s", projectName, err.Error())
klog.Infof("failed to list the targets by the project name %s :%s", projectName, err.Error())
}
var authPDs []auth.PrivilegeDescription
for _, t := range targets.Targets {
@@ -396,7 +396,7 @@ func (c *cloudShellServiceImpl) managePrivilegesForProject(ctx context.Context,
}
envs, err := c.EnvService.ListEnvs(ctx, 0, 0, apisv1.ListEnvOptions{Project: projectName})
if err != nil {
log.Logger.Infof("failed to list the envs by the project name %s :%s", projectName, err.Error())
klog.Infof("failed to list the envs by the project name %s :%s", projectName, err.Error())
}
for _, e := range envs.Envs {
authPDs = append(authPDs, &auth.ApplicationPrivilege{Cluster: kubevelatypes.ClusterLocalName, Namespace: e.Namespace, ReadOnly: readOnly})
@@ -414,6 +414,6 @@ func (c *cloudShellServiceImpl) managePrivilegesForProject(ctx context.Context,
if err := auth.GrantPrivileges(ctx, c.KubeClient, authPDs, identity, writer, auth.WithReplace); err != nil {
return "", err
}
log.Logger.Debugf("GrantPrivileges: %s", writer.String())
klog.Infof("GrantPrivileges: %s", writer.String())
return groupName, nil
}

View File

@@ -29,6 +29,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/kubevela/pkg/util/rand"
@@ -43,7 +44,6 @@ import (
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
utils2 "github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/cloudprovider"
"github.com/oam-dev/kubevela/pkg/multicluster"
"github.com/oam-dev/kubevela/pkg/utils"
@@ -100,25 +100,25 @@ func (c *clusterServiceImpl) getClusterFromDataStore(ctx context.Context, cluste
func (c *clusterServiceImpl) rollbackAddedClusterInDataStore(ctx context.Context, cluster *model.Cluster) {
if e := c.Store.Delete(ctx, cluster); e != nil {
log.Logger.Errorf("failed to rollback added cluster %s in data store: %s", utils.Sanitize(cluster.Name), e.Error())
klog.Errorf("failed to rollback added cluster %s in data store: %s", utils.Sanitize(cluster.Name), e.Error())
}
}
func (c *clusterServiceImpl) rollbackDeletedClusterInDataStore(ctx context.Context, cluster *model.Cluster) {
if e := c.Store.Add(ctx, cluster); e != nil {
log.Logger.Errorf("failed to rollback deleted cluster %s in data store: %s", utils.Sanitize(cluster.Name), e.Error())
klog.Errorf("failed to rollback deleted cluster %s in data store: %s", utils.Sanitize(cluster.Name), e.Error())
}
}
func (c *clusterServiceImpl) rollbackJoinedKubeCluster(ctx context.Context, cluster *model.Cluster) {
if e := multicluster.DetachCluster(ctx, c.K8sClient, cluster.Name); e != nil {
log.Logger.Errorf("failed to rollback joined cluster %s in kubevela: %s", utils.Sanitize(cluster.Name), e.Error())
klog.Errorf("failed to rollback joined cluster %s in kubevela: %s", utils.Sanitize(cluster.Name), e.Error())
}
}
func (c *clusterServiceImpl) rollbackDetachedKubeCluster(ctx context.Context, cluster *model.Cluster) {
if _, e := joinClusterByKubeConfigString(context.WithValue(ctx, multicluster.KubeConfigContext, c.KubeConfig), c.K8sClient, cluster.Name, cluster.KubeConfig); e != nil {
log.Logger.Errorf("failed to rollback detached cluster %s in kubevela: %s", utils.Sanitize(cluster.Name), e.Error())
klog.Errorf("failed to rollback detached cluster %s in kubevela: %s", utils.Sanitize(cluster.Name), e.Error())
}
}
@@ -492,7 +492,7 @@ func (c *clusterServiceImpl) getClusterResourceInfoFromK8s(ctx context.Context,
func (c *clusterServiceImpl) ListCloudClusters(ctx context.Context, provider string, req apis.AccessKeyRequest, pageNumber int, pageSize int) (*apis.ListCloudClusterResponse, error) {
p, err := cloudprovider.GetClusterProvider(provider, req.AccessKeyID, req.AccessKeySecret, c.K8sClient)
if err != nil {
log.Logger.Errorf("failed to get cluster provider: %s", err.Error())
klog.Errorf("failed to get cluster provider: %s", err.Error())
return nil, bcode.ErrInvalidCloudClusterProvider
}
clusters, total, err := p.ListCloudClusters(pageNumber, pageSize)
@@ -500,7 +500,7 @@ func (c *clusterServiceImpl) ListCloudClusters(ctx context.Context, provider str
if p.IsInvalidKey(err) {
return nil, bcode.ErrInvalidAccessKeyOrSecretKey
}
log.Logger.Errorf("failed to list cloud clusters: %s", err.Error())
klog.Errorf("failed to list cloud clusters: %s", err.Error())
return nil, bcode.ErrGetCloudClusterFailure
}
resp := &apis.ListCloudClusterResponse{
@@ -516,12 +516,12 @@ func (c *clusterServiceImpl) ListCloudClusters(ctx context.Context, provider str
func (c *clusterServiceImpl) ConnectCloudCluster(ctx context.Context, provider string, req apis.ConnectCloudClusterRequest) (*apis.ClusterBase, error) {
p, err := cloudprovider.GetClusterProvider(provider, req.AccessKeyID, req.AccessKeySecret, c.K8sClient)
if err != nil {
log.Logger.Errorf("failed to get cluster provider: %s", err.Error())
klog.Errorf("failed to get cluster provider: %s", err.Error())
return nil, bcode.ErrInvalidCloudClusterProvider
}
kubeConfig, err := p.GetClusterKubeConfig(req.ClusterID)
if err != nil {
log.Logger.Errorf("failed to get cluster kubeConfig: %s", err.Error())
klog.Errorf("failed to get cluster kubeConfig: %s", err.Error())
return nil, bcode.ErrGetCloudClusterFailure
}
cluster, err := p.GetClusterInfo(req.ClusterID)
@@ -529,7 +529,7 @@ func (c *clusterServiceImpl) ConnectCloudCluster(ctx context.Context, provider s
if p.IsInvalidKey(err) {
return nil, bcode.ErrInvalidAccessKeyOrSecretKey
}
log.Logger.Errorf("failed to get cluster info: %s", err.Error())
klog.Errorf("failed to get cluster info: %s", err.Error())
return nil, bcode.ErrGetCloudClusterFailure
}
createReq := apis.CreateClusterRequest{
@@ -546,7 +546,7 @@ func (c *clusterServiceImpl) ConnectCloudCluster(ctx context.Context, provider s
func (c *clusterServiceImpl) CreateCloudCluster(ctx context.Context, provider string, req apis.CreateCloudClusterRequest) (*apis.CreateCloudClusterResponse, error) {
p, err := cloudprovider.GetClusterProvider(provider, req.AccessKeyID, req.AccessKeySecret, c.K8sClient)
if err != nil {
log.Logger.Errorf("failed to get cluster provider: %s", err.Error())
klog.Errorf("failed to get cluster provider: %s", err.Error())
return nil, bcode.ErrInvalidCloudClusterProvider
}
_, err = p.CreateCloudCluster(ctx, req.Name, req.Zone, req.WorkerNumber, req.CPUCoresPerWorker, req.MemoryPerWorker)
@@ -554,7 +554,7 @@ func (c *clusterServiceImpl) CreateCloudCluster(ctx context.Context, provider st
if kerrors.IsAlreadyExists(err) {
return nil, bcode.ErrCloudClusterAlreadyExists
}
log.Logger.Errorf("failed to bootstrap terraform configuration: %s", err.Error())
klog.Errorf("failed to bootstrap terraform configuration: %s", err.Error())
return nil, bcode.ErrBootstrapTerraformConfiguration
}
return c.GetCloudClusterCreationStatus(ctx, provider, req.Name)

View File

@@ -23,12 +23,12 @@ import (
"github.com/pkg/errors"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/types"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/config"
"github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/pkg/utils/apply"
@@ -137,6 +137,14 @@ func (u *configServiceImpl) CreateConfig(ctx context.Context, project string, re
return nil, err
}
}
exist, err := u.Factory.IsExist(ctx, ns, req.Name)
if err != nil {
klog.Errorf("check config name is exist failure %s", err.Error())
return nil, bcode.ErrConfigExist
}
if exist {
return nil, bcode.ErrConfigExist
}
var properties = make(map[string]interface{})
if err := json.Unmarshal([]byte(req.Properties), &properties); err != nil {
return nil, err
@@ -156,9 +164,6 @@ func (u *configServiceImpl) CreateConfig(ctx context.Context, project string, re
return nil, err
}
if err := u.Factory.CreateOrUpdateConfig(ctx, configItem, ns); err != nil {
if errors.Is(err, config.ErrConfigExist) {
return nil, bcode.ErrConfigExist
}
return nil, err
}
return convertConfig(project, *configItem), nil
@@ -196,9 +201,12 @@ func (u *configServiceImpl) UpdateConfig(ctx context.Context, project string, na
return nil, err
}
if err := u.Factory.CreateOrUpdateConfig(ctx, configItem, ns); err != nil {
if errors.Is(err, config.ErrConfigExist) {
if errors.Is(err, config.ErrChangeTemplate) {
return nil, bcode.ErrChangeTemplate
}
if errors.Is(err, config.ErrChangeSecretType) {
return nil, bcode.ErrChangeSecretType
}
return nil, err
}
return convertConfig(project, *configItem), nil
@@ -234,7 +242,7 @@ func (u *configServiceImpl) ListConfigs(ctx context.Context, project string, tem
for i := range configs {
if projectNamespace != "" {
if err := u.Factory.MergeDistributionStatus(ctx, configs[i], projectNamespace); err != nil && !errors.Is(err, config.ErrNotFoundDistribution) {
log.Logger.Warnf("fail to merge the status %s:%s", configs[i].Name, err.Error())
klog.Warningf("fail to merge the status %s:%s", configs[i].Name, err.Error())
}
}
item := convertConfig(project, *configs[i])

View File

@@ -34,6 +34,7 @@ import (
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
k8stypes "k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
@@ -41,7 +42,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// DefinitionService definition service, Implement the management of ComponentDefinition、TraitDefinition and WorkflowStepDefinition.
@@ -151,7 +151,7 @@ func (d *definitionServiceImpl) listDefinitions(ctx context.Context, list *unstr
for _, def := range filteredList.Items {
definition, err := convertDefinitionBase(def, kind)
if err != nil {
log.Logger.Errorf("convert definition to base failure %s", err.Error())
klog.Errorf("convert definition to base failure %s", err.Error())
continue
}
defs = append(defs, definition)
@@ -285,7 +285,7 @@ func renderCustomUISchema(ctx context.Context, cli client.Client, name, defType
Name: fmt.Sprintf("%s-uischema-%s", defType, name),
}, &cm); err != nil {
if !apierrors.IsNotFound(err) {
log.Logger.Errorf("find uischema configmap from cluster failure %s", err.Error())
klog.Errorf("find uischema configmap from cluster failure %s", err.Error())
}
return defaultSchema
}
@@ -295,7 +295,7 @@ func renderCustomUISchema(ctx context.Context, cli client.Client, name, defType
}
schema := []*utils.UIParameter{}
if err := json.Unmarshal([]byte(data), &schema); err != nil {
log.Logger.Errorf("unmarshal ui schema failure %s", err.Error())
klog.Errorf("unmarshal ui schema failure %s", err.Error())
return defaultSchema
}
return patchSchema(defaultSchema, schema)
@@ -305,7 +305,7 @@ func renderCustomUISchema(ctx context.Context, cli client.Client, name, defType
func (d *definitionServiceImpl) AddDefinitionUISchema(ctx context.Context, name, defType string, schema []*utils.UIParameter) ([]*utils.UIParameter, error) {
dataBate, err := json.Marshal(schema)
if err != nil {
log.Logger.Errorf("json marshal failure %s", err.Error())
klog.Errorf("json marshal failure %s", err.Error())
return nil, bcode.ErrInvalidDefinitionUISchema
}
var cm v1.ConfigMap

View File

@@ -24,6 +24,7 @@ import (
"sort"
apierror "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
@@ -34,7 +35,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/auth"
"github.com/oam-dev/kubevela/pkg/oam"
util "github.com/oam-dev/kubevela/pkg/utils"
@@ -191,7 +191,7 @@ func (p *envServiceImpl) UpdateEnv(ctx context.Context, name string, req apisv1.
env.Name = name
err := p.Store.Get(ctx, env)
if err != nil {
log.Logger.Errorf("check if env name exists failure %s", err.Error())
klog.Errorf("check if env name exists failure %s", err.Error())
return nil, bcode.ErrEnvNotExisted
}
if req.Alias != "" {
@@ -370,7 +370,7 @@ func managePrivilegesForEnvironment(ctx context.Context, cli client.Client, env
if err := f(ctx, cli, []auth.PrivilegeDescription{p}, identity, writer); err != nil {
return err
}
log.Logger.Debugf("%s: %s", msg, writer.String())
klog.Infof("%s: %s", msg, writer.String())
return nil
}

View File

@@ -23,6 +23,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
@@ -33,7 +34,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
pkgUtils "github.com/oam-dev/kubevela/pkg/utils"
)
@@ -66,7 +66,7 @@ func NewEnvBindingService() EnvBindingService {
func (e *envBindingServiceImpl) GetEnvBindings(ctx context.Context, app *model.Application) ([]*apisv1.EnvBindingBase, error) {
full, err := repository.ListFullEnvBinding(ctx, e.Store, repository.EnvListOption{AppPrimaryKey: app.PrimaryKey(), ProjectName: app.Project})
if err != nil {
log.Logger.Errorf("list envbinding for app %s err: %v\n", app.Name, err)
klog.Errorf("list envbinding for app %s err: %v\n", app.Name, err)
return nil, err
}
return full, nil
@@ -125,16 +125,16 @@ func (e *envBindingServiceImpl) BatchCreateEnvBinding(ctx context.Context, app *
envBindingModel := assembler.ConvertToEnvBindingModel(app, *envbindings[i])
env, err := repository.GetEnv(ctx, e.Store, envBindingModel.Name)
if err != nil {
log.Logger.Errorf("get env failure %s", err.Error())
klog.Errorf("get env failure %s", err.Error())
continue
}
if err := e.Store.Add(ctx, envBindingModel); err != nil {
log.Logger.Errorf("add envbinding %s failure %s", pkgUtils.Sanitize(envBindingModel.Name), err.Error())
klog.Errorf("add envbinding %s failure %s", pkgUtils.Sanitize(envBindingModel.Name), err.Error())
continue
}
err = e.createEnvWorkflow(ctx, app, env, i == 0)
if err != nil {
log.Logger.Errorf("create env workflow failure %s", err.Error())
klog.Errorf("create env workflow failure %s", err.Error())
continue
}
}
@@ -237,14 +237,14 @@ func (e *envBindingServiceImpl) createEnvWorkflow(ctx context.Context, app *mode
EnvName: env.Name,
AppPrimaryKey: app.PrimaryKey(),
}
log.Logger.Infof("create workflow %s for app %s", pkgUtils.Sanitize(workflow.Name), pkgUtils.Sanitize(app.PrimaryKey()))
klog.Infof("create workflow %s for app %s", pkgUtils.Sanitize(workflow.Name), pkgUtils.Sanitize(app.PrimaryKey()))
if err := e.Store.Add(ctx, workflow); err != nil {
return err
}
err := e.Store.BatchAdd(ctx, policies)
if err != nil {
if err := e.WorkflowService.DeleteWorkflow(ctx, app, repository.ConvertWorkflowName(env.Name)); err != nil {
log.Logger.Errorf("fail to rollback the workflow after fail to create policies, %s", err.Error())
klog.Errorf("fail to rollback the workflow after fail to create policies, %s", err.Error())
}
return fmt.Errorf("fail to create policies %w", err)
}
@@ -299,6 +299,6 @@ func (e *envBindingServiceImpl) ApplicationEnvRecycle(ctx context.Context, appMo
if err := resetRevisionsAndRecords(ctx, e.Store, appModel.Name, "", "", ""); err != nil {
return err
}
log.Logger.Infof("Application %s(%s) recycle successfully from env %s", appModel.Name, name, env.Name)
klog.Infof("Application %s(%s) recycle successfully from env %s", appModel.Name, name, env.Name)
return nil
}

View File

@@ -23,12 +23,12 @@ import (
"github.com/oam-dev/kubevela/apis/types"
v1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/pkg/utils/common"
"github.com/oam-dev/kubevela/pkg/utils/helm"
types2 "k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"helm.sh/helm/v3/pkg/repo"
@@ -69,7 +69,7 @@ func (d defaultHelmImpl) ListChartNames(ctx context.Context, repoURL string, sec
}
charts, err := d.helper.ListChartsFromRepo(repoURL, skipCache, opts)
if err != nil {
log.Logger.Errorf("cannot fetch charts repo: %s, error: %s", utils.Sanitize(repoURL), err.Error())
klog.Errorf("cannot fetch charts repo: %s, error: %s", utils.Sanitize(repoURL), err.Error())
return nil, bcode.ErrListHelmChart
}
return charts, nil
@@ -89,11 +89,11 @@ func (d defaultHelmImpl) ListChartVersions(ctx context.Context, repoURL string,
}
chartVersions, err := d.helper.ListVersions(repoURL, chartName, skipCache, opts)
if err != nil {
log.Logger.Errorf("cannot fetch chart versions repo: %s, chart: %s error: %s", utils.Sanitize(repoURL), utils.Sanitize(chartName), err.Error())
klog.Errorf("cannot fetch chart versions repo: %s, chart: %s error: %s", utils.Sanitize(repoURL), utils.Sanitize(chartName), err.Error())
return nil, bcode.ErrListHelmVersions
}
if len(chartVersions) == 0 {
log.Logger.Errorf("cannot fetch chart versions repo: %s, chart: %s", utils.Sanitize(repoURL), utils.Sanitize(chartName))
klog.Errorf("cannot fetch chart versions repo: %s, chart: %s", utils.Sanitize(repoURL), utils.Sanitize(chartName))
return nil, bcode.ErrChartNotExist
}
return chartVersions, nil
@@ -113,7 +113,7 @@ func (d defaultHelmImpl) GetChartValues(ctx context.Context, repoURL string, cha
}
v, err := d.helper.GetValuesFromChart(repoURL, chartName, version, skipCache, opts)
if err != nil {
log.Logger.Errorf("cannot fetch chart values repo: %s, chart: %s, version: %s, error: %s", utils.Sanitize(repoURL), utils.Sanitize(chartName), utils.Sanitize(version), err.Error())
klog.Errorf("cannot fetch chart values repo: %s, chart: %s, version: %s, error: %s", utils.Sanitize(repoURL), utils.Sanitize(chartName), utils.Sanitize(version), err.Error())
return nil, bcode.ErrGetChartValues
}
res := make(map[string]interface{}, len(v))

View File

@@ -33,11 +33,11 @@ import (
"github.com/google/go-containerregistry/pkg/v1/remote/transport"
corev1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/types"
v1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// True -
@@ -97,7 +97,7 @@ func (i *imageImpl) GetImageInfo(ctx context.Context, project, secretName, image
registries, err := i.ListImageRepos(ctx, project)
if err != nil {
log.Logger.Warnf("fail to list the image registries:%s", err.Error())
klog.Warningf("fail to list the image registries:%s", err.Error())
imageInfo.Message = "There is no registry."
return imageInfo
}
@@ -151,7 +151,7 @@ func getAccountFromSecret(secret corev1.Secret, registryDomain string) (insecure
if len(conf) > 0 {
var authConfig map[string]map[string]map[string]string
if err := json.Unmarshal(conf, &authConfig); err != nil {
log.Logger.Warnf("fail to unmarshal the secret %s , %s", secret.Name, err.Error())
klog.Warningf("fail to unmarshal the secret %s , %s", secret.Name, err.Error())
return
}
if authConfig != nil && authConfig["auths"] != nil && authConfig["auths"][registryDomain] != nil {

View File

@@ -29,7 +29,6 @@ import (
"time"
"github.com/fatih/color"
"github.com/kubevela/workflow/api/v1alpha1"
"github.com/kubevela/workflow/pkg/cue/model/value"
wfTypes "github.com/kubevela/workflow/pkg/types"
@@ -42,6 +41,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
types2 "github.com/oam-dev/kubevela/apis/types"
@@ -50,7 +50,6 @@ import (
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/oam/util"
pkgutils "github.com/oam-dev/kubevela/pkg/utils"
)
@@ -210,7 +209,7 @@ func (p pipelineServiceImpl) ListPipelines(ctx context.Context, req apis.ListPip
info, err = p.getPipelineInfo(ctx, pipeline, projectMap[pipeline.Project].Namespace)
if err != nil {
// Since we are listing pipelines. We should not return directly if we cannot get pipeline info
log.Logger.Errorf("get pipeline %s/%s info error: %v", pipeline.Project, pkgutils.Sanitize(pipeline.Name), err)
klog.Errorf("get pipeline %s/%s info error: %v", pipeline.Project, pkgutils.Sanitize(pipeline.Name), err)
continue
}
}
@@ -248,7 +247,7 @@ func (p pipelineServiceImpl) GetPipeline(ctx context.Context, name string, getIn
if getInfo {
in, err := p.getPipelineInfo(ctx, pipeline, project.Namespace)
if err != nil {
log.Logger.Errorf("get pipeline %s/%s info error: %v", pipeline.Project, pkgutils.Sanitize(pipeline.Name), err)
klog.Errorf("get pipeline %s/%s info error: %v", pipeline.Project, pkgutils.Sanitize(pipeline.Name), err)
return nil, bcode.ErrGetPipelineInfo
}
if in != nil {
@@ -304,11 +303,11 @@ func (p pipelineServiceImpl) DeletePipeline(ctx context.Context, pl apis.Pipelin
}
// Clean up pipeline: 1. delete pipeline runs 2. delete contexts 3. delete pipeline
if err := p.PipelineRunService.CleanPipelineRuns(ctx, pl); err != nil {
log.Logger.Errorf("delete pipeline all pipeline-runs failure: %s", err.Error())
klog.Errorf("delete pipeline all pipeline-runs failure: %s", err.Error())
return err
}
if err := p.ContextService.DeleteAllContexts(ctx, pl.Project.Name, pl.Name); err != nil {
log.Logger.Errorf("delete pipeline all context failure: %s", err.Error())
klog.Errorf("delete pipeline all context failure: %s", err.Error())
return err
}
if err := p.Store.Delete(ctx, pipeline); err != nil {
@@ -351,7 +350,7 @@ func (p pipelineRunServiceImpl) GetPipelineRunOutput(ctx context.Context, pipeli
}
v, err := wfUtils.GetDataFromContext(ctx, p.KubeClient, ctxBackend.Name, pipelineRun.PipelineRunName, ctxBackend.Namespace)
if err != nil {
log.Logger.Errorf("get data from context backend failed: %v", err)
klog.Errorf("get data from context backend failed: %v", err)
return apis.GetPipelineRunOutputResponse{}, bcode.ErrGetContextBackendData
}
for _, s := range pipelineRun.Status.Steps {
@@ -413,7 +412,7 @@ func (p pipelineRunServiceImpl) GetPipelineRunInput(ctx context.Context, pipelin
}
v, err := wfUtils.GetDataFromContext(ctx, p.KubeClient, ctxBackend.Name, pipelineRun.PipelineRunName, ctxBackend.Namespace)
if err != nil {
log.Logger.Errorf("get data from context backend failed: %v", err)
klog.Errorf("get data from context backend failed: %v", err)
return apis.GetPipelineRunInputResponse{}, bcode.ErrGetContextBackendData
}
for _, s := range pipelineRun.Status.Steps {
@@ -507,13 +506,13 @@ func (p pipelineRunServiceImpl) GetPipelineRunLog(ctx context.Context, pipelineR
var logsBuilder strings.Builder
readCloser, err := wfUtils.GetLogsFromURL(ctx, logConfig.Source.URL)
if err != nil {
log.Logger.Errorf("get logs from url %s failed: %v", logConfig.Source.URL, err)
klog.Errorf("get logs from url %s failed: %v", logConfig.Source.URL, err)
return apis.GetPipelineRunLogResponse{}, bcode.ErrReadSourceLog
}
//nolint:errcheck
defer readCloser.Close()
if _, err := io.Copy(&logsBuilder, readCloser); err != nil {
log.Logger.Errorf("copy logs from url %s failed: %v", logConfig.Source.URL, err)
klog.Errorf("copy logs from url %s failed: %v", logConfig.Source.URL, err)
return apis.GetPipelineRunLogResponse{}, bcode.ErrReadSourceLog
}
logs = logsBuilder.String()
@@ -613,12 +612,12 @@ func getResourceLogs(ctx context.Context, config *rest.Config, cli client.Client
}
pods, err := wfUtils.GetPodListFromResources(ctx, cli, resources)
if err != nil {
log.Logger.Errorf("fail to get pod list from resources: %v", err)
klog.Errorf("fail to get pod list from resources: %v", err)
return "", err
}
clientSet, err := kubernetes.NewForConfig(config)
if err != nil {
log.Logger.Errorf("fail to get clientset from kubeconfig: %v", err)
klog.Errorf("fail to get clientset from kubeconfig: %v", err)
return "", err
}
podContainers := make([]PodContainer, 0)
@@ -652,7 +651,7 @@ func getResourceLogs(ctx context.Context, config *rest.Config, cli client.Client
req := clientSet.CoreV1().Pods(pc.Namespace).GetLogs(pc.Name, &podLogOpts)
podLogs, err := req.Stream(ctxQuery)
if err != nil {
log.Logger.Errorf("fail to get pod logs: %v", err)
klog.Errorf("fail to get pod logs: %v", err)
return
}
defer func() {
@@ -687,7 +686,7 @@ func getResourceLogs(ctx context.Context, config *rest.Config, cli client.Client
}
if readErr != nil {
errPrint(buf, "error in copy information from APIServer to buffer: %s", err.Error())
log.Logger.Errorf("fail to copy pod logs: %v", err)
klog.Errorf("fail to copy pod logs: %v", err)
}
logMap.Store(fmt.Sprintf("%s/%s", pc.Name, pc.Container), buf.String())
}(pc)
@@ -742,7 +741,6 @@ func pipelineStep2WorkflowStep(step model.WorkflowStep) v1alpha1.WorkflowStep {
func pipelineSpec2WorkflowSpec(spec model.WorkflowSpec) *v1alpha1.WorkflowSpec {
res := &v1alpha1.WorkflowSpec{
Mode: spec.Mode,
Steps: make([]v1alpha1.WorkflowStep, 0),
}
for _, step := range spec.Steps {
@@ -925,7 +923,7 @@ func (p pipelineRunServiceImpl) GetPipelineRun(ctx context.Context, meta apis.Pi
Project: project.Name,
}
if err := p.Store.Get(ctx, pipeline); err != nil {
log.Logger.Errorf("failed to load the workflow %s", err.Error())
klog.Errorf("failed to load the workflow %s", err.Error())
if errors.Is(err, datastore.ErrRecordNotExist) {
return nil, bcode.ErrPipelineNotExist
}
@@ -1031,7 +1029,7 @@ func (c contextServiceImpl) CreateContext(ctx context.Context, projectName, pipe
}
}
if _, ok := modelCtx.Contexts[context.Name]; ok {
log.Logger.Errorf("context %s already exists", pkgutils.Sanitize(context.Name))
klog.Errorf("context %s already exists", pkgutils.Sanitize(context.Name))
return nil, bcode.ErrContextAlreadyExist
}
modelCtx.Contexts[context.Name] = context.Values
@@ -1216,7 +1214,7 @@ func (p pipelineRunServiceImpl) workflowRun2runBriefing(ctx context.Context, run
if contextName, ok := run.Labels[labelContext]; ok {
apiContext, err = p.ContextService.GetContext(ctx, project.Name, pipelineName, contextName)
if err != nil {
log.Logger.Warnf("failed to get pipeline run context %s/%s/%s: %v", project, pipelineName, contextName, err)
klog.Warningf("failed to get pipeline run context %s/%s/%s: %v", project, pipelineName, contextName, err)
apiContext = nil
}
}

View File

@@ -23,6 +23,7 @@ import (
terraformapi "github.com/oam-dev/terraform-controller/api/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/types"
@@ -30,7 +31,6 @@ import (
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/multicluster"
"github.com/oam-dev/kubevela/pkg/utils"
)
@@ -97,7 +97,7 @@ func (p *projectServiceImpl) InitDefaultProjectEnvTarget(ctx context.Context, de
if count > 0 {
return nil
}
log.Logger.Info("no default project found, adding a default project with default env and target")
klog.Info("no default project found, adding a default project with default env and target")
_, err = p.CreateProject(ctx, apisv1.CreateProjectRequest{
Name: model.DefaultInitName,
@@ -169,7 +169,7 @@ func (p *projectServiceImpl) DetailProject(ctx context.Context, projectName stri
var user = &model.User{Name: project.Owner}
if project.Owner != "" {
if err := p.Store.Get(ctx, user); err != nil {
log.Logger.Warnf("get project owner %s info failure %s", project.Owner, err.Error())
klog.Warningf("get project owner %s info failure %s", project.Owner, err.Error())
}
}
return ConvertProjectModel2Base(project, user), nil
@@ -187,7 +187,7 @@ func listProjects(ctx context.Context, ds datastore.DataStore, page, pageSize in
var user = &model.User{Name: project.Owner}
if project.Owner != "" {
if err := ds.Get(ctx, user); err != nil {
log.Logger.Warnf("get project owner %s info failure %s", project.Owner, err.Error())
klog.Warningf("get project owner %s info failure %s", project.Owner, err.Error())
}
}
projects = append(projects, ConvertProjectModel2Base(project, user))
@@ -297,7 +297,7 @@ func (p *projectServiceImpl) DeleteProject(ctx context.Context, name string) err
func (p *projectServiceImpl) CreateProject(ctx context.Context, req apisv1.CreateProjectRequest) (*apisv1.ProjectBase, error) {
exist, err := p.Store.IsExist(ctx, &model.Project{Name: req.Name})
if err != nil {
log.Logger.Errorf("check project name is exist failure %s", err.Error())
klog.Errorf("check project name is exist failure %s", err.Error())
return nil, bcode.ErrProjectIsExist
}
if exist {
@@ -334,7 +334,7 @@ func (p *projectServiceImpl) CreateProject(ctx context.Context, req apisv1.Creat
}
if err := p.RbacService.SyncDefaultRoleAndUsersForProject(ctx, newProject); err != nil {
log.Logger.Errorf("fail to sync the default role and users for the project: %s", err.Error())
klog.Errorf("fail to sync the default role and users for the project: %s", err.Error())
}
return ConvertProjectModel2Base(newProject, user), nil

View File

@@ -26,6 +26,7 @@ import (
"sync"
"github.com/emicklei/go-restful/v3"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/types"
@@ -36,7 +37,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
apiserverutils "github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/auth"
"github.com/oam-dev/kubevela/pkg/utils"
)
@@ -590,7 +590,7 @@ func (p *rbacServiceImpl) CheckPerm(resource string, actions ...string) func(req
}
path, err := checkResourcePath(resource)
if err != nil {
log.Logger.Errorf("check resource path failure %s", err.Error())
klog.Errorf("check resource path failure %s", err.Error())
bcode.ReturnError(req, res, bcode.ErrForbidden)
return
}
@@ -634,7 +634,7 @@ func (p *rbacServiceImpl) CheckPerm(resource string, actions ...string) func(req
projectName := getProjectName()
permissions, err := p.GetUserPermissions(req.Request.Context(), user, projectName, true)
if err != nil {
log.Logger.Errorf("get user's perm policies failure %s, user is %s", err.Error(), user.Name)
klog.Errorf("get user's perm policies failure %s, user is %s", err.Error(), user.Name)
bcode.ReturnError(req, res, bcode.ErrForbidden)
return
}
@@ -696,7 +696,7 @@ func (p *rbacServiceImpl) DeleteRole(ctx context.Context, projectName, roleName
func (p *rbacServiceImpl) DeletePermission(ctx context.Context, projectName, permName string) error {
roles, _, err := repository.ListRoles(ctx, p.Store, projectName, 0, 0)
if err != nil {
log.Logger.Errorf("fail to list the roles: %s", err.Error())
klog.Errorf("fail to list the roles: %s", err.Error())
return bcode.ErrPermissionIsUsed
}
for _, role := range roles {
@@ -768,7 +768,7 @@ func (p *rbacServiceImpl) ListRole(ctx context.Context, projectName string, page
policies, err := p.listPermPolices(ctx, projectName, utils.MapKey2Array(policySet))
if err != nil {
log.Logger.Errorf("list perm policies failure %s", err.Error())
klog.Errorf("list perm policies failure %s", err.Error())
}
var policyMap = make(map[string]*model.Permission)
for i, policy := range policies {
@@ -1073,6 +1073,6 @@ func managePrivilegesForAdminUser(ctx context.Context, cli client.Client, roleNa
if err := f(ctx, cli, []auth.PrivilegeDescription{p}, identity, writer); err != nil {
return err
}
log.Logger.Debugf("%s: %s", msg, writer.String())
klog.Infof("%s: %s", msg, writer.String())
return nil
}

View File

@@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
@@ -30,7 +31,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/auth"
"github.com/oam-dev/kubevela/pkg/multicluster"
)
@@ -228,14 +228,14 @@ func (dt *targetServiceImpl) convertFromTargetModel(ctx context.Context, target
Name: target.Project,
}
if err := dt.Store.Get(ctx, &project); err != nil {
log.Logger.Errorf("get project failure %s", err.Error())
klog.Errorf("get project failure %s", err.Error())
}
targetBase.Project = apisv1.NameAlias{Name: project.Name, Alias: project.Alias}
}
if targetBase.Cluster != nil && targetBase.Cluster.ClusterName != "" {
cluster, err := _getClusterFromDataStore(ctx, dt.Store, target.Cluster.ClusterName)
if err != nil {
log.Logger.Errorf("query cluster info failure %s", err.Error())
klog.Errorf("query cluster info failure %s", err.Error())
}
if cluster != nil {
targetBase.ClusterAlias = cluster.Alias
@@ -259,7 +259,7 @@ func managePrivilegesForTarget(ctx context.Context, cli client.Client, target *m
if err := f(ctx, cli, []auth.PrivilegeDescription{p}, identity, writer); err != nil {
return err
}
log.Logger.Debugf("%s: %s", msg, writer.String())
klog.Infof("%s: %s", msg, writer.String())
return nil
}

View File

@@ -22,13 +22,13 @@ import (
"golang.org/x/crypto/bcrypt"
"helm.sh/helm/v3/pkg/time"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
pkgUtils "github.com/oam-dev/kubevela/pkg/utils"
)
@@ -84,12 +84,12 @@ func (u *userServiceImpl) Init(ctx context.Context) error {
return err
}
// print default password of admin user in log
log.Logger.Infof("initialized admin username and password: admin / %s", InitAdminPassword)
klog.Infof("initialized admin username and password: admin / %s", InitAdminPassword)
} else {
return err
}
}
log.Logger.Info("admin user is exist")
klog.Info("admin user is exist")
return nil
}
@@ -108,7 +108,7 @@ func (u *userServiceImpl) GetUser(ctx context.Context, username string) (*model.
func (u *userServiceImpl) DetailUser(ctx context.Context, user *model.User) (*apisv1.DetailUserResponse, error) {
roles, err := u.RbacService.ListRole(ctx, "", 0, 0)
if err != nil {
log.Logger.Warnf("list platform roles failure %s", err.Error())
klog.Warningf("list platform roles failure %s", err.Error())
}
detailUser := convertUserModel(user, roles)
pUser := &model.ProjectUser{
@@ -125,7 +125,7 @@ func (u *userServiceImpl) DetailUser(ctx context.Context, user *model.User) (*ap
if ok {
project, err := u.ProjectService.DetailProject(ctx, pu.ProjectName)
if err != nil {
log.Logger.Errorf("failed to delete project(%s) info: %s", pu.ProjectName, err.Error())
klog.Errorf("failed to delete project(%s) info: %s", pu.ProjectName, err.Error())
continue
}
detailUser.Projects = append(detailUser.Projects, project)
@@ -147,11 +147,11 @@ func (u *userServiceImpl) DeleteUser(ctx context.Context, username string) error
for _, v := range projectUsers {
pu := v.(*model.ProjectUser)
if err := u.Store.Delete(ctx, pu); err != nil {
log.Logger.Errorf("failed to delete project user %s: %s", pu.PrimaryKey(), err.Error())
klog.Errorf("failed to delete project user %s: %s", pu.PrimaryKey(), err.Error())
}
}
if err := u.Store.Delete(ctx, &model.User{Name: username}); err != nil {
log.Logger.Errorf("failed to delete user %s %v", pkgUtils.Sanitize(username), err.Error())
klog.Errorf("failed to delete user %s %v", pkgUtils.Sanitize(username), err.Error())
return err
}
return nil
@@ -261,7 +261,7 @@ func (u *userServiceImpl) ListUsers(ctx context.Context, page, pageSize int, lis
}
roles, err := u.RbacService.ListRole(ctx, "", 0, 0)
if err != nil {
log.Logger.Warnf("list platform roles failure %s", err.Error())
klog.Warningf("list platform roles failure %s", err.Error())
}
for _, v := range users {
user, ok := v.(*model.User)
@@ -312,7 +312,7 @@ func (u *userServiceImpl) DetailLoginUserInfo(ctx context.Context) (*apisv1.Logi
}
user, err := u.GetUser(ctx, userName)
if !ok {
log.Logger.Errorf("get login user model failure %s", err.Error())
klog.Errorf("get login user model failure %s", err.Error())
return nil, bcode.ErrUnauthorized
}
projects, err := u.ProjectService.ListUserProjects(ctx, userName)
@@ -323,7 +323,7 @@ func (u *userServiceImpl) DetailLoginUserInfo(ctx context.Context) (*apisv1.Logi
for _, project := range projects {
perms, err := u.RbacService.GetUserPermissions(ctx, user, project.Name, false)
if err != nil {
log.Logger.Errorf("list user %s perm policies from project %s failure %s", user.Name, project.Name, err.Error())
klog.Errorf("list user %s perm policies from project %s failure %s", user.Name, project.Name, err.Error())
continue
}
projectPermissions[project.Name] = func() (list []apisv1.PermissionBase) {
@@ -343,7 +343,7 @@ func (u *userServiceImpl) DetailLoginUserInfo(ctx context.Context) (*apisv1.Logi
}
perms, err := u.RbacService.GetUserPermissions(ctx, user, "", true)
if err != nil {
log.Logger.Errorf("list user %s platform perm policies failure %s", user.Name, err.Error())
klog.Errorf("list user %s platform perm policies failure %s", user.Name, err.Error())
}
var platformPermissions []apisv1.PermissionBase
for _, perm := range perms {

View File

@@ -22,6 +22,7 @@ import (
"strings"
"k8s.io/client-go/rest"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/kubevela/workflow/pkg/cue/packages"
@@ -29,7 +30,6 @@ import (
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/clients"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/oam/discoverymapper"
"github.com/oam-dev/kubevela/pkg/velaql"
)
@@ -50,12 +50,12 @@ type velaQLServiceImpl struct {
func NewVelaQLService() VelaQLService {
dm, err := clients.GetDiscoverMapper()
if err != nil {
log.Logger.Fatalf("get discover mapper failure %s", err.Error())
klog.Fatalf("get discover mapper failure %s", err.Error())
}
pd, err := clients.GetPackageDiscover()
if err != nil {
log.Logger.Fatalf("get package discover failure %s", err.Error())
klog.Fatalf("get package discover failure %s", err.Error())
}
return &velaQLServiceImpl{
dm: dm,
@@ -72,14 +72,14 @@ func (v *velaQLServiceImpl) QueryView(ctx context.Context, velaQL string) (*apis
queryValue, err := velaql.NewViewHandler(v.KubeClient, v.KubeConfig, v.dm, v.pd).QueryView(ctx, query)
if err != nil {
log.Logger.Errorf("fail to query the view %s", err.Error())
klog.Errorf("fail to query the view %s", err.Error())
return nil, bcode.ErrViewQuery
}
resp := apis.VelaQLViewResponse{}
err = queryValue.UnmarshalTo(&resp)
if err != nil {
log.Logger.Errorf("decode the velaQL response to json failure %s", err.Error())
klog.Errorf("decode the velaQL response to json failure %s", err.Error())
return nil, bcode.ErrParseQuery2Json
}
if strings.Contains(velaQL, "collect-logs") {

View File

@@ -25,12 +25,12 @@ import (
"github.com/emicklei/go-restful/v3"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/policy/envbinding"
)
@@ -215,13 +215,16 @@ func (c *customHandlerImpl) install() {
}
func (c *acrHandlerImpl) handle(ctx context.Context, webhookTrigger *model.ApplicationTrigger, app *model.Application) (interface{}, error) {
component, err := getComponent(ctx, c.w.Store, webhookTrigger)
if err != nil {
return nil, err
}
acrReq := c.req
image := fmt.Sprintf("registry.%s.aliyuncs.com/%s:%s", acrReq.Repository.Region, acrReq.Repository.RepoFullName, acrReq.PushData.Tag)
registry := webhookTrigger.Registry
if registry == "" {
registry = fmt.Sprintf("registry.%s.aliyuncs.com", acrReq.Repository.Region)
}
image := fmt.Sprintf("%s/%s:%s", registry, acrReq.Repository.RepoFullName, acrReq.PushData.Tag)
if err := c.w.patchComponentProperties(ctx, component, &runtime.RawExtension{
Raw: []byte(fmt.Sprintf(`{"image": "%s"}`, image)),
}); err != nil {
@@ -260,7 +263,7 @@ func (c *acrHandlerImpl) install() {
func (c dockerHubHandlerImpl) handle(ctx context.Context, trigger *model.ApplicationTrigger, app *model.Application) (interface{}, error) {
dockerHubReq := c.req
if dockerHubReq.Repository.Status != "Active" {
log.Logger.Debugf("receive dockerhub webhook but not create event: %v", dockerHubReq)
klog.Infof("receive dockerhub webhook but not create event: %v", dockerHubReq)
return &apisv1.ApplicationDockerhubWebhookResponse{
State: "failed",
Description: "not create event",
@@ -323,12 +326,12 @@ func parseTimeString(t string) time.Time {
l, err := time.LoadLocation("PRC")
if err != nil {
log.Logger.Errorf("failed to load location: %v", err)
klog.Errorf("failed to load location: %v", err)
return time.Time{}
}
parsedTime, err := time.ParseInLocation("2006-01-02 15:04:05", t, l)
if err != nil {
log.Logger.Errorf("failed to parse time: %v", err)
klog.Errorf("failed to parse time: %v", err)
return time.Time{}
}
return parsedTime

View File

@@ -196,6 +196,40 @@ var _ = Describe("Test application service function", func() {
Expect(err).Should(BeNil())
Expect((*comp.Properties)["image"]).Should(Equal("registry.test-region.aliyuncs.com/test-namespace/test-repo:test-tag"))
By("Test HandleApplicationWebhook function with ACR payload and registry info")
acrTrigger, err = appService.CreateApplicationTrigger(context.TODO(), appModel, apisv1.CreateApplicationTriggerRequest{
Name: "test-acr",
PayloadType: "acr",
Type: "webhook",
ComponentName: "component-name-webhook",
Registry: "test-enterprise-registry.test-region.cr.aliyuncs.com",
})
Expect(err).Should(BeNil())
acrBody = apisv1.HandleApplicationTriggerACRRequest{
PushData: apisv1.ACRPushData{
Digest: "test-digest",
Tag: "test-tag",
},
Repository: apisv1.ACRRepository{
Name: "test-repo",
Namespace: "test-namespace",
Region: "test-region",
RepoFullName: "test-namespace/test-repo",
RepoType: "public",
},
}
body, err = json.Marshal(acrBody)
Expect(err).Should(BeNil())
httpreq, err = http.NewRequest("post", "/", bytes.NewBuffer(body))
httpreq.Header.Add(restful.HEADER_ContentType, "application/json")
Expect(err).Should(BeNil())
_, err = webhookService.HandleApplicationWebhook(context.TODO(), acrTrigger.Token, restful.NewRequest(httpreq))
Expect(err).Should(BeNil())
comp, err = appService.GetApplicationComponent(context.TODO(), appModel, "component-name-webhook")
Expect(err).Should(BeNil())
Expect((*comp.Properties)["image"]).Should(Equal("test-enterprise-registry.test-region.cr.aliyuncs.com/test-namespace/test-repo:test-tag"))
By("Test HandleApplicationWebhook function with harbor payload")
harborTrigger, err := appService.CreateApplicationTrigger(context.TODO(), appModel, apisv1.CreateApplicationTriggerRequest{
Name: "test-harbor",

View File

@@ -42,7 +42,6 @@ import (
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/oam"
pkgUtils "github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/pkg/utils/apply"
@@ -93,11 +92,11 @@ func (w *workflowServiceImpl) DeleteWorkflow(ctx context.Context, app *model.App
}
records, err := w.Store.List(ctx, &record, &datastore.ListOptions{})
if err != nil {
log.Logger.Errorf("list workflow %s record failure %s", pkgUtils.Sanitize(workflow.PrimaryKey()), err.Error())
klog.Errorf("list workflow %s record failure %s", pkgUtils.Sanitize(workflow.PrimaryKey()), err.Error())
}
for _, record := range records {
if err := w.Store.Delete(ctx, record); err != nil {
log.Logger.Errorf("delete workflow record %s failure %s", record.PrimaryKey(), err.Error())
klog.Errorf("delete workflow record %s failure %s", record.PrimaryKey(), err.Error())
}
}
if err := w.Store.Delete(ctx, workflow); err != nil {
@@ -124,7 +123,7 @@ func (w *workflowServiceImpl) DeleteWorkflowByApp(ctx context.Context, app *mode
for i := range workflows {
workflow := workflows[i].(*model.Workflow)
if err := w.Store.Delete(ctx, workflow); err != nil {
log.Logger.Errorf("delete workflow %s failure %s", workflow.PrimaryKey(), err.Error())
klog.Errorf("delete workflow %s failure %s", workflow.PrimaryKey(), err.Error())
}
}
var record = model.WorkflowRecord{
@@ -132,11 +131,11 @@ func (w *workflowServiceImpl) DeleteWorkflowByApp(ctx context.Context, app *mode
}
records, err := w.Store.List(ctx, &record, &datastore.ListOptions{})
if err != nil {
log.Logger.Errorf("list workflow %s record failure %s", workflow.PrimaryKey(), err.Error())
klog.Errorf("list workflow %s record failure %s", workflow.PrimaryKey(), err.Error())
}
for _, record := range records {
if err := w.Store.Delete(ctx, record); err != nil {
log.Logger.Errorf("delete workflow record %s failure %s", record.PrimaryKey(), err.Error())
klog.Errorf("delete workflow record %s failure %s", record.PrimaryKey(), err.Error())
}
}
return nil
@@ -173,7 +172,7 @@ func (w *workflowServiceImpl) CreateOrUpdateWorkflow(ctx context.Context, app *m
EnvName: req.EnvName,
AppPrimaryKey: app.PrimaryKey(),
}
log.Logger.Infof("create workflow %s for app %s", pkgUtils.Sanitize(req.Name), pkgUtils.Sanitize(app.PrimaryKey()))
klog.Infof("create workflow %s for app %s", pkgUtils.Sanitize(req.Name), pkgUtils.Sanitize(app.PrimaryKey()))
if err := w.Store.Add(ctx, workflow); err != nil {
return nil, err
}
@@ -347,7 +346,7 @@ func (w *workflowServiceImpl) SyncWorkflowRecord(ctx context.Context) error {
}, app); err != nil {
if apierrors.IsNotFound(err) {
if err := w.setRecordToTerminated(ctx, record.AppPrimaryKey, record.Name); err != nil {
log.Logger.Errorf("failed to set the record status to terminated %s", err.Error())
klog.Errorf("failed to set the record status to terminated %s", err.Error())
}
continue
}
@@ -384,12 +383,12 @@ func (w *workflowServiceImpl) SyncWorkflowRecord(ctx context.Context) error {
record.Status = model.RevisionStatusFail
err := w.Store.Put(ctx, record)
if err != nil {
log.Logger.Errorf("failed to set the workflow status is failure %s", err.Error())
klog.Errorf("failed to set the workflow status is failure %s", err.Error())
}
continue
}
}
log.Logger.Errorf("failed to get the application revision from database %s", err.Error())
klog.Errorf("failed to get the application revision from database %s", err.Error())
continue
}
@@ -397,11 +396,11 @@ func (w *workflowServiceImpl) SyncWorkflowRecord(ctx context.Context) error {
if err := w.KubeClient.Get(ctx, types.NamespacedName{Namespace: app.Namespace, Name: revision.RevisionCRName}, &appRevision); err != nil {
if apierrors.IsNotFound(err) {
if err := w.setRecordToTerminated(ctx, record.AppPrimaryKey, record.Name); err != nil {
log.Logger.Errorf("failed to set the record status to terminated %s", err.Error())
klog.Errorf("failed to set the record status to terminated %s", err.Error())
}
continue
}
log.Logger.Warnf("failed to get the application revision %s", err.Error())
klog.Warningf("failed to get the application revision %s", err.Error())
continue
}
@@ -638,7 +637,7 @@ func resetRevisionsAndRecords(ctx context.Context, ds datastore.DataStore, appNa
func (w *workflowServiceImpl) CountWorkflow(ctx context.Context, app *model.Application) int64 {
count, err := w.Store.Count(ctx, &model.Workflow{AppPrimaryKey: app.PrimaryKey()}, &datastore.FilterOptions{})
if err != nil {
log.Logger.Errorf("count app %s workflow failure %s", app.PrimaryKey(), err.Error())
klog.Errorf("count app %s workflow failure %s", app.PrimaryKey(), err.Error())
}
return count
}
@@ -754,7 +753,7 @@ func (w *workflowServiceImpl) RollbackRecord(ctx context.Context, appModel *mode
return bcode.ErrApplicationNoReadyRevision
}
revisionVersion = revisions[0].Index()["version"]
log.Logger.Infof("select lastest complete revision %s", revisions[0].Index()["version"])
klog.Infof("select lastest complete revision %s", revisions[0].Index()["version"])
}
var record = &model.WorkflowRecord{

View File

@@ -33,11 +33,11 @@ import (
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/robfig/cron/v3"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/util/retry"
"k8s.io/klog/v2"
)
// TopKFrequent top frequency component or trait definition
@@ -81,14 +81,14 @@ func (i *InfoCalculateCronJob) start(cronSpec string) {
return true
}, func() error {
if err := i.run(); err != nil {
log.Logger.Errorf("Failed to calculate systemInfo, will try again after several minute error %v", err)
klog.Errorf("Failed to calculate systemInfo, will try again after several minute error %v", err)
return err
}
log.Logger.Info("Successfully to calculate systemInfo")
klog.Info("Successfully to calculate systemInfo")
return nil
})
if err != nil {
log.Logger.Errorf("After 5 tries the calculating cronJob failed: %v", err)
klog.Errorf("After 5 tries the calculating cronJob failed: %v", err)
}
})
i.cron = c

View File

@@ -22,10 +22,11 @@ import (
"strconv"
"strings"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/oam"
)
@@ -91,7 +92,7 @@ func (c *CR2UX) shouldSync(ctx context.Context, targetApp *v1beta1.Application,
if del || err != nil {
c.cache.Delete(key)
} else if cd.generation == targetApp.Generation {
log.Logger.Infof("app %s/%s with generation(%v) hasn't updated, ignore the sync event..", targetApp.Name, targetApp.Namespace, targetApp.Generation)
klog.Infof("app %s/%s with generation(%v) hasn't updated, ignore the sync event..", targetApp.Name, targetApp.Namespace, targetApp.Generation)
return false
}
}

View File

@@ -24,6 +24,7 @@ import (
workflowv1alpha1 "github.com/kubevela/workflow/api/v1alpha1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
@@ -31,7 +32,6 @@ import (
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/multicluster"
"github.com/oam-dev/kubevela/pkg/policy"
)
@@ -167,7 +167,7 @@ func FromCRTargets(ctx context.Context, cli client.Client, targetApp *v1beta1.Ap
// read the target from the topology policies
placements, err := policy.GetPlacementsFromTopologyPolicies(ctx, cli, targetApp.Namespace, targetApp.Spec.Policies, true)
if err != nil {
log.Logger.Errorf("fail to get placements from topology policies %s", err.Error())
klog.Errorf("fail to get placements from topology policies %s", err.Error())
return targets, targetNames
}
for _, placement := range placements {
@@ -256,7 +256,7 @@ func FromCRApplicationRevision(ctx context.Context, cli client.Client, app *v1be
ctxTimeout, cancel := context.WithTimeout(ctx, time.Second*20)
defer cancel()
if err := cli.Get(ctxTimeout, types.NamespacedName{Namespace: app.Namespace, Name: versionName}, &appRevision); err != nil {
log.Logger.Errorf("failed to get the application revision %s", err.Error())
klog.Errorf("failed to get the application revision %s", err.Error())
return nil
}
configByte, _ := yaml.Marshal(appRevision.Spec.Application)

View File

@@ -20,13 +20,13 @@ import (
"context"
"sync"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// getApp will return the app and appname if exists
@@ -81,52 +81,52 @@ func (c *CR2UX) AddOrUpdate(ctx context.Context, targetApp *v1beta1.Application)
dsApp, err := c.ConvertApp2DatastoreApp(ctx, targetApp)
if err != nil {
log.Logger.Errorf("Convert App to data store err %v", err)
klog.Errorf("Convert App to data store err %v", err)
return err
}
if err = StoreProject(ctx, dsApp.AppMeta.Project, ds, c.projectService); err != nil {
log.Logger.Errorf("get or create project for sync process err %v", err)
klog.Errorf("get or create project for sync process err %v", err)
return err
}
if err = StoreTargets(ctx, dsApp, ds, c.targetService); err != nil {
log.Logger.Errorf("Store targets to data store err %v", err)
klog.Errorf("Store targets to data store err %v", err)
return err
}
if err = StoreEnv(ctx, dsApp, ds, c.envService); err != nil {
log.Logger.Errorf("Store Env Metadata to data store err %v", err)
klog.Errorf("Store Env Metadata to data store err %v", err)
return err
}
if err = StoreEnvBinding(ctx, dsApp.Eb, ds); err != nil {
log.Logger.Errorf("Store EnvBinding Metadata to data store err %v", err)
klog.Errorf("Store EnvBinding Metadata to data store err %v", err)
return err
}
if err = StoreComponents(ctx, dsApp.AppMeta.Name, dsApp.Comps, ds); err != nil {
log.Logger.Errorf("Store Components Metadata to data store err %v", err)
klog.Errorf("Store Components Metadata to data store err %v", err)
return err
}
if err = StorePolicy(ctx, dsApp.AppMeta.Name, dsApp.Policies, ds); err != nil {
log.Logger.Errorf("Store Policy Metadata to data store err %v", err)
klog.Errorf("Store Policy Metadata to data store err %v", err)
return err
}
if err = StoreWorkflow(ctx, dsApp, ds); err != nil {
log.Logger.Errorf("Store Workflow Metadata to data store err %v", err)
klog.Errorf("Store Workflow Metadata to data store err %v", err)
return err
}
if err = StoreApplicationRevision(ctx, dsApp, ds); err != nil {
log.Logger.Errorf("Store application revision to data store err %v", err)
klog.Errorf("Store application revision to data store err %v", err)
return err
}
if err = StoreWorkflowRecord(ctx, dsApp, ds); err != nil {
log.Logger.Errorf("Store Workflow Record to data store err %v", err)
klog.Errorf("Store Workflow Record to data store err %v", err)
return err
}
if err = StoreAppMeta(ctx, dsApp, ds); err != nil {
log.Logger.Errorf("Store App Metadata to data store err %v", err)
klog.Errorf("Store App Metadata to data store err %v", err)
return err
}

View File

@@ -22,13 +22,13 @@ import (
"golang.org/x/text/cases"
"golang.org/x/text/language"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
v1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/utils"
)
@@ -152,7 +152,7 @@ func StoreComponents(ctx context.Context, appPrimaryKey string, expComps []*mode
if errors.Is(err, datastore.ErrRecordNotExist) {
continue
}
log.Logger.Warnf("delete comp %s for app %s failure %s", comp.Name, appPrimaryKey, err.Error())
klog.Warningf("delete comp %s for app %s failure %s", comp.Name, appPrimaryKey, err.Error())
}
}
@@ -167,7 +167,7 @@ func StoreComponents(ctx context.Context, appPrimaryKey string, expComps []*mode
err = ds.Put(ctx, comp)
}
if err != nil {
log.Logger.Warnf("convert comp %s for app %s into datastore failure %s", comp.Name, utils.Sanitize(appPrimaryKey), err.Error())
klog.Warningf("convert comp %s for app %s into datastore failure %s", comp.Name, utils.Sanitize(appPrimaryKey), err.Error())
return err
}
}
@@ -212,7 +212,7 @@ func StorePolicy(ctx context.Context, appPrimaryKey string, expPolicies []*model
if errors.Is(err, datastore.ErrRecordNotExist) {
continue
}
log.Logger.Warnf("delete policy %s for app %s failure %s", plc.Name, appPrimaryKey, err.Error())
klog.Warningf("delete policy %s for app %s failure %s", plc.Name, appPrimaryKey, err.Error())
}
}
@@ -227,7 +227,7 @@ func StorePolicy(ctx context.Context, appPrimaryKey string, expPolicies []*model
err = ds.Put(ctx, plc)
}
if err != nil {
log.Logger.Warnf("convert policy %s for app %s into datastore failure %s", plc.Name, utils.Sanitize(appPrimaryKey), err.Error())
klog.Warningf("convert policy %s for app %s into datastore failure %s", plc.Name, utils.Sanitize(appPrimaryKey), err.Error())
return err
}
}

View File

@@ -29,12 +29,12 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// ApplicationSync sync application from cluster to database
@@ -65,7 +65,7 @@ func (a *ApplicationSync) Start(ctx context.Context, errorChan chan error) {
var app v1beta1.Application
if object, ok := obj.(*unstructured.Unstructured); ok {
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(object.Object, &app); err != nil {
log.Logger.Errorf("decode the application failure %s", err.Error())
klog.Errorf("decode the application failure %s", err.Error())
return &app
}
}
@@ -91,7 +91,7 @@ func (a *ApplicationSync) Start(ctx context.Context, errorChan chan error) {
break
}
if err := cu.AddOrUpdate(ctx, app.(*v1beta1.Application)); err != nil {
log.Logger.Errorf("fail to add or update application %s", err.Error())
klog.Errorf("fail to add or update application %s", err.Error())
}
a.Queue.Done(app)
}
@@ -101,7 +101,7 @@ func (a *ApplicationSync) Start(ctx context.Context, errorChan chan error) {
app := getApp(obj)
if app.DeletionTimestamp == nil {
a.Queue.Add(app)
log.Logger.Infof("watched update/add app event, namespace: %s, name: %s", app.Namespace, app.Name)
klog.Infof("watched update/add app event, namespace: %s, name: %s", app.Namespace, app.Name)
}
}
@@ -114,17 +114,17 @@ func (a *ApplicationSync) Start(ctx context.Context, errorChan chan error) {
},
DeleteFunc: func(obj interface{}) {
app := getApp(obj)
log.Logger.Infof("watched delete app event, namespace: %s, name: %s", app.Namespace, app.Name)
klog.Infof("watched delete app event, namespace: %s, name: %s", app.Namespace, app.Name)
a.Queue.Forget(app)
a.Queue.Done(app)
err = cu.DeleteApp(ctx, app)
if err != nil {
log.Logger.Errorf("Application %-30s Deleted Sync to db err %v", color.WhiteString(app.Namespace+"/"+app.Name), err)
klog.Errorf("Application %-30s Deleted Sync to db err %v", color.WhiteString(app.Namespace+"/"+app.Name), err)
}
log.Logger.Infof("delete the application (%s/%s) metadata successfully", app.Namespace, app.Name)
klog.Infof("delete the application (%s/%s) metadata successfully", app.Namespace, app.Name)
},
}
informer.AddEventHandler(handlers)
log.Logger.Info("app syncing started")
klog.Info("app syncing started")
informer.Run(ctx.Done())
}

View File

@@ -20,8 +20,9 @@ import (
"context"
"time"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// WorkflowRecordSync sync workflow record from cluster to database
@@ -32,15 +33,15 @@ type WorkflowRecordSync struct {
// Start sync workflow record data
func (w *WorkflowRecordSync) Start(ctx context.Context, errorChan chan error) {
log.Logger.Infof("workflow record syncing worker started")
defer log.Logger.Infof("workflow record syncing worker closed")
klog.Infof("workflow record syncing worker started")
defer klog.Infof("workflow record syncing worker closed")
t := time.NewTicker(w.Duration)
defer t.Stop()
for {
select {
case <-t.C:
if err := w.WorkflowService.SyncWorkflowRecord(ctx); err != nil {
log.Logger.Errorf("syncWorkflowRecordError: %s", err.Error())
klog.Errorf("syncWorkflowRecordError: %s", err.Error())
}
case <-ctx.Done():
return

View File

@@ -32,11 +32,11 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/clients"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
type kubeapi struct {
@@ -135,7 +135,7 @@ func (m *kubeapi) BatchAdd(ctx context.Context, entities []datastore.Entity) err
if _, exit := notRollback[deleteEntity.PrimaryKey()]; !exit {
if err := m.Delete(ctx, deleteEntity); err != nil {
if !errors.Is(err, datastore.ErrRecordNotExist) {
log.Logger.Errorf("rollback delete entity failure %w", err)
klog.Errorf("rollback delete entity failure %w", err)
}
}
}
@@ -366,7 +366,7 @@ func (m *kubeapi) List(ctx context.Context, entity datastore.Entity, op *datasto
}
rq, err := labels.NewRequirement(inFilter.Key, selection.In, values)
if err != nil {
log.Logger.Errorf("new list requirement failure %s", err.Error())
klog.Errorf("new list requirement failure %s", err.Error())
return nil, datastore.ErrIndexInvalid
}
selector = selector.Add(*rq)
@@ -374,7 +374,7 @@ func (m *kubeapi) List(ctx context.Context, entity datastore.Entity, op *datasto
for _, notFilter := range op.IsNotExist {
rq, err := labels.NewRequirement(notFilter.Key, selection.DoesNotExist, []string{})
if err != nil {
log.Logger.Errorf("new list requirement failure %s", err.Error())
klog.Errorf("new list requirement failure %s", err.Error())
return nil, datastore.ErrIndexInvalid
}
selector = selector.Add(*rq)
@@ -463,7 +463,7 @@ func (m *kubeapi) Count(ctx context.Context, entity datastore.Entity, filterOpti
for _, notFilter := range filterOptions.IsNotExist {
rq, err := labels.NewRequirement(notFilter.Key, selection.DoesNotExist, []string{})
if err != nil {
log.Logger.Errorf("new list requirement failure %s", err.Error())
klog.Errorf("new list requirement failure %s", err.Error())
return 0, datastore.ErrIndexInvalid
}
selector = selector.Add(*rq)

View File

@@ -23,7 +23,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"

View File

@@ -27,9 +27,9 @@ import (
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"go.mongodb.org/mongo-driver/x/bsonx"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
type mongodb struct {
@@ -95,7 +95,7 @@ func (m *mongodb) BatchAdd(ctx context.Context, entities []datastore.Entity) err
if _, exit := notRollback[deleteEntity.PrimaryKey()]; !exit {
if err := m.Delete(ctx, deleteEntity); err != nil {
if !errors.Is(err, datastore.ErrRecordNotExist) {
log.Logger.Errorf("rollback delete entity failure %w", err)
klog.Errorf("rollback delete entity failure %w", err)
}
}
}
@@ -185,7 +185,7 @@ func (m *mongodb) Delete(ctx context.Context, entity datastore.Entity) error {
})
_, err := collection.DeleteOne(ctx, makeNameFilter(entity.PrimaryKey()), opts)
if err != nil {
log.Logger.Errorf("delete document failure %w", err)
klog.Errorf("delete document failure %w", err)
return datastore.NewDBError(err)
}
return nil
@@ -243,7 +243,7 @@ func (m *mongodb) List(ctx context.Context, entity datastore.Entity, op *datasto
}
defer func() {
if err := cur.Close(ctx); err != nil {
log.Logger.Warnf("close mongodb cursor failure %s", err.Error())
klog.Warningf("close mongodb cursor failure %s", err.Error())
}
}()
var list []datastore.Entity

View File

@@ -20,6 +20,8 @@ import (
"context"
"strconv"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
restfulspec "github.com/emicklei/go-restful-openapi/v2"
@@ -29,7 +31,6 @@ import (
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
type applicationAPIInterface struct {
@@ -601,7 +602,7 @@ func (c *applicationAPIInterface) createApplication(req *restful.Request, res *r
// Call the domain layer code
appBase, err := c.ApplicationService.CreateApplication(req.Request.Context(), createReq)
if err != nil {
log.Logger.Errorf("create application failure %s", err.Error())
klog.Errorf("create application failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -17,10 +17,11 @@ limitations under the License.
package v1
import (
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
apisv1 "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// CreateEnvBindingModel assemble the EnvBinding model from DTO
@@ -71,7 +72,7 @@ func CreateWorkflowStepModel(apiSteps []apisv1.WorkflowStep) ([]model.WorkflowSt
func CreateWorkflowStepBaseModel(step apisv1.WorkflowStepBase) (*model.WorkflowStepBase, error) {
properties, err := model.NewJSONStructByString(step.Properties)
if err != nil {
log.Logger.Errorf("parse trait workflow step failure %w", err)
klog.Errorf("parse trait workflow step failure %w", err)
return nil, bcode.ErrInvalidProperties
}
return &model.WorkflowStepBase{

View File

@@ -129,6 +129,8 @@ type EnableAddonRequest struct {
Clusters []string `json:"clusters,omitempty"`
// Version specify the version of addon to enable
Version string `json:"version,omitempty"`
// RegistryName specify the registry name
RegistryName string `json:"registryName,omitempty"`
}
// ListAddonResponse defines the format for addon list response
@@ -504,6 +506,7 @@ type CreateApplicationTriggerRequest struct {
Type string `json:"type" validate:"oneof=webhook"`
PayloadType string `json:"payloadType" validate:"checkpayloadtype"`
ComponentName string `json:"componentName,omitempty" optional:"true"`
Registry string `json:"registry,omitempty" optional:"true"`
}
// ApplicationTriggerBase application trigger base model

View File

@@ -19,12 +19,12 @@ package api
import (
restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/emicklei/go-restful/v3"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
type envAPIInterface struct {
@@ -118,7 +118,7 @@ func (n *envAPIInterface) delete(req *restful.Request, res *restful.Response) {
return
}
if len(lists) > 0 {
log.Logger.Infof("detected %d applications in this env, the first is %s", len(lists), lists[0].Name)
klog.Infof("detected %d applications in this env, the first is %s", len(lists), lists[0].Name)
bcode.ReturnError(req, res, bcode.ErrDeleteEnvButAppExist)
return
}
@@ -148,7 +148,7 @@ func (n *envAPIInterface) create(req *restful.Request, res *restful.Response) {
// Call the Domain layer code
env, err := n.EnvService.CreateEnv(req.Request.Context(), createReq)
if err != nil {
log.Logger.Errorf("create application failure %s", err.Error())
klog.Errorf("create application failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -19,11 +19,11 @@ package api
import (
restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/emicklei/go-restful/v3"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
type oamApplicationAPIInterface struct {
@@ -82,7 +82,7 @@ func (c *oamApplicationAPIInterface) getApplication(req *restful.Request, res *r
appName := req.PathParameter("appname")
appRes, err := c.OamApplicationService.GetOAMApplication(req.Request.Context(), appName, namespace)
if err != nil {
log.Logger.Errorf("get application failure %s", err.Error())
klog.Errorf("get application failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -111,13 +111,13 @@ func (c *oamApplicationAPIInterface) createOrUpdateApplication(req *restful.Requ
return
}
if err := c.OamApplicationService.DryRunOAMApplication(req.Request.Context(), createReq, appName, namespace); err != nil {
log.Logger.Errorf("dryrun application failure %s", err.Error())
klog.Errorf("dryrun application failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
} else {
if err := c.OamApplicationService.CreateOrUpdateOAMApplication(req.Request.Context(), createReq, appName, namespace); err != nil {
log.Logger.Errorf("create application failure %s", err.Error())
klog.Errorf("create application failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -135,7 +135,7 @@ func (c *oamApplicationAPIInterface) deleteApplication(req *restful.Request, res
err := c.OamApplicationService.DeleteOAMApplication(req.Request.Context(), appName, namespace)
if err != nil {
log.Logger.Errorf("delete application failure %s", err.Error())
klog.Errorf("delete application failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -24,11 +24,11 @@ import (
"github.com/emicklei/go-restful/v3"
"github.com/kubevela/workflow/api/v1alpha1"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
const (
@@ -256,7 +256,7 @@ func (n *pipelineAPIInterface) listPipelines(req *restful.Request, res *restful.
Detailed: detailed,
})
if err != nil {
log.Logger.Errorf("list pipeline failure %s", err.Error())
klog.Errorf("list pipeline failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -289,13 +289,13 @@ func (n *projectAPIInterface) createPipeline(req *restful.Request, res *restful.
}
pipelineBase, err := n.PipelineService.CreatePipeline(req.Request.Context(), createReq)
if err != nil {
log.Logger.Errorf("create pipeline failure %s", err.Error())
klog.Errorf("create pipeline failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
_, err = n.ContextService.InitContext(req.Request.Context(), pipelineBase.Project.Name, pipelineBase.Name)
if err != nil {
log.Logger.Errorf("init pipeline context failure: %s", err.Error())
klog.Errorf("init pipeline context failure: %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -318,7 +318,7 @@ func (n *projectAPIInterface) updatePipeline(req *restful.Request, res *restful.
pipeline := req.Request.Context().Value(&apis.CtxKeyPipeline).(apis.PipelineBase)
pipelineBase, err := n.PipelineService.UpdatePipeline(req.Request.Context(), pipeline.Name, updateReq)
if err != nil {
log.Logger.Errorf("update pipeline failure %s", err.Error())
klog.Errorf("update pipeline failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -332,7 +332,7 @@ func (n *projectAPIInterface) deletePipeline(req *restful.Request, res *restful.
pipeline := req.Request.Context().Value(&apis.CtxKeyPipeline).(apis.PipelineBase)
err := n.PipelineService.DeletePipeline(req.Request.Context(), pipeline)
if err != nil {
log.Logger.Errorf("delete pipeline failure %s", err.Error())
klog.Errorf("delete pipeline failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -352,7 +352,7 @@ func (n *projectAPIInterface) runPipeline(req *restful.Request, res *restful.Res
run, err := n.PipelineService.RunPipeline(req.Request.Context(), pipeline, runReq)
if err != nil {
log.Logger.Errorf("run pipeline failure %s", err.Error())
klog.Errorf("run pipeline failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -366,7 +366,7 @@ func (n *projectAPIInterface) stopPipeline(req *restful.Request, res *restful.Re
pipelineRun := req.Request.Context().Value(&apis.CtxKeyPipelineRun).(*apis.PipelineRun)
err := n.PipelineRunService.StopPipelineRun(req.Request.Context(), pipelineRun.PipelineRunBase)
if err != nil {
log.Logger.Errorf("stop pipeline failure %s", err.Error())
klog.Errorf("stop pipeline failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -380,7 +380,7 @@ func (n *projectAPIInterface) listPipelineRuns(req *restful.Request, res *restfu
pipeline := req.Request.Context().Value(&apis.CtxKeyPipeline).(apis.PipelineBase)
pipelineRuns, err := n.PipelineRunService.ListPipelineRuns(req.Request.Context(), pipeline)
if err != nil {
log.Logger.Errorf("list pipeline runs failure %s", err.Error())
klog.Errorf("list pipeline runs failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -410,7 +410,7 @@ func (n *projectAPIInterface) getPipelineRunLog(req *restful.Request, res *restf
pipelineRun := req.Request.Context().Value(&apis.CtxKeyPipelineRun).(*apis.PipelineRun)
logs, err := n.PipelineRunService.GetPipelineRunLog(req.Request.Context(), *pipelineRun, req.QueryParameter("step"))
if err != nil {
log.Logger.Errorf("get pipeline run log failure %s", err.Error())
klog.Errorf("get pipeline run log failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -450,7 +450,7 @@ func (n *projectAPIInterface) deletePipelineRun(req *restful.Request, res *restf
pipelineRun := req.Request.Context().Value(&apis.CtxKeyPipelineRun).(*apis.PipelineRun)
err := n.PipelineRunService.DeletePipelineRun(req.Request.Context(), pipelineRun.PipelineRunMeta)
if err != nil {
log.Logger.Errorf("delete pipeline run failure %s", err.Error())
klog.Errorf("delete pipeline run failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -464,7 +464,7 @@ func (n *projectAPIInterface) listContextValues(req *restful.Request, res *restf
pipeline := req.Request.Context().Value(&apis.CtxKeyPipeline).(apis.PipelineBase)
contextValues, err := n.ContextService.ListContexts(req.Request.Context(), pipeline.Project.Name, pipeline.Name)
if err != nil {
log.Logger.Errorf("list context values failure: %s", err.Error())
klog.Errorf("list context values failure: %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -489,7 +489,7 @@ func (n *projectAPIInterface) createContextValue(req *restful.Request, res *rest
pipelineCtx := apis.Context(createReq)
_, err := n.ContextService.CreateContext(req.Request.Context(), pipeline.Project.Name, pipeline.Name, pipelineCtx)
if err != nil {
log.Logger.Errorf("create context failure %s", err.Error())
klog.Errorf("create context failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -514,7 +514,7 @@ func (n *projectAPIInterface) updateContextValue(req *restful.Request, res *rest
pipelineCtx := apis.Context{Name: plCtx.Name, Values: updateReq.Values}
_, err := n.ContextService.UpdateContext(req.Request.Context(), pipeline.Project.Name, pipeline.Name, pipelineCtx)
if err != nil {
log.Logger.Errorf("update context failure %s", err.Error())
klog.Errorf("update context failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -529,7 +529,7 @@ func (n *projectAPIInterface) deleteContextValue(req *restful.Request, res *rest
pipeline := req.Request.Context().Value(&apis.CtxKeyPipeline).(apis.PipelineBase)
err := n.ContextService.DeleteContext(req.Request.Context(), pipeline.Project.Name, pipeline.Name, plCtx.Name)
if err != nil {
log.Logger.Errorf("delete context failure %s", err.Error())
klog.Errorf("delete context failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -19,12 +19,12 @@ package api
import (
restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/emicklei/go-restful/v3"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/config"
)
@@ -345,7 +345,7 @@ func (n *projectAPIInterface) createproject(req *restful.Request, res *restful.R
// Call the domain layer code
projectBase, err := n.ProjectService.CreateProject(req.Request.Context(), createReq)
if err != nil {
log.Logger.Errorf("create project failure %s", err.Error())
klog.Errorf("create project failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -371,7 +371,7 @@ func (n *projectAPIInterface) updateProject(req *restful.Request, res *restful.R
// Call the domain layer code
projectBase, err := n.ProjectService.UpdateProject(req.Request.Context(), req.PathParameter("projectName"), updateReq)
if err != nil {
log.Logger.Errorf("update project failure %s", err.Error())
klog.Errorf("update project failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -445,7 +445,7 @@ func (n *projectAPIInterface) createProjectUser(req *restful.Request, res *restf
// Call the domain layer code
userBase, err := n.ProjectService.AddProjectUser(req.Request.Context(), req.PathParameter("projectName"), createReq)
if err != nil {
log.Logger.Errorf("create project user failure %s", err.Error())
klog.Errorf("create project user failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -466,7 +466,7 @@ func (n *projectAPIInterface) listProjectUser(req *restful.Request, res *restful
// Call the domain layer code
users, err := n.ProjectService.ListProjectUser(req.Request.Context(), req.PathParameter("projectName"), page, pageSize)
if err != nil {
log.Logger.Errorf("list project users failure %s", err.Error())
klog.Errorf("list project users failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -496,7 +496,7 @@ func (n *projectAPIInterface) updateProjectUser(req *restful.Request, res *restf
// Call the domain layer code
userBase, err := n.ProjectService.UpdateProjectUser(req.Request.Context(), req.PathParameter("projectName"), req.PathParameter("userName"), updateReq)
if err != nil {
log.Logger.Errorf("update project user failure %s", err.Error())
klog.Errorf("update project user failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -512,7 +512,7 @@ func (n *projectAPIInterface) deleteProjectUser(req *restful.Request, res *restf
// Call the domain layer code
err := n.ProjectService.DeleteProjectUser(req.Request.Context(), req.PathParameter("projectName"), req.PathParameter("userName"))
if err != nil {
log.Logger.Errorf("delete project user failure %s", err.Error())
klog.Errorf("delete project user failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -563,7 +563,7 @@ func (n *projectAPIInterface) createProjectRole(req *restful.Request, res *restf
// Call the domain layer code
projectBase, err := n.RbacService.CreateRole(req.Request.Context(), req.PathParameter("projectName"), createReq)
if err != nil {
log.Logger.Errorf("create role failure %s", err.Error())
klog.Errorf("create role failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -593,7 +593,7 @@ func (n *projectAPIInterface) updateProjectRole(req *restful.Request, res *restf
// Call the domain layer code
roleBase, err := n.RbacService.UpdateRole(req.Request.Context(), req.PathParameter("projectName"), req.PathParameter("roleName"), updateReq)
if err != nil {
log.Logger.Errorf("update role failure %s", err.Error())
klog.Errorf("update role failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -652,7 +652,7 @@ func (n *projectAPIInterface) createProjectPermission(req *restful.Request, res
// Call the domain layer code
permissionBase, err := n.RbacService.CreatePermission(req.Request.Context(), req.PathParameter("projectName"), createReq)
if err != nil {
log.Logger.Errorf("create the permission failure %s", err.Error())
klog.Errorf("create the permission failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -19,12 +19,12 @@ package api
import (
restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/emicklei/go-restful/v3"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
type rbacAPIInterface struct {
@@ -135,7 +135,7 @@ func (r *rbacAPIInterface) createPlatformRole(req *restful.Request, res *restful
// Call the domain layer code
projectBase, err := r.RbacService.CreateRole(req.Request.Context(), "", createReq)
if err != nil {
log.Logger.Errorf("create role failure %s", err.Error())
klog.Errorf("create role failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -161,7 +161,7 @@ func (r *rbacAPIInterface) updatePlatformRole(req *restful.Request, res *restful
// Call the domain layer code
roleBase, err := r.RbacService.UpdateRole(req.Request.Context(), "", req.PathParameter("roleName"), updateReq)
if err != nil {
log.Logger.Errorf("update role failure %s", err.Error())
klog.Errorf("update role failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}
@@ -212,7 +212,7 @@ func (r *rbacAPIInterface) createPlatformPermission(req *restful.Request, res *r
// Call the domain layer code
permissionBase, err := r.RbacService.CreatePermission(req.Request.Context(), "", createReq)
if err != nil {
log.Logger.Errorf("create the permission failure %s", err.Error())
klog.Errorf("create the permission failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -20,6 +20,7 @@ import (
"context"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
@@ -31,7 +32,6 @@ import (
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// NewTargetAPIInterface new Target Interface
@@ -121,7 +121,7 @@ func (dt *TargetAPIInterface) createTarget(req *restful.Request, res *restful.Re
// Call the domain layer code
TargetDetail, err := dt.TargetService.CreateTarget(req.Request.Context(), createReq)
if err != nil {
log.Logger.Errorf("create -target failure %s", err.Error())
klog.Errorf("create -target failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -20,13 +20,13 @@ import (
"context"
restful "github.com/emicklei/go-restful/v3"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/model"
"github.com/oam-dev/kubevela/pkg/apiserver/domain/service"
apis "github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api/dto/v1"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/bcode"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// WorkflowAPIInterface workflow api
@@ -79,7 +79,7 @@ func (w *WorkflowAPIInterface) createOrUpdateApplicationWorkflow(req *restful.Re
// Call the domain service layer code
workflowDetail, err := w.WorkflowService.CreateOrUpdateWorkflow(req.Request.Context(), app, createReq)
if err != nil {
log.Logger.Errorf("create application failure %s", err.Error())
klog.Errorf("create application failure %s", err.Error())
bcode.ReturnError(req, res, err)
return
}

View File

@@ -41,7 +41,6 @@ import (
"github.com/oam-dev/kubevela/pkg/apiserver/interfaces/api"
"github.com/oam-dev/kubevela/pkg/apiserver/utils"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/container"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
pkgconfig "github.com/oam-dev/kubevela/pkg/config"
pkgUtils "github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/pkg/utils/apply"
@@ -256,14 +255,14 @@ func (s *restServer) requestLog(req *restful.Request, resp *restful.Response, ch
resp.ResponseWriter = c
chain.ProcessFilter(req, resp)
takeTime := time.Since(start)
log.Logger.With(
klog.InfoS("request log",
"clientIP", pkgUtils.Sanitize(utils.ClientIP(req.Request)),
"path", pkgUtils.Sanitize(req.Request.URL.Path),
"method", req.Request.Method,
"status", c.StatusCode(),
"time", takeTime.String(),
"responseSize", len(c.Bytes()),
).Infof("request log")
)
}
func (s *restServer) OPTIONSFilter(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {
@@ -299,7 +298,7 @@ func enrichSwaggerObject(swo *spec.Swagger) {
func (s *restServer) startHTTP(ctx context.Context) error {
// Start HTTP apiserver
log.Logger.Infof("HTTP APIs are being served on: %s, ctx: %s", s.cfg.BindAddr, ctx)
klog.Infof("HTTP APIs are being served on: %s, ctx: %s", s.cfg.BindAddr, ctx)
server := &http.Server{Addr: s.cfg.BindAddr, Handler: s.webContainer, ReadHeaderTimeout: 2 * time.Second}
return server.ListenAndServe()
}

View File

@@ -73,6 +73,9 @@ var (
// ErrCloudShellNotInit means the cloudshell CR not created
ErrCloudShellNotInit = NewBcode(400, 50021, "Closing the console window and retry")
// ErrRegistryNotExist means the specified registry not exist
ErrRegistryNotExist = NewBcode(400, 50022, "The specified not exist")
)
// isGithubRateLimit check if error is github rate limit

View File

@@ -37,4 +37,7 @@ var (
// ErrNotFoundDistribution means the distribution is not exist
ErrNotFoundDistribution = NewBcode(404, 16007, "the distribution is not exist")
// ErrChangeSecretType the secret type of the config can not be change
ErrChangeSecretType = NewBcode(400, 16008, "the secret type of the config can not be change")
)

View File

@@ -22,9 +22,9 @@ import (
"github.com/emicklei/go-restful/v3"
"github.com/go-playground/validator/v10"
"k8s.io/klog/v2"
"github.com/oam-dev/kubevela/pkg/apiserver/infrastructure/datastore"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"github.com/oam-dev/kubevela/pkg/utils"
)
@@ -81,21 +81,21 @@ func ReturnError(req *restful.Request, res *restful.Response, err error) {
var bcode *Bcode
if errors.As(err, &bcode) {
if err := res.WriteHeaderAndEntity(int(bcode.HTTPCode), err); err != nil {
log.Logger.Error("write entity failure %s", err.Error())
klog.Errorf("write entity failure %s", err.Error())
}
return
}
if errors.Is(err, datastore.ErrRecordNotExist) {
if err := res.WriteHeaderAndEntity(int(404), err); err != nil {
log.Logger.Error("write entity failure %s", err.Error())
klog.Errorf("write entity failure %s", err.Error())
}
return
}
var restfulerr restful.ServiceError
if errors.As(err, &restfulerr) {
if err := res.WriteHeaderAndEntity(restfulerr.Code, Bcode{HTTPCode: int32(restfulerr.Code), BusinessCode: int32(restfulerr.Code), Message: restfulerr.Message}); err != nil {
log.Logger.Error("write entity failure %s", err.Error())
klog.Errorf("write entity failure %s", err.Error())
}
return
}
@@ -103,13 +103,13 @@ func ReturnError(req *restful.Request, res *restful.Response, err error) {
var validErr validator.ValidationErrors
if errors.As(err, &validErr) {
if err := res.WriteHeaderAndEntity(400, Bcode{HTTPCode: 400, BusinessCode: 400, Message: err.Error()}); err != nil {
log.Logger.Error("write entity failure %s", err.Error())
klog.Errorf("write entity failure %s", err.Error())
}
return
}
log.Logger.Errorf("Business exceptions, error message: %s, path:%s method:%s", err.Error(), utils.Sanitize(req.Request.URL.String()), req.Request.Method)
klog.Errorf("Business exceptions, error message: %s, path:%s method:%s", err.Error(), utils.Sanitize(req.Request.URL.String()), req.Request.Method)
if err := res.WriteHeaderAndEntity(500, Bcode{HTTPCode: 500, BusinessCode: 500, Message: err.Error()}); err != nil {
log.Logger.Error("write entity failure %s", err.Error())
klog.Errorf("write entity failure %s", err.Error())
}
}

View File

@@ -19,8 +19,7 @@ package container
import (
"github.com/barnettZQG/inject"
"helm.sh/helm/v3/pkg/time"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
"k8s.io/klog/v2"
)
// NewContainer new a IoC container
@@ -55,7 +54,7 @@ func (c *Container) ProvideWithName(name string, bean interface{}) error {
func (c *Container) Populate() error {
start := time.Now()
defer func() {
log.Logger.Infof("populate the bean container take time %s", time.Now().Sub(start))
klog.Infof("populate the bean container take time %s", time.Now().Sub(start))
}()
return c.graph.Populate()
}

View File

@@ -20,11 +20,10 @@ import (
"encoding/json"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/oam-dev/kubevela/apis/types"
"github.com/oam-dev/kubevela/pkg/apiserver/utils/log"
)
// GetDexConnectors returns the dex connectors for Dex connector controller
@@ -41,7 +40,7 @@ func GetDexConnectors(ctx context.Context, k8sClient client.Client) ([]map[strin
if _, ok := s.Data[key]; ok {
err := json.Unmarshal(s.Data[key], &data)
if err != nil {
log.Logger.Warnf("the dex connector %s is invalid", s.Name)
klog.Warningf("the dex connector %s is invalid", s.Name)
continue
}
connectors[i] = map[string]interface{}{

View File

@@ -1,29 +0,0 @@
/*
Copyright 2021 The KubeVela Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package log
import (
"go.uber.org/zap"
)
// Logger Log component
var Logger *zap.SugaredLogger
func init() {
l, _ := zap.NewProduction()
Logger = l.Sugar()
}

View File

@@ -19,6 +19,7 @@ package component
import (
"context"
"encoding/json"
"fmt"
"strings"
"github.com/pkg/errors"
@@ -141,10 +142,18 @@ func SelectRefObjectsForDispatch(ctx context.Context, cli client.Client, appNs s
if err != nil {
return nil, err
}
isNamespaced, err := IsGroupVersionKindNamespaceScoped(cli.RESTMapper(), gvk)
if err != nil {
return nil, err
}
if selector.Name == "" && labelSelector != nil {
uns := &unstructured.UnstructuredList{}
uns.SetGroupVersionKind(gvk)
if err = cli.List(ctx, uns, client.InNamespace(ns), client.MatchingLabels(labelSelector)); err != nil {
opts := []client.ListOption{client.MatchingLabels(labelSelector)}
if isNamespaced {
opts = append(opts, client.InNamespace(ns))
}
if err = cli.List(ctx, uns, opts...); err != nil {
return nil, errors.Wrapf(err, "failed to load ref object %s with selector", gvk.Kind)
}
for _, _un := range uns.Items {
@@ -154,7 +163,9 @@ func SelectRefObjectsForDispatch(ctx context.Context, cli client.Client, appNs s
un := &unstructured.Unstructured{}
un.SetGroupVersionKind(gvk)
un.SetName(selector.Name)
un.SetNamespace(ns)
if isNamespaced {
un.SetNamespace(ns)
}
if selector.Name == "" {
un.SetName(compName)
}
@@ -248,3 +259,15 @@ func ConvertUnstructuredsToReferredObjects(uns []*unstructured.Unstructured) (re
}
return refObjs, nil
}
// IsGroupVersionKindNamespaceScoped check if the target GroupVersionKind is namespace scoped resource
func IsGroupVersionKindNamespaceScoped(mapper meta.RESTMapper, gvk schema.GroupVersionKind) (bool, error) {
mappings, err := mapper.RESTMappings(gvk.GroupKind(), gvk.Version)
if err != nil {
return false, err
}
if len(mappings) == 0 {
return false, fmt.Errorf("unable to fund the mappings for gvk %s", gvk)
}
return mappings[0].Scope.Name() == meta.RESTScopeNameNamespace, nil
}

View File

@@ -25,6 +25,7 @@ import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
utilfeature "k8s.io/apiserver/pkg/util/feature"
@@ -111,6 +112,10 @@ var _ = Describe("Test ref-objects functions", func() {
Namespace: "test",
Labels: map[string]string{"key": "value"},
},
}, &rbacv1.ClusterRole{
ObjectMeta: metav1.ObjectMeta{
Name: "test-cluster-role",
},
}} {
Expect(k8sClient.Create(context.Background(), obj)).Should(Succeed())
}
@@ -119,25 +124,26 @@ var _ = Describe("Test ref-objects functions", func() {
Object: map[string]interface{}{
"apiVersion": apiVersion,
"kind": kind,
"metadata": map[string]interface{}{
"name": name,
"namespace": namespace,
},
"metadata": map[string]interface{}{"name": name},
},
}
if namespace != "" {
un.SetNamespace(namespace)
}
if labels != nil {
un.Object["metadata"].(map[string]interface{})["labels"] = labels
}
return un
}
testcases := map[string]struct {
Input v1alpha1.ObjectReferrer
compName string
appNs string
Output []*unstructured.Unstructured
Error string
Scope string
IsService bool
Input v1alpha1.ObjectReferrer
compName string
appNs string
Output []*unstructured.Unstructured
Error string
Scope string
IsService bool
IsClusterRole bool
}{
"normal": {
Input: v1alpha1.ObjectReferrer{
@@ -259,6 +265,16 @@ var _ = Describe("Test ref-objects functions", func() {
Scope: RefObjectsAvailableScopeCluster,
Error: "cannot refer to objects outside control plane",
},
"test-cluster-scope-resource": {
Input: v1alpha1.ObjectReferrer{
ObjectTypeIdentifier: v1alpha1.ObjectTypeIdentifier{Resource: "clusterrole"},
ObjectSelector: v1alpha1.ObjectSelector{Name: "test-cluster-role"},
},
appNs: "test",
Scope: RefObjectsAvailableScopeCluster,
Output: []*unstructured.Unstructured{createUnstructured("rbac.authorization.k8s.io/v1", "ClusterRole", "test-cluster-role", "", nil)},
IsClusterRole: true,
},
}
for name, tt := range testcases {
By("Test " + name)
@@ -276,6 +292,9 @@ var _ = Describe("Test ref-objects functions", func() {
Expect(output[0].Object["kind"]).Should(Equal("Service"))
Expect(output[0].Object["spec"].(map[string]interface{})["clusterIP"]).Should(BeNil())
} else {
if tt.IsClusterRole {
delete(output[0].Object, "rules")
}
Expect(output).Should(Equal(tt.Output))
}
}

View File

@@ -32,7 +32,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
pkgtypes "k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"k8s.io/klog/v2"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/yaml"
@@ -88,6 +88,12 @@ var ErrConfigNotFound = errors.New("the config is not exist")
// ErrTemplateNotFound means the template is not exist
var ErrTemplateNotFound = errors.New("the template is not exist")
// ErrChangeTemplate means the template of the config can not be change
var ErrChangeTemplate = errors.New("the template of the config can not be change")
// ErrChangeSecretType means the secret type of the config can not be change
var ErrChangeSecretType = errors.New("the secret type of the config can not be change")
// NamespacedName the namespace and name model
type NamespacedName struct {
Name string `json:"name"`
@@ -192,6 +198,7 @@ type Factory interface {
ListConfigs(ctx context.Context, namespace, template, scope string, withStatus bool) ([]*Config, error)
DeleteConfig(ctx context.Context, namespace, name string) error
CreateOrUpdateConfig(ctx context.Context, i *Config, ns string) error
IsExist(ctx context.Context, namespace, name string) (bool, error)
CreateOrUpdateDistribution(ctx context.Context, ns, name string, ads *CreateDistributionSpec) error
ListDistributions(ctx context.Context, ns string) ([]*Distribution, error)
@@ -549,7 +556,10 @@ func (k *kubeConfigFactory) CreateOrUpdateConfig(ctx context.Context, i *Config,
var secret v1.Secret
if err := k.cli.Get(ctx, pkgtypes.NamespacedName{Namespace: i.Namespace, Name: i.Name}, &secret); err == nil {
if secret.Labels[types.LabelConfigType] != i.Template.Name {
return ErrConfigExist
return ErrChangeTemplate
}
if secret.Type != i.Secret.Type {
return ErrChangeSecretType
}
}
if err := k.apiApply.Apply(ctx, i.Secret, apply.Quiet()); err != nil {
@@ -571,6 +581,17 @@ func (k *kubeConfigFactory) CreateOrUpdateConfig(ctx context.Context, i *Config,
return nil
}
func (k *kubeConfigFactory) IsExist(ctx context.Context, namespace, name string) (bool, error) {
var secret v1.Secret
if err := k.cli.Get(ctx, pkgtypes.NamespacedName{Namespace: namespace, Name: name}, &secret); err != nil {
if apierrors.IsNotFound(err) {
return false, nil
}
return false, err
}
return true, nil
}
func (k *kubeConfigFactory) ListConfigs(ctx context.Context, namespace, template, scope string, withStatus bool) ([]*Config, error) {
var list = &v1.SecretList{}
requirement := fmt.Sprintf("%s=%s", types.LabelConfigCatalog, types.VelaCoreConfig)

View File

@@ -145,6 +145,12 @@ var _ = Describe("test config factory", func() {
Expect(len(config.Targets)).Should(Equal(1))
})
It("check if the config exist", func() {
exist, err := fac.IsExist(context.TODO(), "default", "db-config")
Expect(err).Should(BeNil())
Expect(exist).Should(BeTrue())
})
It("list the distributions", func() {
distributions, err := fac.ListDistributions(context.TODO(), "default")
Expect(err).Should(BeNil())

View File

@@ -22,7 +22,7 @@ import (
"runtime/debug"
"strings"
"k8s.io/klog"
"k8s.io/klog/v2"
"github.com/nacos-group/nacos-sdk-go/v2/clients"
"github.com/nacos-group/nacos-sdk-go/v2/clients/config_client"

View File

@@ -26,7 +26,7 @@ import (
"github.com/magiconair/properties"
"github.com/pelletier/go-toml"
"gopkg.in/yaml.v2"
"k8s.io/klog"
"k8s.io/klog/v2"
"github.com/kubevela/workflow/pkg/cue/model/value"

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