mirror of
https://github.com/kubevela/kubevela.git
synced 2026-03-02 01:30:47 +00:00
Compare commits
149 Commits
v1.9.0-bet
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02e13f9dc3 | ||
|
|
d56da069eb | ||
|
|
89c1d07a8f | ||
|
|
fa8350bc50 | ||
|
|
8917780555 | ||
|
|
f46bfcf131 | ||
|
|
5bdd0db6e7 | ||
|
|
838ff055b8 | ||
|
|
24756fc507 | ||
|
|
81b54781a2 | ||
|
|
d27cc318f2 | ||
|
|
4e16b047f9 | ||
|
|
c512bbe93a | ||
|
|
1a001e5b29 | ||
|
|
42d75e09e5 | ||
|
|
5101401837 | ||
|
|
b9bfc4ac75 | ||
|
|
86dc53afab | ||
|
|
62efa9c787 | ||
|
|
0c449d52b1 | ||
|
|
7a69a3b52b | ||
|
|
7973864c22 | ||
|
|
f88b167b04 | ||
|
|
8b8c00fbba | ||
|
|
5f04812d06 | ||
|
|
9c037c8233 | ||
|
|
dc14baf1d8 | ||
|
|
003f329b31 | ||
|
|
b036624efc | ||
|
|
73c9c75c6f | ||
|
|
cdcda5c9f9 | ||
|
|
5861988909 | ||
|
|
d3581b9189 | ||
|
|
30fb7a56a0 | ||
|
|
786e0f7755 | ||
|
|
544cc4afb6 | ||
|
|
a07acc02c9 | ||
|
|
26faaaf4f9 | ||
|
|
ac9aa16579 | ||
|
|
a8cc84587c | ||
|
|
263081a105 | ||
|
|
308819db33 | ||
|
|
0defc5d312 | ||
|
|
c8d53c103c | ||
|
|
3655a90dfe | ||
|
|
e94426963d | ||
|
|
5d8543fd8b | ||
|
|
48d1ba0538 | ||
|
|
eb1bb69a3e | ||
|
|
a39a8356bd | ||
|
|
e3dc76d0cd | ||
|
|
5be6f38e54 | ||
|
|
6961587c7f | ||
|
|
6cbc12f9bb | ||
|
|
08548968f0 | ||
|
|
d787e95a08 | ||
|
|
c4f9c8f63f | ||
|
|
6ee7eb345b | ||
|
|
b5d42d3d4e | ||
|
|
662597bbca | ||
|
|
9459aae74f | ||
|
|
94cbcad471 | ||
|
|
68a2223353 | ||
|
|
15c0b1e218 | ||
|
|
faf5502fae | ||
|
|
bdf9bf16b8 | ||
|
|
6afe75efa6 | ||
|
|
88a85eacb6 | ||
|
|
c315e81757 | ||
|
|
5b6b66a5cc | ||
|
|
103bd9b42e | ||
|
|
b494185481 | ||
|
|
9d479b7f7c | ||
|
|
629592c7e7 | ||
|
|
b06dec994a | ||
|
|
4218faac4b | ||
|
|
555e94a10c | ||
|
|
5349f1663f | ||
|
|
4778aacaaf | ||
|
|
dab2059bf8 | ||
|
|
9c57c09878 | ||
|
|
cc1ac251ce | ||
|
|
18fb098fce | ||
|
|
5a5721048c | ||
|
|
bab5bb2caf | ||
|
|
cce1859294 | ||
|
|
72bb0798ef | ||
|
|
29aa2b9644 | ||
|
|
307d1db36d | ||
|
|
00ae0c9494 | ||
|
|
f0357fdc8f | ||
|
|
ef8b0ac00f | ||
|
|
aaaf2bddac | ||
|
|
eeb6f08edf | ||
|
|
b9f1cc97a9 | ||
|
|
2117554d53 | ||
|
|
9edd6ebc30 | ||
|
|
ccdfc409a8 | ||
|
|
449b3e0b49 | ||
|
|
8be1fb29b4 | ||
|
|
b42e6cf1e6 | ||
|
|
096afa227b | ||
|
|
57b74c3687 | ||
|
|
9203bbcdb8 | ||
|
|
f3e920ab60 | ||
|
|
6893a2b776 | ||
|
|
4637e3a918 | ||
|
|
118f022cf5 | ||
|
|
dabaf03e73 | ||
|
|
64e4ab813d | ||
|
|
2808de4733 | ||
|
|
8059c30f57 | ||
|
|
48cf6fb10e | ||
|
|
90246065d9 | ||
|
|
6e1cb04cd4 | ||
|
|
b8259c9979 | ||
|
|
110d475ae0 | ||
|
|
141f7dcdeb | ||
|
|
1baa125cc1 | ||
|
|
7d3854d86a | ||
|
|
6e9063d40c | ||
|
|
c4f14ad261 | ||
|
|
257695f073 | ||
|
|
162a8f346a | ||
|
|
9b6019f93d | ||
|
|
d283c2fbeb | ||
|
|
10e458c06d | ||
|
|
2ca31b41a0 | ||
|
|
c43368457f | ||
|
|
69dd0d0b20 | ||
|
|
7af4bd5a49 | ||
|
|
28004bc26f | ||
|
|
da3618ad27 | ||
|
|
189555ba16 | ||
|
|
49327b8910 | ||
|
|
a513029ec8 | ||
|
|
b05ea09d5a | ||
|
|
ff52cf58ba | ||
|
|
95fa62164a | ||
|
|
b576bee882 | ||
|
|
9599e67275 | ||
|
|
8626a4d988 | ||
|
|
ef2df1231c | ||
|
|
8a794a08cd | ||
|
|
36efea15a3 | ||
|
|
799dfbe781 | ||
|
|
06cacb80a0 | ||
|
|
652368fdb3 | ||
|
|
f1bae16723 |
4
.github/workflows/back-port.yml
vendored
4
.github/workflows/back-port.yml
vendored
@@ -17,12 +17,12 @@ jobs:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Open Backport PR
|
||||
uses: zeebe-io/backport-action@b9f8a0a03e4697a60b4daa3a4b3bb054bf90c9bd
|
||||
uses: zeebe-io/backport-action@08bafb375e6e9a9a2b53a744b987e5d81a133191
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_workspace: ${{ github.workspace }}
|
||||
|
||||
4
.github/workflows/chart.yml
vendored
4
.github/workflows/chart.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
HELM_CHART_NAME: vela-core
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
- name: Get git revision
|
||||
id: vars
|
||||
shell: bash
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
with:
|
||||
version: v3.4.0
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Generate helm doc
|
||||
|
||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@959cbb7472c4d4ad70cdfe6f4976053fe48ab394 # v2.1.37
|
||||
|
||||
2
.github/workflows/commit-lint.yml
vendored
2
.github/workflows/commit-lint.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
check:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: thehanimo/pr-title-checker@v1.4.0
|
||||
- uses: thehanimo/pr-title-checker@v1.4.1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
pass_on_octokit_error: true
|
||||
|
||||
4
.github/workflows/core-api-test.yml
vendored
4
.github/workflows/core-api-test.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Set up Go 1.19
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
env:
|
||||
GO_VERSION: '1.19'
|
||||
with:
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
|
||||
6
.github/workflows/definition-lint.yml
vendored
6
.github/workflows/definition-lint.yml
vendored
@@ -23,16 +23,16 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- uses: Setup KinD
|
||||
- name: Setup KinD
|
||||
run: |
|
||||
go install sigs.k8s.io/kind@v0.19.0
|
||||
kind create cluster
|
||||
|
||||
6
.github/workflows/e2e-multicluster-test.yml
vendored
6
.github/workflows/e2e-multicluster-test.yml
vendored
@@ -31,7 +31,7 @@ jobs:
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281
|
||||
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
sudo snap install helm --classic
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
|
||||
11
.github/workflows/e2e-test.yml
vendored
11
.github/workflows/e2e-test.yml
vendored
@@ -18,7 +18,7 @@ permissions:
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.19'
|
||||
GO_VERSION: '1.22'
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281
|
||||
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Install tools
|
||||
run: |
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
sudo snap install helm --classic
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
@@ -78,7 +78,8 @@ jobs:
|
||||
- name: Get Ginkgo
|
||||
run: |
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@v2.10.0
|
||||
go get github.com/onsi/gomega/...
|
||||
go get github.com/onsi/gomega@v1.34.2
|
||||
go mod tidy
|
||||
|
||||
- name: Load image
|
||||
run: |
|
||||
|
||||
42
.github/workflows/go.yml
vendored
42
.github/workflows/go.yml
vendored
@@ -30,7 +30,7 @@ jobs:
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281
|
||||
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
@@ -44,12 +44,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
@@ -69,12 +69,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
@@ -83,7 +83,7 @@ jobs:
|
||||
# version, but we prefer this action because it leaves 'annotations' (i.e.
|
||||
# it comments on PRs to point out linter violations).
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@5f1fec7010f6ae3b84ea4f7b2129beb8639b564f # v3.5.0
|
||||
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_VERSION }}
|
||||
|
||||
@@ -94,22 +94,22 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
||||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
@@ -139,17 +139,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
||||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
@@ -170,15 +170,15 @@ jobs:
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1
|
||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
||||
- name: Build Test for vela core
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
@@ -190,15 +190,15 @@ jobs:
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1
|
||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
||||
- name: Build Test for CLI
|
||||
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.cli
|
||||
|
||||
9
.github/workflows/issue-commands.yml
vendored
9
.github/workflows/issue-commands.yml
vendored
@@ -7,6 +7,7 @@ on:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
bot:
|
||||
@@ -16,13 +17,13 @@ jobs:
|
||||
issues: write
|
||||
steps:
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
repository: "oam-dev/kubevela-github-actions"
|
||||
path: ./actions
|
||||
ref: v0.4.2
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
@@ -75,11 +76,11 @@ jobs:
|
||||
})
|
||||
console.log("Added '" + label + "' label.")
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Open Backport PR
|
||||
uses: zeebe-io/backport-action@b9f8a0a03e4697a60b4daa3a4b3bb054bf90c9bd
|
||||
uses: zeebe-io/backport-action@08bafb375e6e9a9a2b53a744b987e5d81a133191
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_workspace: ${{ github.workspace }}
|
||||
|
||||
3
.github/workflows/license.yml
vendored
3
.github/workflows/license.yml
vendored
@@ -9,7 +9,6 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
-
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
@@ -18,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
name: Check for unapproved licenses
|
||||
steps:
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
|
||||
14
.github/workflows/registry.yml
vendored
14
.github/workflows/registry.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
packages: write
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: |
|
||||
@@ -31,23 +31,23 @@ jobs:
|
||||
run: |
|
||||
echo "git_revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
- name: Login ghcr.io
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login docker.io
|
||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
|
||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||
with:
|
||||
registry: docker.io
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
|
||||
- uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # v2.4.1
|
||||
- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
|
||||
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
|
||||
with:
|
||||
driver-opts: image=moby/buildkit:master
|
||||
|
||||
- uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
- uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
name: Build & Pushing vela-core for Dockerhub, GHCR
|
||||
with:
|
||||
context: .
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
docker.io/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
ghcr.io/${{ github.repository_owner }}/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
- uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # v4.0.0
|
||||
- uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
|
||||
name: Build & Pushing CLI for Dockerhub, GHCR
|
||||
with:
|
||||
context: .
|
||||
|
||||
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -24,16 +24,16 @@ jobs:
|
||||
name: goreleaser
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- run: git fetch --force --tags
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: 1.19
|
||||
cache: true
|
||||
- uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0
|
||||
- uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: 1.14.1
|
||||
@@ -56,7 +56,7 @@ jobs:
|
||||
name: upload-sha256sums
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
- name: Update kubectl plugin version in krew-index
|
||||
uses: rajatjindal/krew-release-bot@df3eb197549e3568be8b4767eec31c5e8e8e6ad8 # v0.0.46
|
||||
- name: Update Homebrew formula
|
||||
|
||||
6
.github/workflows/scorecards.yml
vendored
6
.github/workflows/scorecards.yml
vendored
@@ -23,12 +23,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@80e868c13c90f172d68d1f4501dee99e2479f7af # tag=v2.1.3
|
||||
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # tag=v2.3.1
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
|
||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
|
||||
4
.github/workflows/sdk-test.yml
vendored
4
.github/workflows/sdk-test.yml
vendored
@@ -26,10 +26,10 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
|
||||
4
.github/workflows/sync-api.yml
vendored
4
.github/workflows/sync-api.yml
vendored
@@ -18,12 +18,12 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
|
||||
4
.github/workflows/sync-sdk.yaml
vendored
4
.github/workflows/sync-sdk.yaml
vendored
@@ -22,12 +22,12 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
|
||||
2
.github/workflows/trivy-scan.yml
vendored
2
.github/workflows/trivy-scan.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Build Vela Core image from Dockerfile
|
||||
run: |
|
||||
|
||||
10
.github/workflows/unit-test.yml
vendored
10
.github/workflows/unit-test.yml
vendored
@@ -29,7 +29,7 @@ jobs:
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281
|
||||
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
@@ -43,17 +43,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
||||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
@@ -71,7 +71,7 @@ jobs:
|
||||
kind create cluster
|
||||
|
||||
- name: install Kubebuilder
|
||||
uses: RyanSiu1995/kubebuilder-action@ed0e300b13152c2c2bfb104475665c7bf609332f
|
||||
uses: RyanSiu1995/kubebuilder-action@7170cb0476187070ae04cbb6cee305e809de2693
|
||||
with:
|
||||
version: 3.9.1
|
||||
kubebuilderOnly: false
|
||||
|
||||
@@ -155,6 +155,13 @@ issues:
|
||||
linters:
|
||||
- gocritic
|
||||
|
||||
# Gosmopolitan complains of internationalization issues on the file that actually defines
|
||||
# the translation.
|
||||
- path: i18n\.go
|
||||
text: "Han"
|
||||
linters:
|
||||
- gosmopolitan
|
||||
|
||||
# These are performance optimisations rather than style issues per se.
|
||||
# They warn when function arguments or range values copy a lot of memory
|
||||
# rather than using a pointer.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the manager binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as builder
|
||||
FROM golang:1.19-alpine3.18 as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
@@ -9,7 +9,7 @@ COPY go.sum go.sum
|
||||
|
||||
# It's a proxy for CN developer, please unblock it if you have network issue
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
|
||||
ENV GOPROXY=${GOPROXY:-https://proxy.golang.org}
|
||||
|
||||
# cache deps before building and copying source so that we don't need to re-download as much
|
||||
# and so that source changes don't invalidate our downloaded layer
|
||||
@@ -34,7 +34,7 @@ RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
|
||||
# You can replace distroless as minimal base image to package the manager binary
|
||||
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
||||
# Overwrite `BASE_IMAGE` by passing `--build-arg=BASE_IMAGE=gcr.io/distroless/static:nonroot`
|
||||
FROM ${BASE_IMAGE:-alpine@sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501}
|
||||
FROM ${BASE_IMAGE:-alpine:3.18}
|
||||
# This is required by daemon connecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash expat
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ ARG BASE_IMAGE
|
||||
# Build the cli binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as builder
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
|
||||
ENV GOPROXY=${GOPROXY:-https://proxy.golang.org}
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
COPY go.mod go.mod
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the manager binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as builder
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.22.7-alpine@sha256:48eab5e3505d8c8b42a06fe5f1cf4c346c167cc6a89e772f31cb9e5c301dcf60 as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
|
||||
2
Makefile
2
Makefile
@@ -62,7 +62,7 @@ staticcheck: staticchecktool
|
||||
## lint: Run the golangci-lint
|
||||
lint: golangci
|
||||
@$(INFO) lint
|
||||
@$(GOLANGCILINT) run --skip-dirs 'scaffold'
|
||||
@$(GOLANGCILINT) run --fix --verbose --skip-dirs 'scaffold'
|
||||
|
||||
## reviewable: Run the reviewable
|
||||
reviewable: manifests fmt vet lint staticcheck helm-doc-gen sdk_fmt
|
||||
|
||||
@@ -32,16 +32,6 @@ import (
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// Kube defines the encapsulation in raw Kubernetes resource format
|
||||
type Kube struct {
|
||||
// Template defines the raw Kubernetes resource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Template runtime.RawExtension `json:"template"`
|
||||
|
||||
// Parameters defines configurable parameters
|
||||
Parameters []KubeParameter `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
// ParameterValueType refers to a data type of parameter
|
||||
type ParameterValueType string
|
||||
|
||||
@@ -52,31 +42,6 @@ const (
|
||||
BooleanType ParameterValueType = "boolean"
|
||||
)
|
||||
|
||||
// A KubeParameter defines a configurable parameter of a component.
|
||||
type KubeParameter struct {
|
||||
// Name of this parameter
|
||||
Name string `json:"name"`
|
||||
|
||||
// +kubebuilder:validation:Enum:=string;number;boolean
|
||||
// ValueType indicates the type of the parameter value, and
|
||||
// only supports basic data types: string, number, boolean.
|
||||
ValueType ParameterValueType `json:"type"`
|
||||
|
||||
// FieldPaths specifies an array of fields within this workload that will be
|
||||
// overwritten by the value of this parameter. All fields must be of the
|
||||
// same type. Fields are specified as JSON field paths without a leading
|
||||
// dot, for example 'spec.replicas'.
|
||||
FieldPaths []string `json:"fieldPaths"`
|
||||
|
||||
// +kubebuilder:default:=false
|
||||
// Required specifies whether or not a value for this parameter must be
|
||||
// supplied when authoring an Application.
|
||||
Required *bool `json:"required,omitempty"`
|
||||
|
||||
// Description of this parameter.
|
||||
Description *string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// CUE defines the encapsulation in CUE format
|
||||
type CUE struct {
|
||||
// Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field.
|
||||
@@ -87,26 +52,11 @@ type CUE struct {
|
||||
// Schematic defines the encapsulation of this capability(workload/trait/scope),
|
||||
// the encapsulation can be defined in different ways, e.g. CUE/HCL(terraform)/KUBE(K8s Object)/HELM, etc...
|
||||
type Schematic struct {
|
||||
KUBE *Kube `json:"kube,omitempty"`
|
||||
|
||||
CUE *CUE `json:"cue,omitempty"`
|
||||
|
||||
HELM *Helm `json:"helm,omitempty"`
|
||||
|
||||
Terraform *Terraform `json:"terraform,omitempty"`
|
||||
}
|
||||
|
||||
// A Helm represents resources used by a Helm module
|
||||
type Helm struct {
|
||||
// Release records a Helm release used by a Helm module workload.
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Release runtime.RawExtension `json:"release"`
|
||||
|
||||
// HelmRelease records a Helm repository used by a Helm module workload.
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Repository runtime.RawExtension `json:"repository"`
|
||||
}
|
||||
|
||||
// Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
|
||||
type Terraform struct {
|
||||
// Configuration is Terraform Configuration
|
||||
@@ -213,26 +163,6 @@ const (
|
||||
ApplicationDeleting ApplicationPhase = "deleting"
|
||||
)
|
||||
|
||||
// WorkflowState is a string that mark the workflow state
|
||||
type WorkflowState string
|
||||
|
||||
const (
|
||||
// WorkflowStateInitializing means the workflow is in initial state
|
||||
WorkflowStateInitializing WorkflowState = "Initializing"
|
||||
// WorkflowStateTerminated means workflow is terminated manually, and it won't be started unless the spec changed.
|
||||
WorkflowStateTerminated WorkflowState = "Terminated"
|
||||
// WorkflowStateSuspended means workflow is suspended manually, and it can be resumed.
|
||||
WorkflowStateSuspended WorkflowState = "Suspended"
|
||||
// WorkflowStateSucceeded means workflow is running successfully, all steps finished.
|
||||
WorkflowStateSucceeded WorkflowState = "Succeeded"
|
||||
// WorkflowStateFinished means workflow is end.
|
||||
WorkflowStateFinished WorkflowState = "Finished"
|
||||
// WorkflowStateExecuting means workflow is still running or waiting some steps.
|
||||
WorkflowStateExecuting WorkflowState = "Executing"
|
||||
// WorkflowStateSkipping means it will skip this reconcile and let next reconcile to handle it.
|
||||
WorkflowStateSkipping WorkflowState = "Skipping"
|
||||
)
|
||||
|
||||
// ApplicationComponentStatus record the health status of App component
|
||||
type ApplicationComponentStatus struct {
|
||||
Name string `json:"name"`
|
||||
@@ -269,13 +199,6 @@ type Revision struct {
|
||||
RevisionHash string `json:"revisionHash,omitempty"`
|
||||
}
|
||||
|
||||
// RawComponent record raw component
|
||||
type RawComponent struct {
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Raw runtime.RawExtension `json:"raw"`
|
||||
}
|
||||
|
||||
// AppStatus defines the observed state of Application
|
||||
type AppStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
@@ -411,12 +334,11 @@ const (
|
||||
type OAMObjectReference struct {
|
||||
Component string `json:"component,omitempty"`
|
||||
Trait string `json:"trait,omitempty"`
|
||||
Env string `json:"env,omitempty"`
|
||||
}
|
||||
|
||||
// Equal check if two references are equal
|
||||
func (in OAMObjectReference) Equal(r OAMObjectReference) bool {
|
||||
return in.Component == r.Component && in.Trait == r.Trait && in.Env == r.Env
|
||||
return in.Component == r.Component && in.Trait == r.Trait
|
||||
}
|
||||
|
||||
// AddLabelsToObject add labels to object if properties are not empty
|
||||
@@ -431,9 +353,6 @@ func (in OAMObjectReference) AddLabelsToObject(obj client.Object) {
|
||||
if in.Trait != "" {
|
||||
labels[oam.TraitTypeLabel] = in.Trait
|
||||
}
|
||||
if in.Env != "" {
|
||||
labels[oam.LabelAppEnv] = in.Env
|
||||
}
|
||||
obj.SetLabels(labels)
|
||||
}
|
||||
|
||||
@@ -443,7 +362,6 @@ func NewOAMObjectReferenceFromObject(obj client.Object) OAMObjectReference {
|
||||
return OAMObjectReference{
|
||||
Component: labels[oam.LabelAppComponent],
|
||||
Trait: labels[oam.TraitTypeLabel],
|
||||
Env: labels[oam.LabelAppEnv],
|
||||
}
|
||||
}
|
||||
return OAMObjectReference{}
|
||||
|
||||
@@ -29,13 +29,12 @@ func TestOAMObjectReference(t *testing.T) {
|
||||
o1 := OAMObjectReference{
|
||||
Component: "component",
|
||||
Trait: "trait",
|
||||
Env: "env",
|
||||
}
|
||||
obj := &unstructured.Unstructured{}
|
||||
o2 := NewOAMObjectReferenceFromObject(obj)
|
||||
r.False(o2.Equal(o1))
|
||||
o1.AddLabelsToObject(obj)
|
||||
r.Equal(3, len(obj.GetLabels()))
|
||||
r.Equal(2, len(obj.GetLabels()))
|
||||
o3 := NewOAMObjectReferenceFromObject(obj)
|
||||
r.True(o1.Equal(o3))
|
||||
o3.Component = "comp"
|
||||
|
||||
@@ -278,76 +278,6 @@ func (in *DefinitionReference) DeepCopy() *DefinitionReference {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Helm) DeepCopyInto(out *Helm) {
|
||||
*out = *in
|
||||
in.Release.DeepCopyInto(&out.Release)
|
||||
in.Repository.DeepCopyInto(&out.Repository)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Helm.
|
||||
func (in *Helm) DeepCopy() *Helm {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Helm)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Kube) DeepCopyInto(out *Kube) {
|
||||
*out = *in
|
||||
in.Template.DeepCopyInto(&out.Template)
|
||||
if in.Parameters != nil {
|
||||
in, out := &in.Parameters, &out.Parameters
|
||||
*out = make([]KubeParameter, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Kube.
|
||||
func (in *Kube) DeepCopy() *Kube {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Kube)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *KubeParameter) DeepCopyInto(out *KubeParameter) {
|
||||
*out = *in
|
||||
if in.FieldPaths != nil {
|
||||
in, out := &in.FieldPaths, &out.FieldPaths
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Required != nil {
|
||||
in, out := &in.Required, &out.Required
|
||||
*out = new(bool)
|
||||
**out = **in
|
||||
}
|
||||
if in.Description != nil {
|
||||
in, out := &in.Description, &out.Description
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeParameter.
|
||||
func (in *KubeParameter) DeepCopy() *KubeParameter {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(KubeParameter)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OAMObjectReference) DeepCopyInto(out *OAMObjectReference) {
|
||||
*out = *in
|
||||
@@ -383,22 +313,6 @@ func (in *PolicyStatus) DeepCopy() *PolicyStatus {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RawComponent) DeepCopyInto(out *RawComponent) {
|
||||
*out = *in
|
||||
in.Raw.DeepCopyInto(&out.Raw)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RawComponent.
|
||||
func (in *RawComponent) DeepCopy() *RawComponent {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RawComponent)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RawExtensionPointer) DeepCopyInto(out *RawExtensionPointer) {
|
||||
*out = *in
|
||||
@@ -475,21 +389,11 @@ func (in *Revision) DeepCopy() *Revision {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Schematic) DeepCopyInto(out *Schematic) {
|
||||
*out = *in
|
||||
if in.KUBE != nil {
|
||||
in, out := &in.KUBE, &out.KUBE
|
||||
*out = new(Kube)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.CUE != nil {
|
||||
in, out := &in.CUE, &out.CUE
|
||||
*out = new(CUE)
|
||||
**out = **in
|
||||
}
|
||||
if in.HELM != nil {
|
||||
in, out := &in.HELM, &out.HELM
|
||||
*out = new(Helm)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Terraform != nil {
|
||||
in, out := &in.Terraform, &out.Terraform
|
||||
*out = new(Terraform)
|
||||
|
||||
@@ -32,7 +32,6 @@ import (
|
||||
"github.com/kubevela/pkg/util/compression"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/interfaces"
|
||||
velatypes "github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
velaerr "github.com/oam-dev/kubevela/pkg/utils/errors"
|
||||
@@ -53,8 +52,7 @@ type ResourceTracker struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ResourceTrackerSpec `json:"spec,omitempty"`
|
||||
Status ResourceTrackerStatus `json:"status,omitempty"`
|
||||
Spec ResourceTrackerSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceTrackerType defines the type of resourceTracker
|
||||
@@ -140,7 +138,7 @@ type ManagedResource struct {
|
||||
}
|
||||
|
||||
// Equal check if two managed resource equals
|
||||
func (in ManagedResource) Equal(r ManagedResource) bool {
|
||||
func (in *ManagedResource) Equal(r ManagedResource) bool {
|
||||
if !in.ClusterObjectReference.Equal(r.ClusterObjectReference) {
|
||||
return false
|
||||
}
|
||||
@@ -151,7 +149,7 @@ func (in ManagedResource) Equal(r ManagedResource) bool {
|
||||
}
|
||||
|
||||
// DisplayName readable name for locating resource
|
||||
func (in ManagedResource) DisplayName() string {
|
||||
func (in *ManagedResource) DisplayName() string {
|
||||
s := in.Kind + " " + in.Name
|
||||
if in.Namespace != "" || in.Cluster != "" {
|
||||
s += " ("
|
||||
@@ -170,12 +168,12 @@ func (in ManagedResource) DisplayName() string {
|
||||
}
|
||||
|
||||
// NamespacedName namespacedName
|
||||
func (in ManagedResource) NamespacedName() types.NamespacedName {
|
||||
func (in *ManagedResource) NamespacedName() types.NamespacedName {
|
||||
return types.NamespacedName{Namespace: in.Namespace, Name: in.Name}
|
||||
}
|
||||
|
||||
// ResourceKey computes the key for managed resource, resources with the same key points to the same resource
|
||||
func (in ManagedResource) ResourceKey() string {
|
||||
func (in *ManagedResource) ResourceKey() string {
|
||||
group := in.GroupVersionKind().Group
|
||||
kind := in.GroupVersionKind().Kind
|
||||
cluster := in.Cluster
|
||||
@@ -186,12 +184,12 @@ func (in ManagedResource) ResourceKey() string {
|
||||
}
|
||||
|
||||
// ComponentKey computes the key for the component which managed resource belongs to
|
||||
func (in ManagedResource) ComponentKey() string {
|
||||
return strings.Join([]string{in.Env, in.Component}, "/")
|
||||
func (in *ManagedResource) ComponentKey() string {
|
||||
return strings.Join([]string{in.Cluster, in.Component}, "/")
|
||||
}
|
||||
|
||||
// UnmarshalTo unmarshal ManagedResource into target object
|
||||
func (in ManagedResource) UnmarshalTo(obj interface{}) error {
|
||||
func (in *ManagedResource) UnmarshalTo(obj interface{}) error {
|
||||
if in.Data == nil || in.Data.Raw == nil {
|
||||
return velaerr.ManagedResourceHasNoDataError{}
|
||||
}
|
||||
@@ -199,7 +197,7 @@ func (in ManagedResource) UnmarshalTo(obj interface{}) error {
|
||||
}
|
||||
|
||||
// ToUnstructured converts managed resource into unstructured
|
||||
func (in ManagedResource) ToUnstructured() *unstructured.Unstructured {
|
||||
func (in *ManagedResource) ToUnstructured() *unstructured.Unstructured {
|
||||
obj := &unstructured.Unstructured{}
|
||||
obj.SetGroupVersionKind(in.GroupVersionKind())
|
||||
obj.SetName(in.Name)
|
||||
@@ -211,7 +209,7 @@ func (in ManagedResource) ToUnstructured() *unstructured.Unstructured {
|
||||
}
|
||||
|
||||
// ToUnstructuredWithData converts managed resource into unstructured and unmarshal data
|
||||
func (in ManagedResource) ToUnstructuredWithData() (*unstructured.Unstructured, error) {
|
||||
func (in *ManagedResource) ToUnstructuredWithData() (*unstructured.Unstructured, error) {
|
||||
obj := in.ToUnstructured()
|
||||
if err := in.UnmarshalTo(obj); err != nil {
|
||||
if errors.Is(err, velaerr.ManagedResourceHasNoDataError{}) {
|
||||
@@ -221,13 +219,6 @@ func (in ManagedResource) ToUnstructuredWithData() (*unstructured.Unstructured,
|
||||
return obj, nil
|
||||
}
|
||||
|
||||
// ResourceTrackerStatus define the status of resourceTracker
|
||||
// For backward-compatibility
|
||||
type ResourceTrackerStatus struct {
|
||||
// Deprecated
|
||||
TrackedResources []common.ClusterObjectReference `json:"trackedResources,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
@@ -325,29 +316,3 @@ func (in *ResourceTracker) DeleteManagedResource(rsc client.Object, remove bool)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// addClusterObjectReference
|
||||
// Deprecated
|
||||
func (in *ResourceTracker) addClusterObjectReference(ref common.ClusterObjectReference) bool {
|
||||
for _, _rsc := range in.Status.TrackedResources {
|
||||
if _rsc.Equal(ref) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
in.Status.TrackedResources = append(in.Status.TrackedResources, ref)
|
||||
return false
|
||||
}
|
||||
|
||||
// AddTrackedResource add new object reference into tracked resources, return if already exists
|
||||
// Deprecated
|
||||
func (in *ResourceTracker) AddTrackedResource(rsc interfaces.TrackableResource) bool {
|
||||
return in.addClusterObjectReference(common.ClusterObjectReference{
|
||||
ObjectReference: corev1.ObjectReference{
|
||||
APIVersion: rsc.GetAPIVersion(),
|
||||
Kind: rsc.GetKind(),
|
||||
Name: rsc.GetName(),
|
||||
Namespace: rsc.GetNamespace(),
|
||||
UID: rsc.GetUID(),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@@ -124,14 +124,13 @@ func TestManagedResourceKeys(t *testing.T) {
|
||||
},
|
||||
},
|
||||
OAMObjectReference: common.OAMObjectReference{
|
||||
Env: "env",
|
||||
Component: "component",
|
||||
Trait: "trait",
|
||||
},
|
||||
}
|
||||
r.Equal("namespace/name", input.NamespacedName().String())
|
||||
r.Equal("apps/Deployment/cluster/namespace/name", input.ResourceKey())
|
||||
r.Equal("env/component", input.ComponentKey())
|
||||
r.Equal("cluster/component", input.ComponentKey())
|
||||
r.Equal("Deployment name (Cluster: cluster, Namespace: namespace)", input.DisplayName())
|
||||
var deploy1, deploy2 appsv1.Deployment
|
||||
deploy1.Spec.Replicas = pointer.Int32(5)
|
||||
|
||||
@@ -679,7 +679,6 @@ func (in *ResourceTracker) DeepCopyInto(out *ResourceTracker) {
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceTracker.
|
||||
@@ -771,26 +770,6 @@ func (in *ResourceTrackerSpec) DeepCopy() *ResourceTrackerSpec {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceTrackerStatus) DeepCopyInto(out *ResourceTrackerStatus) {
|
||||
*out = *in
|
||||
if in.TrackedResources != nil {
|
||||
in, out := &in.TrackedResources, &out.TrackedResources
|
||||
*out = make([]common.ClusterObjectReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceTrackerStatus.
|
||||
func (in *ResourceTrackerStatus) DeepCopy() *ResourceTrackerStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceTrackerStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TraitDefinition) DeepCopyInto(out *TraitDefinition) {
|
||||
*out = *in
|
||||
|
||||
@@ -1,35 +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 interfaces
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
// ObjectOwner is the interface for get and set ownerReference
|
||||
type ObjectOwner interface {
|
||||
GetOwnerReferences() []metav1.OwnerReference
|
||||
SetOwnerReferences([]metav1.OwnerReference)
|
||||
}
|
||||
|
||||
// TrackableResource is the interface for resources to be tracked by resourcetracker
|
||||
type TrackableResource interface {
|
||||
client.Object
|
||||
metav1.Type
|
||||
ObjectOwner
|
||||
}
|
||||
@@ -17,13 +17,7 @@ limitations under the License.
|
||||
package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"cuelang.org/go/cue"
|
||||
"github.com/spf13/pflag"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// Source record the source of Capability
|
||||
@@ -38,22 +32,6 @@ type CRDInfo struct {
|
||||
Kind string `json:"kind"`
|
||||
}
|
||||
|
||||
// Chart defines all necessary information to install a whole chart
|
||||
type Chart struct {
|
||||
Repo string `json:"repo"`
|
||||
URL string `json:"url"`
|
||||
Name string `json:"name"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Version string `json:"version"`
|
||||
Values map[string]interface{} `json:"values"`
|
||||
}
|
||||
|
||||
// Installation defines the installation method for this Capability, currently only helm is supported
|
||||
type Installation struct {
|
||||
Helm Chart `json:"helm"`
|
||||
// TODO(wonderflow) add raw yaml file support for install capability
|
||||
}
|
||||
|
||||
// CapType defines the type of capability
|
||||
type CapType string
|
||||
|
||||
@@ -89,10 +67,6 @@ type CapabilityCategory string
|
||||
const (
|
||||
TerraformCategory CapabilityCategory = "terraform"
|
||||
|
||||
HelmCategory CapabilityCategory = "helm"
|
||||
|
||||
KubeCategory CapabilityCategory = "kube"
|
||||
|
||||
CUECategory CapabilityCategory = "cue"
|
||||
)
|
||||
|
||||
@@ -109,49 +83,6 @@ type Parameter struct {
|
||||
JSONType string `json:"jsonType,omitempty"`
|
||||
}
|
||||
|
||||
// SetFlagBy set cli flag from Parameter
|
||||
func SetFlagBy(flags *pflag.FlagSet, v Parameter) {
|
||||
name := v.Name
|
||||
if v.Alias != "" {
|
||||
name = v.Alias
|
||||
}
|
||||
// nolint:exhaustive
|
||||
switch v.Type {
|
||||
case cue.IntKind:
|
||||
var vv int64
|
||||
switch val := v.Default.(type) {
|
||||
case int64:
|
||||
vv = val
|
||||
case json.Number:
|
||||
vv, _ = val.Int64()
|
||||
case int:
|
||||
vv = int64(val)
|
||||
case float64:
|
||||
vv = int64(val)
|
||||
}
|
||||
flags.Int64P(name, v.Short, vv, v.Usage)
|
||||
case cue.StringKind:
|
||||
flags.StringP(name, v.Short, v.Default.(string), v.Usage)
|
||||
case cue.BoolKind:
|
||||
flags.BoolP(name, v.Short, v.Default.(bool), v.Usage)
|
||||
case cue.NumberKind, cue.FloatKind:
|
||||
var vv float64
|
||||
switch val := v.Default.(type) {
|
||||
case int64:
|
||||
vv = float64(val)
|
||||
case json.Number:
|
||||
vv, _ = val.Float64()
|
||||
case int:
|
||||
vv = float64(val)
|
||||
case float64:
|
||||
vv = val
|
||||
}
|
||||
flags.Float64P(name, v.Short, vv, v.Usage)
|
||||
default:
|
||||
// other types not supported yet
|
||||
}
|
||||
}
|
||||
|
||||
// Capability defines the content of a capability
|
||||
type Capability struct {
|
||||
Name string `json:"name"`
|
||||
@@ -160,7 +91,6 @@ type Capability struct {
|
||||
CueTemplateURI string `json:"templateURI,omitempty"`
|
||||
Parameters []Parameter `json:"parameters,omitempty"`
|
||||
CrdName string `json:"crdName,omitempty"`
|
||||
Center string `json:"center,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
Example string `json:"example,omitempty"`
|
||||
@@ -174,15 +104,10 @@ type Capability struct {
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
|
||||
// Plugin Source
|
||||
Source *Source `json:"source,omitempty"`
|
||||
CrdInfo *CRDInfo `json:"crdInfo,omitempty"`
|
||||
Source *Source `json:"source,omitempty"`
|
||||
|
||||
// Terraform
|
||||
TerraformConfiguration string `json:"terraformConfiguration,omitempty"`
|
||||
ConfigurationType string `json:"configurationType,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// KubeTemplate
|
||||
KubeTemplate runtime.RawExtension `json:"kubetemplate,omitempty"`
|
||||
KubeParameter []common.KubeParameter `json:"kubeparameter,omitempty"`
|
||||
}
|
||||
|
||||
@@ -26,13 +26,8 @@ type ComponentManifest struct {
|
||||
Namespace string
|
||||
RevisionName string
|
||||
RevisionHash string
|
||||
// StandardWorkload contains K8s resource generated from "output" block of ComponentDefinition
|
||||
StandardWorkload *unstructured.Unstructured
|
||||
// Traits contains both resources generated from "outputs" block of ComponentDefinition and resources generated from TraitDefinition
|
||||
Traits []*unstructured.Unstructured
|
||||
|
||||
// PackagedWorkloadResources contain all the workload related resources. It could be a Helm
|
||||
// Release, Git Repo or anything that can package and run a workload.
|
||||
PackagedWorkloadResources []*unstructured.Unstructured
|
||||
PackagedTraitResources map[string][]*unstructured.Unstructured
|
||||
// ComponentOutput contains K8s resource generated from "output" block of ComponentDefinition
|
||||
ComponentOutput *unstructured.Unstructured
|
||||
// ComponentOutputsAndTraits contains both resources generated from "outputs" block of ComponentDefinition and resources generated from TraitDefinition
|
||||
ComponentOutputsAndTraits []*unstructured.Unstructured
|
||||
}
|
||||
|
||||
@@ -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 types
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
)
|
||||
|
||||
// WorkflowContext is the workflow context to pass into workflow objects.
|
||||
type WorkflowContext struct {
|
||||
AppName string `json:"appName,omitempty"`
|
||||
AppRevision string `json:"appRevision,omitempty"`
|
||||
WorkflowIndex int `json:"workflowIndex"`
|
||||
ResourceConfigMap corev1.LocalObjectReference `json:"resourceConfigMap,omitempty"`
|
||||
}
|
||||
@@ -25,7 +25,7 @@ multi-cloud environments. At the mean time, it is highly extensible and programm
|
||||
## TL;DR
|
||||
|
||||
```bash
|
||||
helm repo add kubevela https://charts.kubevela.net/core
|
||||
helm repo add kubevela https://kubevela.github.io/charts
|
||||
helm repo update
|
||||
helm install --create-namespace -n vela-system kubevela kubevela/vela-core --wait
|
||||
```
|
||||
@@ -186,6 +186,21 @@ if [ $fluxcd ]; then
|
||||
fi
|
||||
```
|
||||
|
||||
Make sure all existing KubeVela resources deleted before uninstallation:
|
||||
```shell
|
||||
kubectl delete applicationrevisions.core.oam.dev --all
|
||||
kubectl delete applications.core.oam.dev --all
|
||||
kubectl delete componentdefinitions.core.oam.dev --all
|
||||
kubectl delete definitionrevisions.core.oam.dev --all
|
||||
kubectl delete policies.core.oam.dev --all
|
||||
kubectl delete policydefinitions.core.oam.dev --all
|
||||
kubectl delete resourcetrackers.core.oam.dev --all
|
||||
kubectl delete traitdefinitions.core.oam.dev --all
|
||||
kubectl delete workflows.core.oam.dev --all
|
||||
kubectl delete workflowstepdefinitions.core.oam.dev --all
|
||||
kubectl delete workloaddefinitions.core.oam.dev --all
|
||||
```
|
||||
|
||||
To uninstall the KubeVela helm release:
|
||||
|
||||
```shell
|
||||
|
||||
@@ -968,79 +968,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used
|
||||
by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will
|
||||
be overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or
|
||||
not a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type
|
||||
of the parameter value, and only supports
|
||||
basic data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes
|
||||
resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
@@ -1353,79 +1280,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used
|
||||
by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will
|
||||
be overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or
|
||||
not a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type
|
||||
of the parameter value, and only supports
|
||||
basic data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes
|
||||
resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
@@ -1697,79 +1551,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used
|
||||
by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will
|
||||
be overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or
|
||||
not a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type
|
||||
of the parameter value, and only supports
|
||||
basic data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes
|
||||
resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
@@ -2193,79 +1974,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used
|
||||
by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will
|
||||
be overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or
|
||||
not a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type
|
||||
of the parameter value, and only supports
|
||||
basic data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes
|
||||
resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
@@ -2524,79 +2232,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used
|
||||
by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will
|
||||
be overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or
|
||||
not a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type
|
||||
of the parameter value, and only supports
|
||||
basic data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes
|
||||
resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
|
||||
@@ -101,76 +101,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by a Helm
|
||||
module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable parameter
|
||||
of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array of fields
|
||||
within this workload that will be overwritten by the
|
||||
value of this parameter. \tAll fields must be of the
|
||||
same type. Fields are specified as JSON field paths
|
||||
without a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not a value
|
||||
for this parameter must be supplied when authoring
|
||||
an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of the parameter
|
||||
value, and only supports basic data types: string,
|
||||
number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud resources
|
||||
managed by Hashicorp Terraform
|
||||
|
||||
@@ -142,78 +142,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will be
|
||||
overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not
|
||||
a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of
|
||||
the parameter value, and only supports basic
|
||||
data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
@@ -473,78 +401,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will be
|
||||
overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not
|
||||
a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of
|
||||
the parameter value, and only supports basic
|
||||
data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
@@ -805,78 +661,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will be
|
||||
overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not
|
||||
a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of
|
||||
the parameter value, and only supports basic
|
||||
data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
@@ -1112,78 +896,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm
|
||||
module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository
|
||||
used by a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable
|
||||
parameter of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array
|
||||
of fields within this workload that will be
|
||||
overwritten by the value of this parameter.
|
||||
\tAll fields must be of the same type. Fields
|
||||
are specified as JSON field paths without
|
||||
a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not
|
||||
a value for this parameter must be supplied
|
||||
when authoring an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of
|
||||
the parameter value, and only supports basic
|
||||
data types: string, number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud
|
||||
resources managed by Hashicorp Terraform
|
||||
|
||||
@@ -74,76 +74,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by a Helm
|
||||
module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable parameter
|
||||
of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array of fields
|
||||
within this workload that will be overwritten by the
|
||||
value of this parameter. \tAll fields must be of the
|
||||
same type. Fields are specified as JSON field paths
|
||||
without a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not a value
|
||||
for this parameter must be supplied when authoring
|
||||
an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of the parameter
|
||||
value, and only supports basic data types: string,
|
||||
number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud resources
|
||||
managed by Hashicorp Terraform
|
||||
|
||||
@@ -82,8 +82,6 @@ spec:
|
||||
deleted:
|
||||
description: Deleted marks the resource to be deleted
|
||||
type: boolean
|
||||
env:
|
||||
type: string
|
||||
fieldPath:
|
||||
description: 'If referring to a piece of an object instead of
|
||||
an entire object, this string should contain a valid JSON/Go
|
||||
@@ -130,56 +128,6 @@ spec:
|
||||
required:
|
||||
- applicationGeneration
|
||||
type: object
|
||||
status:
|
||||
description: ResourceTrackerStatus define the status of resourceTracker
|
||||
For backward-compatibility
|
||||
properties:
|
||||
trackedResources:
|
||||
description: Deprecated
|
||||
items:
|
||||
description: ClusterObjectReference defines the object reference
|
||||
with cluster.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: API version of the referent.
|
||||
type: string
|
||||
cluster:
|
||||
type: string
|
||||
creator:
|
||||
type: string
|
||||
fieldPath:
|
||||
description: 'If referring to a piece of an object instead of
|
||||
an entire object, this string should contain a valid JSON/Go
|
||||
field access statement, such as desiredState.manifest.containers[2].
|
||||
For example, if the object reference is to a container within
|
||||
a pod, this would take on a value like: "spec.containers{name}"
|
||||
(where "name" refers to the name of the container that triggered
|
||||
the event) or if no container name is specified "spec.containers[2]"
|
||||
(container with index 2 in this pod). This syntax is chosen
|
||||
only to have some well-defined way of referencing a part of
|
||||
an object. TODO: this design is not final and this field is
|
||||
subject to change in the future.'
|
||||
type: string
|
||||
kind:
|
||||
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
|
||||
type: string
|
||||
name:
|
||||
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
|
||||
type: string
|
||||
namespace:
|
||||
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
|
||||
type: string
|
||||
resourceVersion:
|
||||
description: 'Specific resourceVersion to which this reference
|
||||
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
|
||||
type: string
|
||||
uid:
|
||||
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
|
||||
type: string
|
||||
type: object
|
||||
x-kubernetes-map-type: atomic
|
||||
type: array
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
|
||||
@@ -119,76 +119,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by a Helm
|
||||
module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable parameter
|
||||
of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array of fields
|
||||
within this workload that will be overwritten by the
|
||||
value of this parameter. \tAll fields must be of the
|
||||
same type. Fields are specified as JSON field paths
|
||||
without a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not a value
|
||||
for this parameter must be supplied when authoring
|
||||
an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of the parameter
|
||||
value, and only supports basic data types: string,
|
||||
number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud resources
|
||||
managed by Hashicorp Terraform
|
||||
|
||||
@@ -71,76 +71,6 @@ spec:
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
helm:
|
||||
description: A Helm represents resources used by a Helm module
|
||||
properties:
|
||||
release:
|
||||
description: Release records a Helm release used by a Helm
|
||||
module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
repository:
|
||||
description: HelmRelease records a Helm repository used by
|
||||
a Helm module workload.
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- release
|
||||
- repository
|
||||
type: object
|
||||
kube:
|
||||
description: Kube defines the encapsulation in raw Kubernetes
|
||||
resource format
|
||||
properties:
|
||||
parameters:
|
||||
description: Parameters defines configurable parameters
|
||||
items:
|
||||
description: A KubeParameter defines a configurable parameter
|
||||
of a component.
|
||||
properties:
|
||||
description:
|
||||
description: Description of this parameter.
|
||||
type: string
|
||||
fieldPaths:
|
||||
description: "FieldPaths specifies an array of fields
|
||||
within this workload that will be overwritten by the
|
||||
value of this parameter. \tAll fields must be of the
|
||||
same type. Fields are specified as JSON field paths
|
||||
without a leading dot, for example 'spec.replicas'."
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
name:
|
||||
description: Name of this parameter
|
||||
type: string
|
||||
required:
|
||||
default: false
|
||||
description: Required specifies whether or not a value
|
||||
for this parameter must be supplied when authoring
|
||||
an Application.
|
||||
type: boolean
|
||||
type:
|
||||
description: 'ValueType indicates the type of the parameter
|
||||
value, and only supports basic data types: string,
|
||||
number, boolean.'
|
||||
enum:
|
||||
- string
|
||||
- number
|
||||
- boolean
|
||||
type: string
|
||||
required:
|
||||
- fieldPaths
|
||||
- name
|
||||
- type
|
||||
type: object
|
||||
type: array
|
||||
template:
|
||||
description: Template defines the raw Kubernetes resource
|
||||
type: object
|
||||
x-kubernetes-preserve-unknown-fields: true
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
terraform:
|
||||
description: Terraform is the struct to describe cloud resources
|
||||
managed by Hashicorp Terraform
|
||||
|
||||
@@ -8,7 +8,7 @@ data:
|
||||
"KubeVela":{
|
||||
"name": "KubeVela",
|
||||
"helm": {
|
||||
"url": "https://addons.kubevela.net"
|
||||
"url": "https://kubevela.github.io/catalog/official"
|
||||
}
|
||||
}
|
||||
}'
|
||||
|
||||
@@ -29,7 +29,7 @@ webhooks:
|
||||
- apiGroups:
|
||||
- core.oam.dev
|
||||
apiVersions:
|
||||
- v1alpha2
|
||||
- v1beta1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
@@ -89,4 +89,30 @@ webhooks:
|
||||
- UPDATE
|
||||
resources:
|
||||
- componentdefinitions
|
||||
- clientConfig:
|
||||
caBundle: Cg==
|
||||
service:
|
||||
name: {{ template "kubevela.name" . }}-webhook
|
||||
namespace: {{ .Release.Namespace }}
|
||||
path: /validating-core-oam-dev-v1beta1-policydefinitions
|
||||
{{- if .Values.admissionWebhooks.patch.enabled }}
|
||||
failurePolicy: Ignore
|
||||
{{- else }}
|
||||
failurePolicy: Fail
|
||||
{{- end }}
|
||||
name: validating.core.oam-dev.v1beta1.policydefinitions
|
||||
sideEffects: None
|
||||
admissionReviewVersions:
|
||||
- v1beta1
|
||||
- v1
|
||||
rules:
|
||||
- apiGroups:
|
||||
- core.oam.dev
|
||||
apiVersions:
|
||||
- v1beta1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- policydefinitions
|
||||
{{- end -}}
|
||||
|
||||
@@ -4,7 +4,7 @@ apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Add annotations on your workload. if it generates pod, add same annotations for generated pods.
|
||||
definition.oam.dev/description: Add annotations on your workload. If it generates pod or job, add same annotations for generated pods.
|
||||
name: annotations
|
||||
namespace: {{ include "systemDefinitionNamespace" . }}
|
||||
spec:
|
||||
@@ -16,17 +16,21 @@ spec:
|
||||
template: |
|
||||
// +patchStrategy=jsonMergePatch
|
||||
patch: {
|
||||
metadata: annotations: {
|
||||
let annotationsContent = {
|
||||
for k, v in parameter {
|
||||
(k): v
|
||||
}
|
||||
}
|
||||
if context.output.spec != _|_ && context.output.spec.template != _|_ {
|
||||
spec: template: metadata: annotations: {
|
||||
for k, v in parameter {
|
||||
(k): v
|
||||
}
|
||||
}
|
||||
|
||||
metadata: annotations: annotationsContent
|
||||
if context.output.spec != _|_ if context.output.spec.template != _|_ {
|
||||
spec: template: metadata: annotations: annotationsContent
|
||||
}
|
||||
if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ {
|
||||
spec: jobTemplate: metadata: annotations: annotationsContent
|
||||
}
|
||||
if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ if context.output.spec.jobTemplate.spec != _|_ if context.output.spec.jobTemplate.spec.template != _|_ {
|
||||
spec: jobTemplate: spec: template: metadata: annotations: annotationsContent
|
||||
}
|
||||
}
|
||||
parameter: [string]: string | null
|
||||
|
||||
@@ -19,5 +19,7 @@ spec:
|
||||
component: string
|
||||
// +usage=Specify the cluster
|
||||
cluster: *"" | string
|
||||
// +usage=Specify the namespace
|
||||
namespace: *"" | string
|
||||
}
|
||||
|
||||
|
||||
135
charts/vela-core/templates/defwithtemplate/container-ports.yaml
Normal file
135
charts/vela-core/templates/defwithtemplate/container-ports.yaml
Normal file
@@ -0,0 +1,135 @@
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/container-ports.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Expose on the host and bind the external port to host to enable web traffic for your component.
|
||||
name: container-ports
|
||||
namespace: {{ include "systemDefinitionNamespace" . }}
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
- statefulsets.apps
|
||||
- daemonsets.apps
|
||||
- jobs.batch
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
#PatchParams: {
|
||||
// +usage=Specify the name of the target container, if not set, use the component name
|
||||
containerName: *"" | string
|
||||
// +usage=Specify ports you want customer traffic sent to
|
||||
ports: *[] | [...{
|
||||
// +usage=Number of port to expose on the pod's IP address
|
||||
containerPort: int
|
||||
// +usage=Protocol for port. Must be UDP, TCP, or SCTP
|
||||
protocol: *"TCP" | "UDP" | "SCTP"
|
||||
// +usage=Number of port to expose on the host
|
||||
hostPort?: int
|
||||
// +usage=What host IP to bind the external port to.
|
||||
hostIP?: string
|
||||
}]
|
||||
}
|
||||
|
||||
PatchContainer: {
|
||||
_params: #PatchParams
|
||||
name: _params.containerName
|
||||
_baseContainers: context.output.spec.template.spec.containers
|
||||
_matchContainers_: [ for _container_ in _baseContainers if _container_.name == name {_container_}]
|
||||
_baseContainer: *_|_ | {...}
|
||||
if len(_matchContainers_) == 0 {
|
||||
err: "container \(name) not found"
|
||||
}
|
||||
if len(_matchContainers_) > 0 {
|
||||
_baseContainer: _matchContainers_[0]
|
||||
_basePorts: _baseContainer.ports
|
||||
if _basePorts == _|_ {
|
||||
// +patchStrategy=replace
|
||||
ports: [ for port in _params.ports {
|
||||
containerPort: port.containerPort
|
||||
protocol: port.protocol
|
||||
if port.hostPort != _|_ {
|
||||
hostPort: port.hostPort
|
||||
}
|
||||
if port.hostIP != _|_ {
|
||||
hostIP: port.hostIP
|
||||
}
|
||||
}]
|
||||
}
|
||||
if _basePorts != _|_ {
|
||||
_basePortsMap: {for _basePort in _basePorts {(strings.ToLower(_basePort.protocol) + strconv.FormatInt(_basePort.containerPort, 10)): _basePort}}
|
||||
_portsMap: {for port in _params.ports {(strings.ToLower(port.protocol) + strconv.FormatInt(port.containerPort, 10)): port}}
|
||||
// +patchStrategy=replace
|
||||
ports: [ for portVar in _basePorts {
|
||||
containerPort: portVar.containerPort
|
||||
protocol: portVar.protocol
|
||||
name: portVar.name
|
||||
_uniqueKey: strings.ToLower(portVar.protocol) + strconv.FormatInt(portVar.containerPort, 10)
|
||||
if _portsMap[_uniqueKey] != _|_ {
|
||||
if _portsMap[_uniqueKey].hostPort != _|_ {
|
||||
hostPort: _portsMap[_uniqueKey].hostPort
|
||||
}
|
||||
if _portsMap[_uniqueKey].hostIP != _|_ {
|
||||
hostIP: _portsMap[_uniqueKey].hostIP
|
||||
}
|
||||
}
|
||||
}] + [ for port in _params.ports if _basePortsMap[strings.ToLower(port.protocol)+strconv.FormatInt(port.containerPort, 10)] == _|_ {
|
||||
if port.containerPort != _|_ {
|
||||
containerPort: port.containerPort
|
||||
}
|
||||
if port.protocol != _|_ {
|
||||
protocol: port.protocol
|
||||
}
|
||||
if port.hostPort != _|_ {
|
||||
hostPort: port.hostPort
|
||||
}
|
||||
if port.hostIP != _|_ {
|
||||
hostIP: port.hostIP
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
patch: spec: template: spec: {
|
||||
if parameter.containers == _|_ {
|
||||
// +patchKey=name
|
||||
containers: [{
|
||||
PatchContainer & {_params: {
|
||||
if parameter.containerName == "" {
|
||||
containerName: context.name
|
||||
}
|
||||
if parameter.containerName != "" {
|
||||
containerName: parameter.containerName
|
||||
}
|
||||
ports: parameter.ports
|
||||
}}
|
||||
}]
|
||||
}
|
||||
if parameter.containers != _|_ {
|
||||
// +patchKey=name
|
||||
containers: [ for c in parameter.containers {
|
||||
if c.containerName == "" {
|
||||
err: "container name must be set for containers"
|
||||
}
|
||||
if c.containerName != "" {
|
||||
PatchContainer & {_params: c}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
parameter: *#PatchParams | close({
|
||||
// +usage=Specify the container ports for multiple containers
|
||||
containers: [...#PatchParams]
|
||||
})
|
||||
|
||||
errs: [ for c in patch.spec.template.spec.containers if c.err != _|_ {c.err}]
|
||||
|
||||
@@ -11,6 +11,138 @@ spec:
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
mountsArray: {
|
||||
pvc: *[
|
||||
for v in parameter.volumeMounts.pvc {
|
||||
{
|
||||
mountPath: v.mountPath
|
||||
if v.subPath != _|_ {
|
||||
subPath: v.subPath
|
||||
}
|
||||
name: v.name
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
configMap: *[
|
||||
for v in parameter.volumeMounts.configMap {
|
||||
{
|
||||
mountPath: v.mountPath
|
||||
if v.subPath != _|_ {
|
||||
subPath: v.subPath
|
||||
}
|
||||
name: v.name
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
secret: *[
|
||||
for v in parameter.volumeMounts.secret {
|
||||
{
|
||||
mountPath: v.mountPath
|
||||
if v.subPath != _|_ {
|
||||
subPath: v.subPath
|
||||
}
|
||||
name: v.name
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
emptyDir: *[
|
||||
for v in parameter.volumeMounts.emptyDir {
|
||||
{
|
||||
mountPath: v.mountPath
|
||||
if v.subPath != _|_ {
|
||||
subPath: v.subPath
|
||||
}
|
||||
name: v.name
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
hostPath: *[
|
||||
for v in parameter.volumeMounts.hostPath {
|
||||
{
|
||||
mountPath: v.mountPath
|
||||
if v.subPath != _|_ {
|
||||
subPath: v.subPath
|
||||
}
|
||||
name: v.name
|
||||
}
|
||||
},
|
||||
] | []
|
||||
}
|
||||
volumesArray: {
|
||||
pvc: *[
|
||||
for v in parameter.volumeMounts.pvc {
|
||||
{
|
||||
name: v.name
|
||||
persistentVolumeClaim: claimName: v.claimName
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
configMap: *[
|
||||
for v in parameter.volumeMounts.configMap {
|
||||
{
|
||||
name: v.name
|
||||
configMap: {
|
||||
defaultMode: v.defaultMode
|
||||
name: v.cmName
|
||||
if v.items != _|_ {
|
||||
items: v.items
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
secret: *[
|
||||
for v in parameter.volumeMounts.secret {
|
||||
{
|
||||
name: v.name
|
||||
secret: {
|
||||
defaultMode: v.defaultMode
|
||||
secretName: v.secretName
|
||||
if v.items != _|_ {
|
||||
items: v.items
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
emptyDir: *[
|
||||
for v in parameter.volumeMounts.emptyDir {
|
||||
{
|
||||
name: v.name
|
||||
emptyDir: medium: v.medium
|
||||
}
|
||||
},
|
||||
] | []
|
||||
|
||||
hostPath: *[
|
||||
for v in parameter.volumeMounts.hostPath {
|
||||
{
|
||||
name: v.name
|
||||
hostPath: path: v.path
|
||||
}
|
||||
},
|
||||
] | []
|
||||
}
|
||||
volumesList: volumesArray.pvc + volumesArray.configMap + volumesArray.secret + volumesArray.emptyDir + volumesArray.hostPath
|
||||
deDupVolumesArray: [
|
||||
for val in [
|
||||
for i, vi in volumesList {
|
||||
for j, vj in volumesList if j < i && vi.name == vj.name {
|
||||
_ignore: true
|
||||
}
|
||||
vi
|
||||
},
|
||||
] if val._ignore == _|_ {
|
||||
val
|
||||
},
|
||||
]
|
||||
output: {
|
||||
if context.clusterVersion.minor < 25 {
|
||||
apiVersion: "batch/v1beta1"
|
||||
@@ -90,15 +222,18 @@ spec:
|
||||
requests: memory: parameter.memory
|
||||
}
|
||||
}
|
||||
if parameter["volumes"] != _|_ {
|
||||
if parameter["volumes"] != _|_ if parameter["volumeMounts"] == _|_ {
|
||||
volumeMounts: [ for v in parameter.volumes {
|
||||
{
|
||||
mountPath: v.mountPath
|
||||
name: v.name
|
||||
}}]
|
||||
}
|
||||
if parameter["volumeMounts"] != _|_ {
|
||||
volumeMounts: mountsArray.pvc + mountsArray.configMap + mountsArray.secret + mountsArray.emptyDir + mountsArray.hostPath
|
||||
}
|
||||
}]
|
||||
if parameter["volumes"] != _|_ {
|
||||
if parameter["volumes"] != _|_ if parameter["volumeMounts"] == _|_ {
|
||||
volumes: [ for v in parameter.volumes {
|
||||
{
|
||||
name: v.name
|
||||
@@ -128,6 +263,9 @@ spec:
|
||||
}
|
||||
}}]
|
||||
}
|
||||
if parameter["volumeMounts"] != _|_ {
|
||||
volumes: deDupVolumesArray
|
||||
}
|
||||
if parameter["imagePullSecrets"] != _|_ {
|
||||
imagePullSecrets: [ for v in parameter.imagePullSecrets {
|
||||
name: v
|
||||
@@ -224,7 +362,58 @@ spec:
|
||||
// +usage=Specifies the attributes of the memory resource required for the container.
|
||||
memory?: string
|
||||
|
||||
// +usage=Declare volumes and volumeMounts
|
||||
volumeMounts?: {
|
||||
// +usage=Mount PVC type volume
|
||||
pvc?: [...{
|
||||
name: string
|
||||
mountPath: string
|
||||
subPath?: string
|
||||
// +usage=The name of the PVC
|
||||
claimName: string
|
||||
}]
|
||||
// +usage=Mount ConfigMap type volume
|
||||
configMap?: [...{
|
||||
name: string
|
||||
mountPath: string
|
||||
subPath?: string
|
||||
defaultMode: *420 | int
|
||||
cmName: string
|
||||
items?: [...{
|
||||
key: string
|
||||
path: string
|
||||
mode: *511 | int
|
||||
}]
|
||||
}]
|
||||
// +usage=Mount Secret type volume
|
||||
secret?: [...{
|
||||
name: string
|
||||
mountPath: string
|
||||
subPath?: string
|
||||
defaultMode: *420 | int
|
||||
secretName: string
|
||||
items?: [...{
|
||||
key: string
|
||||
path: string
|
||||
mode: *511 | int
|
||||
}]
|
||||
}]
|
||||
// +usage=Mount EmptyDir type volume
|
||||
emptyDir?: [...{
|
||||
name: string
|
||||
mountPath: string
|
||||
subPath?: string
|
||||
medium: *"" | "Memory"
|
||||
}]
|
||||
// +usage=Mount HostPath type volume
|
||||
hostPath?: [...{
|
||||
name: string
|
||||
mountPath: string
|
||||
subPath?: string
|
||||
path: string
|
||||
}]
|
||||
}
|
||||
|
||||
// +usage=Deprecated field, use volumeMounts instead.
|
||||
volumes?: [...{
|
||||
name: string
|
||||
mountPath: string
|
||||
|
||||
@@ -14,26 +14,35 @@ spec:
|
||||
podDisruptive: false
|
||||
schematic:
|
||||
cue:
|
||||
template: |2
|
||||
template: |
|
||||
import "strconv"
|
||||
|
||||
let nameSuffix = {
|
||||
if parameter.name != _|_ {"-" + parameter.name}
|
||||
if parameter.name == _|_ {""}
|
||||
}
|
||||
let serviceOutputName = "service" + nameSuffix
|
||||
let serviceMetaName = context.name + nameSuffix
|
||||
|
||||
outputs: (serviceOutputName): {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
metadata: name: "\(serviceMetaName)"
|
||||
spec: {
|
||||
selector: "app.oam.dev/component": context.name
|
||||
ports: [
|
||||
for k, v in parameter.http {
|
||||
port: v
|
||||
targetPort: v
|
||||
},
|
||||
]
|
||||
let serviceMetaName = {
|
||||
if (parameter.existingServiceName != _|_) {parameter.existingServiceName}
|
||||
if (parameter.existingServiceName == _|_) {context.name + nameSuffix}
|
||||
}
|
||||
|
||||
if (parameter.existingServiceName == _|_) {
|
||||
let serviceOutputName = "service" + nameSuffix
|
||||
outputs: (serviceOutputName): {
|
||||
apiVersion: "v1"
|
||||
kind: "Service"
|
||||
metadata: name: "\(serviceMetaName)"
|
||||
spec: {
|
||||
selector: "app.oam.dev/component": context.name
|
||||
ports: [
|
||||
for k, v in parameter.http {
|
||||
name: "port-" + strconv.FormatInt(v, 10)
|
||||
port: v
|
||||
targetPort: v
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +67,18 @@ spec:
|
||||
if parameter.gatewayHost != _|_ {
|
||||
"ingress.controller/host": parameter.gatewayHost
|
||||
}
|
||||
if parameter.annotations != _|_ {
|
||||
for key, value in parameter.annotations {
|
||||
"\(key)": "\(value)"
|
||||
}
|
||||
}
|
||||
}
|
||||
labels: {
|
||||
if parameter.labels != _|_ {
|
||||
for key, value in parameter.labels {
|
||||
"\(key)": "\(value)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
spec: {
|
||||
@@ -122,6 +143,15 @@ spec:
|
||||
|
||||
// +usage=Specify a pathType for the ingress rules, defaults to "ImplementationSpecific"
|
||||
pathType: *"ImplementationSpecific" | "Prefix" | "Exact"
|
||||
|
||||
// +usage=Specify the annotations to be added to the ingress
|
||||
annotations?: [string]: string
|
||||
|
||||
// +usage=Specify the labels to be added to the ingress
|
||||
labels?: [string]: string
|
||||
|
||||
// +usage=If specified, use an existing Service rather than creating one
|
||||
existingServiceName?: string
|
||||
}
|
||||
status:
|
||||
customStatus: |-
|
||||
|
||||
@@ -55,11 +55,11 @@ spec:
|
||||
name: "memory"
|
||||
target: {
|
||||
type: parameter.mem.type
|
||||
if parameter.cpu.type == "Utilization" {
|
||||
averageUtilization: parameter.cpu.value
|
||||
if parameter.mem.type == "Utilization" {
|
||||
averageUtilization: parameter.mem.value
|
||||
}
|
||||
if parameter.cpu.type == "AverageValue" {
|
||||
averageValue: parameter.cpu.value
|
||||
if parameter.mem.type == "AverageValue" {
|
||||
averageValue: parameter.mem.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,43 +13,54 @@ spec:
|
||||
- statefulsets.apps
|
||||
- daemonsets.apps
|
||||
- jobs.batch
|
||||
- cronjobs.batch
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |
|
||||
patch: spec: template: spec: {
|
||||
// +patchKey=name
|
||||
containers: [{
|
||||
resources: {
|
||||
if parameter.cpu != _|_ if parameter.memory != _|_ if parameter.requests == _|_ if parameter.limits == _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
requests: {
|
||||
cpu: parameter.cpu
|
||||
memory: parameter.memory
|
||||
}
|
||||
// +patchStrategy=retainKeys
|
||||
limits: {
|
||||
cpu: parameter.cpu
|
||||
memory: parameter.memory
|
||||
}
|
||||
template: |2
|
||||
let resourceContent = {
|
||||
resources: {
|
||||
if parameter.cpu != _|_ if parameter.memory != _|_ if parameter.requests == _|_ if parameter.limits == _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
requests: {
|
||||
cpu: parameter.cpu
|
||||
memory: parameter.memory
|
||||
}
|
||||
|
||||
if parameter.requests != _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
requests: {
|
||||
cpu: parameter.requests.cpu
|
||||
memory: parameter.requests.memory
|
||||
}
|
||||
}
|
||||
if parameter.limits != _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
limits: {
|
||||
cpu: parameter.limits.cpu
|
||||
memory: parameter.limits.memory
|
||||
}
|
||||
// +patchStrategy=retainKeys
|
||||
limits: {
|
||||
cpu: parameter.cpu
|
||||
memory: parameter.memory
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
if parameter.requests != _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
requests: {
|
||||
cpu: parameter.requests.cpu
|
||||
memory: parameter.requests.memory
|
||||
}
|
||||
}
|
||||
if parameter.limits != _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
limits: {
|
||||
cpu: parameter.limits.cpu
|
||||
memory: parameter.limits.memory
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if context.output.spec != _|_ if context.output.spec.template != _|_ {
|
||||
patch: spec: template: spec: {
|
||||
// +patchKey=name
|
||||
containers: [resourceContent]
|
||||
}
|
||||
}
|
||||
if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ {
|
||||
patch: spec: jobTemplate: spec: template: spec: {
|
||||
// +patchKey=name
|
||||
containers: [resourceContent]
|
||||
}
|
||||
}
|
||||
|
||||
parameter: {
|
||||
|
||||
@@ -65,7 +65,7 @@ spec:
|
||||
// +usage=Instructions for assessing container startup status by probing a TCP socket. Either this attribute or the exec attribute or the tcpSocket attribute or the httpGet attribute MUST be specified. This attribute is mutually exclusive with the exec attribute and the httpGet attribute and the gRPC attribute.
|
||||
tcpSocket?: {
|
||||
// +usage=Number or name of the port to access on the container.
|
||||
port: string
|
||||
port: int
|
||||
// +usage=Host name to connect to, defaults to the pod IP.
|
||||
host?: string
|
||||
}
|
||||
@@ -144,7 +144,7 @@ spec:
|
||||
grpc: parameter.grpc
|
||||
}
|
||||
if parameter.tcpSocket != _|_ {
|
||||
tcpSocket: parameter.grtcpSocketpc
|
||||
tcpSocket: parameter.tcpSocket
|
||||
}
|
||||
}}
|
||||
}]
|
||||
|
||||
@@ -46,11 +46,11 @@ spec:
|
||||
}
|
||||
}
|
||||
}
|
||||
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
|
||||
{
|
||||
name: "hostpath-" + v.name
|
||||
path: v.path
|
||||
}
|
||||
},
|
||||
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
|
||||
{
|
||||
name: "hostpath-" + v.name
|
||||
path: v.path
|
||||
}
|
||||
},
|
||||
]
|
||||
|
||||
@@ -165,14 +165,20 @@ spec:
|
||||
if parameter["ports"] != _|_ {
|
||||
ports: [ for v in parameter.ports {
|
||||
{
|
||||
containerPort: v.port
|
||||
protocol: v.protocol
|
||||
containerPort: {
|
||||
if v.containerPort != _|_ {v.containerPort}
|
||||
if v.containerPort == _|_ {v.port}
|
||||
}
|
||||
protocol: v.protocol
|
||||
if v.name != _|_ {
|
||||
name: v.name
|
||||
}
|
||||
if v.name == _|_ {
|
||||
_name: "port-" + strconv.FormatInt(v.port, 10)
|
||||
name: *_name | string
|
||||
_name: {
|
||||
if v.containerPort != _|_ {"port-" + strconv.FormatInt(v.containerPort, 10)}
|
||||
if v.containerPort == _|_ {"port-" + strconv.FormatInt(v.port, 10)}
|
||||
}
|
||||
name: *_name | string
|
||||
if v.protocol != "TCP" {
|
||||
name: _name + "-" + strings.ToLower(v.protocol)
|
||||
}
|
||||
@@ -290,14 +296,20 @@ spec:
|
||||
|
||||
exposePorts: [
|
||||
if parameter.ports != _|_ for v in parameter.ports if v.expose == true {
|
||||
port: v.port
|
||||
targetPort: v.port
|
||||
if v.name != _|_ {
|
||||
name: v.name
|
||||
}
|
||||
port: v.port
|
||||
if v.containerPort != _|_ {targetPort: v.containerPort}
|
||||
if v.containerPort == _|_ {targetPort: v.port}
|
||||
if v.name != _|_ {name: v.name}
|
||||
if v.name == _|_ {
|
||||
_name: "port-" + strconv.FormatInt(v.port, 10)
|
||||
name: *_name | string
|
||||
_name: {
|
||||
if v.containerPort != _|_ {
|
||||
"port-" + strconv.FormatInt(v.containerPort, 10)
|
||||
}
|
||||
if v.containerPort == _|_ {
|
||||
"port-" + strconv.FormatInt(v.port, 10)
|
||||
}
|
||||
}
|
||||
name: *_name | string
|
||||
if v.protocol != "TCP" {
|
||||
name: _name + "-" + strings.ToLower(v.protocol)
|
||||
}
|
||||
@@ -352,6 +364,8 @@ spec:
|
||||
ports?: [...{
|
||||
// +usage=Number of port to expose on the pod's IP address
|
||||
port: int
|
||||
// +usage=Number of container port to connect to, defaults to port
|
||||
containerPort?: int
|
||||
// +usage=Name of the port
|
||||
name?: string
|
||||
// +usage=Protocol for port. Must be UDP, TCP, or SCTP
|
||||
|
||||
@@ -3,6 +3,7 @@ apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "kubevela.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "kubevela.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
@@ -121,6 +122,7 @@ apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ include "kubevela.fullname" . }}:leader-election-role
|
||||
namespace: {{ .Release.Namespace }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
@@ -154,6 +156,7 @@ apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ include "kubevela.fullname" . }}:leader-election-rolebinding
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
@@ -168,6 +171,7 @@ apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ include "kubevela.fullname" . }}:template-reader-role
|
||||
namespace: {{ .Release.Namespace }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
@@ -188,6 +192,7 @@ apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ include "kubevela.fullname" . }}:template-reader-binding
|
||||
namespace: {{ .Release.Namespace }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
|
||||
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/kubevela/pkg/controller/sharding"
|
||||
pkgmulticluster "github.com/kubevela/pkg/multicluster"
|
||||
utillog "github.com/kubevela/pkg/util/log"
|
||||
"github.com/kubevela/pkg/util/profiling"
|
||||
wfTypes "github.com/kubevela/workflow/pkg/types"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
cliflag "k8s.io/component-base/cli/flag"
|
||||
@@ -53,7 +54,6 @@ type CoreOptions struct {
|
||||
InformerSyncPeriod time.Duration
|
||||
QPS float64
|
||||
Burst int
|
||||
PprofAddr string
|
||||
LeaderElectionResourceLock string
|
||||
LeaseDuration time.Duration
|
||||
RenewDeadLine time.Duration
|
||||
@@ -81,7 +81,6 @@ func NewCoreOptions() *CoreOptions {
|
||||
DefRevisionLimit: 20,
|
||||
AutoGenWorkloadDefinition: true,
|
||||
ConcurrentReconciles: 4,
|
||||
EnableCompatibility: false,
|
||||
IgnoreAppWithoutControllerRequirement: false,
|
||||
IgnoreDefinitionWithoutControllerRequirement: false,
|
||||
},
|
||||
@@ -90,7 +89,6 @@ func NewCoreOptions() *CoreOptions {
|
||||
InformerSyncPeriod: 10 * time.Hour,
|
||||
QPS: 50,
|
||||
Burst: 100,
|
||||
PprofAddr: "",
|
||||
LeaderElectionResourceLock: "configmapsleases",
|
||||
LeaseDuration: 15 * time.Second,
|
||||
RenewDeadLine: 10 * time.Second,
|
||||
@@ -123,7 +121,6 @@ func (s *CoreOptions) Flags() cliflag.NamedFlagSets {
|
||||
"The re-sync period for informer in controller-runtime. This is a system-level configuration.")
|
||||
gfs.Float64Var(&s.QPS, "kube-api-qps", s.QPS, "the qps for reconcile clients. Low qps may lead to low throughput. High qps may give stress to api-server. Raise this value if concurrent-reconciles is set to be high.")
|
||||
gfs.IntVar(&s.Burst, "kube-api-burst", s.Burst, "the burst for reconcile clients. Recommend setting it qps*2.")
|
||||
gfs.StringVar(&s.PprofAddr, "pprof-addr", s.PprofAddr, "The address for pprof to use while exporting profiling results. The default value is empty which means do not expose it. Set it to address like :6666 to expose it.")
|
||||
gfs.StringVar(&s.LeaderElectionResourceLock, "leader-election-resource-lock", s.LeaderElectionResourceLock, "The resource lock to use for leader election")
|
||||
gfs.DurationVar(&s.LeaseDuration, "leader-election-lease-duration", s.LeaseDuration,
|
||||
"The duration that non-leader candidates will wait to force acquire leadership")
|
||||
@@ -163,6 +160,7 @@ func (s *CoreOptions) Flags() cliflag.NamedFlagSets {
|
||||
kfs := fss.FlagSet("klog")
|
||||
pkgclient.AddTimeoutControllerClientFlags(fss.FlagSet("controllerclient"))
|
||||
utillog.AddFlags(kfs)
|
||||
profiling.AddFlags(fss.FlagSet("profiling"))
|
||||
|
||||
if s.LogDebug {
|
||||
_ = kfs.Set("v", strconv.Itoa(int(commonconfig.LogDebug)))
|
||||
|
||||
@@ -60,7 +60,6 @@ func TestCoreOptions_Flags(t *testing.T) {
|
||||
"--max-workflow-wait-backoff-time=5",
|
||||
"--metrics-addr=/metrics",
|
||||
"--perf-enabled=true",
|
||||
"--pprof-addr=/debug/pprof",
|
||||
"--use-webhook=true",
|
||||
"--webhook-cert-dir=/path/to/cert",
|
||||
"--webhook-port=8080",
|
||||
@@ -86,7 +85,6 @@ func TestCoreOptions_Flags(t *testing.T) {
|
||||
InformerSyncPeriod: 3 * time.Second,
|
||||
QPS: 200,
|
||||
Burst: 500,
|
||||
PprofAddr: "/debug/pprof",
|
||||
LeaderElectionResourceLock: "/leases",
|
||||
LeaseDuration: 3 * time.Second,
|
||||
RenewDeadLine: 5 * time.Second,
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
velaclient "github.com/kubevela/pkg/controller/client"
|
||||
"github.com/kubevela/pkg/controller/sharding"
|
||||
"github.com/kubevela/pkg/meta"
|
||||
"github.com/kubevela/pkg/util/profiling"
|
||||
"github.com/kubevela/workflow/pkg/cue/packages"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/spf13/cobra"
|
||||
@@ -46,13 +47,12 @@ import (
|
||||
"github.com/oam-dev/kubevela/pkg/auth"
|
||||
"github.com/oam-dev/kubevela/pkg/cache"
|
||||
commonconfig "github.com/oam-dev/kubevela/pkg/controller/common"
|
||||
oamv1alpha2 "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1beta1"
|
||||
oamv1beta1 "github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1beta1"
|
||||
"github.com/oam-dev/kubevela/pkg/controller/core.oam.dev/v1beta1/application"
|
||||
"github.com/oam-dev/kubevela/pkg/features"
|
||||
"github.com/oam-dev/kubevela/pkg/monitor/watcher"
|
||||
"github.com/oam-dev/kubevela/pkg/multicluster"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
pkgutil "github.com/oam-dev/kubevela/pkg/utils"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/util"
|
||||
oamwebhook "github.com/oam-dev/kubevela/pkg/webhook/core.oam.dev"
|
||||
@@ -75,6 +75,10 @@ func NewCoreCommand() *cobra.Command {
|
||||
return run(signals.SetupSignalHandler(), s)
|
||||
},
|
||||
SilenceUsage: true,
|
||||
FParseErrWhitelist: cobra.FParseErrWhitelist{
|
||||
// Allow unknown flags for backward-compatibility.
|
||||
UnknownFlags: true,
|
||||
},
|
||||
}
|
||||
|
||||
fs := cmd.Flags()
|
||||
@@ -101,10 +105,7 @@ func run(ctx context.Context, s *options.CoreOptions) error {
|
||||
"QPS", restConfig.QPS,
|
||||
"Burst", restConfig.Burst,
|
||||
)
|
||||
|
||||
if s.PprofAddr != "" {
|
||||
go pkgutil.EnablePprof(s.PprofAddr, nil)
|
||||
}
|
||||
go profiling.StartProfilingServer(nil)
|
||||
|
||||
// wrapper the round tripper by multi cluster rewriter
|
||||
if s.EnableClusterGateway {
|
||||
@@ -230,7 +231,7 @@ func prepareRun(ctx context.Context, mgr manager.Manager, s *options.CoreOptions
|
||||
}
|
||||
}
|
||||
|
||||
if err := oamv1alpha2.Setup(mgr, *s.ControllerArgs); err != nil {
|
||||
if err := oamv1beta1.Setup(mgr, *s.ControllerArgs); err != nil {
|
||||
klog.ErrorS(err, "Unable to setup the oam controller")
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import (
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
"github.com/oam-dev/kubevela/e2e"
|
||||
"github.com/oam-dev/kubevela/pkg/addon"
|
||||
addonutil "github.com/oam-dev/kubevela/pkg/utils/addon"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/common"
|
||||
)
|
||||
|
||||
@@ -180,7 +181,7 @@ var _ = Describe("Addon Test", func() {
|
||||
})
|
||||
|
||||
Context("Enable dependency addon test", func() {
|
||||
It(" enable mock-dependence-rely without specified clusters when mock-dependence addon is not enabled", func() {
|
||||
It("enable upstream addon without specified clusters when dependence addon is not enabled", func() {
|
||||
output, err := e2e.Exec("vela addon enable mock-dependence-rely")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).To(ContainSubstring("enabled successfully."))
|
||||
@@ -198,7 +199,7 @@ var _ = Describe("Addon Test", func() {
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("enable mock-dependence-rely with specified clusters when mock-dependence addon is not enabled ", func() {
|
||||
It("enable upstream addon with specified clusters when dependence addon is not enabled ", func() {
|
||||
output, err := e2e.Exec("vela addon enable mock-dependence-rely2 --clusters local")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).To(ContainSubstring("enabled successfully."))
|
||||
@@ -216,8 +217,133 @@ var _ = Describe("Addon Test", func() {
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("enable mock-dependence-rely without specified clusters when mock-dependence addon was enabled with specified clusters", func() {
|
||||
It("enable upstream addon without specified clusters when dependence addon is enabled with specified clusters", func() {
|
||||
// 1. enable mock-dependence addon with local clusters
|
||||
dependentName := "mock-dependence3"
|
||||
addonName := "mock-dependence-rely3"
|
||||
output, err := e2e.Exec("vela addon enable " + dependentName + " --clusters local myparam=test")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).To(ContainSubstring("enabled successfully."))
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: addonutil.Addon2SecName(dependentName), Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"clusters": []interface{}{"local"},
|
||||
"myparam": "test",
|
||||
}))
|
||||
// check application render cluster
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: addonutil.Addon2AppName(dependentName), Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
for _, policy := range app.Spec.Policies {
|
||||
if policy.Type == "topology" {
|
||||
Expect(json.Unmarshal(policy.Properties.Raw, &topologyPolicyValue)).Should(Succeed())
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusters"]).Should(Equal([]interface{}{"local"}))
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(BeNil())
|
||||
}, 600*time.Second).Should(Succeed())
|
||||
// 2. enable mock-dependence-rely addon without clusters
|
||||
output1, err1 := e2e.Exec("vela addon enable " + addonName)
|
||||
Expect(err1).NotTo(HaveOccurred())
|
||||
Expect(output1).To(ContainSubstring("enabled successfully."))
|
||||
// 3. enable mock-dependence-rely addon changes the mock-dependence topology policy
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: addonutil.Addon2SecName(dependentName), Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"myparam": "test",
|
||||
}))
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: addonutil.Addon2AppName(dependentName), Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
for _, policy := range app.Spec.Policies {
|
||||
if policy.Type == "topology" {
|
||||
Expect(json.Unmarshal(policy.Properties.Raw, &topologyPolicyValue)).Should(Succeed())
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusters"]).Should(BeNil())
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(Equal(map[string]interface{}{}))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("enable upstream addon with specified clusters when dependence addon is enabled with clusters value is nil", func() {
|
||||
// enable fluxcd
|
||||
// enable rollout --clusters={local}
|
||||
// 1. enable mock-dependence addon with nil clusters parameter
|
||||
output, err := e2e.InteractiveExec("vela addon enable mock-dependence myparam=test", func(c *expect.Console) {
|
||||
_, err = c.SendLine("y")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).To(ContainSubstring("enabled successfully."))
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"myparam": "test",
|
||||
}))
|
||||
// check application render cluster
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-mock-dependence", Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
for _, policy := range app.Spec.Policies {
|
||||
if policy.Type == "topology" {
|
||||
Expect(json.Unmarshal(policy.Properties.Raw, &topologyPolicyValue)).Should(Succeed())
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusters"]).Should(BeNil())
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(Equal(map[string]interface{}{}))
|
||||
}, 600*time.Second).Should(Succeed())
|
||||
|
||||
// 2. enable mock-dependence-rely addon with local clusters
|
||||
output1, err := e2e.InteractiveExec("vela addon enable mock-dependence-rely --clusters local", func(c *expect.Console) {
|
||||
_, err = c.SendLine("y")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output1).To(ContainSubstring("enabled successfully."))
|
||||
// 3. enable mock-dependence-rely addon changes the mock-dependence topology policy
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"myparam": "test",
|
||||
}))
|
||||
// check application render cluster
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-mock-dependence", Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
for _, policy := range app.Spec.Policies {
|
||||
if policy.Type == "topology" {
|
||||
Expect(json.Unmarshal(policy.Properties.Raw, &topologyPolicyValue)).Should(Succeed())
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusters"]).Should(BeNil())
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(Equal(map[string]interface{}{}))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("enable upstream addon without clusters when dependence addon is enabled with clusters value is not nil", func() {
|
||||
// enable fluxcd --clusters={local}
|
||||
// enable rollout
|
||||
// 1. enable mock-dependence addon with local clusters and myparam parameter
|
||||
output, err := e2e.InteractiveExec("vela addon enable mock-dependence --clusters local myparam=test", func(c *expect.Console) {
|
||||
_, err = c.SendLine("y")
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
@@ -225,6 +351,15 @@ var _ = Describe("Addon Test", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).To(ContainSubstring("enabled successfully."))
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"clusters": []interface{}{"local"},
|
||||
"myparam": "test",
|
||||
}))
|
||||
// check application render cluster
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-mock-dependence", Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
@@ -238,6 +373,7 @@ var _ = Describe("Addon Test", func() {
|
||||
Expect(topologyPolicyValue["clusters"]).Should(Equal([]interface{}{"local"}))
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(BeNil())
|
||||
}, 600*time.Second).Should(Succeed())
|
||||
|
||||
// 2. enable mock-dependence-rely addon without clusters
|
||||
output1, err := e2e.InteractiveExec("vela addon enable mock-dependence-rely", func(c *expect.Console) {
|
||||
_, err = c.SendLine("y")
|
||||
@@ -247,6 +383,15 @@ var _ = Describe("Addon Test", func() {
|
||||
Expect(output1).To(ContainSubstring("enabled successfully."))
|
||||
// 3. enable mock-dependence-rely addon changes the mock-dependence topology policy
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"myparam": "test",
|
||||
}))
|
||||
// check application render cluster
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-mock-dependence", Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
@@ -256,12 +401,12 @@ var _ = Describe("Addon Test", func() {
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(Equal(map[string]interface{}{}))
|
||||
Expect(topologyPolicyValue["clusters"]).Should(BeNil())
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(Equal(map[string]interface{}{}))
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("Test addon dependency with specified clusters", func() {
|
||||
It("enable upstream addon with two clusters when dependence addon is enabled with one cluster", func() {
|
||||
const clusterName = "k3s-default"
|
||||
// enable addon
|
||||
output, err := e2e.InteractiveExec("vela addon enable mock-dependence --clusters local myparam=test", func(c *expect.Console) {
|
||||
@@ -330,6 +475,101 @@ var _ = Describe("Addon Test", func() {
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusters"]).Should(Equal([]interface{}{"local", clusterName}))
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("enable upstream addon without clusters when dependence addon which is enabled locally", func() {
|
||||
// enable ./fluxcd
|
||||
// enable rollout
|
||||
// enable addon locally
|
||||
output, err := e2e.LongTimeExec("vela addon enable ../../e2e/addon/mock/testdata/mock-dependence-locally --clusters local myparam=test", 600*time.Second)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).To(ContainSubstring("enabled successfully."))
|
||||
// check dependence application parameter
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence-locally", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"clusters": []interface{}{"local"},
|
||||
"myparam": "test",
|
||||
}))
|
||||
// check application render cluster
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-mock-dependence-locally", Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
for _, policy := range app.Spec.Policies {
|
||||
if policy.Type == "topology" {
|
||||
Expect(json.Unmarshal(policy.Properties.Raw, &topologyPolicyValue)).Should(Succeed())
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusters"]).Should(Equal([]interface{}{"local"}))
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(BeNil())
|
||||
}, 600*time.Second).Should(Succeed())
|
||||
// enable addon which rely on mock-dependence-locally
|
||||
output1, err1 := e2e.Exec("vela addon enable mock-dependence-upstream-locally")
|
||||
Expect(err1).NotTo(HaveOccurred())
|
||||
Expect(output1).To(ContainSubstring("enabled successfully."))
|
||||
// check mock-dependence-locally application parameter
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence-locally", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"clusters": []interface{}{"local"},
|
||||
"myparam": "test",
|
||||
}))
|
||||
// check application render cluster
|
||||
app := &v1beta1.Application{}
|
||||
Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-mock-dependence-locally", Namespace: "vela-system"}, app)).Should(Succeed())
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
for _, policy := range app.Spec.Policies {
|
||||
if policy.Type == "topology" {
|
||||
Expect(json.Unmarshal(policy.Properties.Raw, &topologyPolicyValue)).Should(Succeed())
|
||||
break
|
||||
}
|
||||
}
|
||||
Expect(topologyPolicyValue["clusters"]).Should(Equal([]interface{}{"local"}))
|
||||
Expect(topologyPolicyValue["clusterLabelSelector"]).Should(BeNil())
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("enable upstream addon with specified clusters when dependence addon which without clusters arg is enabled", func() {
|
||||
// enable vela-prism
|
||||
// enable o11
|
||||
output, err := e2e.LongTimeExec("vela addon enable mock-dependence-no-clusters-arg myparam=test", 600*time.Second)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).To(ContainSubstring("enabled successfully."))
|
||||
// check dependence application parameter
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence-no-clusters-arg", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"myparam": "test",
|
||||
}))
|
||||
}, 600*time.Second).Should(Succeed())
|
||||
// enable addon which rely on mock-dependence-no-clusters-arg
|
||||
output1, err1 := e2e.Exec("vela addon enable mock-dependence-upstream-no-clusters-arg --clusters local")
|
||||
Expect(err1).NotTo(HaveOccurred())
|
||||
Expect(output1).To(ContainSubstring("enabled successfully."))
|
||||
// check mock-dependence-locally application parameter
|
||||
Eventually(func(g Gomega) {
|
||||
// check parameter
|
||||
sec := &v1.Secret{}
|
||||
g.Expect(k8sClient.Get(context.Background(), types.NamespacedName{Name: "addon-secret-mock-dependence-no-clusters-arg", Namespace: "vela-system"}, sec)).Should(Succeed())
|
||||
parameters := map[string]interface{}{}
|
||||
json.Unmarshal(sec.Data[addon.AddonParameterDataKey], ¶meters)
|
||||
g.Expect(parameters).Should(BeEquivalentTo(map[string]interface{}{
|
||||
"myparam": "test",
|
||||
}))
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
})
|
||||
})
|
||||
|
||||
3
e2e/addon/mock/testdata/mock-dependence-locally/README.md
vendored
Normal file
3
e2e/addon/mock/testdata/mock-dependence-locally/README.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# mock-dependence
|
||||
|
||||
This is an addon template. Check how to build your own addon: https://kubevela.net/docs/platform-engineers/addon/intro
|
||||
7
e2e/addon/mock/testdata/mock-dependence-locally/metadata.yaml
vendored
Normal file
7
e2e/addon/mock/testdata/mock-dependence-locally/metadata.yaml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
description: An addon for testing addon dependency with installed locally.
|
||||
icon: ""
|
||||
invisible: false
|
||||
name: mock-dependence-locally
|
||||
tags:
|
||||
- my-tag
|
||||
version: 1.0.0
|
||||
12
e2e/addon/mock/testdata/mock-dependence-locally/parameter.cue
vendored
Normal file
12
e2e/addon/mock/testdata/mock-dependence-locally/parameter.cue
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// parameter.cue is used to store addon parameters.
|
||||
//
|
||||
// You can use these parameters in template.cue or in resources/ by 'parameter.myparam'
|
||||
//
|
||||
// For example, you can use parameters to allow the user to customize
|
||||
// container images, ports, and etc.
|
||||
parameter: {
|
||||
// +usage=Custom parameter description
|
||||
myparam: *"myns" | string
|
||||
// +usage=Deploy to specified clusters. Leave empty to deploy to all clusters.
|
||||
clusters?: [...string]
|
||||
}
|
||||
24
e2e/addon/mock/testdata/mock-dependence-locally/template.cue
vendored
Normal file
24
e2e/addon/mock/testdata/mock-dependence-locally/template.cue
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
_targetNamespace: parameter.myparam
|
||||
output: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
spec: {
|
||||
components: [],
|
||||
policies: [
|
||||
{
|
||||
type: "topology"
|
||||
name: "deploy-mock-dependency-ns"
|
||||
properties: {
|
||||
namespace: _targetNamespace
|
||||
if parameter.clusters != _|_ {
|
||||
clusters: parameter.clusters
|
||||
}
|
||||
if parameter.clusters == _|_ {
|
||||
clusterLabelSelector: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
3
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/README.md
vendored
Normal file
3
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/README.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# mock-dependence
|
||||
|
||||
This is an addon template. Check how to build your own addon: https://kubevela.net/docs/platform-engineers/addon/intro
|
||||
7
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/metadata.yaml
vendored
Normal file
7
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/metadata.yaml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
description: An addon for testing addon dependency witch is not defined clusters arg.
|
||||
icon: ""
|
||||
invisible: false
|
||||
name: mock-dependence-no-clusters-arg
|
||||
tags:
|
||||
- my-tag
|
||||
version: 1.0.0
|
||||
10
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/parameter.cue
vendored
Normal file
10
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/parameter.cue
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// parameter.cue is used to store addon parameters.
|
||||
//
|
||||
// You can use these parameters in template.cue or in resources/ by 'parameter.myparam'
|
||||
//
|
||||
// For example, you can use parameters to allow the user to customize
|
||||
// container images, ports, and etc.
|
||||
parameter: {
|
||||
// +usage=Custom parameter description
|
||||
myparam: *"myns" | string
|
||||
}
|
||||
10
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/template.cue
vendored
Normal file
10
e2e/addon/mock/testdata/mock-dependence-no-clusters-arg/template.cue
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
package main
|
||||
_targetNamespace: parameter.myparam
|
||||
output: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
spec: {
|
||||
components: [],
|
||||
policies: []
|
||||
}
|
||||
}
|
||||
3
e2e/addon/mock/testdata/mock-dependence-rely3/README.md
vendored
Normal file
3
e2e/addon/mock/testdata/mock-dependence-rely3/README.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# mock-dependence-rely2
|
||||
|
||||
This is an addon template. Check how to build your own addon: https://kubevela.net/docs/platform-engineers/addon/intro
|
||||
10
e2e/addon/mock/testdata/mock-dependence-rely3/metadata.yaml
vendored
Normal file
10
e2e/addon/mock/testdata/mock-dependence-rely3/metadata.yaml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
description: An addon for testing addon dependency with specified clusters.
|
||||
icon: ""
|
||||
invisible: false
|
||||
name: mock-dependence-rely3
|
||||
tags:
|
||||
- my-tag
|
||||
version: 1.0.0
|
||||
dependencies:
|
||||
# install controller by helm.
|
||||
- name: mock-dependence3
|
||||
4
e2e/addon/mock/testdata/mock-dependence-rely3/parameter.cue
vendored
Normal file
4
e2e/addon/mock/testdata/mock-dependence-rely3/parameter.cue
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
parameter: {
|
||||
// +usage=Custom parameter description
|
||||
myparam: *"mynsrely" | string
|
||||
}
|
||||
9
e2e/addon/mock/testdata/mock-dependence-rely3/template.cue
vendored
Normal file
9
e2e/addon/mock/testdata/mock-dependence-rely3/template.cue
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
package main
|
||||
output: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
spec: {
|
||||
components: []
|
||||
policies: []
|
||||
}
|
||||
}
|
||||
3
e2e/addon/mock/testdata/mock-dependence-upstream-locally/README.md
vendored
Normal file
3
e2e/addon/mock/testdata/mock-dependence-upstream-locally/README.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# mock-dependence-rely
|
||||
|
||||
This is an addon template. Check how to build your own addon: https://kubevela.net/docs/platform-engineers/addon/intro
|
||||
10
e2e/addon/mock/testdata/mock-dependence-upstream-locally/metadata.yaml
vendored
Normal file
10
e2e/addon/mock/testdata/mock-dependence-upstream-locally/metadata.yaml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
description: An addon for testing addon dependency with installed locally.
|
||||
icon: ""
|
||||
invisible: false
|
||||
name: mock-dependence-upstream-locally
|
||||
tags:
|
||||
- my-tag
|
||||
version: 1.0.0
|
||||
dependencies:
|
||||
# install controller by helm.
|
||||
- name: mock-dependence-locally
|
||||
12
e2e/addon/mock/testdata/mock-dependence-upstream-locally/parameter.cue
vendored
Normal file
12
e2e/addon/mock/testdata/mock-dependence-upstream-locally/parameter.cue
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// parameter.cue is used to store addon parameters.
|
||||
//
|
||||
// You can use these parameters in template.cue or in resources/ by 'parameter.myparam'
|
||||
//
|
||||
// For example, you can use parameters to allow the user to customize
|
||||
// container images, ports, and etc.
|
||||
parameter: {
|
||||
// +usage=Custom parameter description
|
||||
myparam: *"mynsrely" | string
|
||||
// +usage=Deploy to specified clusters. Leave empty to deploy to all clusters.
|
||||
clusters?: [...string]
|
||||
}
|
||||
24
e2e/addon/mock/testdata/mock-dependence-upstream-locally/template.cue
vendored
Normal file
24
e2e/addon/mock/testdata/mock-dependence-upstream-locally/template.cue
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
_targetNamespace: parameter.myparam
|
||||
output: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
spec: {
|
||||
components: []
|
||||
policies: [
|
||||
{
|
||||
type: "topology"
|
||||
name: "deploy-mock-dependency-ns"
|
||||
properties: {
|
||||
namespace: _targetNamespace
|
||||
if parameter.clusters != _|_ {
|
||||
clusters: parameter.clusters
|
||||
}
|
||||
if parameter.clusters == _|_ {
|
||||
clusterLabelSelector: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
3
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/README.md
vendored
Normal file
3
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/README.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# mock-dependence-rely
|
||||
|
||||
This is an addon template. Check how to build your own addon: https://kubevela.net/docs/platform-engineers/addon/intro
|
||||
10
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/metadata.yaml
vendored
Normal file
10
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/metadata.yaml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
description: An addon for testing addon dependency witch is not defined clusters arg.
|
||||
icon: ""
|
||||
invisible: false
|
||||
name: mock-dependence-upstream-no-clusters-arg
|
||||
tags:
|
||||
- my-tag
|
||||
version: 1.0.0
|
||||
dependencies:
|
||||
# install controller by helm.
|
||||
- name: mock-dependence-no-clusters-arg
|
||||
12
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/parameter.cue
vendored
Normal file
12
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/parameter.cue
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// parameter.cue is used to store addon parameters.
|
||||
//
|
||||
// You can use these parameters in template.cue or in resources/ by 'parameter.myparam'
|
||||
//
|
||||
// For example, you can use parameters to allow the user to customize
|
||||
// container images, ports, and etc.
|
||||
parameter: {
|
||||
// +usage=Custom parameter description
|
||||
myparam: *"mynsrely" | string
|
||||
// +usage=Deploy to specified clusters. Leave empty to deploy to all clusters.
|
||||
clusters?: [...string]
|
||||
}
|
||||
24
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/template.cue
vendored
Normal file
24
e2e/addon/mock/testdata/mock-dependence-upstream-no-clusters-arg/template.cue
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
_targetNamespace: parameter.myparam
|
||||
output: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
spec: {
|
||||
components: []
|
||||
policies: [
|
||||
{
|
||||
type: "topology"
|
||||
name: "deploy-mock-dependency-ns"
|
||||
properties: {
|
||||
namespace: _targetNamespace
|
||||
if parameter.clusters != _|_ {
|
||||
clusters: parameter.clusters
|
||||
}
|
||||
if parameter.clusters == _|_ {
|
||||
clusterLabelSelector: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,6 @@
|
||||
parameter: {
|
||||
// +usage=Custom parameter description
|
||||
myparam: *"myns" | string
|
||||
//+usage=Deploy to specified clusters. Leave empty to deploy to all clusters.
|
||||
// +usage=Deploy to specified clusters. Leave empty to deploy to all clusters.
|
||||
clusters?: [...string]
|
||||
}
|
||||
|
||||
3
e2e/addon/mock/testdata/mock-dependence3/README.md
vendored
Normal file
3
e2e/addon/mock/testdata/mock-dependence3/README.md
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# mock-dependence2
|
||||
|
||||
This is an addon template. Check how to build your own addon: https://kubevela.net/docs/platform-engineers/addon/intro
|
||||
7
e2e/addon/mock/testdata/mock-dependence3/metadata.yaml
vendored
Normal file
7
e2e/addon/mock/testdata/mock-dependence3/metadata.yaml
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
description: An addon for testing addon dependency with specified clusters.
|
||||
icon: ""
|
||||
invisible: false
|
||||
name: mock-dependence3
|
||||
tags:
|
||||
- my-tag
|
||||
version: 1.0.0
|
||||
6
e2e/addon/mock/testdata/mock-dependence3/parameter.cue
vendored
Normal file
6
e2e/addon/mock/testdata/mock-dependence3/parameter.cue
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
parameter: {
|
||||
//+usage=Custom parameter description
|
||||
myparam: *"myns" | string
|
||||
//+usage=Deploy to specified clusters. Leave empty to deploy to all clusters.
|
||||
clusters?: [...string]
|
||||
}
|
||||
24
e2e/addon/mock/testdata/mock-dependence3/template.cue
vendored
Normal file
24
e2e/addon/mock/testdata/mock-dependence3/template.cue
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
_targetNamespace: parameter.myparam
|
||||
output: {
|
||||
apiVersion: "core.oam.dev/v1beta1"
|
||||
kind: "Application"
|
||||
spec: {
|
||||
components: [],
|
||||
policies: [
|
||||
{
|
||||
type: "topology"
|
||||
name: "deploy-mock-dependency-ns"
|
||||
properties: {
|
||||
namespace: _targetNamespace
|
||||
if parameter.clusters != _|_ {
|
||||
clusters: parameter.clusters
|
||||
}
|
||||
if parameter.clusters == _|_ {
|
||||
clusterLabelSelector: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
e2e/addon/mock/testrepo/helm-repo/has-clusters-arg-v1.0.0.tgz
Normal file
BIN
e2e/addon/mock/testrepo/helm-repo/has-clusters-arg-v1.0.0.tgz
Normal file
Binary file not shown.
@@ -69,4 +69,13 @@ entries:
|
||||
urls:
|
||||
- http://127.0.0.1:9098/helm/mock-be-dep-addon-v1.0.0.tgz
|
||||
version: v1.0.0
|
||||
has-clusters-arg:
|
||||
- created: "2023-06-01T09:11:16.865230605Z"
|
||||
description: An addon for testing addon dependency with clusters.
|
||||
home: https://www.has-clusters-arg.com/icon
|
||||
icon: https://www.has-clusters-arg.com
|
||||
name: has-clusters-arg
|
||||
urls:
|
||||
- http://127.0.0.1:9098/helm/has-clusters-arg-v1.0.0.tgz
|
||||
version: v1.0.0
|
||||
generated: "2022-06-15T13:17:04.733573+08:00"
|
||||
@@ -43,8 +43,6 @@ var app v1beta1.Application
|
||||
var testShowCdDef v1beta1.ComponentDefinition
|
||||
var testShowTdDef v1beta1.TraitDefinition
|
||||
var testCdDef v1beta1.ComponentDefinition
|
||||
var testCdDefWithHelm v1beta1.ComponentDefinition
|
||||
var testCdDefWithKube v1beta1.ComponentDefinition
|
||||
var testCdWithDeepCue v1beta1.ComponentDefinition
|
||||
var testTdDef v1beta1.TraitDefinition
|
||||
var testTdDefWithKube v1beta1.TraitDefinition
|
||||
@@ -80,14 +78,6 @@ var _ = BeforeSuite(func() {
|
||||
err = k8sClient.Create(ctx, &testCdDef)
|
||||
Expect(err).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
|
||||
|
||||
Expect(yaml.Unmarshal([]byte(componentDefWithHelm), &testCdDefWithHelm)).Should(BeNil())
|
||||
err = k8sClient.Create(ctx, &testCdDefWithHelm)
|
||||
Expect(err).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
|
||||
|
||||
Expect(yaml.Unmarshal([]byte(componentDefWithKube), &testCdDefWithKube)).Should(BeNil())
|
||||
err = k8sClient.Create(ctx, &testCdDefWithKube)
|
||||
Expect(err).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
|
||||
|
||||
Expect(yaml.Unmarshal([]byte(componentWithDeepCue), &testCdWithDeepCue)).Should(BeNil())
|
||||
err = k8sClient.Create(ctx, &testCdWithDeepCue)
|
||||
Expect(err).Should(SatisfyAny(BeNil(), &util.AlreadyExistMatcher{}))
|
||||
@@ -124,8 +114,6 @@ var _ = AfterSuite(func() {
|
||||
|
||||
Expect(k8sClient.Delete(ctx, &app)).Should(BeNil())
|
||||
Expect(k8sClient.Delete(ctx, &testCdDef)).Should(BeNil())
|
||||
Expect(k8sClient.Delete(ctx, &testCdDefWithHelm)).Should(BeNil())
|
||||
Expect(k8sClient.Delete(ctx, &testCdDefWithKube)).Should(BeNil())
|
||||
Expect(k8sClient.Delete(ctx, &testCdWithDeepCue)).Should(BeNil())
|
||||
Expect(k8sClient.Delete(ctx, &testTdDef)).Should(BeNil())
|
||||
Expect(k8sClient.Delete(ctx, &testTdDefWithKube)).Should(BeNil())
|
||||
|
||||
@@ -53,14 +53,14 @@ var _ = Describe("Test Kubectl Plugin", func() {
|
||||
err := os.WriteFile("dry-run-app.yaml", []byte(application), 0644)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Eventually(func() string {
|
||||
output, _ := e2e.Exec("kubectl-vela dry-run -f dry-run-app.yaml -n vela-system")
|
||||
output, _ := e2e.Exec("kubectl-vela dry-run -f dry-run-app.yaml -n default -x default")
|
||||
return output
|
||||
}, 10*time.Second, time.Second).Should(ContainSubstring(dryRunResult))
|
||||
})
|
||||
|
||||
It("Test dry-run application use definitions in local", func() {
|
||||
Eventually(func() string {
|
||||
output, _ := e2e.Exec("kubectl-vela dry-run -f dry-run-app.yaml -d definitions")
|
||||
output, _ := e2e.Exec("kubectl-vela dry-run -f dry-run-app.yaml -n default -d definitions")
|
||||
return output
|
||||
}, 10*time.Second, time.Second).Should(ContainSubstring(dryRunResult))
|
||||
})
|
||||
@@ -131,29 +131,6 @@ var _ = Describe("Test Kubectl Plugin", func() {
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).Should(ContainSubstring(showTdResult))
|
||||
})
|
||||
It("Test show componentDefinition use Helm Charts as Workload", func() {
|
||||
Eventually(func() string {
|
||||
cdName := "test-webapp-chart"
|
||||
output, _ := e2e.Exec(fmt.Sprintf("kubectl-vela show %s -n default", cdName))
|
||||
return output
|
||||
}, 20*time.Second, time.Second).Should(ContainSubstring("Specification"))
|
||||
})
|
||||
It("Test show componentDefinition def with raw Kube mode", func() {
|
||||
cdName := "kube-worker"
|
||||
output, err := e2e.Exec(fmt.Sprintf("kubectl-vela show %s -n default", cdName))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).Should(ContainSubstring("image"))
|
||||
Expect(output).Should(ContainSubstring("The value will be applied to fields: [spec.template.spec.containers[0].image]."))
|
||||
Expect(output).Should(ContainSubstring("port"))
|
||||
Expect(output).Should(ContainSubstring("the specific container port num which can accept external request."))
|
||||
})
|
||||
It("Test show traitDefinition def with raw Kube mode", func() {
|
||||
tdName := "service-kube"
|
||||
output, err := e2e.Exec(fmt.Sprintf("kubectl-vela show %s -n default", tdName))
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(output).Should(ContainSubstring("targetPort"))
|
||||
Expect(output).Should(ContainSubstring("target port num for service provider."))
|
||||
})
|
||||
It("Test show traitDefinition def with cue single map parameter", func() {
|
||||
tdName := "annotations"
|
||||
output, err := e2e.Exec(fmt.Sprintf("kubectl-vela show %s -n default", tdName))
|
||||
@@ -397,73 +374,6 @@ spec:
|
||||
|
||||
`
|
||||
|
||||
var componentDefWithHelm = `
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
name: test-webapp-chart
|
||||
namespace: default
|
||||
annotations:
|
||||
definition.oam.dev/description: helm chart for webapp
|
||||
spec:
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
schematic:
|
||||
helm:
|
||||
release:
|
||||
chart:
|
||||
spec:
|
||||
chart: "podinfo"
|
||||
version: "5.1.4"
|
||||
repository:
|
||||
url: "https://charts.kubevela.net/example/"
|
||||
`
|
||||
|
||||
var componentDefWithKube = `
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
name: kube-worker
|
||||
namespace: default
|
||||
spec:
|
||||
workload:
|
||||
definition:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
schematic:
|
||||
kube:
|
||||
template:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
ports:
|
||||
- containerPort: 80
|
||||
parameters:
|
||||
- name: image
|
||||
required: true
|
||||
type: string
|
||||
fieldPaths:
|
||||
- "spec.template.spec.containers[0].image"
|
||||
- name: port
|
||||
required: true
|
||||
type: string
|
||||
fieldPaths:
|
||||
- "spec.template.spec.containers[0].ports[0].containerPort"
|
||||
description: "the specific container port num which can accept external request."
|
||||
`
|
||||
|
||||
var traitDef = `
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
|
||||
@@ -20,14 +20,14 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/oam-dev/kubevela/e2e"
|
||||
"github.com/oam-dev/kubevela/references/apis"
|
||||
"github.com/oam-dev/kubevela/references/cli"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var (
|
||||
registryConfigs = []apis.RegistryConfig{
|
||||
registryConfigs = []cli.RegistryConfig{
|
||||
{
|
||||
Name: "e2e-oss-registry",
|
||||
URL: "oss://registry.e2e.net",
|
||||
|
||||
89
go.mod
89
go.mod
@@ -12,8 +12,7 @@ require (
|
||||
github.com/bluele/gcache v0.0.2
|
||||
github.com/briandowns/spinner v1.23.0
|
||||
github.com/chartmuseum/helm-push v0.10.4
|
||||
github.com/containerd/containerd v1.7.1
|
||||
github.com/coreos/prometheus-operator v0.41.1
|
||||
github.com/containerd/containerd v1.7.5
|
||||
github.com/crossplane/crossplane-runtime v0.19.2
|
||||
github.com/cue-exp/kubevelafix v0.0.0-20220922150317-aead819d979d
|
||||
github.com/dave/jennifer v1.6.1
|
||||
@@ -24,56 +23,57 @@ require (
|
||||
github.com/fluxcd/source-controller/api v0.24.4
|
||||
github.com/form3tech-oss/jwt-go v3.2.5+incompatible
|
||||
github.com/gdamore/tcell/v2 v2.6.0
|
||||
github.com/getkin/kin-openapi v0.94.0
|
||||
github.com/go-git/go-git/v5 v5.6.1
|
||||
github.com/go-logr/logr v1.2.4
|
||||
github.com/go-resty/resty/v2 v2.7.0
|
||||
github.com/getkin/kin-openapi v0.118.0
|
||||
github.com/go-git/go-git/v5 v5.8.1
|
||||
github.com/go-logr/logr v1.3.0
|
||||
github.com/go-resty/resty/v2 v2.8.0
|
||||
github.com/golang/mock v1.6.0
|
||||
github.com/google/go-cmp v0.5.9
|
||||
github.com/google/go-containerregistry v0.15.2
|
||||
github.com/google/go-cmp v0.6.0
|
||||
github.com/google/go-containerregistry v0.16.1
|
||||
github.com/google/go-github/v32 v32.1.0
|
||||
github.com/gosuri/uitable v0.0.4
|
||||
github.com/hashicorp/go-version v1.6.0
|
||||
github.com/hashicorp/hcl/v2 v2.16.2
|
||||
github.com/hashicorp/hcl/v2 v2.18.0
|
||||
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174
|
||||
github.com/imdario/mergo v0.3.16
|
||||
github.com/kubevela/pkg v1.8.1-0.20230522085329-7d5e1241a86d
|
||||
github.com/kubevela/workflow v0.5.1-0.20230412142834-be9e5a10baf0
|
||||
github.com/kubevela/pkg v1.9.2
|
||||
github.com/kubevela/workflow v0.6.1
|
||||
github.com/kyokomi/emoji v2.2.4+incompatible
|
||||
github.com/magiconair/properties v1.8.7
|
||||
github.com/mattn/go-runewidth v0.0.15
|
||||
github.com/mitchellh/hashstructure/v2 v2.0.2
|
||||
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2
|
||||
github.com/oam-dev/cluster-gateway v1.9.0-alpha.2
|
||||
github.com/oam-dev/cluster-register v1.0.4-0.20230424040021-147f7c1fefe5
|
||||
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28
|
||||
github.com/oam-dev/terraform-controller v0.7.10
|
||||
github.com/oam-dev/terraform-controller v0.8.0
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/onsi/ginkgo/v2 v2.10.0
|
||||
github.com/onsi/gomega v1.27.7
|
||||
github.com/onsi/ginkgo/v2 v2.13.1
|
||||
github.com/onsi/gomega v1.29.0
|
||||
github.com/openkruise/kruise-api v1.4.0
|
||||
github.com/openkruise/rollouts v0.3.0
|
||||
github.com/pelletier/go-toml v1.9.5
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/prometheus/client_golang v1.15.1
|
||||
github.com/prometheus/client_model v0.3.0
|
||||
github.com/prometheus/client_golang v1.16.0
|
||||
github.com/prometheus/client_model v0.4.0
|
||||
github.com/rivo/tview v0.0.0-20221128165837-db36428c92d9
|
||||
github.com/rogpeppe/go-internal v1.10.0
|
||||
github.com/sirupsen/logrus v1.9.3
|
||||
github.com/spf13/cobra v1.7.0
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.8.3
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tidwall/gjson v1.14.4
|
||||
github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f
|
||||
github.com/xanzy/go-gitlab v0.83.0
|
||||
github.com/xanzy/go-gitlab v0.91.1
|
||||
github.com/xlab/treeprint v1.2.0
|
||||
go.uber.org/multierr v1.11.0
|
||||
golang.org/x/crypto v0.9.0
|
||||
golang.org/x/oauth2 v0.8.0
|
||||
golang.org/x/sync v0.2.0
|
||||
golang.org/x/term v0.8.0
|
||||
golang.org/x/text v0.9.0
|
||||
golang.org/x/tools v0.9.3
|
||||
gomodules.xyz/jsonpatch/v2 v2.3.0
|
||||
golang.org/x/crypto v0.21.0
|
||||
golang.org/x/oauth2 v0.12.0
|
||||
golang.org/x/sync v0.4.0
|
||||
golang.org/x/term v0.18.0
|
||||
golang.org/x/text v0.14.0
|
||||
golang.org/x/tools v0.14.0
|
||||
gomodules.xyz/jsonpatch/v2 v2.4.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
helm.sh/helm/v3 v3.11.2
|
||||
k8s.io/api v0.26.3
|
||||
@@ -92,13 +92,14 @@ require (
|
||||
open-cluster-management.io/api v0.10.1
|
||||
sigs.k8s.io/controller-runtime v0.14.6
|
||||
sigs.k8s.io/controller-tools v0.11.4
|
||||
sigs.k8s.io/gateway-api v0.7.0
|
||||
sigs.k8s.io/kind v0.18.0
|
||||
sigs.k8s.io/gateway-api v0.7.1
|
||||
sigs.k8s.io/kind v0.20.0
|
||||
sigs.k8s.io/yaml v1.3.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
|
||||
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
|
||||
github.com/BurntSushi/toml v1.2.1 // indirect
|
||||
github.com/MakeNowJust/heredoc v1.0.0 // indirect
|
||||
@@ -109,13 +110,14 @@ require (
|
||||
github.com/Masterminds/squirrel v1.5.3 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/NYTimes/gziphandler v1.1.1 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
|
||||
github.com/acomagu/bufpipe v1.0.4 // indirect
|
||||
github.com/agext/levenshtein v1.2.3 // indirect
|
||||
github.com/alessio/shellescape v1.4.1 // indirect
|
||||
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect
|
||||
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect
|
||||
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
|
||||
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||
@@ -130,10 +132,10 @@ require (
|
||||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||
github.com/creack/pty v1.1.18 // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.3 // indirect
|
||||
github.com/docker/cli v23.0.5+incompatible // indirect
|
||||
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
|
||||
github.com/docker/cli v24.0.0+incompatible // indirect
|
||||
github.com/docker/distribution v2.8.2+incompatible // indirect
|
||||
github.com/docker/docker v23.0.5+incompatible // indirect
|
||||
github.com/docker/docker v24.0.0+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.7.0 // indirect
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/go-metrics v0.0.1 // indirect
|
||||
@@ -154,7 +156,7 @@ require (
|
||||
github.com/gdamore/encoding v1.0.0 // indirect
|
||||
github.com/ghodss/yaml v1.0.0 // indirect
|
||||
github.com/go-errors/errors v1.0.1 // indirect
|
||||
github.com/go-git/gcfg v1.5.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.4.1 // indirect
|
||||
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
@@ -189,6 +191,7 @@ require (
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/huandu/xstrings v1.4.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/invopop/yaml v0.1.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jellydator/ttlcache/v3 v3.0.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
@@ -204,10 +207,9 @@ require (
|
||||
github.com/lib/pq v1.10.7 // 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/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.17 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // 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
|
||||
@@ -219,6 +221,7 @@ require (
|
||||
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
|
||||
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
|
||||
github.com/morikuni/aec v1.0.0 // indirect
|
||||
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect
|
||||
@@ -227,11 +230,12 @@ require (
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
|
||||
github.com/openshift/library-go v0.0.0-20230327085348-8477ec72b725 // indirect
|
||||
github.com/perimeterx/marshmallow v1.1.4 // indirect
|
||||
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/prometheus/common v0.42.0 // indirect
|
||||
github.com/prometheus/procfs v0.9.0 // indirect
|
||||
github.com/prometheus/procfs v0.10.1 // indirect
|
||||
github.com/protocolbuffers/txtpbfmt v0.0.0-20220428173112-74888fd59c2b // indirect
|
||||
github.com/rivo/uniseg v0.4.3 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
@@ -239,7 +243,7 @@ require (
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sergi/go-diff v1.1.0 // indirect
|
||||
github.com/shopspring/decimal v1.3.1 // indirect
|
||||
github.com/skeema/knownhosts v1.1.0 // indirect
|
||||
github.com/skeema/knownhosts v1.2.0 // indirect
|
||||
github.com/spf13/cast v1.5.0 // indirect
|
||||
github.com/stoewer/go-strcase v1.2.0 // indirect
|
||||
github.com/tidwall/match v1.1.1 // indirect
|
||||
@@ -249,7 +253,7 @@ require (
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
|
||||
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
|
||||
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
|
||||
github.com/zclconf/go-cty v1.12.1 // indirect
|
||||
github.com/zclconf/go-cty v1.13.0 // indirect
|
||||
go.etcd.io/etcd/api/v3 v3.5.5 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
|
||||
go.etcd.io/etcd/client/v3 v3.5.5 // indirect
|
||||
@@ -265,15 +269,16 @@ require (
|
||||
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
|
||||
go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
|
||||
go.uber.org/atomic v1.9.0 // indirect
|
||||
go.uber.org/automaxprocs v1.5.3 // indirect
|
||||
go.uber.org/zap v1.24.0 // indirect
|
||||
golang.org/x/mod v0.10.0 // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sys v0.8.0 // indirect
|
||||
golang.org/x/mod v0.13.0 // indirect
|
||||
golang.org/x/net v0.21.0 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/time v0.3.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
|
||||
google.golang.org/grpc v1.53.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
google.golang.org/protobuf v1.33.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/inf.v0 v0.9.1 // indirect
|
||||
|
||||
@@ -42,7 +42,7 @@ var ComponentDefDirs = []string{"./vela-templates/definitions/internal/component
|
||||
|
||||
// CustomComponentHeaderEN .
|
||||
var CustomComponentHeaderEN = `---
|
||||
title: Built-in Component Type
|
||||
title: Built-in ParsedComponents Type
|
||||
---
|
||||
|
||||
This documentation will walk through all the built-in component types sorted alphabetically.
|
||||
|
||||
@@ -9,7 +9,7 @@ kubectl-vela:
|
||||
|
||||
# Build the docker image
|
||||
.PHONY: docker-build
|
||||
docker-build: docker-build-core docker-build-apiserver docker-build-cli
|
||||
docker-build: docker-build-core docker-build-cli
|
||||
@$(OK)
|
||||
|
||||
.PHONY: docker-build-core
|
||||
|
||||
@@ -46,12 +46,13 @@ else
|
||||
GOIMPORTS=$(shell which goimports)
|
||||
endif
|
||||
|
||||
CUE_VERSION ?= v0.6.0
|
||||
.PHONY: installcue
|
||||
installcue:
|
||||
ifeq (, $(shell which cue))
|
||||
@{ \
|
||||
set -e ;\
|
||||
go install cuelang.org/go/cmd/cue@latest ;\
|
||||
go install cuelang.org/go/cmd/cue@$(CUE_VERSION) ;\
|
||||
}
|
||||
CUE=$(GOBIN)/cue
|
||||
else
|
||||
|
||||
@@ -124,6 +124,9 @@ const (
|
||||
|
||||
// InstallerRuntimeOption inject install runtime info into addon options
|
||||
InstallerRuntimeOption string = "installerRuntimeOption"
|
||||
|
||||
// CUEExtension with the expected extension for CUE files
|
||||
CUEExtension = ".cue"
|
||||
)
|
||||
|
||||
// ParameterFileName is the addon resources/parameter.cue file name
|
||||
@@ -396,7 +399,7 @@ func readResFile(a *InstallPackage, reader AsyncReader, readPath string) error {
|
||||
}
|
||||
file := ElementFile{Data: b, Name: filepath.Base(readPath)}
|
||||
switch filepath.Ext(filename) {
|
||||
case ".cue":
|
||||
case CUEExtension:
|
||||
a.CUETemplates = append(a.CUETemplates, file)
|
||||
case ".yaml", ".yml":
|
||||
a.YAMLTemplates = append(a.YAMLTemplates, file)
|
||||
@@ -425,7 +428,7 @@ func readDefFile(a *UIData, reader AsyncReader, readPath string) error {
|
||||
filename := path.Base(readPath)
|
||||
file := ElementFile{Data: b, Name: filepath.Base(readPath)}
|
||||
switch filepath.Ext(filename) {
|
||||
case ".cue":
|
||||
case CUEExtension:
|
||||
a.CUEDefinitions = append(a.CUEDefinitions, file)
|
||||
case ".yaml", ".yml":
|
||||
a.Definitions = append(a.Definitions, file)
|
||||
@@ -442,7 +445,7 @@ func readConfigTemplateFile(a *UIData, reader AsyncReader, readPath string) erro
|
||||
return err
|
||||
}
|
||||
filename := path.Base(readPath)
|
||||
if filepath.Ext(filename) != ".cue" {
|
||||
if filepath.Ext(filename) != CUEExtension {
|
||||
return nil
|
||||
}
|
||||
file := ElementFile{Data: b, Name: filepath.Base(readPath)}
|
||||
@@ -458,7 +461,7 @@ func readViewFile(a *InstallPackage, reader AsyncReader, readPath string) error
|
||||
}
|
||||
filename := path.Base(readPath)
|
||||
switch filepath.Ext(filename) {
|
||||
case ".cue":
|
||||
case CUEExtension:
|
||||
a.CUEViews = append(a.CUEViews, ElementFile{Data: b, Name: filepath.Base(readPath)})
|
||||
case ".yaml", ".yml":
|
||||
a.YAMLViews = append(a.YAMLViews, ElementFile{Data: b, Name: filepath.Base(readPath)})
|
||||
@@ -582,7 +585,7 @@ func unmarshalToContent(content []byte) (fileContent *github.RepositoryContent,
|
||||
if directoryUnmarshalError == nil {
|
||||
return nil, directoryContent, nil
|
||||
}
|
||||
return nil, nil, fmt.Errorf("unmarshalling failed for both file and directory content: %s and %w", fileUnmarshalError, directoryUnmarshalError)
|
||||
return nil, nil, fmt.Errorf("unmarshalling failed for both file and directory content: %s and %w", fileUnmarshalError.Error(), directoryUnmarshalError)
|
||||
}
|
||||
|
||||
func genAddonAPISchema(addonRes *UIData) error {
|
||||
@@ -846,6 +849,21 @@ func RenderArgsSecret(addon *InstallPackage, args map[string]interface{}) *unstr
|
||||
return u
|
||||
}
|
||||
|
||||
// deleteArgsSecret delete the addon's args secret file
|
||||
func deleteArgsSecret(ctx context.Context, k8sClient client.Client, addonName string) error {
|
||||
var sec v1.Secret
|
||||
if err := k8sClient.Get(ctx, client.ObjectKey{Namespace: types.DefaultKubeVelaNS, Name: addonutil.Addon2SecName(addonName)}, &sec); err == nil {
|
||||
// Handle successful get operation
|
||||
if deleteErr := k8sClient.Delete(ctx, &sec); deleteErr != nil {
|
||||
return deleteErr
|
||||
}
|
||||
return nil
|
||||
} else if !apierrors.IsNotFound(err) {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FetchArgsFromSecret fetch addon args from secrets
|
||||
func FetchArgsFromSecret(sec *v1.Secret) (map[string]interface{}, error) {
|
||||
res := map[string]interface{}{}
|
||||
@@ -1025,7 +1043,7 @@ func (h *Installer) installDependency(addon *InstallPackage) error {
|
||||
var dependencies []string
|
||||
var addonClusters = getClusters(h.args)
|
||||
for _, dep := range addon.Dependencies {
|
||||
needInstallAddonDep, depClusters, err := checkDependencyNeedInstall(h.ctx, h.cli, dep.Name, addonClusters)
|
||||
needInstallAddonDep, err := checkDependencyNeedInstall(h.ctx, h.cli, dep.Name, addonClusters)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1039,7 +1057,7 @@ func (h *Installer) installDependency(addon *InstallPackage) error {
|
||||
}
|
||||
depHandler := *h
|
||||
// reset dependency addon clusters parameter
|
||||
depArgs, depArgsErr := getDependencyArgs(h.ctx, h.cli, dep.Name, depClusters)
|
||||
depArgs, depArgsErr := getDependencyArgs(h.ctx, h.cli, dep.Name, addonClusters)
|
||||
if depArgsErr != nil {
|
||||
return depArgsErr
|
||||
}
|
||||
@@ -1276,39 +1294,150 @@ func listInstalledAddons(ctx context.Context, k8sClient client.Client) (itemInfo
|
||||
return installedAddons, nil
|
||||
}
|
||||
|
||||
// checkDependencyNeedInstall checks whether dependency addon needs to be installed on other clusters
|
||||
func checkDependencyNeedInstall(ctx context.Context, k8sClient client.Client, depName string, addonClusters []string) (bool, []string, error) {
|
||||
// checkDependencyNeedInstall checks whether dependency addon needs to be reinstalled
|
||||
// If the dep addon is not installed, need to install
|
||||
// If the dep addon is installed locally, don't need to install
|
||||
// If the dep addon is installed from registry and not defined clusters, don't need to install
|
||||
// If the dep addon is installed from registry and is defined clusters, and clusters value is nil, don't need to install
|
||||
// If the dep addon is installed from registry and is defined clusters, and clusters value is not nil,
|
||||
// and the upstream addon's clusters is nil, need to install
|
||||
// If the dep addon is installed from registry and is defined clusters, and clusters value is not nil,
|
||||
// and the upstream addon's clusters is not nil, the re-installation is based on whether the dep clusters value can contain the upstream clusters value
|
||||
func checkDependencyNeedInstall(ctx context.Context, k8sClient client.Client, depName string, addonClusters []string) (bool, error) {
|
||||
depApp, err := FetchAddonRelatedApp(ctx, k8sClient, depName)
|
||||
if err != nil {
|
||||
if !apierrors.IsNotFound(err) {
|
||||
return false, nil, err
|
||||
return false, err
|
||||
}
|
||||
// dependent addon is not exist
|
||||
return true, addonClusters, nil
|
||||
// dependent addon is not exist, need to install it
|
||||
return true, nil
|
||||
}
|
||||
topologyPolicyValue := map[string]interface{}{}
|
||||
for _, policy := range depApp.Spec.Policies {
|
||||
if policy.Type == "topology" {
|
||||
unmarshalErr := json.Unmarshal(policy.Properties.Raw, &topologyPolicyValue)
|
||||
if unmarshalErr != nil {
|
||||
return false, nil, unmarshalErr
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
// We should not automatically override addons installed locally by the user, so skip to reinstall it
|
||||
labels := depApp.GetLabels()
|
||||
installedRegistry := labels[oam.LabelAddonRegistry]
|
||||
isLocalRegistry := installedRegistry == LocalAddonRegistryName
|
||||
if isLocalRegistry {
|
||||
klog.Warningf("%v is installed locally. Please ensure that it has been installed to the required clusters, if not, please manually install it.", depName)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// Addons without the clusters parameter can only be installed on the local cluster. So we don't need to reinstall it
|
||||
hasClustersArg, hasClustersArgsErr := hasClustersParameters(ctx, k8sClient, depName)
|
||||
if hasClustersArgsErr != nil {
|
||||
return false, hasClustersArgsErr
|
||||
}
|
||||
if !hasClustersArg {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
// get addon current parameter value
|
||||
depArgs, depArgsErr := GetAddonLegacyParameters(ctx, k8sClient, depName)
|
||||
if depArgsErr != nil && !apierrors.IsNotFound(depArgsErr) {
|
||||
return false, depArgsErr
|
||||
}
|
||||
clusterArgValue := depArgs[types.ClustersArg]
|
||||
|
||||
// nil clusters indicates that the dependent addon is installed on all clusters
|
||||
if topologyPolicyValue["clusters"] == nil {
|
||||
return false, nil, nil
|
||||
if clusterArgValue == nil {
|
||||
return false, nil
|
||||
}
|
||||
// nil addonClusters indicates the addon will be installed,
|
||||
// thus we should set the dependent addon's clusters arg to be nil so that it is installed on all clusters
|
||||
|
||||
// nil addonClusters indicates the addon will be installed all clusters, thus the dependent addon should also to be installed on all clusters.
|
||||
if addonClusters == nil {
|
||||
return true, nil, nil
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Determine whether the dependent addon's existing clusters can cover the new addon's clusters
|
||||
needInstallAddonDep, _ := hasNotCoveredClusters(clusterArgValue, addonClusters)
|
||||
return needInstallAddonDep, nil
|
||||
}
|
||||
|
||||
// getDependencyArgs get the dependent addon's install args according to the upstream addon's clusters parameter's value
|
||||
// If dep addon has not defined clusters parameter, don't need to set clusters parameter value,
|
||||
// If dep addon has not installed, set the clusters value same to addon's clusters
|
||||
// If dep addon clusters parameter's value is nil, the dependent addon is installed on all clusters,
|
||||
// don't need to reset clusters parameter value
|
||||
// If dep addon has defined clusters parameter, and clusters is not nil, and addon clusters is nil,
|
||||
// set clusters value as nil
|
||||
// If dep addon has defined clusters parameter, and clusters is not nil, and addon clusters is not nil,
|
||||
// set clusters value as the union of the dependent addon's and the upstream addon's clusters
|
||||
func getDependencyArgs(ctx context.Context, k8sClient client.Client, depName string, addonClusters []string) (map[string]interface{}, error) {
|
||||
hasClustersArg, err := hasClustersParameters(ctx, k8sClient, depName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// dep addon is not install, installed it by assigning clusters value
|
||||
_, depErr := FetchAddonRelatedApp(ctx, k8sClient, depName)
|
||||
if depErr != nil {
|
||||
if !apierrors.IsNotFound(depErr) {
|
||||
return nil, err
|
||||
}
|
||||
depArgs := map[string]interface{}{}
|
||||
if addonClusters != nil {
|
||||
depArgs = map[string]interface{}{
|
||||
types.ClustersArg: addonClusters,
|
||||
}
|
||||
}
|
||||
return depArgs, nil
|
||||
}
|
||||
|
||||
// dep addon is installed
|
||||
depArgs, depArgsErr := GetAddonLegacyParameters(ctx, k8sClient, depName)
|
||||
if depArgsErr != nil && !apierrors.IsNotFound(depArgsErr) {
|
||||
return nil, depArgsErr
|
||||
}
|
||||
if !hasClustersArg || depArgs[types.ClustersArg] == nil {
|
||||
return depArgs, nil
|
||||
}
|
||||
if addonClusters == nil {
|
||||
delete(depArgs, types.ClustersArg)
|
||||
} else {
|
||||
clusterArgValue := depArgs[types.ClustersArg]
|
||||
notCovered, depClusters := hasNotCoveredClusters(clusterArgValue, addonClusters)
|
||||
if notCovered {
|
||||
depArgs[types.ClustersArg] = depClusters
|
||||
}
|
||||
}
|
||||
return depArgs, nil
|
||||
}
|
||||
|
||||
// hasClustersParameters checks whether the addon defines the clusters parameter.
|
||||
// If the addon has been installed, get addon package from the installed registry,
|
||||
// Otherwise, get addon package from one of registries where this addon exists.
|
||||
func hasClustersParameters(ctx context.Context, k8sClient client.Client, addonName string) (bool, error) {
|
||||
var installedRegistry []string
|
||||
depApp, err := FetchAddonRelatedApp(ctx, k8sClient, addonName)
|
||||
if err == nil {
|
||||
labels := depApp.GetLabels()
|
||||
registryName, ok := labels[oam.LabelAddonRegistry]
|
||||
if ok {
|
||||
installedRegistry = []string{registryName}
|
||||
}
|
||||
}
|
||||
addonPackages, err := FindAddonPackagesDetailFromRegistry(context.Background(), k8sClient, []string{addonName}, installedRegistry)
|
||||
// If the state of addon is not disabled, we don't check the error, because it could be installed from local.
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
var addonPackage *WholeAddonPackage
|
||||
if len(addonPackages) != 0 {
|
||||
addonPackage = addonPackages[0]
|
||||
}
|
||||
if addonPackage.APISchema == nil {
|
||||
return false, nil
|
||||
}
|
||||
schemas := addonPackage.APISchema.Properties
|
||||
_, hasClusters := schemas[types.ClustersArg]
|
||||
return hasClusters, nil
|
||||
}
|
||||
|
||||
// hasNotCoveredClusters check if the clusterArgsValue can cover the values of addonClusters,
|
||||
// and if not covered, also return the merged clusters array
|
||||
func hasNotCoveredClusters(clusterArgValue interface{}, addonClusters []string) (bool, []string) {
|
||||
var needInstallAddonDep = false
|
||||
var depClusters []string
|
||||
originClusters := topologyPolicyValue["clusters"].([]interface{})
|
||||
originClusters := clusterArgValue.([]interface{})
|
||||
for _, r := range originClusters {
|
||||
depClusters = append(depClusters, r.(string))
|
||||
}
|
||||
@@ -1318,28 +1447,7 @@ func checkDependencyNeedInstall(ctx context.Context, k8sClient client.Client, de
|
||||
needInstallAddonDep = true
|
||||
}
|
||||
}
|
||||
return needInstallAddonDep, depClusters, nil
|
||||
}
|
||||
|
||||
// getDependencyArgs resets the dependency clusters arg according needed install depClusters
|
||||
func getDependencyArgs(ctx context.Context, k8sClient client.Client, depName string, depClusters []string) (map[string]interface{}, error) {
|
||||
depArgs, depArgsErr := GetAddonLegacyParameters(ctx, k8sClient, depName)
|
||||
if depArgsErr != nil && !apierrors.IsNotFound(depArgsErr) {
|
||||
return nil, depArgsErr
|
||||
}
|
||||
// reset the cluster arg
|
||||
if depClusters == nil {
|
||||
// delete clusters args, when render addon, it will use clusterLabelSelector then render addon to all clusters
|
||||
if depArgs != nil && depArgs[types.ClustersArg] != nil {
|
||||
delete(depArgs, types.ClustersArg)
|
||||
}
|
||||
} else {
|
||||
if depArgs == nil {
|
||||
depArgs = map[string]interface{}{}
|
||||
}
|
||||
depArgs[types.ClustersArg] = depClusters
|
||||
}
|
||||
return depArgs, nil
|
||||
return needInstallAddonDep, depClusters
|
||||
}
|
||||
|
||||
// checkDependency checks if addon's dependency
|
||||
@@ -1494,6 +1602,12 @@ func (h *Installer) dispatchAddonResource(addon *InstallPackage) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// delete addon args secret file
|
||||
deleteErr := deleteArgsSecret(h.ctx, h.cli, addon.Name)
|
||||
if deleteErr != nil {
|
||||
return deleteErr
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http/httptest"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
@@ -51,9 +52,27 @@ import (
|
||||
var _ = Describe("Addon test", func() {
|
||||
ctx := context.Background()
|
||||
var app v1beta1.Application
|
||||
var s *httptest.Server
|
||||
|
||||
BeforeEach(func() {
|
||||
s = setupMockServer()
|
||||
// Prepare registry
|
||||
reg := &Registry{
|
||||
Name: "addon_helper_test",
|
||||
Helm: &HelmSource{
|
||||
URL: s.URL,
|
||||
},
|
||||
}
|
||||
ds := NewRegistryDataStore(k8sClient)
|
||||
Expect(ds.AddRegistry(context.Background(), *reg)).To(Succeed())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
Expect(k8sClient.Delete(ctx, &app)).Should(BeNil())
|
||||
// Clean up registry
|
||||
ds := NewRegistryDataStore(k8sClient)
|
||||
Expect(ds.DeleteRegistry(context.Background(), "addon_helper_test")).To(Succeed())
|
||||
s.Close()
|
||||
})
|
||||
|
||||
It("continueOrRestartWorkflow func test", func() {
|
||||
@@ -175,104 +194,68 @@ var _ = Describe("Addon test", func() {
|
||||
})
|
||||
|
||||
It("checkDependencyNeedInstall func test", func() {
|
||||
// case1: dependency addon not exist, adonClusters is not nil
|
||||
// case1: dependency addon not exist
|
||||
depAddonName := "legacy-addon"
|
||||
addonClusters := []string{"cluster1", "cluster2"}
|
||||
needInstallAddonDep, depClusters, err := checkDependencyNeedInstall(ctx, k8sClient, depAddonName, addonClusters)
|
||||
needInstallAddonDep, err := checkDependencyNeedInstall(ctx, k8sClient, depAddonName, addonClusters)
|
||||
Expect(needInstallAddonDep).Should(BeTrue())
|
||||
Expect(depClusters).Should(Equal(addonClusters))
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
// case1.1: dependency addon not exist, adonClusters is nil
|
||||
needInstallAddonDep1, depClusters1, err := checkDependencyNeedInstall(ctx, k8sClient, depAddonName, nil)
|
||||
Expect(needInstallAddonDep1).Should(BeTrue())
|
||||
Expect(depClusters1).Should(BeNil())
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
// case2: dependency addon exist, no topology policy, addonClusters is not nil
|
||||
// case2: dependency addon is installed locally
|
||||
app = v1beta1.Application{}
|
||||
Expect(yaml.Unmarshal([]byte(legacyAppYaml), &app)).Should(BeNil())
|
||||
Expect(yaml.Unmarshal([]byte(legacyAppYamlLocal), &app)).Should(BeNil())
|
||||
app.SetNamespace(testns)
|
||||
Expect(k8sClient.Create(ctx, &app)).Should(BeNil())
|
||||
Eventually(func(g Gomega) {
|
||||
needInstallAddonDep, depClusters, err := checkDependencyNeedInstall(ctx, k8sClient, depAddonName, addonClusters)
|
||||
needInstallAddonDep, err := checkDependencyNeedInstall(ctx, k8sClient, "legacy-addon-local", addonClusters)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(needInstallAddonDep).Should(BeFalse())
|
||||
Expect(depClusters).Should(BeNil())
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
|
||||
// case3: clusters is nil (no topology policy), addonClusters is nil
|
||||
needInstallAddonDep2, depClusters2, err := checkDependencyNeedInstall(ctx, k8sClient, depAddonName, nil)
|
||||
Expect(needInstallAddonDep2).Should(BeFalse())
|
||||
Expect(depClusters2).Should(BeNil())
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
// case4: clusters is nil, addonClusters is nil
|
||||
// case3: dependency addon has no clusters arg
|
||||
noClusterArgAddonName := "vela-workflow"
|
||||
app = v1beta1.Application{}
|
||||
Expect(yaml.Unmarshal([]byte(legacy3AppYaml), &app)).Should(BeNil())
|
||||
Expect(yaml.Unmarshal([]byte(legacyAppYamlNoClustersArg), &app)).Should(BeNil())
|
||||
app.SetNamespace(testns)
|
||||
Expect(k8sClient.Create(ctx, &app)).Should(BeNil())
|
||||
Eventually(func(g Gomega) {
|
||||
needInstallAddonDep, depClusters, err := checkDependencyNeedInstall(ctx, k8sClient, "legacy-addon3", nil)
|
||||
needInstallAddonDep, err := checkDependencyNeedInstall(ctx, k8sClient, noClusterArgAddonName, addonClusters)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(needInstallAddonDep).Should(BeFalse())
|
||||
Expect(depClusters).Should(BeNil())
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
|
||||
// case5: clusters is not nil, addonClusters is nil,
|
||||
// case3: dependency addon has clusters arg, but clusters value is nil
|
||||
hasClusterArgAddonName := "has-clusters-arg"
|
||||
app = v1beta1.Application{}
|
||||
Expect(yaml.Unmarshal([]byte(legacy2AppYaml), &app)).Should(BeNil())
|
||||
Expect(yaml.Unmarshal([]byte(legacyAppYamlHasClustersArg), &app)).Should(BeNil())
|
||||
app.SetNamespace(testns)
|
||||
Expect(k8sClient.Create(ctx, &app)).Should(BeNil())
|
||||
Eventually(func(g Gomega) {
|
||||
needInstallAddonDep, depClusters, err := checkDependencyNeedInstall(ctx, k8sClient, "legacy-addon2", nil)
|
||||
needInstallAddonDep, err := checkDependencyNeedInstall(ctx, k8sClient, hasClusterArgAddonName, addonClusters)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(needInstallAddonDep).Should(BeTrue())
|
||||
Expect(depClusters).Should(BeNil())
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
Expect(needInstallAddonDep).Should(BeFalse())
|
||||
}, 30*time.Second).Should(Succeed())
|
||||
|
||||
// case6: clusters is [local], addonClusters is ["cluster1", "cluster2"]
|
||||
Eventually(func(g Gomega) {
|
||||
needInstallAddonDep, depClusters, err := checkDependencyNeedInstall(ctx, k8sClient, "legacy-addon2", addonClusters)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(needInstallAddonDep).Should(BeTrue())
|
||||
Expect(depClusters).Should(Equal(append([]string{"local"}, addonClusters...)))
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
})
|
||||
|
||||
It("getDependencyArgs func test", func() {
|
||||
// case1: depClusters is nil
|
||||
depAddonName := "legacy-addon"
|
||||
depArgs, err := getDependencyArgs(ctx, k8sClient, depAddonName, nil)
|
||||
Expect(depArgs).Should(BeNil())
|
||||
Expect(err).Should(BeNil())
|
||||
|
||||
// case2: depClusters is not nil
|
||||
app = v1beta1.Application{}
|
||||
Expect(yaml.Unmarshal([]byte(legacyAppYaml), &app)).Should(BeNil())
|
||||
// case4: dependency addon has clusters arg, clusters value is local, addonClusters is nil
|
||||
secret := v1.Secret{}
|
||||
Expect(yaml.Unmarshal([]byte(legacySecretYamlHasClustersArg), &secret)).Should(BeNil())
|
||||
app.SetNamespace(testns)
|
||||
//Expect(k8sClient.Create(ctx, &app)).Should(BeNil())
|
||||
depClusters := []string{"cluster1", "cluster2"}
|
||||
depArgs2, err := getDependencyArgs(ctx, k8sClient, depAddonName, depClusters)
|
||||
Expect(depArgs2["clusters"]).Should(Equal(depClusters))
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(k8sClient.Create(ctx, &secret)).Should(BeNil())
|
||||
Eventually(func(g Gomega) {
|
||||
needInstallAddonDep, err := checkDependencyNeedInstall(ctx, k8sClient, hasClusterArgAddonName, nil)
|
||||
Expect(err).Should(BeNil())
|
||||
Expect(needInstallAddonDep).Should(BeTrue())
|
||||
}, 60*time.Second).Should(Succeed())
|
||||
|
||||
// clusters exist, depClusters is nil
|
||||
sec := v1.Secret{}
|
||||
Expect(yaml.Unmarshal([]byte(secretYaml), &sec)).Should(BeNil())
|
||||
Expect(k8sClient.Create(ctx, &sec)).Should(BeNil())
|
||||
depArgs3, err := getDependencyArgs(ctx, k8sClient, "fluxcd", nil)
|
||||
Expect(depArgs3).ToNot(BeNil())
|
||||
Expect(depArgs3["clusters"]).Should(BeNil())
|
||||
Expect(err).Should(BeNil())
|
||||
// case5: dependency addon has clusters arg, clusters value is ["local"], addonClusters is ["local"]
|
||||
needInstallAddonDep1, err1 := checkDependencyNeedInstall(ctx, k8sClient, hasClusterArgAddonName, []string{"local"})
|
||||
Expect(err1).Should(BeNil())
|
||||
Expect(needInstallAddonDep1).Should(BeFalse())
|
||||
|
||||
// getArgs throw exception
|
||||
sec1 := v1.Secret{}
|
||||
Expect(yaml.Unmarshal([]byte(secretErrorYaml), &sec1)).Should(BeNil())
|
||||
Expect(k8sClient.Create(ctx, &sec1)).Should(BeNil())
|
||||
depArgs4, err := getDependencyArgs(ctx, k8sClient, "fluxcd1", nil)
|
||||
Expect(depArgs4).Should(BeNil())
|
||||
Expect(err).ToNot(BeNil())
|
||||
// case6: dependency addon has clusters arg, clusters value is local, addonClusters is ["cluster1", "cluster2"]
|
||||
needInstallAddonDep2, err2 := checkDependencyNeedInstall(ctx, k8sClient, hasClusterArgAddonName, addonClusters)
|
||||
Expect(err2).Should(BeNil())
|
||||
Expect(needInstallAddonDep2).Should(BeTrue())
|
||||
})
|
||||
|
||||
It(" determineAddonAppName func test", func() {
|
||||
@@ -678,6 +661,53 @@ spec:
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
`
|
||||
legacyAppYamlLocal = `apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: legacy-addon-local
|
||||
labels:
|
||||
addons.oam.dev/registry: local
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
`
|
||||
legacyAppYamlNoClustersArg = `apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: addon-vela-workflow
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
`
|
||||
legacyAppYamlHasClustersArg = `apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: addon-has-clusters-arg
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
image: crccheck/hello-world
|
||||
port: 8000
|
||||
`
|
||||
legacySecretYamlHasClustersArg = `apiVersion: v1
|
||||
data:
|
||||
addonParameterDataKey: eyJjbHVzdGVycyI6WyJsb2NhbCJdfQ==
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: addon-secret-has-clusters-arg
|
||||
namespace: vela-system
|
||||
type: Opaque
|
||||
`
|
||||
legacy2AppYaml = `apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
|
||||
@@ -426,6 +426,21 @@ func TestGetAddonVersionMeetSystemRequirement(t *testing.T) {
|
||||
assert.Equal(t, version, "")
|
||||
}
|
||||
|
||||
func TestHasNotCoveredClusters(t *testing.T) {
|
||||
// case1: clusterArgValue can cover addonClusters
|
||||
cav := []interface{}{"local"}
|
||||
addonClusters := []string{"local"}
|
||||
notCovered, mergedClusters := hasNotCoveredClusters(cav, addonClusters)
|
||||
assert.False(t, notCovered)
|
||||
assert.Equal(t, []string{"local"}, mergedClusters)
|
||||
|
||||
// case2: clusterArgValue can not cover addonClusters
|
||||
addonClusters = []string{"local", "c1"}
|
||||
notCovered1, mergedClusters1 := hasNotCoveredClusters(cav, addonClusters)
|
||||
assert.True(t, notCovered1)
|
||||
assert.Equal(t, addonClusters, mergedClusters1)
|
||||
}
|
||||
|
||||
var baseAddon = InstallPackage{
|
||||
Meta: Meta{
|
||||
Name: "test-render-cue-definition-addon",
|
||||
@@ -1120,13 +1135,16 @@ func TestPackageAddon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGenerateAnnotation(t *testing.T) {
|
||||
meta := Meta{SystemRequirements: &SystemRequirements{
|
||||
VelaVersion: ">1.4.0",
|
||||
KubernetesVersion: ">1.20.0",
|
||||
}}
|
||||
meta := Meta{
|
||||
Name: "test-addon",
|
||||
SystemRequirements: &SystemRequirements{
|
||||
VelaVersion: ">1.4.0",
|
||||
KubernetesVersion: ">1.20.0",
|
||||
}}
|
||||
res := generateAnnotation(&meta)
|
||||
assert.Equal(t, res[velaSystemRequirement], ">1.4.0")
|
||||
assert.Equal(t, res[kubernetesSystemRequirement], ">1.20.0")
|
||||
assert.Equal(t, res[addonSystemRequirement], meta.Name)
|
||||
|
||||
meta = Meta{}
|
||||
meta.SystemRequirements = &SystemRequirements{KubernetesVersion: ">=1.20.1"}
|
||||
|
||||
@@ -337,6 +337,11 @@ func (u *Cache) listVersionRegistryUIDataAndCache(r Registry) ([]*UIData, error)
|
||||
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
|
||||
}
|
||||
// identity an addon from helm chart structure
|
||||
if uiData.Name == "" {
|
||||
addon.Name = ""
|
||||
continue
|
||||
}
|
||||
u.putVersionedUIData2Cache(r.Name, addon.Name, addon.Version, uiData)
|
||||
// we also no version key, if use get addonUIData without version will return this vale as latest data.
|
||||
u.putVersionedUIData2Cache(r.Name, addon.Name, "latest", uiData)
|
||||
|
||||
@@ -193,7 +193,6 @@ func FindAddonPackagesDetailFromRegistry(ctx context.Context, k8sClient client.C
|
||||
if len(addonNames) == 0 {
|
||||
return nil, fmt.Errorf("no addon name specified")
|
||||
}
|
||||
|
||||
registryDataStore := NewRegistryDataStore(k8sClient)
|
||||
|
||||
// Find matched registries
|
||||
@@ -254,7 +253,7 @@ func FindAddonPackagesDetailFromRegistry(ctx context.Context, k8sClient client.C
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
uiData, err := r.GetUIData(&sourceMeta, CLIMetaOptions)
|
||||
uiData, err := r.GetUIData(&sourceMeta, UIMetaOptions)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ func setupMockServer() *httptest.Server {
|
||||
"bar-v1.0.0.tgz",
|
||||
"bar-v2.0.0.tgz",
|
||||
"mock-be-dep-addon-v1.0.0.tgz",
|
||||
"has-clusters-arg-v1.0.0.tgz",
|
||||
}
|
||||
for _, f := range fileList {
|
||||
if strings.Contains(req.URL.Path, f) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user