mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-22 13:54:06 +00:00
Compare commits
39 Commits
release-1.
...
release-0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92a887c1dc | ||
|
|
b3eaea0912 | ||
|
|
e320a4b027 | ||
|
|
a534c17e8a | ||
|
|
7bcf469e8c | ||
|
|
64f07ebd33 | ||
|
|
9e0a86212c | ||
|
|
c15a631b9a | ||
|
|
df8fb9369b | ||
|
|
222906ece0 | ||
|
|
ca8aa01c95 | ||
|
|
4cf4fdff30 | ||
|
|
2648f6d100 | ||
|
|
3bc014bc8c | ||
|
|
bb9f5402b3 | ||
|
|
1d3307002c | ||
|
|
37bd952486 | ||
|
|
5c33598fe9 | ||
|
|
54e806a94c | ||
|
|
740b85c6e1 | ||
|
|
8ceb64d16c | ||
|
|
5bf11d4142 | ||
|
|
0229ac775b | ||
|
|
52e3893bf3 | ||
|
|
419afd27b5 | ||
|
|
52550bb7b5 | ||
|
|
d6f3f995cd | ||
|
|
dc6ab6b8d6 | ||
|
|
613f1f9b53 | ||
|
|
eefc72b0c6 | ||
|
|
1ac66bb3e4 | ||
|
|
ac6d6d1a73 | ||
|
|
46f7472bd5 | ||
|
|
d872430b08 | ||
|
|
9d2cf16141 | ||
|
|
8c9fab1aa1 | ||
|
|
e213779235 | ||
|
|
e4bf16b618 | ||
|
|
9c64afa1f6 |
36
.github/CODEOWNERS
vendored
36
.github/CODEOWNERS
vendored
@@ -1,36 +0,0 @@
|
||||
# This file is a github code protect rule follow the codeowners https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners#example-of-a-codeowners-file
|
||||
|
||||
* @barnettZQG @wonderflow @leejanee @Somefive
|
||||
design/ @barnettZQG @leejanee @wonderflow @Somefive
|
||||
|
||||
# Owner of CUE
|
||||
pkg/cue @leejanee @FogDong @Somefive
|
||||
pkg/stdlib @leejanee @FogDong @Somefive
|
||||
|
||||
# Owner of Workflow
|
||||
pkg/workflow @leejanee @FogDong @Somefive
|
||||
|
||||
# Owner of rollout
|
||||
pkg/controller/common/rollout/ @wangyikewxgm @wonderflow
|
||||
pkg/controller/core.oam.dev/v1alpha2/applicationrollout @wangyikewxgm @wonderflow
|
||||
pkg/controller/standard.oam.dev/v1alpha1/rollout @wangyikewxgm @wonderflow
|
||||
runtime/rollout @wangyikewxgm @wonderflow
|
||||
|
||||
# Owner of definition controller
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/workflow/workflowstepdefinition @yangsoon @Somefive @FogDong
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/policies/policydefinition @yangsoon @Somefive @FogDong
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/components/componentdefinition @yangsoon @zzxwill @Somefive
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/traits/traitdefinition @yangsoon @zzxwill @Somefive
|
||||
|
||||
# Owner of health scope controller
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/scopes/healthscope @captainroy-hy @zzxwill @yangsoon
|
||||
|
||||
# Owner of vela templates
|
||||
vela-templates/ @Somefive @barnettZQG @wonderflow
|
||||
|
||||
# Owner of vela CLI
|
||||
references/cli/ @Somefive @zzxwill @StevenLeiZhang
|
||||
|
||||
# Owner of vela APIServer
|
||||
pkg/apiserver/ @barnettZQG @yangsoon @FogDong
|
||||
|
||||
12
.github/ISSUE_TEMPLATE/bug_report.md
vendored
12
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -15,9 +15,9 @@ A clear and concise description of what the bug is.
|
||||
**To Reproduce**
|
||||
<!--
|
||||
Steps to reproduce the behavior:
|
||||
1. The YAML files of Component/Trait I used.
|
||||
2. The YAML file of Application I applied.
|
||||
3. Other operations I have done.
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
-->
|
||||
|
||||
@@ -31,12 +31,6 @@ A clear and concise description of what you expected to happen.
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
-->
|
||||
|
||||
**KubeVela Version**
|
||||
|
||||
<!--
|
||||
Describe your KubeVela controller or CLI version information.
|
||||
-->
|
||||
|
||||
**Cluster information**
|
||||
<!--
|
||||
Describe your kubernetes cluster information.
|
||||
|
||||
1
.github/ISSUE_TEMPLATE/config.yaml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
blank_issues_enabled: true
|
||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
5
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +0,0 @@
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Questions & Help
|
||||
url: https://github.com/oam-dev/kubevela/discussions
|
||||
about: Please ask and answer questions here.
|
||||
37
.github/PULL_REQUEST_TEMPLATE.md
vendored
37
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,37 +0,0 @@
|
||||
|
||||
### Description of your changes
|
||||
|
||||
<!--
|
||||
|
||||
Briefly describe what this pull request does. We love pull requests that resolve an open KubeVela issue. If yours does, you
|
||||
can uncomment the below line to indicate which issue your PR fixes, for example
|
||||
"Fixes #500":
|
||||
|
||||
-->
|
||||
|
||||
Fixes #
|
||||
|
||||
I have:
|
||||
|
||||
- [ ] Read and followed KubeVela's [contribution process](https://github.com/kubevela/kubevela/blob/master/contribute/create-pull-request.md).
|
||||
- [ ] [Related Docs](https://github.com/kubevela/kubevela.io) updated properly. In a new feature or configuration option, an update to the documentation is necessary.
|
||||
- [ ] Run `make reviewable` to ensure this PR is ready for review.
|
||||
- [ ] Added `backport release-x.y` labels to auto-backport this PR if necessary.
|
||||
|
||||
### How has this code been tested
|
||||
|
||||
<!--
|
||||
Before reviewers can be confident in the correctness of this pull request, it
|
||||
needs to tested and shown to be correct. Briefly describe the testing that has
|
||||
already been done or which is planned for this change.
|
||||
-->
|
||||
|
||||
|
||||
### Special notes for your reviewer
|
||||
|
||||
<!--
|
||||
|
||||
Be sure to direct your reviewers'
|
||||
attention to anything that needs special consideration.
|
||||
|
||||
-->
|
||||
31
.github/bot.md
vendored
31
.github/bot.md
vendored
@@ -1,31 +0,0 @@
|
||||
### GitHub & kubevela automation
|
||||
|
||||
The bot is configured via [issue-commands.json](https://github.com/kubevela/kubevela/blob/master/.github/workflows/issue-commands.json)
|
||||
and some other GitHub [workflows](https://github.com/kubevela/kubevela/blob/master/.github/workflows).
|
||||
By default, users with write access to the repo is allowed to use the comments,
|
||||
the [userlist](https://github.com/kubevela/kubevela/blob/master/.github/comment.userlist)
|
||||
file is for adding additional members who do not have access and want to contribute to the issue triage.
|
||||
|
||||
Comment commands:
|
||||
* Write the word `/needsInvestigation` in a comment, and the bot will add the corresponding label.
|
||||
* Write the word `/needsMoreInfo` in a comment, and the bot will add the correct label and standard message.
|
||||
* Write the word `/duplicate #<number>` to have `type/duplicate` label, the issue number is required for remind where is the other issue.
|
||||
* Write the word `/type/*` in a comment, and the bot will add the corresponding label `/type/*`.
|
||||
* Write the word `/area/*` in a comment, and the bot will add the corresponding label `/area/*`.
|
||||
* Write the word `/priority/*` in a comment, and the bot will add the corresponding label `/priority/*`.
|
||||
|
||||
The `*` mention above represent a specific word. Please read the details about label category in [ISSUE_TRIAGE.md](https://github.com/kubevela/kubevela/blob/master/ISSUE_TRIAGE.md)
|
||||
|
||||
Label commands:
|
||||
|
||||
* Add label `bot/question` the bot will close with standard question message and add label `type/question`
|
||||
* Add label `bot/needs more info` for bot to request more info (or use comment command mentioned above)
|
||||
* Add label `bot/no new info` for bot to close an issue where we asked for more info but has not received any updates in at least 14 days.
|
||||
* Add label `bot/duplicate` to have `type/duplicate` label & the bot will close issue with an appropriate message.
|
||||
* Add label `bot/close feature request` for bot to close a feature request with standard message.
|
||||
|
||||
Assign:
|
||||
When you participating in an issue area, and you want to assign to others
|
||||
to distribute this task or self-assign to give a solution. You can use the comment bellow.
|
||||
* Write the word `/assign githubname` in a comment, the robot will automatically assign to the corresponding person.
|
||||
* Specially, write the word `/assign` in a comment, you can assgin this task to yourself.
|
||||
14
.github/comment.userlist
vendored
14
.github/comment.userlist
vendored
@@ -1,14 +0,0 @@
|
||||
resouer
|
||||
wonderflow
|
||||
hongchaodeng
|
||||
zzxwill
|
||||
ryanzhang-oss
|
||||
captainroy-hy
|
||||
wangyikewxgm
|
||||
BinaryHB0916
|
||||
yangsoon
|
||||
wangyuan249
|
||||
chivalryq
|
||||
FogDong
|
||||
leejanee
|
||||
barnettZQG
|
||||
15
.github/how-to.md
vendored
15
.github/how-to.md
vendored
@@ -1,15 +0,0 @@
|
||||
# Github Utilities
|
||||
|
||||
## How to add a custom runner
|
||||
|
||||
1. Create an ECS that can connect github. Create a normal user(DON'T use `root`).
|
||||
2. Install Dependencies:
|
||||
- Kind
|
||||
- Docker `apt install docker.io`, and the user to docker group(`usermod -aG docker <user>`)
|
||||
- Kubectl
|
||||
- Go(1.14 for now, must align with CI)
|
||||
- Helm v3
|
||||
- ginkgo
|
||||
- Add all these dependencies to $PATH.
|
||||
3. Install Custom runner agent https://docs.github.com/en/actions/hosting-your-own-runners/adding-self-hosted-runners
|
||||
4. Run the runner as service https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service
|
||||
153
.github/issue-commands.json
vendored
153
.github/issue-commands.json
vendored
@@ -1,153 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "needsMoreInfo",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "needs more info"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "needsInvestigation",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "needs investigation"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "assign",
|
||||
"allowUsers": ["*"]
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "type/bug",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "type/bug"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "type/docs",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "type/docs"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "type/enhancement",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "type/enhancement"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "priority/critical",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "priority/critical"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "priority/important-soon",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "priority/important-soon"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "priority/important-longterm",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "priority/important-longterm"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "priority/nice-to-have",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "priority/nice-to-have"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "priority/awaiting-more-evidence",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "priority/awaiting-more-evidence"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "priority/unscheduled",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "priority/unscheduled"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "area/appconfig",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "area/appconfig"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "area/application",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "area/application"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "area/component",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "area/component"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "area/controller",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "area/controller"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "area/cue",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "area/cue"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "area/trait",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "area/trait"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"name": "duplicate",
|
||||
"allowUsers": [],
|
||||
"action": "updateLabels",
|
||||
"addLabel": "type/duplicate"
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"name": "bot/duplicate",
|
||||
"addLabel": "type/duplicate",
|
||||
"removeLabel": "bot/duplicate",
|
||||
"action": "close",
|
||||
"comment": "Thanks for creating this issue! It looks like this has already been reported by another user. We’ve closed this in favor of the existing one. Please consider adding any details you think is missing to that issue.\n\nTo avoid having your issue closed in the future, please read our [CONTRIBUTING](https://github.com/oam-dev/kubevela/blob/master/CONTRIBUTING.md) guidelines.\n\nHappy graphing!"
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"name": "bot/no new info",
|
||||
"action": "close",
|
||||
"comment": "We've closed this issue since it needs more information and hasn't had any activity recently. We can re-open it after you you add more information. To avoid having your issue closed in the future, please read our [CONTRIBUTING](https://github.com/oam-dev/kubevela/blob/master/CONTRIBUTING.md) guidelines.\n\nHappy graphing!"
|
||||
},
|
||||
{
|
||||
"type": "label",
|
||||
"name": "bot/close feature request",
|
||||
"action": "close",
|
||||
"comment": "This feature request has been open for a long time with few received upvotes or comments, so we are closing it. We're trying to limit open GitHub issues in order to better track planned work and features. \r\n\r\nThis doesn't mean that we'll never ever implement it or that we will never accept a PR for it. A closed issue can still attract upvotes and act as a ticket to track feature demand\/interest. \r\n\r\nThank You to you for taking the time to create this issue!"
|
||||
}
|
||||
]
|
||||
10
.github/pr-title-checker-config.json
vendored
10
.github/pr-title-checker-config.json
vendored
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"LABEL": {
|
||||
"name": "title-needs-formatting",
|
||||
"color": "EEEEEE"
|
||||
},
|
||||
"CHECKS": {
|
||||
"prefixes": ["Fix: ", "Feat: ", "Docs: ", "Test: ", "Chore: ", "CI: ", "Perf: ", "Refactor: ", "Revert: ", "Style: ", "Test: ",
|
||||
"Fix(", "Feat(", "Docs(", "Test(", "Chore(", "CI(", "Perf(", "Refactor(", "Revert(", "Style(", "Test(", "[Backport"]
|
||||
}
|
||||
}
|
||||
207
.github/workflows/apiserver-test.yaml
vendored
207
.github/workflows/apiserver-test.yaml
vendored
@@ -1,207 +0,0 @@
|
||||
name: VelaUX APIServer Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
- apiserver
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: { }
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
- apiserver
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
K3D_IMAGE_VERSION: '[\"v1.20\",\"v1.24\"]'
|
||||
K3D_IMAGE_VERSIONS: '[\"v1.20\",\"v1.24\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
noop: ${{ steps.noop.outputs.should_skip }}
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@v4.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
concurrent_skipping: false
|
||||
|
||||
set-k8s-matrix:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
matrix: ${{ steps.set-k8s-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- id: set-k8s-matrix
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
||||
echo "pushing tag: ${{ github.ref_name }}"
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSIONS }}"
|
||||
else
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSION }}"
|
||||
fi
|
||||
|
||||
apiserver-unit-tests:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-pkg-
|
||||
|
||||
- name: Install ginkgo
|
||||
run: |
|
||||
sudo apt-get install -y golang-ginkgo-dev
|
||||
|
||||
- name: Start MongoDB
|
||||
uses: supercharge/mongodb-github-action@1.7.0
|
||||
with:
|
||||
mongodb-version: '5.0'
|
||||
|
||||
- name: install Kubebuilder
|
||||
uses: RyanSiu1995/kubebuilder-action@v1.2
|
||||
with:
|
||||
version: 3.1.0
|
||||
kubebuilderOnly: false
|
||||
kubernetesVersion: v1.21.2
|
||||
|
||||
- name: Run api server unit test
|
||||
run: make unit-test-apiserver
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ./coverage.txt
|
||||
flags: apiserver-unittests
|
||||
name: codecov-umbrella
|
||||
|
||||
apiserver-e2e-tests:
|
||||
runs-on: aliyun-legacy
|
||||
needs: [ detect-noop,set-k8s-matrix ]
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
strategy:
|
||||
matrix:
|
||||
k8s-version: ${{ fromJson(needs.set-k8s-matrix.outputs.matrix) }}
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Tear down K3d if exist
|
||||
run: |
|
||||
k3d cluster delete || true
|
||||
k3d cluster delete worker || true
|
||||
|
||||
- name: Calculate K3d args
|
||||
run: |
|
||||
EGRESS_ARG=""
|
||||
if [[ "${{ matrix.k8s-version }}" == v1.24 ]]; then
|
||||
EGRESS_ARG="--k3s-arg --egress-selector-mode=disabled@server:0"
|
||||
fi
|
||||
echo "EGRESS_ARG=${EGRESS_ARG}" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup K3d (Hub)
|
||||
uses: nolar/setup-k3d-k3s@v1.0.8
|
||||
with:
|
||||
version: ${{ matrix.k8s-version }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
k3d-args: ${{ env.EGRESS_ARG }}
|
||||
|
||||
|
||||
- name: Setup K3d (Worker)
|
||||
uses: nolar/setup-k3d-k3s@v1.0.8
|
||||
with:
|
||||
version: ${{ matrix.k8s-version }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
k3d-name: worker
|
||||
k3d-args: --kubeconfig-update-default=false --network=k3d-k3s-default ${{ env.EGRESS_ARG }}
|
||||
|
||||
|
||||
- name: Kind Cluster (Worker)
|
||||
run: |
|
||||
internal_ip=$(docker network inspect k3d-k3s-default|jq ".[0].Containers"| jq -r '.[]| select(.Name=="k3d-worker-server-0")|.IPv4Address' | cut -d/ -f1)
|
||||
k3d kubeconfig get worker > /tmp/worker.client.kubeconfig
|
||||
cp /tmp/worker.client.kubeconfig /tmp/worker.kubeconfig
|
||||
sed -i "s/0.0.0.0:[0-9]\+/$internal_ip:6443/" /tmp/worker.kubeconfig
|
||||
|
||||
- name: Load image to k3d cluster
|
||||
run: make image-load
|
||||
|
||||
- name: Cleanup for e2e tests
|
||||
run: |
|
||||
make vela-cli
|
||||
make e2e-cleanup
|
||||
make e2e-setup-core
|
||||
bin/vela addon enable fluxcd
|
||||
timeout 600s bash -c -- 'while true; do kubectl get ns flux-system; if [ $? -eq 0 ] ; then break; else sleep 5; fi;done'
|
||||
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=vela-core,app.kubernetes.io/instance=kubevela -n vela-system --timeout=600s
|
||||
kubectl wait --for=condition=Ready pod -l app=source-controller -n flux-system --timeout=600s
|
||||
kubectl wait --for=condition=Ready pod -l app=helm-controller -n flux-system --timeout=600s
|
||||
|
||||
- name: Run api server e2e test
|
||||
run: |
|
||||
export ALIYUN_ACCESS_KEY_ID=${{ secrets.ALIYUN_ACCESS_KEY_ID }}
|
||||
export ALIYUN_ACCESS_KEY_SECRET=${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
|
||||
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
||||
make e2e-apiserver-test
|
||||
|
||||
- name: Stop kubevela, get profile
|
||||
run: make end-e2e-core
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: /tmp/e2e_apiserver_test.out
|
||||
flags: apiserver-e2etests
|
||||
name: codecov-umbrella
|
||||
|
||||
- name: Clean e2e profile
|
||||
run: rm /tmp/e2e-profile.out
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: make image-cleanup
|
||||
22
.github/workflows/back-port.yaml
vendored
22
.github/workflows/back-port.yaml
vendored
@@ -1,22 +0,0 @@
|
||||
name: Backport
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
|
||||
jobs:
|
||||
# align with crossplane's choice https://github.com/crossplane/crossplane/blob/master/.github/workflows/backport.yml
|
||||
open-pr:
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event.pull_request.merged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Open Backport PR
|
||||
uses: zeebe-io/backport-action@v0.0.6
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_workspace: ${{ github.workspace }}
|
||||
100
.github/workflows/chart.yaml
vendored
100
.github/workflows/chart.yaml
vendored
@@ -1,100 +0,0 @@
|
||||
name: Publish Chart
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch: { }
|
||||
|
||||
env:
|
||||
BUCKET: ${{ secrets.OSS_BUCKET }}
|
||||
ENDPOINT: ${{ secrets.OSS_ENDPOINT }}
|
||||
ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }}
|
||||
ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||
ARTIFACT_HUB_REPOSITORY_ID: ${{ secrets.ARTIFACT_HUB_REPOSITORY_ID }}
|
||||
|
||||
jobs:
|
||||
publish-charts:
|
||||
env:
|
||||
HELM_CHARTS_DIR: charts
|
||||
HELM_CHART: charts/vela-core
|
||||
MINIMAL_HELM_CHART: charts/vela-minimal
|
||||
LEGACY_HELM_CHART: legacy/charts/vela-core-legacy
|
||||
VELA_ROLLOUT_HELM_CHART: runtime/rollout/charts
|
||||
LOCAL_OSS_DIRECTORY: .oss
|
||||
HELM_CHART_NAME: vela-core
|
||||
MINIMAL_HELM_CHART_NAME: vela-minimal
|
||||
LEGACY_HELM_CHART_NAME: vela-core-legacy
|
||||
VELA_ROLLOUT_HELM_CHART_NAME: vela-rollout
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Get git revision
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::set-output name=git_revision::$(git rev-parse --short HEAD)"
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
version: v3.4.0
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Generate helm doc
|
||||
run: |
|
||||
make helm-doc-gen
|
||||
- name: Prepare legacy chart
|
||||
run: |
|
||||
rsync -r $LEGACY_HELM_CHART $HELM_CHARTS_DIR
|
||||
rsync -r $HELM_CHART/* $LEGACY_HELM_CHART --exclude=Chart.yaml --exclude=crds
|
||||
- name: Prepare vela chart
|
||||
run: |
|
||||
rsync -r $VELA_ROLLOUT_HELM_CHART $HELM_CHARTS_DIR
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
echo ::set-output name=VERSION::${VERSION}
|
||||
- name: Tag helm chart image
|
||||
run: |
|
||||
image_tag=${{ steps.get_version.outputs.VERSION }}
|
||||
chart_version=${{ steps.get_version.outputs.VERSION }}
|
||||
sed -i "s/latest/${image_tag}/g" $HELM_CHART/values.yaml
|
||||
sed -i "s/latest/${image_tag}/g" $MINIMAL_HELM_CHART/values.yaml
|
||||
sed -i "s/latest/${image_tag}/g" $LEGACY_HELM_CHART/values.yaml
|
||||
sed -i "s/latest/${image_tag}/g" $VELA_ROLLOUT_HELM_CHART/values.yaml
|
||||
chart_smever=${chart_version#"v"}
|
||||
sed -i "s/0.1.0/$chart_smever/g" $HELM_CHART/Chart.yaml
|
||||
sed -i "s/0.1.0/$chart_smever/g" $MINIMAL_HELM_CHART/Chart.yaml
|
||||
sed -i "s/0.1.0/$chart_smever/g" $LEGACY_HELM_CHART/Chart.yaml
|
||||
sed -i "s/0.1.0/$chart_smever/g" $VELA_ROLLOUT_HELM_CHART/Chart.yaml
|
||||
- name: Install ossutil
|
||||
run: wget http://gosspublic.alicdn.com/ossutil/1.7.0/ossutil64 && chmod +x ossutil64 && mv ossutil64 ossutil
|
||||
- name: Configure Alibaba Cloud OSSUTIL
|
||||
run: ./ossutil --config-file .ossutilconfig config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${ENDPOINT} -c .ossutilconfig
|
||||
- name: sync cloud to local
|
||||
run: ./ossutil --config-file .ossutilconfig sync oss://$BUCKET/core $LOCAL_OSS_DIRECTORY
|
||||
- name: add artifacthub stuff to the repo
|
||||
run: |
|
||||
rsync $HELM_CHART/README.md $LEGACY_HELM_CHART/README.md
|
||||
rsync $HELM_CHART/README.md $VELA_ROLLOUT_HELM_CHART/README.md
|
||||
sed -i "s/ARTIFACT_HUB_REPOSITORY_ID/$ARTIFACT_HUB_REPOSITORY_ID/g" hack/artifacthub/artifacthub-repo.yml
|
||||
rsync hack/artifacthub/artifacthub-repo.yml $LOCAL_OSS_DIRECTORY
|
||||
- name: Package helm charts
|
||||
run: |
|
||||
helm package $HELM_CHART --destination $LOCAL_OSS_DIRECTORY
|
||||
helm package $MINIMAL_HELM_CHART --destination $LOCAL_OSS_DIRECTORY
|
||||
helm package $LEGACY_HELM_CHART --destination $LOCAL_OSS_DIRECTORY
|
||||
helm package $VELA_ROLLOUT_HELM_CHART --destination $LOCAL_OSS_DIRECTORY
|
||||
helm repo index --url https://$BUCKET.$ENDPOINT/core $LOCAL_OSS_DIRECTORY
|
||||
- name: sync local to cloud
|
||||
run: |
|
||||
image_tag=${{ steps.get_version.outputs.VERSION }}
|
||||
chart_semver=${image_tag#"v"}
|
||||
./ossutil --config-file .ossutilconfig cp -f $LOCAL_OSS_DIRECTORY/index.yaml oss://$BUCKET/core/index.yaml
|
||||
./ossutil --config-file .ossutilconfig cp -f $LOCAL_OSS_DIRECTORY/$HELM_CHART_NAME-${chart_semver}.tgz oss://$BUCKET/core/$HELM_CHART_NAME-${chart_semver}.tgz
|
||||
./ossutil --config-file .ossutilconfig cp -f $LOCAL_OSS_DIRECTORY/$MINIMAL_HELM_CHART_NAME-${chart_semver}.tgz oss://$BUCKET/core/$MINIMAL_HELM_CHART_NAME-${chart_semver}.tgz
|
||||
./ossutil --config-file .ossutilconfig cp -f $LOCAL_OSS_DIRECTORY/$LEGACY_HELM_CHART_NAME-${chart_semver}.tgz oss://$BUCKET/core/$LEGACY_HELM_CHART_NAME-${chart_semver}.tgz
|
||||
./ossutil --config-file .ossutilconfig cp -f $LOCAL_OSS_DIRECTORY/$VELA_ROLLOUT_HELM_CHART_NAME-${chart_semver}.tgz oss://$BUCKET/core/$VELA_ROLLOUT_HELM_CHART_NAME-${chart_semver}.tgz
|
||||
30
.github/workflows/codeql-analysis.yml
vendored
30
.github/workflows/codeql-analysis.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master, release-* ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'go' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
19
.github/workflows/commit-lint.yml
vendored
19
.github/workflows/commit-lint.yml
vendored
@@ -1,19 +0,0 @@
|
||||
name: PR Title Checker
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- synchronize
|
||||
- labeled
|
||||
- unlabeled
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: thehanimo/pr-title-checker@v1.3.1
|
||||
with:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
pass_on_octokit_error: true
|
||||
configuration_path: ".github/pr-title-checker-config.json"
|
||||
29
.github/workflows/dashboard.yml
vendored
Normal file
29
.github/workflows/dashboard.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
name: Dashboard
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
workflow_dispatch: {}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./dashboard
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: yarn
|
||||
- run: yarn lint
|
||||
- run: yarn build
|
||||
|
||||
145
.github/workflows/e2e-multicluster-test.yml
vendored
145
.github/workflows/e2e-multicluster-test.yml
vendored
@@ -1,145 +0,0 @@
|
||||
name: E2E MultiCluster Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
K3D_IMAGE_VERSION: '[\"v1.20\",\"v1.24\"]'
|
||||
K3D_IMAGE_VERSIONS: '[\"v1.20\",\"v1.24\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
noop: ${{ steps.noop.outputs.should_skip }}
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@v4.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
concurrent_skipping: false
|
||||
|
||||
set-k8s-matrix:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
matrix: ${{ steps.set-k8s-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- id: set-k8s-matrix
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
||||
echo "pushing tag: ${{ github.ref_name }}"
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSIONS }}"
|
||||
else
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSION }}"
|
||||
fi
|
||||
|
||||
|
||||
e2e-multi-cluster-tests:
|
||||
runs-on: aliyun-legacy
|
||||
needs: [ detect-noop,set-k8s-matrix ]
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
strategy:
|
||||
matrix:
|
||||
k8s-version: ${{ fromJson(needs.set-k8s-matrix.outputs.matrix) }}
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Tear down K3d if exist
|
||||
run: |
|
||||
k3d cluster delete || true
|
||||
k3d cluster delete worker || true
|
||||
|
||||
- name: Calculate K3d args
|
||||
run: |
|
||||
EGRESS_ARG=""
|
||||
if [[ "${{ matrix.k8s-version }}" == v1.24 ]]; then
|
||||
EGRESS_ARG="--k3s-arg --egress-selector-mode=disabled@server:0"
|
||||
fi
|
||||
echo "EGRESS_ARG=${EGRESS_ARG}" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup K3d (Hub)
|
||||
uses: nolar/setup-k3d-k3s@v1.0.8
|
||||
with:
|
||||
version: ${{ matrix.k8s-version }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
k3d-args: ${{ env.EGRESS_ARG }}
|
||||
|
||||
- name: Setup K3d (Worker)
|
||||
uses: nolar/setup-k3d-k3s@v1.0.8
|
||||
with:
|
||||
version: ${{ matrix.k8s-version }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
k3d-name: worker
|
||||
k3d-args: --kubeconfig-update-default=false --network=k3d-k3s-default ${{ env.EGRESS_ARG }}
|
||||
|
||||
- name: Generating internal worker kubeconfig
|
||||
run: |
|
||||
internal_ip=$(docker network inspect k3d-k3s-default|jq ".[0].Containers"| jq -r '.[]| select(.Name=="k3d-worker-server-0")|.IPv4Address' | cut -d/ -f1)
|
||||
k3d kubeconfig get worker > /tmp/worker.client.kubeconfig
|
||||
cp /tmp/worker.client.kubeconfig /tmp/worker.kubeconfig
|
||||
sed -i "s/0.0.0.0:[0-9]\+/$internal_ip:6443/" /tmp/worker.kubeconfig
|
||||
|
||||
- name: Load image to k3d cluster (hub and worker)
|
||||
run: make image-load image-load-runtime-cluster
|
||||
|
||||
- name: Cleanup for e2e tests
|
||||
run: |
|
||||
make vela-cli
|
||||
make e2e-cleanup
|
||||
make e2e-setup-core-auth
|
||||
make setup-runtime-e2e-cluster
|
||||
|
||||
- name: Run e2e multicluster tests
|
||||
run: |
|
||||
export PATH=$(pwd)/bin:$PATH
|
||||
make e2e-multicluster-test
|
||||
|
||||
- name: Stop kubevela, get profile
|
||||
run: make end-e2e-core
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: /tmp/e2e-profile.out,/tmp/e2e_multicluster_test.out
|
||||
flags: e2e-multicluster-test
|
||||
name: codecov-umbrella
|
||||
|
||||
- name: Clean e2e profile
|
||||
run: rm /tmp/e2e-profile.out
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: make image-cleanup
|
||||
128
.github/workflows/e2e-rollout-test.yml
vendored
128
.github/workflows/e2e-rollout-test.yml
vendored
@@ -1,128 +0,0 @@
|
||||
name: E2E Rollout Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
K3D_IMAGE_VERSION: '[\"v1.20\",\"v1.24\"]'
|
||||
K3D_IMAGE_VERSIONS: '[\"v1.20\",\"v1.24\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
noop: ${{ steps.noop.outputs.should_skip }}
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@v4.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
concurrent_skipping: false
|
||||
|
||||
set-k8s-matrix:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
matrix: ${{ steps.set-k8s-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- id: set-k8s-matrix
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
||||
echo "pushing tag: ${{ github.ref_name }}"
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSIONS }}"
|
||||
else
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSION }}"
|
||||
fi
|
||||
|
||||
e2e-rollout-tests:
|
||||
runs-on: aliyun-legacy
|
||||
needs: [ detect-noop,set-k8s-matrix ]
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
strategy:
|
||||
matrix:
|
||||
k8s-version: ${{ fromJson(needs.set-k8s-matrix.outputs.matrix) }}
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Tear down K3d if exist
|
||||
run: |
|
||||
k3d cluster delete || true
|
||||
k3d cluster delete worker || true
|
||||
|
||||
- name: Calculate K3d args
|
||||
run: |
|
||||
EGRESS_ARG=""
|
||||
if [[ "${{ matrix.k8s-version }}" == v1.24 ]]; then
|
||||
EGRESS_ARG="--k3s-arg --egress-selector-mode=disabled@server:0"
|
||||
fi
|
||||
echo "EGRESS_ARG=${EGRESS_ARG}" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup K3d
|
||||
uses: nolar/setup-k3d-k3s@v1.0.8
|
||||
with:
|
||||
version: ${{ matrix.k8s-version }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
k3d-args: ${{ env.EGRESS_ARG }}
|
||||
|
||||
- name: Load image to k3d cluster
|
||||
run: make image-load image-load-runtime-cluster
|
||||
|
||||
- name: Prepare for e2e tests
|
||||
run: |
|
||||
make vela-cli
|
||||
make e2e-cleanup
|
||||
make e2e-setup-core
|
||||
make setup-runtime-e2e-cluster
|
||||
helm test -n vela-system kubevela --timeout 5m
|
||||
|
||||
- name: Run e2e tests
|
||||
run: make e2e-rollout-test
|
||||
|
||||
- name: Stop kubevela, get profile
|
||||
run: make end-e2e
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: /tmp/e2e-profile.out
|
||||
flags: e2e-rollout-tests
|
||||
name: codecov-umbrella
|
||||
|
||||
- name: Clean e2e profile
|
||||
run: rm /tmp/e2e-profile.out
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: make image-cleanup
|
||||
135
.github/workflows/e2e-test.yml
vendored
135
.github/workflows/e2e-test.yml
vendored
@@ -1,135 +0,0 @@
|
||||
name: E2E Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
K3D_IMAGE_VERSION: '[\"v1.20\",\"v1.24\"]'
|
||||
K3D_IMAGE_VERSIONS: '[\"v1.20\",\"v1.24\"]'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
noop: ${{ steps.noop.outputs.should_skip }}
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@v4.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
concurrent_skipping: false
|
||||
|
||||
set-k8s-matrix:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
matrix: ${{ steps.set-k8s-matrix.outputs.matrix }}
|
||||
steps:
|
||||
- id: set-k8s-matrix
|
||||
run: |
|
||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
||||
echo "pushing tag: ${{ github.ref_name }}"
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSIONS }}"
|
||||
else
|
||||
echo "::set-output name=matrix::${{ env.K3D_IMAGE_VERSION }}"
|
||||
fi
|
||||
|
||||
e2e-tests:
|
||||
runs-on: aliyun-legacy
|
||||
needs: [ detect-noop,set-k8s-matrix ]
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
strategy:
|
||||
matrix:
|
||||
k8s-version: ${{ fromJson(needs.set-k8s-matrix.outputs.matrix) }}
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
|
||||
cancel-in-progress: true
|
||||
|
||||
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Tear down K3d if exist
|
||||
run: |
|
||||
k3d cluster delete || true
|
||||
k3d cluster delete worker || true
|
||||
|
||||
- name: Calculate K3d args
|
||||
run: |
|
||||
EGRESS_ARG=""
|
||||
if [[ "${{ matrix.k8s-version }}" == v1.24 ]]; then
|
||||
EGRESS_ARG="--k3s-arg --egress-selector-mode=disabled@server:0"
|
||||
fi
|
||||
echo "EGRESS_ARG=${EGRESS_ARG}" >> $GITHUB_ENV
|
||||
|
||||
- name: Setup K3d
|
||||
uses: nolar/setup-k3d-k3s@v1.0.8
|
||||
with:
|
||||
version: ${{ matrix.k8s-version }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
k3d-args: ${{ env.EGRESS_ARG }}
|
||||
|
||||
- name: Load image to k3d cluster
|
||||
run: make image-load
|
||||
|
||||
- name: Run Make
|
||||
run: make
|
||||
|
||||
- name: Prepare for e2e tests
|
||||
run: |
|
||||
make e2e-cleanup
|
||||
make e2e-setup-core
|
||||
helm test -n vela-system kubevela --timeout 5m
|
||||
|
||||
- name: Run api e2e tests
|
||||
run: make e2e-api-test
|
||||
|
||||
- name: Run addons e2e tests
|
||||
run: make e2e-addon-test
|
||||
|
||||
- name: Run e2e tests
|
||||
run: make e2e-test
|
||||
|
||||
- name: Stop kubevela, get profile
|
||||
run: make end-e2e
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: /tmp/e2e-profile.out
|
||||
flags: e2etests
|
||||
name: codecov-umbrella
|
||||
|
||||
- name: Clean e2e profile
|
||||
run: rm /tmp/e2e-profile.out
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: make image-cleanup
|
||||
184
.github/workflows/go.yml
vendored
184
.github/workflows/go.yml
vendored
@@ -13,36 +13,156 @@ on:
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
GO_VERSION: '1.14'
|
||||
GOLANGCI_VERSION: 'v1.31'
|
||||
DOCKER_BUILDX_VERSION: 'v0.4.2'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
unit-tests:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
noop: ${{ steps.noop.outputs.should_skip }}
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@v4.0.0
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
concurrent_skipping: false
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
staticcheck:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-pkg-
|
||||
|
||||
- name: Install ginkgo
|
||||
run: |
|
||||
sudo apt-get install -y golang-ginkgo-dev
|
||||
|
||||
- name: Setup Kind Cluster
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
|
||||
- name: install Kubebuilder
|
||||
uses: wonderflow/kubebuilder-action@v1.1
|
||||
|
||||
- name: Run Make test
|
||||
run: make test
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ./coverage.txt
|
||||
flags: unittests
|
||||
name: codecov-umbrella
|
||||
|
||||
compatibility-test:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
|
||||
steps:
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-pkg-
|
||||
|
||||
- name: Install ginkgo
|
||||
run: |
|
||||
sudo apt-get install -y golang-ginkgo-dev
|
||||
|
||||
- name: Setup Kind Cluster
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
|
||||
- name: install Kubebuilder
|
||||
uses: wonderflow/kubebuilder-action@v1.1
|
||||
|
||||
- name: Run Make compatibility-test
|
||||
run: make compatibility-test
|
||||
|
||||
- name: Clean up testdata
|
||||
run: make compatibility-testdata-cleanup
|
||||
|
||||
e2e-tests:
|
||||
runs-on: aliyun
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Setup Kind
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
skipClusterCreation: true
|
||||
|
||||
- name: Setup Kind Cluster
|
||||
run: |
|
||||
kind delete cluster
|
||||
kind create cluster
|
||||
kubectl version
|
||||
kubectl cluster-info
|
||||
|
||||
- name: Load Image to kind cluster
|
||||
run: make kind-load
|
||||
|
||||
- name: Run Make
|
||||
run: make
|
||||
|
||||
- name: Run Make Manager
|
||||
run: make manager
|
||||
|
||||
- name: Prepare for e2e tests
|
||||
run: |
|
||||
make e2e-cleanup
|
||||
make e2e-setup
|
||||
|
||||
- name: Wait for e2e preparation ready
|
||||
run: |
|
||||
timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:38081/api/workloads)" != "200" ]]; do sleep 5; done' || false
|
||||
|
||||
- name: Run api e2e tests
|
||||
run: make e2e-api-test
|
||||
|
||||
- name: Run e2e tests
|
||||
run: make e2e-test
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: make image-cleanup
|
||||
|
||||
staticcheck:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -55,26 +175,13 @@ jobs:
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-pkg-
|
||||
|
||||
- name: Install StaticCheck
|
||||
run: GO111MODULE=on go get honnef.co/go/tools/cmd/staticcheck@v0.3.0
|
||||
|
||||
- name: Static Check
|
||||
run: staticcheck ./...
|
||||
|
||||
- name: License Header Check
|
||||
run: make check-license-header
|
||||
run: go run honnef.co/go/tools/cmd/staticcheck -- ./...
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
@@ -92,14 +199,12 @@ 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@v3
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_VERSION }}
|
||||
|
||||
check-diff:
|
||||
runs-on: aliyun-legacy
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -112,11 +217,6 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14'
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
@@ -127,11 +227,5 @@ jobs:
|
||||
- name: Check code formatting
|
||||
run: go install golang.org/x/tools/cmd/goimports && make fmt
|
||||
|
||||
- name: Run cross-build
|
||||
run: make cross-build
|
||||
|
||||
- name: Check Diff
|
||||
run: make check-diff
|
||||
|
||||
- name: Cleanup binary
|
||||
run: make build-cleanup
|
||||
|
||||
75
.github/workflows/issue-commands.yml
vendored
75
.github/workflows/issue-commands.yml
vendored
@@ -1,75 +0,0 @@
|
||||
name: Run commands when issues are labeled or comments added
|
||||
on:
|
||||
issues:
|
||||
types: [labeled, opened]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
bot:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: "oam-dev/kubevela-github-actions"
|
||||
path: ./actions
|
||||
ref: v0.4.2
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '14'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: ./actions/package-lock.json
|
||||
- name: Install Dependencies
|
||||
run: npm ci --production --prefix ./actions
|
||||
- name: Run Commands
|
||||
uses: ./actions/commands
|
||||
with:
|
||||
token: ${{secrets.VELA_BOT_TOKEN}}
|
||||
configPath: issue-commands
|
||||
|
||||
backport:
|
||||
runs-on: ubuntu-18.04
|
||||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/backport')
|
||||
steps:
|
||||
- name: Extract Command
|
||||
id: command
|
||||
uses: xt0rted/slash-command-action@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.VELA_BOT_TOKEN }}
|
||||
command: backport
|
||||
reaction: "true"
|
||||
reaction-type: "eyes"
|
||||
allow-edits: "false"
|
||||
permission-level: read
|
||||
- name: Handle Command
|
||||
uses: actions/github-script@v4
|
||||
env:
|
||||
VERSION: ${{ steps.command.outputs.command-arguments }}
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const version = process.env.VERSION
|
||||
let label = "backport release-" + version
|
||||
if (version.includes("release")) {
|
||||
label = "backport " + version
|
||||
}
|
||||
// Add our backport label.
|
||||
github.issues.addLabels({
|
||||
// Every pull request is an issue, but not every issue is a pull request.
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels: [label]
|
||||
})
|
||||
console.log("Added '" + label + "' label.")
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Open Backport PR
|
||||
uses: zeebe-io/backport-action@v0.0.6
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_workspace: ${{ github.workspace }}
|
||||
26
.github/workflows/license.yml
vendored
26
.github/workflows/license.yml
vendored
@@ -1,26 +0,0 @@
|
||||
name: license
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
jobs:
|
||||
license_check:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check for unapproved licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
- name: Install dependencies
|
||||
run: gem install license_finder
|
||||
- name: Run tests
|
||||
run: license_finder --decisions_file .license/dependency_decisions.yml
|
||||
154
.github/workflows/registry.yml
vendored
154
.github/workflows/registry.yml
vendored
@@ -8,11 +8,14 @@ on:
|
||||
workflow_dispatch: {}
|
||||
|
||||
env:
|
||||
BUCKET: kubevelacharts
|
||||
ENDPOINT: oss-cn-hangzhou.aliyuncs.com
|
||||
ACCESS_KEY: ${{ secrets.OSS_ACCESS_KEY }}
|
||||
ACCESS_KEY_SECRET: ${{ secrets.OSS_ACCESS_KEY_SECRET }}
|
||||
ARTIFACT_HUB_REPOSITORY_ID: ${{ secrets.ARTIFACT_HUB_REPOSITORY_ID }}
|
||||
|
||||
jobs:
|
||||
publish-core-images:
|
||||
publish-images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
@@ -33,7 +36,7 @@ jobs:
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login docker.io
|
||||
uses: docker/login-action@v1
|
||||
@@ -41,19 +44,10 @@ jobs:
|
||||
registry: docker.io
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login Alibaba Cloud ACR
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ secrets.ACR_DOMAIN }}
|
||||
username: ${{ secrets.ACR_USERNAME }}
|
||||
password: ${{ secrets.ACR_PASSWORD }}
|
||||
- uses: docker/setup-qemu-action@v1
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
driver-opts: image=moby/buildkit:master
|
||||
|
||||
- uses: docker/build-push-action@v2
|
||||
name: Build & Pushing vela-core for Dockerhub, GHCR and ACR
|
||||
name: Build & Pushing
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
@@ -65,33 +59,17 @@ jobs:
|
||||
build-args: |
|
||||
GITVERSION=git-${{ steps.vars.outputs.git_revision }}
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
GOPROXY=https://proxy.golang.org
|
||||
tags: |-
|
||||
ghcr.io/${{ github.repository }}/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
docker.io/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
ghcr.io/${{ github.repository_owner }}/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
${{ secrets.ACR_DOMAIN }}/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
- uses: docker/build-push-action@v2
|
||||
name: Build & Pushing CLI for Dockerhub, GHCR and ACR
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.cli
|
||||
labels: |-
|
||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
build-args: |
|
||||
GITVERSION=git-${{ steps.vars.outputs.git_revision }}
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
GOPROXY=https://proxy.golang.org
|
||||
tags: |-
|
||||
docker.io/oamdev/vela-cli:${{ steps.get_version.outputs.VERSION }}
|
||||
ghcr.io/${{ github.repository_owner }}/oamdev/vela-cli:${{ steps.get_version.outputs.VERSION }}
|
||||
${{ secrets.ACR_DOMAIN }}/oamdev/vela-cli:${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
publish-addon-images:
|
||||
runs-on: ubuntu-latest
|
||||
publish-charts:
|
||||
env:
|
||||
HELM_CHARTS_DIR: charts
|
||||
HELM_CHART: charts/vela-core
|
||||
LEGACY_HELM_CHART: legacy/charts/vela-core-legacy
|
||||
LOCAL_OSS_DIRECTORY: .oss/
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Get the version
|
||||
@@ -107,82 +85,38 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::set-output name=git_revision::$(git rev-parse --short HEAD)"
|
||||
- name: Login ghcr.io
|
||||
uses: docker/login-action@v1
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Login docker.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: docker.io
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login Alibaba Cloud ACR
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ${{ secrets.ACR_DOMAIN }}
|
||||
username: ${{ secrets.ACR_USERNAME }}
|
||||
password: ${{ secrets.ACR_PASSWORD }}
|
||||
- uses: docker/setup-qemu-action@v1
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
driver-opts: image=moby/buildkit:master
|
||||
|
||||
- uses: docker/build-push-action@v2
|
||||
name: Build & Pushing vela-apiserver for Dockerhub, GHCR and ACR
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.apiserver
|
||||
labels: |-
|
||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
build-args: |
|
||||
GITVERSION=git-${{ steps.vars.outputs.git_revision }}
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
GOPROXY=https://proxy.golang.org
|
||||
tags: |-
|
||||
docker.io/oamdev/vela-apiserver:${{ steps.get_version.outputs.VERSION }}
|
||||
ghcr.io/${{ github.repository_owner }}/oamdev/vela-apiserver:${{ steps.get_version.outputs.VERSION }}
|
||||
${{ secrets.ACR_DOMAIN }}/oamdev/vela-apiserver:${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
- uses: docker/build-push-action@v2
|
||||
name: Build & Pushing runtime rollout Dockerhub, GHCR and ACR
|
||||
with:
|
||||
context: .
|
||||
file: runtime/rollout/Dockerfile
|
||||
labels: |-
|
||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
build-args: |
|
||||
GITVERSION=git-${{ steps.vars.outputs.git_revision }}
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
GOPROXY=https://proxy.golang.org
|
||||
tags: |-
|
||||
docker.io/oamdev/vela-rollout:${{ steps.get_version.outputs.VERSION }}
|
||||
ghcr.io/${{ github.repository_owner }}/oamdev/vela-rollout:${{ steps.get_version.outputs.VERSION }}
|
||||
${{ secrets.ACR_DOMAIN }}/oamdev/vela-rollout:${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
publish-capabilities:
|
||||
env:
|
||||
CAPABILITY_BUCKET: kubevela-registry
|
||||
CAPABILITY_DIR: capabilities
|
||||
CAPABILITY_ENDPOINT: oss-cn-beijing.aliyuncs.com
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
version: v3.4.0
|
||||
- name: Prepare legacy chart
|
||||
run: |
|
||||
rsync -r $LEGACY_HELM_CHART $HELM_CHARTS_DIR
|
||||
rsync -r $HELM_CHART/* $LEGACY_HELM_CHART --exclude=Chart.yaml --exclude=crds
|
||||
- name: Tag helm chart image
|
||||
run: |
|
||||
version=${{ steps.get_version.outputs.VERSION }}
|
||||
sed -i "s/latest/$version/g" $HELM_CHART/values.yaml
|
||||
sed -i "s/latest/$version/g" $LEGACY_HELM_CHART/values.yaml
|
||||
number=${version#"v"}
|
||||
sed -i "s/0.1.0/$number/g" $HELM_CHART/Chart.yaml
|
||||
sed -i "s/0.1.0/$number/g" $LEGACY_HELM_CHART/Chart.yaml
|
||||
- name: Install ossutil
|
||||
run: wget http://gosspublic.alicdn.com/ossutil/1.7.0/ossutil64 && chmod +x ossutil64 && mv ossutil64 ossutil
|
||||
- name: Configure Alibaba Cloud OSSUTIL
|
||||
run: ./ossutil --config-file .ossutilconfig config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${CAPABILITY_ENDPOINT} -c .ossutilconfig
|
||||
- name: sync capabilities bucket to local
|
||||
run: ./ossutil --config-file .ossutilconfig sync oss://$CAPABILITY_BUCKET $CAPABILITY_DIR
|
||||
- name: rsync all capabilites
|
||||
run: rsync vela-templates/registry/auto-gen/* $CAPABILITY_DIR
|
||||
run: ./ossutil --config-file .ossutilconfig config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${ENDPOINT} -c .ossutilconfig
|
||||
- name: sync cloud to local
|
||||
run: ./ossutil --config-file .ossutilconfig sync oss://$BUCKET/core $LOCAL_OSS_DIRECTORY
|
||||
- name: add artifacthub stuff to the repo
|
||||
run: |
|
||||
rsync docs/en/install.md $HELM_CHART/README.md
|
||||
rsync docs/en/install.md $LEGACY_HELM_CHART/README.md
|
||||
sed -i "s/ARTIFACT_HUB_REPOSITORY_ID/$ARTIFACT_HUB_REPOSITORY_ID/g" hack/artifacthub/artifacthub-repo.yml
|
||||
rsync hack/artifacthub/artifacthub-repo.yml $LOCAL_OSS_DIRECTORY
|
||||
- name: Package helm charts
|
||||
run: |
|
||||
helm package $HELM_CHART --destination $LOCAL_OSS_DIRECTORY
|
||||
helm package $LEGACY_HELM_CHART --destination $LOCAL_OSS_DIRECTORY
|
||||
helm repo index --url https://$BUCKET.$ENDPOINT/core $LOCAL_OSS_DIRECTORY
|
||||
- name: sync local to cloud
|
||||
run: ./ossutil --config-file .ossutilconfig sync $CAPABILITY_DIR oss://$CAPABILITY_BUCKET -f
|
||||
run: ./ossutil --config-file .ossutilconfig sync $LOCAL_OSS_DIRECTORY oss://$BUCKET/core -f
|
||||
|
||||
199
.github/workflows/release.yml
vendored
199
.github/workflows/release.yml
vendored
@@ -4,177 +4,92 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch: { }
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
BUCKET: ${{ secrets.CLI_OSS_BUCKET }}
|
||||
ENDPOINT: ${{ secrets.CLI_OSS_ENDPOINT }}
|
||||
ACCESS_KEY: ${{ secrets.CLI_OSS_ACCESS_KEY }}
|
||||
ACCESS_KEY_SECRET: ${{ secrets.CLI_OSS_ACCESS_KEY_SECRET }}
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
publish-cli:
|
||||
runs-on: ubuntu-latest
|
||||
name: build
|
||||
strategy:
|
||||
matrix:
|
||||
TARGETS: [ linux/amd64, darwin/amd64, windows/amd64, linux/arm64, darwin/arm64 ]
|
||||
env:
|
||||
VELA_VERSION_KEY: github.com/oam-dev/kubevela/version.VelaVersion
|
||||
VELA_GITVERSION_KEY: github.com/oam-dev/kubevela/version.GitRevision
|
||||
GO_BUILD_ENV: GO111MODULE=on CGO_ENABLED=0
|
||||
DIST_DIRS: find * -type d -exec
|
||||
VELA_VERSION: ${{ github.ref }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
- name: Set up Go 1.14
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.17
|
||||
go-version: 1.14
|
||||
id: go
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
|
||||
- name: Use Node.js 10.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 12.x
|
||||
- name: Run dashboard install
|
||||
run: make dashboard-install
|
||||
- name: Run dashboard build
|
||||
run: make dashboard-build
|
||||
- name: Tag helm chart image
|
||||
run: |
|
||||
sed -i 's/latest/${{ steps.get_version.outputs.VERSION }}/g' charts/vela-core/values.yaml
|
||||
sed -i 's/0.1.0/${{ steps.get_version.outputs.VERSION }}/g' charts/vela-core/Chart.yaml
|
||||
- name: Run generate-source
|
||||
run: make generate-source
|
||||
- name: Run cross-build
|
||||
run: make cross-build
|
||||
- name: Run compress binary
|
||||
run: make compress
|
||||
- name: Get release
|
||||
id: get_release
|
||||
uses: bruceadams/get-release@v1.2.2
|
||||
- name: Get version
|
||||
run: echo "VELA_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||
- name: Get matrix
|
||||
id: get_matrix
|
||||
run: |
|
||||
TARGETS=${{matrix.TARGETS}}
|
||||
echo ::set-output name=OS::${TARGETS%/*}
|
||||
echo ::set-output name=ARCH::${TARGETS#*/}
|
||||
- name: Get ldflags
|
||||
id: get_ldflags
|
||||
run: |
|
||||
LDFLAGS="-s -w -X ${{ env.VELA_VERSION_KEY }}=${{ env.VELA_VERSION }} -X ${{ env.VELA_GITVERSION_KEY }}=git-$(git rev-parse --short HEAD)"
|
||||
echo "LDFLAGS=${LDFLAGS}" >> $GITHUB_ENV
|
||||
- name: Build
|
||||
run: |
|
||||
${{ env.GO_BUILD_ENV }} GOOS=${{ steps.get_matrix.outputs.OS }} GOARCH=${{ steps.get_matrix.outputs.ARCH }} \
|
||||
go build -ldflags "${{ env.LDFLAGS }}" \
|
||||
-o _bin/vela/${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}/vela -v \
|
||||
./references/cmd/cli/main.go
|
||||
${{ env.GO_BUILD_ENV }} GOOS=${{ steps.get_matrix.outputs.OS }} GOARCH=${{ steps.get_matrix.outputs.ARCH }} \
|
||||
go build -ldflags "${{ env.LDFLAGS }}" \
|
||||
-o _bin/kubectl-vela/${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}/kubectl-vela -v \
|
||||
./cmd/plugin/main.go
|
||||
- name: Compress
|
||||
run: |
|
||||
echo "\n## Release Info\nVERSION: ${{ env.VELA_VERSION }}" >> README.md && \
|
||||
echo "GIT_COMMIT: ${GITHUB_SHA}\n" >> README.md && \
|
||||
cd _bin/vela && \
|
||||
${{ env.DIST_DIRS }} cp ../../LICENSE {} \; && \
|
||||
${{ env.DIST_DIRS }} cp ../../README.md {} \; && \
|
||||
${{ env.DIST_DIRS }} tar -zcf vela-{}.tar.gz {} \; && \
|
||||
${{ env.DIST_DIRS }} zip -r vela-{}.zip {} \; && \
|
||||
cd ../kubectl-vela && \
|
||||
${{ env.DIST_DIRS }} cp ../../LICENSE {} \; && \
|
||||
${{ env.DIST_DIRS }} cp ../../README.md {} \; && \
|
||||
${{ env.DIST_DIRS }} tar -zcf kubectl-vela-{}.tar.gz {} \; && \
|
||||
${{ env.DIST_DIRS }} zip -r kubectl-vela-{}.zip {} \; && \
|
||||
cd .. && \
|
||||
sha256sum vela/vela-* kubectl-vela/kubectl-vela-* >> sha256-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.txt \
|
||||
- name: Upload Vela tar.gz
|
||||
- name: Upload Linux amd64 tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/vela-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.tar.gz
|
||||
asset_name: vela-${{ env.VELA_VERSION }}-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.tar.gz
|
||||
asset_path: ./_bin/vela-linux-amd64.tar.gz
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Vela zip
|
||||
- name: Upload Linux amd64 zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/vela-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.zip
|
||||
asset_name: vela-${{ env.VELA_VERSION }}-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.zip
|
||||
asset_path: ./_bin/vela-linux-amd64.zip
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela tar.gz
|
||||
- name: Upload MacOS tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/kubectl-vela/kubectl-vela-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.tar.gz
|
||||
asset_name: kubectl-vela-${{ env.VELA_VERSION }}-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.tar.gz
|
||||
asset_path: ./_bin/vela-darwin-amd64.tar.gz
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela zip
|
||||
- name: Upload MacOS zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/kubectl-vela/kubectl-vela-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.zip
|
||||
asset_name: kubectl-vela-${{ env.VELA_VERSION }}-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.zip
|
||||
asset_path: ./_bin/vela-darwin-amd64.zip
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Post sha256
|
||||
uses: actions/upload-artifact@v2
|
||||
- name: Upload Windows tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
name: sha256sums
|
||||
path: ./_bin/sha256-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.txt
|
||||
retention-days: 1
|
||||
- name: clear the asset
|
||||
run: |
|
||||
rm -rf ./_bin/vela/${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}
|
||||
mv ./_bin/vela/vela-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.tar.gz ./_bin/vela/vela-${{ env.VELA_VERSION }}-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.tar.gz
|
||||
mv ./_bin/vela/vela-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.zip ./_bin/vela/vela-${{ env.VELA_VERSION }}-${{ steps.get_matrix.outputs.OS }}-${{ steps.get_matrix.outputs.ARCH }}.zip
|
||||
- name: Install ossutil
|
||||
run: wget http://gosspublic.alicdn.com/ossutil/1.7.0/ossutil64 && chmod +x ossutil64 && mv ossutil64 ossutil
|
||||
- name: Configure Alibaba Cloud OSSUTIL
|
||||
run: ./ossutil --config-file .ossutilconfig config -i ${ACCESS_KEY} -k ${ACCESS_KEY_SECRET} -e ${ENDPOINT} -c .ossutilconfig
|
||||
- name: sync local to cloud
|
||||
run: ./ossutil --config-file .ossutilconfig sync ./_bin/vela oss://$BUCKET/binary/vela/${{ env.VELA_VERSION }}
|
||||
|
||||
- name: sync the latest version file
|
||||
if: ${{ !contains(env.VELA_VERSION,'alpha') && !contains(env.VELA_VERSION,'beta') }}
|
||||
run: |
|
||||
LATEST_VERSION=$(curl -fsSl https://static.kubevela.net/binary/vela/latest_version)
|
||||
verlte() {
|
||||
[ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]
|
||||
}
|
||||
verlte ${{ env.VELA_VERSION }} $LATEST_VERSION && echo "${{ env.VELA_VERSION }} <= $LATEST_VERSION, skip update" && exit 0
|
||||
echo ${{ env.VELA_VERSION }} > ./latest_version
|
||||
./ossutil --config-file .ossutilconfig cp -u ./latest_version oss://$BUCKET/binary/vela/latest_version
|
||||
|
||||
|
||||
upload-plugin-homebrew:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
name: upload-sha256sums
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Get release
|
||||
id: get_release
|
||||
uses: bruceadams/get-release@v1.2.2
|
||||
- name: Download sha256sums
|
||||
uses: actions/download-artifact@v2
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela-windows-amd64.tar.gz
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-windows-amd64.tar.gz
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Windows zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
name: sha256sums
|
||||
path: cli-artifacts
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -R
|
||||
working-directory: cli-artifacts
|
||||
- name: Get version
|
||||
run: echo "VELA_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||
- shell: bash
|
||||
working-directory: cli-artifacts
|
||||
run: |
|
||||
for file in *
|
||||
do
|
||||
sed -i "s/\/vela/-${{ env.VELA_VERSION }}/g" ${file}
|
||||
sed -i "s/\/kubectl-vela/-${{ env.VELA_VERSION }}/g" ${file}
|
||||
cat ${file} >> sha256sums.txt
|
||||
done
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela-windows-amd64.zip
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-windows-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Checksums
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: cli-artifacts/sha256sums.txt
|
||||
asset_path: ./_bin/sha256sums.txt
|
||||
asset_name: sha256sums.txt
|
||||
asset_content_type: text/plain
|
||||
- name: Update kubectl plugin version in krew-index
|
||||
uses: rajatjindal/krew-release-bot@v0.0.38
|
||||
- name: Update Homebrew formula
|
||||
uses: dawidd6/action-homebrew-bump-formula@v3
|
||||
with:
|
||||
token: ${{ secrets.HOMEBREW_TOKEN }}
|
||||
formula: kubevela
|
||||
tag: ${{ github.ref }}
|
||||
revision: ${{ github.sha }}
|
||||
force: false
|
||||
asset_content_type: text/plain
|
||||
37
.github/workflows/sync-api.yml
vendored
37
.github/workflows/sync-api.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: sync-api
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'apis/**'
|
||||
- 'pkg/oam/**'
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
sync-core-api:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Set up Go 1.17
|
||||
uses: actions/setup-go@v1
|
||||
env:
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
|
||||
|
||||
- name: Sync to kubevela-core-api Repo
|
||||
env:
|
||||
SSH_DEPLOY_KEY: ${{ secrets.VELA_API_DEPLOY }}
|
||||
VERSION: ${{ steps.get_version.outputs.VERSION }}
|
||||
COMMIT_ID: ${{ github.sha }}
|
||||
run: |
|
||||
bash ./hack/apis/clientgen.sh
|
||||
bash ./hack/apis/sync.sh
|
||||
10
.github/workflows/timed-task.yml
vendored
10
.github/workflows/timed-task.yml
vendored
@@ -1,10 +0,0 @@
|
||||
name: Timed Task
|
||||
on:
|
||||
schedule:
|
||||
- cron: '* * * * *'
|
||||
jobs:
|
||||
clean-image:
|
||||
runs-on: aliyun-legacy
|
||||
steps:
|
||||
- name: Cleanup image
|
||||
run: docker image prune -f
|
||||
30
.github/workflows/trivy-scan.yml
vendored
30
.github/workflows/trivy-scan.yml
vendored
@@ -1,30 +0,0 @@
|
||||
name: "Trivy Scan"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
images:
|
||||
name: Image Scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build Vela Core image from Dockerfile
|
||||
run: |
|
||||
docker build --build-arg GOPROXY=https://proxy.golang.org -t docker.io/oamdev/vela-core:${{ github.sha }} .
|
||||
|
||||
- name: Run Trivy vulnerability scanner for vela core
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
image-ref: 'docker.io/oamdev/vela-core:${{ github.sha }}'
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
|
||||
- name: Upload Trivy scan results to GitHub Security tab
|
||||
uses: github/codeql-action/upload-sarif@v1
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
85
.github/workflows/unit-test.yml
vendored
85
.github/workflows/unit-test.yml
vendored
@@ -1,85 +0,0 @@
|
||||
name: Unit-Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.17'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
noop: ${{ steps.noop.outputs.should_skip }}
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@v4.0.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
concurrent_skipping: false
|
||||
|
||||
unit-tests:
|
||||
runs-on: ubuntu-20.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
|
||||
steps:
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-pkg-
|
||||
|
||||
- name: Install ginkgo
|
||||
run: |
|
||||
sudo apt-get install -y golang-ginkgo-dev
|
||||
|
||||
- name: Setup K3d
|
||||
uses: nolar/setup-k3d-k3s@v1.0.8
|
||||
with:
|
||||
version: v1.20
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: install Kubebuilder
|
||||
uses: RyanSiu1995/kubebuilder-action@v1.2
|
||||
with:
|
||||
version: 3.1.0
|
||||
kubebuilderOnly: false
|
||||
kubernetesVersion: v1.21.2
|
||||
|
||||
- name: Run Make test
|
||||
run: make test
|
||||
|
||||
- name: Upload coverage report
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
file: ./coverage.txt
|
||||
flags: core-unittests
|
||||
name: codecov-umbrella
|
||||
26
.gitignore
vendored
26
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
# Binaries for programs and docgen
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
@@ -7,7 +7,6 @@
|
||||
bin
|
||||
_bin
|
||||
e2e/vela
|
||||
vela
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
@@ -26,7 +25,6 @@ coverage.txt
|
||||
*.swo
|
||||
*~
|
||||
.DS_Store
|
||||
_.yaml
|
||||
|
||||
# Dependency directories (remove the comment below to include it)
|
||||
vendor/
|
||||
@@ -36,19 +34,23 @@ vendor/
|
||||
|
||||
pkg/test/vela
|
||||
config/crd/bases
|
||||
_tmp/
|
||||
tmp/
|
||||
|
||||
references/cmd/cli/fake/source.go
|
||||
references/cmd/cli/fake/chart_source.go
|
||||
cmd/vela/fake/source.go
|
||||
cmd/vela/fake/chart_source.go
|
||||
charts/vela-core/crds/_.yaml
|
||||
.test_vela
|
||||
tmp/
|
||||
|
||||
.vela/
|
||||
|
||||
# check docs
|
||||
git-page/
|
||||
# Dashboard
|
||||
node_modules/
|
||||
.eslintcache
|
||||
dashboard/dist/
|
||||
dashboard/package-lock.json
|
||||
dashboard/src/.umi/
|
||||
package-lock.json
|
||||
dashboard/src/.umi-production/
|
||||
|
||||
# e2e rollout runtime image build
|
||||
runtime/rollout/e2e/tmp
|
||||
vela.json
|
||||
# Swagger: generate Restful API
|
||||
pkg/server/docs/index.html
|
||||
|
||||
@@ -113,6 +113,7 @@ linters:
|
||||
- govet
|
||||
- gocyclo
|
||||
- gocritic
|
||||
- interfacer
|
||||
- goconst
|
||||
- goimports
|
||||
- gofmt # We enable this as well as goimports for its simplify mode.
|
||||
|
||||
47
.krew.yaml
47
.krew.yaml
@@ -1,47 +0,0 @@
|
||||
apiVersion: krew.googlecontainertools.github.com/v1alpha2
|
||||
kind: Plugin
|
||||
metadata:
|
||||
name: vela
|
||||
spec:
|
||||
version: "{{ .TagName }}"
|
||||
platforms:
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: linux
|
||||
arch: amd64
|
||||
{{addURIAndSha "https://github.com/oam-dev/kubevela/releases/download/{{ .TagName }}/kubectl-vela-{{ .TagName }}-linux-amd64.tar.gz" .TagName }}
|
||||
files:
|
||||
- from: "*/kubectl-vela"
|
||||
to: "."
|
||||
- from: "*/LICENSE"
|
||||
to: "."
|
||||
bin: "kubectl-vela"
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: darwin
|
||||
arch: amd64
|
||||
{{addURIAndSha "https://github.com/oam-dev/kubevela/releases/download/{{ .TagName }}/kubectl-vela-{{ .TagName }}-darwin-amd64.tar.gz" .TagName }}
|
||||
files:
|
||||
- from: "*/kubectl-vela"
|
||||
to: "."
|
||||
- from: "*/LICENSE"
|
||||
to: "."
|
||||
bin: "kubectl-vela"
|
||||
- selector:
|
||||
matchLabels:
|
||||
os: windows
|
||||
arch: amd64
|
||||
{{addURIAndSha "https://github.com/oam-dev/kubevela/releases/download/{{ .TagName }}/kubectl-vela-{{ .TagName }}-windows-amd64.zip" .TagName }}
|
||||
files:
|
||||
- from: "*/kubectl-vela"
|
||||
to: "kubectl-vela.exe"
|
||||
- from: "*/LICENSE"
|
||||
to: "."
|
||||
bin: "kubectl-vela.exe"
|
||||
shortDescription: Easily interact with KubeVela
|
||||
homepage: https://kubevela.io
|
||||
description: |
|
||||
kubectl vela is a kubectl plugin from the KubeVela project. KubeVela is
|
||||
a modern application platform that is fully self-service, and adapts to
|
||||
your needs when you grow. This plugin allows you to better view, manage
|
||||
and maintain KubeVela applications.
|
||||
@@ -1,19 +0,0 @@
|
||||
# License Checker
|
||||
|
||||
Our license checker CI rely on https://github.com/pivotal/LicenseFinder.
|
||||
|
||||
## How to add a new license?
|
||||
|
||||
LicenseFinder is a ruby project, so make sure you have ruby installed.
|
||||
|
||||
### Install the tool
|
||||
|
||||
```shell
|
||||
gem install license_finder
|
||||
```
|
||||
|
||||
### Add a license
|
||||
|
||||
```shell
|
||||
license_finder permitted_licenses add MIT --decisions_file .license/dependency_decisions.yml
|
||||
```
|
||||
@@ -1,43 +0,0 @@
|
||||
---
|
||||
- - :permit
|
||||
- MIT
|
||||
- :who:
|
||||
:why:
|
||||
:versions: []
|
||||
:when: 2021-03-12 07:35:34.645031000 Z
|
||||
- - :permit
|
||||
- Apache 2.0
|
||||
- :who:
|
||||
:why:
|
||||
:versions: []
|
||||
:when: 2021-03-12 07:19:18.243194000 Z
|
||||
- - :permit
|
||||
- New BSD
|
||||
- :who:
|
||||
:why:
|
||||
:versions: []
|
||||
:when: 2021-03-12 07:19:28.540675000 Z
|
||||
- - :permit
|
||||
- Simplified BSD
|
||||
- :who:
|
||||
:why:
|
||||
:versions: []
|
||||
:when: 2021-03-12 07:20:01.774212000 Z
|
||||
- - :permit
|
||||
- Mozilla Public License 2.0
|
||||
- :who:
|
||||
:why:
|
||||
:versions: []
|
||||
:when: 2021-03-12 07:21:05.194536000 Z
|
||||
- - :permit
|
||||
- unknown
|
||||
- :who:
|
||||
:why:
|
||||
:versions: []
|
||||
:when: 2021-03-12 07:21:43.379269000 Z
|
||||
- - :permit
|
||||
- ISC
|
||||
- :who:
|
||||
:why:
|
||||
:versions: []
|
||||
:when: 2021-03-12 07:22:07.265966000 Z
|
||||
@@ -1,260 +0,0 @@
|
||||
# v1.0.7
|
||||
|
||||
This is a minor fix for release-1.0, please refer to release-1.1.x for the latest feature.
|
||||
|
||||
1. Fix podDisruptive field for inner traits #1844
|
||||
|
||||
|
||||
# v1.0.6
|
||||
|
||||
1. fix bug: When the Component contains multiple traits of the same type, the status of the trait in the Application is reported incorrectly (#1731) (#1743)
|
||||
2. Fix terraform component can't work normally, generate OpenAPI JSON schema for Terraform Component (#1738) (#1753)
|
||||
3. Improve the logging system #1735 #1758
|
||||
4. add ConcurrentReconciles for setting the concurrent reconcile number of the controller #1775
|
||||
|
||||
# v1.0.5
|
||||
|
||||
1. Fix Terraform application status issue (#1611)
|
||||
2. application supports specifying different versions of Definition (#1597)
|
||||
3. Enable Dynamic Admission Control for Application (#1619)
|
||||
4. Update inner samples for "vela show xxx --web" (#1616)
|
||||
5. fix empty rolloutBatch will panic whole controller bug (#1646)
|
||||
6. Use stricter syntax check for CUE (#1643)
|
||||
7. make ResourceTracker to own cluster-scope resource (#1634)
|
||||
8. update docs
|
||||
|
||||
# v1.0.4
|
||||
|
||||
## Upgrade to this release
|
||||
|
||||
**Please update Application CRD to upgrade from v1.0.3 to this release**
|
||||
|
||||
```
|
||||
kubectl apply -f https://raw.githubusercontent.com/kubevela/kubevela/master/charts/vela-core/crds/core.oam.dev_applications.yaml
|
||||
```
|
||||
|
||||
**Check the upgrade docs to upgrade from other release: https://kubevela.io/docs/advanced-install#upgrade**
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
1. add more PVC volume traits and docs (#1524)
|
||||
2. automatically sync vela api code to the repo([kubevela-core-api](https://github.com/oam-dev/kubevela-core-api)) on release, you can use this repo as import package for kubevela integration (#1523)
|
||||
3. fix cue template of worker and ingress with more accurate error info (#1532)
|
||||
4. add critical path k8s event for Application (#1463)
|
||||
5. support K8s Deployment for AppRollout #1539 #1557
|
||||
6. vela cli: enable "vela show" to support namespaced capability (#1521)
|
||||
7. Add scpoe reference in Application object `status.Service` (#1540)
|
||||
8. vela cli: `vela show` support list the parameter of ComponentDefinition created by helm charts (#1543)
|
||||
9. Add revision mechanism for Component/Trait Definition and default revision histroy will keep 20 revisions #1531
|
||||
10. fix CRD for legacy K8s cluser(<=1.14) (#1531)
|
||||
11. fix duplate key in kubevela chart webhook yaml (#1571)
|
||||
12. Check whether parameter.cmd is nill for `sidecar` trait (#1575)
|
||||
13. add e2e-test into test coverage report (#1553)
|
||||
14. support krew install for kubectl vela plugin #1582
|
||||
15. fix controller cannot start due to the format error of the third-party CRD (#1584)
|
||||
16. use accelerate domain for helm chart repo to speed up for global users (#1585)
|
||||
17. embed rollout in an application, now you can use rolloutPlan in Application (#1568)
|
||||
18. Support server-side Terraform as cloud resource provider #1519
|
||||
|
||||
# v1.0.3
|
||||
|
||||
More end user guide was added in `Application Deployment` section.
|
||||
|
||||
1. add helm test to verify the chart of KubeVela have been installed successfully (#1415)
|
||||
2. fix bug which Component/TraitDefinition won't work when contains “`_|_`” in value (#1450)
|
||||
3. add volumes definition in worker/webservice (#1459)
|
||||
4. Remove local kind binary dependency #1458
|
||||
5. ignore error not found when deleting resourceTracker (#1462)
|
||||
6. add context.appRevisionNum as runtime context (#1466)
|
||||
7. implement cli `vela system live-diff` to check diff before upgrade (#1419)
|
||||
8. add webhook validation on CUE template outputs name (#1460)
|
||||
9. Fix helm chart about wrong webhook policy (#1483)
|
||||
10. Remove trait-injector from controller options (#1490)
|
||||
12. add app name as label for AppRevision (#1488)
|
||||
13. Introduce vela as a kubectl plugin (#1485)
|
||||
14. update status of appContext by patch to avoid resourceVersion conflict error (#1500)
|
||||
15. add workloadDefinitionRef to application status.services (#1471)
|
||||
16. Add garbage collection mechanism for AppRevision, it will only keep 10 revisions by default (#1501)
|
||||
17. Remove AGE in definition crd print columns (#1509)
|
||||
|
||||
|
||||
# v1.0.2
|
||||
|
||||
1. remove no used ingress notes in KubeVela charts (#1405)
|
||||
2. fix import inner package in the format of third party package path and add docs (#1412 #1417)
|
||||
3. vela cli support use "vela system cue-packages" to list cue-package (#1417)
|
||||
4. Fix bug that the registered k8s built-in gvk does not exist in third party package path (#1414)
|
||||
5. Fix bug that patchKey not work when strategyUnify function not work with close call (#1430)
|
||||
6. add podDisruptive to traitdefinition to notify wether a trait update will cause restart of pod or not (#1192)
|
||||
7. Add a new cloneset scale controller (#1301)
|
||||
8. Support garbage collection for across-namespace workloads and traits (#1421)
|
||||
9. Add short name for crds && Remove redundant and ambiguous short names #1434
|
||||
10. Refresh built-in packages when component/trait definition are registered (#1402)
|
||||
|
||||
|
||||
**You should upgrade following CRDs to upgrade from v1.0.1, all CRDs changes are backward compatible**:
|
||||
|
||||
```
|
||||
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/charts/vela-core/crds/core.oam.dev_resourcetrackers.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/charts/vela-core/crds/standard.oam.dev_rollouttraits.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/charts/vela-core/crds/core.oam.dev_traitdefinitions.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/charts/vela-core/crds/core.oam.dev_applications.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/charts/vela-core/crds/core.oam.dev_approllouts.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/oam-dev/kubevela/master/charts/vela-core/crds/core.oam.dev_applicationrevisions.yaml
|
||||
```
|
||||
|
||||
|
||||
# v1.0.1
|
||||
|
||||
There are some fixes contained for release v1.0.0:
|
||||
|
||||
1. add initial finalizer and abandon support for app rollout, you can revert quickly now(#1362)
|
||||
2. fix vela show fail to get component definition (#1366)
|
||||
3. fix application context controller should not own application object (#1370)
|
||||
4. fix: "system-definition-namespace" chart args not work in vela chart (#1371)
|
||||
5. fix resources created in different namespace can not be updated (#1374)
|
||||
6. fix automatically generate schema for helm values fail in array list value (#1375)
|
||||
7. upgrade API version of mutate/validate webhook to v1 (#1383)
|
||||
8. fix webhook not work by helm install kubevela without cert-manager #1267
|
||||
7. remove create cert-manager issuer in vela CLI env command (#1267)
|
||||
8. refine CRD print results: add additional print column and short Name for CRD (#1377)
|
||||
|
||||
Many other docs improvements.
|
||||
|
||||
Thanks for all the contributors!
|
||||
|
||||
# v1.0.0
|
||||
|
||||
We're excited to announce the release of KubeVela 1.0.0! 🎉🎉🎉🎉
|
||||
|
||||
Thanks to all the new and existing contributors who helped make this release happen!
|
||||
|
||||
You may already noticed the awesome community has shipped a brand new KubeVela website https://kubevela.io ! 🎉🎉
|
||||
|
||||
If you're new to KubeVela, feel free to start with its [getting started page](https://kubevela.io/docs/quick-start) and learning about [its core concepts](https://kubevela.io/docs/concepts). The full feature of vela is explained in [platform builder guide](https://kubevela.io/docs/platform-engineers/overview).
|
||||
|
||||
For existing adopters, please follow the [installing](https://kubevela.io/docs/install) or [upgrading](https://kubevela.io/docs/install#upgrade) KubeVela to version 1.0.0.
|
||||
|
||||
## Acknowledgements ❤️
|
||||
|
||||
Thanks to everyone who made this release possible!
|
||||
|
||||
@captainroy-hy @sunny0826 @leejanee @yangsoon @wangyikewxgm @hongchaodeng @zzxwill @ryanzhang-oss @resouer @wonderflow @hprotzek @vnzongzna @majian159 @Cweiping @mengjiao-liu @kushthedude @unknwon @Ghostbaby @mosesyou @dylandee @wangkai1994 @LeoLiuYan @just-do1 @hoopoe61 @Incubator4th @TomorJM @hahchenchen @zeed-w-beez @allenhaozi @mason1kwok @kinsolee @shikanon @96RadhikaJadhav
|
||||
|
||||
# What's New
|
||||
|
||||
## API version upgraded to `v1beta1`
|
||||
|
||||
All user facing APIs have been upgraded to `v1beta1`, you could learn more details in the [API Changes](#API-Changes) section below.
|
||||
|
||||
## `ComponentDefinition`
|
||||
|
||||
The [`ComponentDefinition`](https://kubevela.io/docs/platform-engineers/definition-and-templates) now takes the responsibility of defining encapsulation and abstraction for your app components. And you are free to choose to use Helm chart or CUE to define them. This leaves `WorkloadDefinition` focusing on declaring workload characteristic such as `replicable`, `childResource` etc, so the `spec.schematic` field in `WorkloadDefinition` could be deprecated in next few releases.
|
||||
|
||||
## Application Versioning and Progressive Rollout
|
||||
|
||||
* A rolling style upgrade was supported by the object called [`AppRollout`](https://kubevela.io/docs/rollout/rollout/). It can help you to upgrade an Application from source revision to the target and support Blue/Green, Canary and A/B testing rollout strategy.
|
||||
* Multi-Version, Multi-Cluster Application Deployment was supported by the object called [`AppDeployment`](https://kubevela.io/docs/rollout/appdeploy). It can help you to deploy multiple revision apps to multiple clusters with leverage of Service Mesh.
|
||||
|
||||
## Visualization Enhancement
|
||||
|
||||
KubeVela now automatically generates Open-API-v3 Schema for all the definition abstractions including CUE, Helm and raw Kubernetes resource templates. You can integrate KubeVela with your own dashboard and [generate forms from definitions](https://kubevela.io/docs/platform-engineers/openapi-v3-json-schema) at ease!
|
||||
|
||||
## Application Abstraction
|
||||
|
||||
There're several major updates on the `Application` abstraction itself:
|
||||
* [Helm based abstraction](https://kubevela.io/docs/helm/component) was supported with few [limitations](https://kubevela.io/docs/helm/known-issues). In other words, you can now declare any existing Helm chart as an app component in KubeVela. The most exciting part is the trait system of KubeVela works seamlessly with the Helm based components, yes, just [attach trait](https://kubevela.io/docs/helm/trait) to it!
|
||||
* [Raw Kubernetes resource templates](https://kubevela.io/docs/kube/component) was still supported, that's simpler but less powerful comparing to [the CUE way](https://kubevela.io/docs/cue/component). Of course, the trait system also [works seamless](https://kubevela.io/docs/kube/trait) with it.
|
||||
|
||||
|
||||
## CUE Template Enhancement
|
||||
|
||||
* [Runtime information context](https://kubevela.io/docs/cue/component#full-available-information-in-cue-context) was supported, you could use this information to render the resources in CUE template.
|
||||
* [Data passing](https://kubevela.io/docs/cue/advanced#data-passing) was supported during CUE rendering. Specifically, the `context.output` contains the rendered workload API resource and the `context.outputs.<xx>` contains all the other rendered API resources.
|
||||
* [K8s API resources are now built-in packages](https://kubevela.io/docs/cue/basic#import-kube-package): the K8s built-in API including CRD will be discovered by KubeVela and automatically built as CUE packages, you can use it in your CUE template. This is very helpful in validation especially on writing new CUE templates.
|
||||
* [Dry-run Application](https://kubevela.io/docs/platform-engineers/debug-test-cue) was supported along with a debug and test guide for building CUE template. You can create CUE based definitions with confidence now!
|
||||
* [Deploy resources in different namespaces](https://kubevela.io/docs/cue/cross-namespace-resource/) was supported now, you can specify namespace in your CUE template.
|
||||
|
||||
## Declare and Consume Cloud Resources
|
||||
|
||||
* [Declare and consume cloud resources](https://kubevela.io/docs/platform-engineers/cloud-services/) were supported now in KubeVela, you can easily register cloud resources by `ComponentDefinition` and bind the service into the applications.
|
||||
|
||||
## A brand new website
|
||||
|
||||
We have upgraded our website [kubevela.io](https://github.com/oam-dev/kubevela.io) based on "Docusaurus". All docs is automatically generated from [KubeVela](https://github.com/oam-dev/kubevela/tree/master/docs) while the blogs are on [kubevela.io/blogs](https://github.com/oam-dev/kubevela.io/tree/main/blog).
|
||||
|
||||
|
||||
# Changes
|
||||
|
||||
## API Changes
|
||||
|
||||
1. Change definition from cluster scope to namespace scope #1085 the cluster scope CRD was still compatible.
|
||||
2. Application Spec changes.
|
||||
- `spec.components[x].settings` in v1alpha2 was changed to `spec.components[x].properties` in v1beta1
|
||||
- `spec.components[x].traits[x].name` in v1alpha2 was changed to `spec.components[x].traits[x].type` in v1beta1
|
||||
|
||||
Example of the v1alpha2 Spec:
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1alpha2
|
||||
kind: Application
|
||||
metadata:
|
||||
name: first-vela-app
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
settings:
|
||||
...
|
||||
traits:
|
||||
- name: ingress
|
||||
properties:
|
||||
...
|
||||
```
|
||||
|
||||
Example of the v1beta1 Spec:
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: first-vela-app
|
||||
spec:
|
||||
components:
|
||||
- name: express-server
|
||||
type: webservice
|
||||
properties:
|
||||
...
|
||||
traits:
|
||||
- type: ingress
|
||||
properties:
|
||||
...
|
||||
```
|
||||
|
||||
|
||||
## Deprecation
|
||||
|
||||
1. route/autoscaler/metrics these three traits and their controllers were moved out from the vela core. #1172 You could still find and use them from https://github.com/oam-dev/catalog.
|
||||
2. the dashboard was deprecated in KubeVela and we will merge these features and create a new in [velacp](https://github.com/oam-dev/velacp) soon.
|
||||
3. vela CLI will only support run/modify an app from appfile by using `vela up`, so some other commands related were deprecated, such as `vela svc deploy`, `vela <trait> ...`
|
||||
|
||||
|
||||
## Other Notable changes
|
||||
|
||||
1. `prometheus` and `certmanager` CRD are not required in installation #1005
|
||||
2. Parent overrides child when annotation/labels conflicts && one revision will apply once only in force mode && AC.status CRD updated #1109
|
||||
3. `ApplicationRevision` CRD Object was introduced as revision of Application #1214
|
||||
4. KubeVela chart image pull policy was changed to `Always` from `IfNotPresent` #1228
|
||||
5.` Application` Controller will use `AppContext` to manage the resources generation #1245, in other word, you can run KubeVela `Application Controller` without any `v1apha2 Object`.
|
||||
6. The regular time for all events automatically sync changed from 5min to 1 hour #1285
|
||||
7. `vela system dry-run` will print raw K8s resources in a better format #1246
|
||||
|
||||
|
||||
# Known Issues
|
||||
|
||||
1. Built-in CUE package was not supported now for K8s Cluster v1.20, we will support in the next release. #1313
|
||||
2. Resources created in different namespace from application will only be garbage collected (GC) when the application deleted, an update will not trigger GC for now, we will fix it in the next release. #1339
|
||||
|
||||
|
||||
Thanks again to all the contributors!
|
||||
@@ -1,243 +0,0 @@
|
||||
# v1.1.3
|
||||
|
||||
## What's Changed
|
||||
* Fix: remove ocm addon enable in Makefile by @Somefive in https://github.com/oam-dev/kubevela/pull/2327
|
||||
* Chore(cli): remove useless deploy.yaml by @chivalryq in https://github.com/oam-dev/kubevela/pull/2335
|
||||
* Fix: do not override the workload name if its specified by @FogDong in https://github.com/oam-dev/kubevela/pull/2336
|
||||
* Fix: remove appcontext CRD and controller by @wonderflow in https://github.com/oam-dev/kubevela/pull/2270
|
||||
* Feat: add revisionHistoryLimit to helm chart by @haugom in https://github.com/oam-dev/kubevela/pull/2343
|
||||
* Chore: deprecate 'vela dashboard' apiserver by @chivalryq in https://github.com/oam-dev/kubevela/pull/2341
|
||||
* Chore: remove e2e-api-test in rollout test to speed up by @chivalryq in https://github.com/oam-dev/kubevela/pull/2345
|
||||
* Docs: rollout demo by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/2348
|
||||
* Feat: add vela minimal chart by @FogDong in https://github.com/oam-dev/kubevela/pull/2340
|
||||
* Fix: runc security issue by @Somefive in https://github.com/oam-dev/kubevela/pull/2350
|
||||
* Docs: add a WeChat QR code by @barnettZQG in https://github.com/oam-dev/kubevela/pull/2351
|
||||
* Feat: Initialize api for vela dashboard and CLI by @barnettZQG in https://github.com/oam-dev/kubevela/pull/2339
|
||||
* Fix(helm chart): fix startup args for apiserver by @yangsoon in https://github.com/oam-dev/kubevela/pull/2362
|
||||
* Fix: dockerfile e2e test command lack environment configuration by @Somefive in https://github.com/oam-dev/kubevela/pull/2231
|
||||
* Feat: inputs support setting value in array by @leejanee in https://github.com/oam-dev/kubevela/pull/2358
|
||||
* Feat: support rollout controller for StatefulSet by @whichxjy in https://github.com/oam-dev/kubevela/pull/1969
|
||||
* Fix: delete deprecated vela dashboard in e2e setup by @FogDong in https://github.com/oam-dev/kubevela/pull/2379
|
||||
* Fix: try fix CI unit test by @wonderflow in https://github.com/oam-dev/kubevela/pull/2376
|
||||
* Feat: Addon REST API by @hongchaodeng in https://github.com/oam-dev/kubevela/pull/2369
|
||||
* Fix: fix built in workflow steps by @FogDong in https://github.com/oam-dev/kubevela/pull/2378
|
||||
* Feat: add vela minimal in make manifests by @FogDong in https://github.com/oam-dev/kubevela/pull/2389
|
||||
* Chore(deps): bump go.mongodb.org/mongo-driver from 1.3.2 to 1.5.1 by @wonderflow in https://github.com/oam-dev/kubevela/pull/2391
|
||||
* Fix: use aliyun oss istio chart by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/2392
|
||||
* Support remote git repo for Terraform configuration by @zzxwill in https://github.com/oam-dev/kubevela/pull/2337
|
||||
* Feat: add inputs test cases and optimize code by @leejanee in https://github.com/oam-dev/kubevela/pull/2388
|
||||
* Fix: pass owner to workload if rollout failed by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/2397
|
||||
* Feat: bootstrap multicluster testing by @Somefive in https://github.com/oam-dev/kubevela/pull/2368
|
||||
* Feat(workflow): add depends on in workflow by @FogDong in https://github.com/oam-dev/kubevela/pull/2387
|
||||
* Fix: make the name of Terraform credential secret same to component name by @zzxwill in https://github.com/oam-dev/kubevela/pull/2399
|
||||
* Fix: revision GC in workflow mode by @FogDong in https://github.com/oam-dev/kubevela/pull/2355
|
||||
* Fix: Applied Resources Statistics Error by @leejanee in https://github.com/oam-dev/kubevela/pull/2398
|
||||
|
||||
|
||||
# v1.1.2
|
||||
|
||||
This is a bug fix release.
|
||||
Since the big v1.1.1 release, many users had given it try for our new features. We sincerely appreciate your enthusiasm and amazing feedback.
|
||||
|
||||
There are some small issues found by our users and we have fixed them. Most notably:
|
||||
|
||||
- The Charts of addons (prometheus, etc.) are moved to OSS to provide better accessibility and network speed.
|
||||
- The FluxCD and Terraform addons are not enabled by default. Users can install them via `vela addon enable ...`.
|
||||
|
||||
We have located more small issues around templates as well and fixed them, and decided a bug fix release ASAP.
|
||||
|
||||
Users are highly recommended to use the v1.1.2 release instead. We want to thank all of our users sincerely! ❤️ ❤️ ❤️
|
||||
|
||||
## What's Changed
|
||||
* Fix(rollout): improve rollback experience by @hongchaodeng in https://github.com/oam-dev/kubevela/pull/2294
|
||||
* Fix: fix typo by @hughxia in https://github.com/oam-dev/kubevela/pull/2317
|
||||
* Fix: fix cluster-gateway image tag in chart by @Somefive in https://github.com/oam-dev/kubevela/pull/2318
|
||||
* Fix: workflow example by @leejanee in https://github.com/oam-dev/kubevela/pull/2323
|
||||
* Fix: fix multicluster values bug by @Somefive in https://github.com/oam-dev/kubevela/pull/2326
|
||||
* Fix(helm): Do not install fluxcd and terraform by default by @yangsoon in https://github.com/oam-dev/kubevela/pull/2328
|
||||
* Fix: move charts from github repo to Alibaba Cloud OSS repo by @zzxwill in https://github.com/oam-dev/kubevela/pull/2324
|
||||
* Fix: add comments and adjust helm typed component's spec by @zzxwill in https://github.com/oam-dev/kubevela/pull/2332
|
||||
* Fix: fix multicluster template bug by @Somefive in https://github.com/oam-dev/kubevela/pull/2333
|
||||
* Feat: add args for init-contianer and sidecar by @Gallardot in https://github.com/oam-dev/kubevela/pull/2331
|
||||
|
||||
# v1.1.1
|
||||
|
||||
Users are highly recommended to use the v1.1.2 release instead.
|
||||
|
||||
# Changes since v1.1.0
|
||||
|
||||
1. rollout trait change IncreaseFirst to DecreaseFirst (#2142)
|
||||
2. Feat(definition): add built-in dingtalk workflow step definition (#2152)
|
||||
3. Fix(dryrun): add default name and namespace in dry run (#2150)
|
||||
4. Docs: fix typo about workflow rollout (#2163)
|
||||
5. Fix: traitdefinition controller reconcile in a infinite loop (#2157)
|
||||
6. Refactor: change the ownerReference of configMap which store the parameter for each revision to definitionRevision (#2164)
|
||||
7. Fix: add fluxcd dashbaords (#2130)
|
||||
8. Feat: modify apply component cue action to support skipWorkload trait (#2167)
|
||||
9. Trait: Add TraitDefinition for PVC (#2158)
|
||||
10. initilize KubeVela codeowner file (#2178)
|
||||
11. Feat(cue): support access components artifacts in cue template context (#2161)
|
||||
12. Feat(addon): add default enable addon (#2172)
|
||||
13. Feat(envbinding): add resourceTracker for envBinding (#2179)
|
||||
14. Fix: align all CUE template keyword to use parameter (#2181)
|
||||
15. Feat: add vela live-diff , dry-run, cue-packages into vela commands (#2182)
|
||||
16. Fix: move Terraform defintions charts/vela-core/templates/definitions (#2176)
|
||||
17. Fix: add patchkey to volumes (#2191)
|
||||
18. Feat(workflow): add depends-on workflow step definition (#2190)
|
||||
19. Feat: add pprof (#2192)
|
||||
20. Feat: add more registry traits as internal ones (#2184)
|
||||
21. Fix: support more Terraform variable types (#2194)
|
||||
22. Fix: update help message of ingress trait (#2198)
|
||||
23. Refactor(#2185): remove unused config options in Makefile (#2200)
|
||||
24. Docs: update environment design (#2199)
|
||||
25. Fix: modify service-binding with more accurate type (#2209)
|
||||
26. Feat(healthscope): add health-scope-binding policy and e2e test for health scope (#2205)
|
||||
27. Feat(workflow): support dingding and slack in webhook notification (#2213)
|
||||
28. Feat(workflow): add apply application workflow step definition (#2186)
|
||||
29. Feat(workflow): input.ParameterKey described like paths notation (#2214)
|
||||
30. Fix(upgrade): upgrade controller-tools from 0.2 to 0.6.2 (#2215)
|
||||
31. Fix(app): When only the policy is specified, the resources in the app need to be rendered and created (#2197)
|
||||
32. Feat(workflow): outputs support script notation (#2218)
|
||||
33. Fix(addon): rename clonset-service to clonse (#2219)
|
||||
34. Feat(workflow): Add op.#Task action (#2220)
|
||||
35. Fix(webhook): only check the uniqueness of component names under the same namespace (#2222)
|
||||
36. Feat(apiserver): add apiserver service to helm chart (#2225)
|
||||
37. Fix: add flag --label to filer components and traits (#2217)
|
||||
38. Fix(addons): remove kruise addon (#2226)
|
||||
39. Feat: add pressure-test parameter optimize (#2230)
|
||||
40. Fix: align the envbind-app name with the original application name (#2232)
|
||||
41. Feat(workflow): add status check for workflow mutil-env deploy (#2229)
|
||||
42. Refactor: move from io/ioutil to io and os package (#2234)
|
||||
43. Feat(trait): annotation and labels trait should also affect the workload object along with pod (#2237)
|
||||
44. Feat(app): show health status from HealthScope in application (#2228)
|
||||
45. Fix: kustomize json patch trait definition (#2239)
|
||||
46. Docs: canary rollout demo (rollout part only) (#2177)
|
||||
47. Feat: vela show annotations display undefined should be refined (#2244)
|
||||
48. Feat: support code-generator and sync to kubevela-core-api (#2174)
|
||||
49. Feat: add image auto update for gitops (#2251)
|
||||
50. Fix: fix the output DB_PASSWORD for rds definition (#2267)
|
||||
51. Fix: add alibaba eip cloud resource (#2268)
|
||||
52. Refactor application code to make it run as Dag workflow (#2236)
|
||||
53. Fix: remove podspecworkload controller and CRD (#2269)
|
||||
54. Feat: add more options for leader election configuration to avoid pressure on apiserver
|
||||
55. Feat: istio addon and use case demo (#2276)
|
||||
56. Fix: patch any key using retainKeys strategy (#2280)
|
||||
57. Fix: add exponential backoff wait time for workflow reconciling (#2279)
|
||||
58. Refactor: change field exportKey to valueFrom (#2284)
|
||||
59. Fix(helm): enable apiserver by default (#2249)
|
||||
60. Feat: alibaba provider addon (#2243)
|
||||
61. Support MultiCluster EnvBinding with cluster-gateway (#2247)
|
||||
62. Fix: fix apply application workflow step (#2288)
|
||||
63. Fix: fix alibaba cloud rds module (#2293)
|
||||
64. Feat: add commit msg in kustomize (#2296)
|
||||
65. Feat: allow user specify alibaba provider addon's region (#2297)
|
||||
66. Fix: generate service in canary-traffic trait (#2300)
|
||||
67. Fix: imagePullSecrets error from cloneset (#2305)
|
||||
68. Fix: add application logging dashboard (#2301)
|
||||
69. Feat: Make applicationComponent can be modified in step (#2304)
|
||||
70. Fix: generate service in canary-traffic trait (#2307)
|
||||
|
||||
|
||||
# v1.1.0
|
||||
|
||||
Note: the documents (https://kubevela.io/) for v1.1.0 is still WIP, so we mark it as pre-release. The ETA for documents is next 2 weeks.
|
||||
|
||||
We would like to extend our thanks to all [the new and existing contributors](https://github.com/oam-dev/kubevela/graphs/contributors) who helped make this release happen.
|
||||
|
||||
Please follow the guide to [install](https://kubevela.io/docs/next/getting-started/quick-install) or [upgrade](https://kubevela.io/docs/next/platform-engineers/advanced-install/) KubeVela to version v1.1.0.
|
||||
|
||||
## What's New
|
||||
|
||||
- **Hybrid Environment App Delivery Control plane**
|
||||
- In the new release, we have fully upgraded KubeVela to a multi-cluster/hybrid-cloud/multi-cloud app delivery control plane with leverage of OAM as the consistent app delivery model across clouds and infrastructures.
|
||||
- **Workflow**
|
||||
- KubeVela has added a Workflow mechanism that empowers users to glue any operational tasks to customize the control logic to build more complex operations. Workflow is modular by design and each module is mainly composed in CUE -- so you can define complex operations in a declarative, data-driven manner.
|
||||
- **Environment**
|
||||
- KubeVela added an Initializer which allow users to define what constructs the environment. The environment Initialized by the Initilizer could contain different kinds of resources include K8s cluster, system components, policies and almost everything. Of course, you can destry an environment very easily with the help of Initializer.
|
||||
- **Out of Box Addons**
|
||||
- With the help of Initilizer, KubeVela has support lots of out of box addons. You can list/enable/disable them by `vela addon` command. Each addon is an Initializer that deloy the CRD Controllers and other resources related.
|
||||
- **Cloud Resources Support**
|
||||
- We also support terraform to provision almost every cloud resources and pass through to other components defined in KubeVela application.
|
||||
- **Tools to edit and manage X-Definition**
|
||||
- We also provide the `vela def` tool sets to provide unified CUE based capability to manage X-Definition.
|
||||
- **Others**
|
||||
- Allow specify name for component revision auto-generated by Application. Allow specify name for auto generated Definition revision.
|
||||
- Controller runtime dependency upgrade that can compatible with Kubernetes v1.21 . KubeVela support Kubernetes v1.18~v1.21.
|
||||
- Other details you could read changelog in the release history.
|
||||
|
||||
## Change log since v1.1-rc2
|
||||
|
||||
1. fix configmap patchkey bug (#2080)
|
||||
2. Merge velacp to apiserver branch in oam repo (#2039) (#2127) (#2087)
|
||||
3. support rollout controller seprated and install as helm chart in runtime cluster (#2075)
|
||||
4. fix bug that KubeVela can not be installed in specified namespace (#2083)
|
||||
5. enable vela def to use import decl (#2084)
|
||||
6. enhance envbinding: support apply resources to cluster (#2093)
|
||||
7. Add obsevability addon (#2091)
|
||||
8. Feat(vela): add vela workflow suspend command (#2108)
|
||||
9. feat(def): add built-in workflow definitions (#2094)
|
||||
10. Feat(vela): add vela workflow resume command (#2114)
|
||||
11. upgrade openkruise version to v0.9.0 (#2076)
|
||||
12. Fix(workflow): set workload name in configmap if the name is not specified (#2119)
|
||||
13. helm component support OSS bucket (#2104)
|
||||
14. add rollout demo with Workflow (#2121)
|
||||
15. Support script as parameter and make the WorkflowStepDefinition more universal (#2124)
|
||||
16. fix(cli) fix bug when vela show componetdefinition's workload type is AutoDetectWorkloadDefinition (#2125)
|
||||
17. Fix(workflow): set the namespace to app's ns if it's not specified (#2133)
|
||||
18. fix specify external revision bug (#2126)
|
||||
19. add CUE-based health check in HealthScope controller (#1956)
|
||||
20. Feat(addon): Add source and patch to kustomize definition (#2138)
|
||||
21. Feat(vela): add vela workflow terminate and restart command (#2131)
|
||||
|
||||
|
||||
# v1.1.0-rc.2
|
||||
|
||||
1. Allow users to specify component revision name in Application (#1929) the new field `externalRevision` can specify the revision name.
|
||||
|
||||
```
|
||||
kind: Application
|
||||
spec:
|
||||
components:
|
||||
- name: mycomp
|
||||
type: webservice
|
||||
externalRevision: my-revision-v1
|
||||
properties:
|
||||
...
|
||||
```
|
||||
|
||||
2. Add more workflow demo and fix some demos #2042 #2059 #2060 #2064
|
||||
3. Add cloneset ComponentDefinition into kruise addon (#2050)
|
||||
4. definitions support specify the revision name (#2044), you can specify the name by adding an annotation `definitionrevision.oam.dev/name`
|
||||
|
||||
```
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: ComponentDefinition
|
||||
metadata:
|
||||
name: worker
|
||||
annotations:
|
||||
# you can specify the revision name in annotations
|
||||
definitionrevision.oam.dev/name: "1.1.3"
|
||||
spec:
|
||||
...
|
||||
```
|
||||
|
||||
5. fix definition controller log error cause by openapi schema generation error (#2063)
|
||||
6. Add add-on input go-template implementation (#2049)
|
||||
|
||||
# v1.1.0-rc.1
|
||||
|
||||
|
||||
1. Workflow support specify Order Steps by Field Tag (#2022)
|
||||
2. support application policy (#2011)
|
||||
3. add OCM multi cluster demo (#1992)
|
||||
4. Fix(volume): seperate volume to trait (#2027)
|
||||
5. allow application skip gc resource and leave workload ownerReference controlled by rollout(#2024)
|
||||
6. Store component parameters in context (#2030)
|
||||
7. Allow specify chart values for helm trait(#2033)
|
||||
8. workflow support http provider (#2029)
|
||||
9. Use vela def commands to replace mergedef.sh for internal definition generation (#2031)
|
||||
|
||||
|
||||
# Other release histories
|
||||
|
||||
Refer to https://github.com/oam-dev/kubevela/releases
|
||||
@@ -1,205 +0,0 @@
|
||||
# v1.2.2
|
||||
|
||||
|
||||
## What's Changed
|
||||
* Feat: add JFrog webhook trigger by @chwetion in https://github.com/oam-dev/kubevela/pull/3104
|
||||
* Fix: trait/comp command output without a new line by @chivalryq in https://github.com/oam-dev/kubevela/pull/3112
|
||||
* Feat: support wild match for env patch by @Somefive in https://github.com/oam-dev/kubevela/pull/3111
|
||||
* Fix: fix revision will change when add new trait with skiprevisionaffect to application by @chwetion in https://github.com/oam-dev/kubevela/pull/3032
|
||||
* Fix: add app samples for Terraform definition by @zzxwill in https://github.com/oam-dev/kubevela/pull/3118
|
||||
* Feat: add port name in webservice by @FogDong in https://github.com/oam-dev/kubevela/pull/3110
|
||||
* Fix: add imagePullSecrets for helm templates to support private docker registry by @StevenLeiZhang in https://github.com/oam-dev/kubevela/pull/3122
|
||||
* Fix: workflow skip executing all steps occasionally by @leejanee in https://github.com/oam-dev/kubevela/pull/3025
|
||||
* Fix: support generate Terraform ComponentDefinition from local HCL file by @zzxwill in https://github.com/oam-dev/kubevela/pull/3132
|
||||
* Fix: prioritize namespace flag for `vela up` by @devholic in https://github.com/oam-dev/kubevela/pull/3135
|
||||
* Fix: handle workflow cache reconcile by @FogDong in https://github.com/oam-dev/kubevela/pull/3128
|
||||
* Feat: extend gateway trait to set class in spec by @devholic in https://github.com/oam-dev/kubevela/pull/3138
|
||||
* Fix: add providerRef in generated ComponentDefinition by @zzxwill in https://github.com/oam-dev/kubevela/pull/3142
|
||||
* Fix: retrieve Terraform variables from variables.tf by @zzxwill in https://github.com/oam-dev/kubevela/pull/3149
|
||||
* Feat: addon parameter support ui-shcema by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/3154
|
||||
* Fix: vela addnon enable cannot support '=' by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/3156
|
||||
* Fix: add context parameters into the error message by @zeed-w-beez in https://github.com/oam-dev/kubevela/pull/3145
|
||||
* Feat: support vela show for workflow step definition by @FogDong in https://github.com/oam-dev/kubevela/pull/3140
|
||||
|
||||
## New Contributors
|
||||
* @devholic made their first contribution in https://github.com/oam-dev/kubevela/pull/3135
|
||||
|
||||
**Full Changelog**: https://github.com/oam-dev/kubevela/compare/v1.2.1...v1.2.2
|
||||
|
||||
# v1.2.1
|
||||
|
||||
## What's Changed
|
||||
|
||||
* Fix: can't query data from the MongoDB by @barnettZQG in https://github.com/oam-dev/kubevela/pull/3095
|
||||
* Fix: use personal token of vela-bot instead of github token for homebrew update by @wonderflow in https://github.com/oam-dev/kubevela/pull/3096
|
||||
* Fix: acr image no version by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/3100
|
||||
* Fix: support generate cloud resource docs in Chinese by @zzxwill in https://github.com/oam-dev/kubevela/pull/3079
|
||||
* Fix: clear old data in mongodb unit test case by @barnettZQG in https://github.com/oam-dev/kubevela/pull/3103
|
||||
* Feat: support external revision in patch component by @Somefive in https://github.com/oam-dev/kubevela/pull/3106
|
||||
* Fix: file under the path of github addon registry is not ignored by @StevenLeiZhang in https://github.com/oam-dev/kubevela/pull/3099
|
||||
* Fix: Vela is crashed, when disabling addon, which needs namespace vela-system by @StevenLeiZhang in https://github.com/oam-dev/kubevela/pull/3109
|
||||
* Fix: rollout workload namespace not aligned with rollout by @Somefive in https://github.com/oam-dev/kubevela/pull/3107
|
||||
|
||||
## New Contributors
|
||||
* @StevenLeiZhang made their first contribution in https://github.com/oam-dev/kubevela/pull/3099
|
||||
|
||||
**Full Changelog**: https://github.com/oam-dev/kubevela/compare/v1.2.0...v1.2.1
|
||||
|
||||
|
||||
# v1.2.0
|
||||
|
||||
❤️ KubeVela v1.2.0 released ! ❤️
|
||||
|
||||
Docs have been updated about the release at https://kubevela.io/docs/next/ .
|
||||
|
||||
**Changelog Between v1.2.0-rc.2~v1.2.0**: https://github.com/oam-dev/kubevela/compare/v1.2.0-rc.2...v1.2.0
|
||||
|
||||
## What's New
|
||||
|
||||
### UI Console Supported
|
||||
|
||||
Check how to use the GUI by this [how-to document](https://kubevela.io/docs/next/how-to/dashboard/application/create-application).
|
||||
|
||||
**GUI frontend code repo is here: https://github.com/oam-dev/velaux**
|
||||
**API Server Code is here: https://github.com/oam-dev/kubevela/tree/master/pkg/apiserver**
|
||||
|
||||
We also add a [VelaQL](https://kubevela.io/docs/next/platform-engineers/system-operation/velaql) feature that could allow apiserver to interact with K8s Object in an extended way.
|
||||
|
||||
### Addon System
|
||||
|
||||
We add a new addon system in v1.2, this helps KubeVela install it's extension including more than X-Definition files.
|
||||
|
||||
The community has already supported some built-in addons here(https://github.com/oam-dev/catalog/tree/master/addons ), there're also some experimental addons here (https://github.com/oam-dev/catalog/tree/master/experimental/addons)。
|
||||
|
||||
You can learn how to use it [from docs](https://kubevela.io/docs/next/how-to/cli/addon/addon).
|
||||
|
||||
You can [build and contribute](https://kubevela.io/docs/next/platform-engineers/addon/intro) your own addons.
|
||||
|
||||
### CI/CD Integration
|
||||
|
||||
You can use triggers to integrate with different CI and image registry systems on VelaUX.
|
||||
|
||||
* Feat: add ACR webhook trigger for CI/CD (#3044)
|
||||
* Feat: add Harbor image registry webhook trigger for CI/CD (#3065)
|
||||
* Feat: add DockerHub webhook trigger for CI/CD (#3081)
|
||||
|
||||
### Cloud Resources Enhancement
|
||||
|
||||
* Feature: support terraform/provider-azure addon by @zzxwill in https://github.com/oam-dev/kubevela/pull/2402
|
||||
* Fix: aws/azure Terraform provider are broken by @zzxwill in https://github.com/oam-dev/kubevela/pull/2513 , https://github.com/oam-dev/kubevela/pull/2520 , https://github.com/oam-dev/kubevela/pull/2465
|
||||
* Feat: Add Terraform Azure Storage Account by @maciejgwizdala in https://github.com/oam-dev/kubevela/pull/2646
|
||||
* Docs: add vpc and vswitch cloud resource templates of alicloud by @lowkeyrd in https://github.com/oam-dev/kubevela/pull/2663
|
||||
* Fix: allow external cloud resources to be kept when Application is deleted by @zzxwill in https://github.com/oam-dev/kubevela/pull/2698
|
||||
* Feat: add alibaba cloud redis definition by @chivalryq in https://github.com/oam-dev/kubevela/pull/2507
|
||||
* Feat: envbinding support cloud resource deploy and share by @Somefive in https://github.com/oam-dev/kubevela/pull/2734
|
||||
* Fix: support naming a terraform provider by @zzxwill in https://github.com/oam-dev/kubevela/pull/2794
|
||||
|
||||
|
||||
### Multi-Cluster Enhancement
|
||||
|
||||
* Feat: multicluster support ServiceAccountToken by @Somefive in https://github.com/oam-dev/kubevela/pull/2356
|
||||
* Feat: add secure tls for cluster-gateway by @Somefive in https://github.com/oam-dev/kubevela/pull/2426
|
||||
* Feat: add support for envbinding with namespace selector by @Somefive in https://github.com/oam-dev/kubevela/pull/2432
|
||||
* Feat: upgrade cluster gateway to support remote debug by @Somefive in https://github.com/oam-dev/kubevela/pull/2673
|
||||
* Feat: set multicluster enabled by default by @Somefive in #2930
|
||||
|
||||
### Workflow Enhancement
|
||||
|
||||
* Feat: add apply raw built in workflow steps by @FogDong in https://github.com/oam-dev/kubevela/pull/2420
|
||||
* Feat: add read object step def by @FogDong in https://github.com/oam-dev/kubevela/pull/2480
|
||||
* Feat: add export config and secret def for workflow by @FogDong in https://github.com/oam-dev/kubevela/pull/2484
|
||||
* Feat: support secret in webhook notification by @FogDong in https://github.com/oam-dev/kubevela/pull/2509
|
||||
* Feat: Record workflow execution state by @leejanee in https://github.com/oam-dev/kubevela/pull/2479
|
||||
* Fix(cli): use flag instead of env in workflow cli by @FogDong in https://github.com/oam-dev/kubevela/pull/2512
|
||||
* Not update resource if render hash equal. by @leejanee in https://github.com/oam-dev/kubevela/pull/2522
|
||||
* Feat: add email support in webhook notification by @FogDong in https://github.com/oam-dev/kubevela/pull/2535
|
||||
* Feat: add render component and apply component remaining by @FogDong in https://github.com/oam-dev/kubevela/pull/2587
|
||||
* Feat: add list application records api by @FogDong in https://github.com/oam-dev/kubevela/pull/2757
|
||||
* Feat: component-pod-view support filter resource by cluster name and cluster namespace by @yangsoon in https://github.com/oam-dev/kubevela/pull/2754
|
||||
* Feat: workflow support update by @barnettZQG in https://github.com/oam-dev/kubevela/pull/2760
|
||||
* Feat: add workflow reconciling backoff time and failed limit times by @FogDong in #2881
|
||||
|
||||
### Component/Trait Enhancement
|
||||
|
||||
* Feat: add health check and custom status for helm type component by @chivalryq in https://github.com/oam-dev/kubevela/pull/2499
|
||||
* Feat: add nocalhost dev config trait definition by @yuyicai in https://github.com/oam-dev/kubevela/pull/2545
|
||||
* Feat(rollout): fill rolloutBatches if empty when scale up/down by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/2569
|
||||
* Feat: allow import package in custom status cue template by @Chwetion in https://github.com/oam-dev/kubevela/pull/2585
|
||||
* Feat: add trait service-account by @yangsoon in https://github.com/oam-dev/kubevela/pull/2878
|
||||
* Fix: add ingress class as arguments by @Somefive in https://github.com/oam-dev/kubevela/pull/2445
|
||||
* Fix: add libgit2 support for gitops by @FogDong in https://github.com/oam-dev/kubevela/pull/2477
|
||||
* Fix: make nginx class to be default value and allow pvc trait to attach more than once by @wonderflow in https://github.com/oam-dev/kubevela/pull/2466
|
||||
* Feat: add imagePullPolicy/imagePullSecret to task def by @chivalryq in https://github.com/oam-dev/kubevela/pull/2503
|
||||
|
||||
|
||||
### Vela CLI Enhancement
|
||||
|
||||
* Feat: add vela prob to test cluster by @wonderflow in https://github.com/oam-dev/kubevela/pull/2635
|
||||
* Feat: vela logs support multicluster by @chivalryq in https://github.com/oam-dev/kubevela/pull/2593
|
||||
* Feat: vela-cli support use ocm to join/list/detach cluster by @yangsoon in https://github.com/oam-dev/kubevela/pull/2599
|
||||
* Feat: add vela exec for multi cluster by @wonderflow in https://github.com/oam-dev/kubevela/pull/2299
|
||||
* Feat: multicluster vela status/exec/port-forward by @Somefive in https://github.com/oam-dev/kubevela/pull/2662
|
||||
* Fix: support `-n` flag for all commands to specify namespace by @chivalryq in https://github.com/oam-dev/kubevela/pull/2719
|
||||
* Feat: vela delete add wait and force options by @yangsoon in https://github.com/oam-dev/kubevela/pull/2747
|
||||
* Feat: add workflow rollback cli by @FogDong in https://github.com/oam-dev/kubevela/pull/2795
|
||||
* Refactor: refine cli commands && align kubectl-vela with vela && use getnamespaceAndEnv for all by @wonderflow in #3048
|
||||
|
||||
|
||||
### Overall Enhancements
|
||||
|
||||
* Feat: ResourceTracker new architecture by @Somefive in https://github.com/oam-dev/kubevela/pull/2849
|
||||
* New Resource Management Model: Garbage Collection and Resource State Keeper [Desigin Doc](https://github.com/oam-dev/kubevela/blob/master/design/vela-core/resourcetracker_design.md)
|
||||
* Feat: output log with structured tag & add step duration metrics by @leejanee in https://github.com/oam-dev/kubevela/pull/2683
|
||||
* Feat: support user defined image registry that allows private installation by @wonderflow in https://github.com/oam-dev/kubevela/pull/2623
|
||||
* Feat: add a built in garbage-collect policy to application by @yangsoon in https://github.com/oam-dev/kubevela/pull/2575
|
||||
* Feat: health scope controller support check trait-managing workload by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/2527
|
||||
* Chore: add homebrew bump to support `brew install kubevela` by @basefas in https://github.com/oam-dev/kubevela/pull/2434
|
||||
* Chore: Update release action to support build binaries for more platform by @basefas in https://github.com/oam-dev/kubevela/pull/2537
|
||||
* Feat: add reconcile timeout configuration for vela-core by @Somefive in https://github.com/oam-dev/kubevela/pull/2630
|
||||
* Chore: push docker images to Alibaba Cloud ACR by @zzxwill in https://github.com/oam-dev/kubevela/pull/2601
|
||||
|
||||
|
||||
## What's Changed/Deprecated
|
||||
|
||||
* Deprecated: containerized workload by @reetasingh in https://github.com/oam-dev/kubevela/pull/2330
|
||||
* Deprecated: initializer CRD controller by @chivalryq in https://github.com/oam-dev/kubevela/pull/2491
|
||||
* Deprecated: remove envbinding controller, use #ApplyComponent for EnvBinding by @Somefive in https://github.com/oam-dev/kubevela/pull/2556 , https://github.com/oam-dev/kubevela/pull/2382
|
||||
* Deprecated(cli): CLI vela config by @chivalryq in https://github.com/oam-dev/kubevela/pull/2037
|
||||
* Deprecated: remove addon with no definitions by @chivalryq in https://github.com/oam-dev/kubevela/pull/2574
|
||||
* Refactor: remove apiserver component from the chart, users should use velaux addon instead by @barnettZQG in https://github.com/oam-dev/kubevela/pull/2838
|
||||
* Refactor: all addons are migrated from initializer to application objects by @chivalryq in https://github.com/oam-dev/kubevela/pull/2444
|
||||
* Refactor: change rollout's json tag so the status of rollout will be optional by @GingoBang in https://github.com/oam-dev/kubevela/pull/2314
|
||||
* Deprecated: deprecate CRD discovery for CUE import in Definition to prevent memory leak and OOM crash (#2925)
|
||||
* Deprecated: delete approllout related code #3040
|
||||
* Deprecate: delete appDeployment related logic #3050
|
||||
|
||||
## Bugfix
|
||||
|
||||
* Feat: rework resource tracker to solve bugs by @Somefive in https://github.com/oam-dev/kubevela/pull/2797
|
||||
* Fix: change raw extension to pointer by @FogDong in https://github.com/oam-dev/kubevela/pull/2451
|
||||
* Fix: show reconcile error log by @wonderflow in https://github.com/oam-dev/kubevela/pull/2626
|
||||
* Fix: Closure Bug In newValue by @leejanee in https://github.com/oam-dev/kubevela/pull/2437
|
||||
* Fix: resourceTracker compatibility bug by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/2467
|
||||
* Fix(application): nil pointer for component properties by @kinsolee in https://github.com/oam-dev/kubevela/pull/2481
|
||||
* Fix: Commit step-generate data without success by @leejanee in https://github.com/oam-dev/kubevela/pull/2539
|
||||
* Fix(cli): client-side throttling in vela CLI by @chivalryq in https://github.com/oam-dev/kubevela/pull/2581
|
||||
* Fix: fix delete a component from application not delete workload by @wangyikewxgm in https://github.com/oam-dev/kubevela/pull/2680
|
||||
* Fix: lookupByScript don't support `import` by @leejanee in https://github.com/oam-dev/kubevela/pull/2788
|
||||
* Fix: resourcetracker do not garbage collect legacyRTs correctly by @Somefive in https://github.com/oam-dev/kubevela/pull/2817
|
||||
* Fix: application conditions confusion. by @leejanee in https://github.com/oam-dev/kubevela/pull/2834
|
||||
|
||||
## New Contributors
|
||||
* @GingoBang made their first contribution in https://github.com/oam-dev/kubevela/pull/2314
|
||||
* @basefas made their first contribution in https://github.com/oam-dev/kubevela/pull/2434
|
||||
* @yuyicai made their first contribution in https://github.com/oam-dev/kubevela/pull/2540
|
||||
* @maciejgwizdala made their first contribution in https://github.com/oam-dev/kubevela/pull/2646
|
||||
* @lowkeyrd made their first contribution in https://github.com/oam-dev/kubevela/pull/2663
|
||||
* @zxbyoyoyo made their first contribution in https://github.com/oam-dev/kubevela/pull/2703
|
||||
* @yue9944882 made their first contribution in https://github.com/oam-dev/kubevela/pull/2751
|
||||
* @snyk-bot made their first contribution in https://github.com/oam-dev/kubevela/pull/2857
|
||||
* @yunjianzhong made their first contribution in https://github.com/oam-dev/kubevela/pull/3005
|
||||
* @songminglong made their first contribution in https://github.com/oam-dev/kubevela/pull/3064
|
||||
* @basuotian made their first contribution in https://github.com/oam-dev/kubevela/pull/3059
|
||||
* @K1ngram4 made their first contribution in https://github.com/oam-dev/kubevela/pull/3065
|
||||
|
||||
**Full Changelog**: https://github.com/oam-dev/kubevela/compare/v1.1.3...v1.2.0
|
||||
@@ -1,13 +0,0 @@
|
||||
# CHANGELOGs
|
||||
|
||||
## Development release
|
||||
|
||||
- [CHANGELOG-1.2.md](./CHANGELOG-1.2.md)
|
||||
|
||||
## Current release
|
||||
|
||||
- [CHANGELOG-1.1.md](./CHANGELOG-1.1.md)
|
||||
|
||||
## Older releases
|
||||
|
||||
- [CHANGELOG-1.0.md](./CHANGELOG-1.0.md)
|
||||
132
CONTRIBUTING.md
132
CONTRIBUTING.md
@@ -1,3 +1,133 @@
|
||||
# CONTRIBUTING Guide
|
||||
|
||||
Please refer to https://kubevela.io/docs/contributor/overview for details.
|
||||
## About KubeVela
|
||||
|
||||
KubeVela project is initialized and maintained by the cloud native community since day 0 with [bootstrapping contributors from 8+ different organizations](https://github.com/oam-dev/kubevela/graphs/contributors).
|
||||
We intend for KubeVela to have an open governance since the very beginning and donate the project to neutral foundation as soon as it's released.
|
||||
|
||||
This doc explains how to set up a development environment, so you can get started
|
||||
contributing to `kubevela` or build a PoC (Proof of Concept).
|
||||
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
1. Golang version 1.13+
|
||||
2. Kubernetes version v1.16+ with `~/.kube/config` configured.
|
||||
3. ginkgo 1.14.0+ (just for [E2E test](https://github.com/oam-dev/kubevela/blob/master/DEVELOPMENT.md#e2e-test))
|
||||
4. golangci-lint 1.31.0+, it will install automatically if you run `make`, you can [install it manually](https://golangci-lint.run/usage/install/#local-installation) if the installation is too slow.
|
||||
|
||||
We also recommend you to learn about KubeVela's [design](docs/en/design.md) before dive into its code.
|
||||
|
||||
### Build
|
||||
|
||||
* Clone this project
|
||||
|
||||
```shell script
|
||||
git clone git@github.com:oam-dev/kubevela.git
|
||||
```
|
||||
|
||||
KubeVela includes two parts, `vela core` and `vela cli`.
|
||||
|
||||
- The `vela core` is actually a K8s controller, it will watch OAM Spec CRD and deploy resources.
|
||||
- The `vela cli` is a command line tool that can build, run apps(with the help of `vela core`).
|
||||
|
||||
For local development, we probably need to build both of them.
|
||||
|
||||
* Build Vela CLI
|
||||
|
||||
```shell script
|
||||
make
|
||||
```
|
||||
|
||||
After the vela cli built successfully, `make` command will create `vela` binary to `bin/` under the project.
|
||||
|
||||
* Configure `vela` binary to System PATH
|
||||
|
||||
```shell script
|
||||
export PATH=$PATH:/your/path/to/project/kubevela/bin
|
||||
```
|
||||
|
||||
Then you can use `vela` command directly.
|
||||
|
||||
* Build Vela Core
|
||||
|
||||
```shell script
|
||||
make manager
|
||||
```
|
||||
|
||||
* Run Vela Core
|
||||
|
||||
Firstly make sure your cluster has CRDs, below is the command that can help install all CRDs.
|
||||
|
||||
```shell script
|
||||
make core-install
|
||||
```
|
||||
|
||||
Run locally:
|
||||
|
||||
```shell script
|
||||
make core-run
|
||||
```
|
||||
|
||||
This command will run controller locally, it will use your local KubeConfig which means you need to have a k8s cluster
|
||||
locally. If you don't have a one, we suggest that you could setup up a cluster with [kind](https://kind.sigs.k8s.io/).
|
||||
|
||||
When you're developing `vela-core`, make sure the controller installed by helm chart is not running.
|
||||
Otherwise, it will conflict with your local running controller.
|
||||
|
||||
You can check and uninstall it by using helm.
|
||||
|
||||
```shell script
|
||||
helm list -A
|
||||
helm uninstall -n vela-system kubevela
|
||||
```
|
||||
|
||||
### Use
|
||||
|
||||
You can try use your local built binaries follow [the documentation](https://kubevela.io/#/en/quick-start).
|
||||
|
||||
## Testing
|
||||
|
||||
### Unit test
|
||||
|
||||
```shell script
|
||||
make test
|
||||
```
|
||||
|
||||
### E2E test
|
||||
|
||||
**Before e2e test start, make sure you have vela-core running.**
|
||||
|
||||
```shell script
|
||||
make core-run
|
||||
```
|
||||
|
||||
Start to test.
|
||||
|
||||
```
|
||||
make e2e-test
|
||||
```
|
||||
|
||||
## Make a pull request
|
||||
|
||||
Remember to write unit-test and e2e-test after you have finished your code.
|
||||
|
||||
Run following checks before making a pull request.
|
||||
|
||||
```shell script
|
||||
make reviewable
|
||||
```
|
||||
|
||||
The command will do some lint checks and clean code.
|
||||
|
||||
After that, check in all changes and send a pull request.
|
||||
|
||||
## Merge Regulations
|
||||
|
||||
Before merging, the pull request should obey the following rules:
|
||||
|
||||
- The commit title and message should be clear about what this PR does.
|
||||
- All test CI should pass green.
|
||||
- The `codecov/project` should pass. This means the coverage should not drop. See [Codecov commit status](https://docs.codecov.io/docs/commit-status#project-status).
|
||||
|
||||
33
Dockerfile
33
Dockerfile
@@ -1,51 +1,38 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the manager binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.14 as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
COPY go.mod go.mod
|
||||
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}
|
||||
|
||||
# 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
|
||||
RUN go mod download
|
||||
|
||||
# Copy the go source
|
||||
COPY cmd/core/main.go main.go
|
||||
COPY cmd/apiserver/main.go cmd/apiserver/main.go
|
||||
COPY apis/ apis/
|
||||
COPY pkg/ pkg/
|
||||
COPY version/ version/
|
||||
COPY references/ references/
|
||||
|
||||
# Build
|
||||
ARG TARGETARCH
|
||||
ARG VERSION
|
||||
ARG GITVERSION
|
||||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
|
||||
go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} GO111MODULE=on \
|
||||
go build -a -ldflags "-X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
|
||||
-o manager-${TARGETARCH} main.go
|
||||
|
||||
# Use alpine as base image due to the discussion in issue #1448
|
||||
# You can replace distroless as minimal base image to package the manager binary
|
||||
# Use 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:3.15}
|
||||
# This is required by daemon connecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash expat
|
||||
# Could use `--build-arg=BASE_DISTROLESS=gcr.io/distroless/static:nonroot` to overwrite
|
||||
ARG BASE_DISTROLESS
|
||||
FROM ${BASE_DISTROLESS:-gcr.io/distroless/static:nonroot}
|
||||
|
||||
WORKDIR /
|
||||
|
||||
ARG TARGETARCH
|
||||
COPY --from=builder /workspace/manager-${TARGETARCH} /usr/local/bin/manager
|
||||
COPY --from=builder /workspace/manager-${TARGETARCH} /manager
|
||||
USER nonroot:nonroot
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
CMD ["manager"]
|
||||
ENTRYPOINT ["/manager"]
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the manager binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
COPY go.mod go.mod
|
||||
COPY go.sum go.sum
|
||||
# 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
|
||||
RUN go mod download
|
||||
|
||||
# Copy the go source
|
||||
COPY cmd/core/main.go main.go
|
||||
COPY cmd/apiserver/main.go cmd/apiserver/main.go
|
||||
COPY apis/ apis/
|
||||
COPY pkg/ pkg/
|
||||
COPY version/ version/
|
||||
COPY references/ references/
|
||||
|
||||
# Build
|
||||
ARG TARGETARCH
|
||||
ARG VERSION
|
||||
ARG GITVERSION
|
||||
|
||||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
|
||||
go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
|
||||
-o apiserver-${TARGETARCH} cmd/apiserver/main.go
|
||||
|
||||
# Use alpine as base image due to the discussion in issue #1448
|
||||
# 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:3.15}
|
||||
# This is required by daemon connecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash expat
|
||||
|
||||
WORKDIR /
|
||||
|
||||
ARG TARGETARCH
|
||||
COPY --from=builder /workspace/apiserver-${TARGETARCH} /usr/local/bin/apiserver
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
CMD ["apiserver"]
|
||||
@@ -1,43 +0,0 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the cli binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
COPY go.mod go.mod
|
||||
COPY go.sum go.sum
|
||||
# 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
|
||||
RUN go mod download
|
||||
|
||||
# Copy the go source
|
||||
COPY apis/ apis/
|
||||
COPY pkg/ pkg/
|
||||
COPY version/ version/
|
||||
COPY references/ references/
|
||||
|
||||
# Build
|
||||
ARG TARGETARCH
|
||||
ARG VERSION
|
||||
ARG GITVERSION
|
||||
|
||||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH:-amd64} \
|
||||
go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
|
||||
-o vela-${TARGETARCH} ./references/cmd/cli/main.go
|
||||
|
||||
|
||||
# Use alpine as base image due to the discussion in issue #1448
|
||||
# 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:3.15}
|
||||
# This is required by daemon connecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash expat
|
||||
|
||||
WORKDIR /
|
||||
|
||||
ARG TARGETARCH
|
||||
COPY --from=builder /workspace/vela-${TARGETARCH} /bin/vela
|
||||
ENTRYPOINT ["/bin/vela"]
|
||||
@@ -1,57 +0,0 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the manager binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.17-alpine as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
COPY go.mod go.mod
|
||||
COPY go.sum go.sum
|
||||
# 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
|
||||
RUN go mod download
|
||||
|
||||
# Copy the go source
|
||||
COPY cmd/core/main.go main.go
|
||||
COPY cmd/core/main_e2e_test.go main_e2e_test.go
|
||||
COPY cmd/apiserver/main.go cmd/apiserver/main.go
|
||||
COPY cmd/ cmd/
|
||||
COPY apis/ apis/
|
||||
COPY pkg/ pkg/
|
||||
COPY version/ version/
|
||||
COPY references/ references/
|
||||
|
||||
# Build
|
||||
ARG TARGETARCH
|
||||
ARG VERSION
|
||||
ARG GITVERSION
|
||||
|
||||
RUN apk add gcc musl-dev libc-dev ;\
|
||||
GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
|
||||
go test -c -o manager-${TARGETARCH} -cover -covermode=atomic -coverpkg ./... .
|
||||
|
||||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
|
||||
go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
|
||||
-o apiserver-${TARGETARCH} cmd/apiserver/main.go
|
||||
|
||||
# Use alpine as base image due to the discussion in issue #1448
|
||||
# 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:3.15}
|
||||
# This is required by daemon connecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash expat
|
||||
|
||||
WORKDIR /
|
||||
|
||||
ARG TARGETARCH
|
||||
COPY --from=builder /workspace/manager-${TARGETARCH} /usr/local/bin/manager
|
||||
COPY --from=builder /workspace/apiserver-${TARGETARCH} /usr/local/bin/apiserver
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/
|
||||
|
||||
VOLUME ["/workspace/data"]
|
||||
|
||||
ENTRYPOINT ["entrypoint.sh"]
|
||||
|
||||
CMD ["manager"]
|
||||
@@ -1,16 +0,0 @@
|
||||
# Governance
|
||||
|
||||
[Project maintainers](https://github.com/kubevela/community/blob/main/OWNERS.md#maintainers) are responsible for activities around maintaining and updating KubeVela.
|
||||
Final decisions on the project reside with the project maintainers.
|
||||
|
||||
Maintainers **MUST** remain active. If they are unresponsive for >6 months,
|
||||
they will be automatically removed unless a [super-majority](https://en.wikipedia.org/wiki/Supermajority#Two-thirds_vote) of the other project maintainers agrees to extend the period to be greater than 6 months.
|
||||
|
||||
New maintainers can be added to the project by a [super-majority](https://en.wikipedia.org/wiki/Supermajority#Two-thirds_vote) vote of the existing maintainers.
|
||||
A potential maintainer may be nominated by an existing maintainer.
|
||||
A vote is conducted in private between the current maintainers over the course of a one week voting period.
|
||||
At the end of the week, votes are counted and a pull request is made on the repo adding the new maintainer to the [CODEOWNERS](https://github.com/kubevela/kubevela/blob/master/.github/CODEOWNERS) file.
|
||||
|
||||
A maintainer may step down by submitting an [issue](https://github.com/kubevela/kubevela/issues/new/choose) stating their intent.
|
||||
|
||||
Changes to this governance document require a pull request with approval from a [super-majority](https://en.wikipedia.org/wiki/Supermajority#Two-thirds_vote) of the current maintainers.
|
||||
323
ISSUE_TRIAGE.md
323
ISSUE_TRIAGE.md
@@ -1,323 +0,0 @@
|
||||
# Triage issues
|
||||
|
||||
The main goal of issue triage is to categorize all incoming KubeVela issues and make sure each issue has all basic
|
||||
information needed for anyone else to understand and be able to start working on it.
|
||||
|
||||
> **Note:** This information is for OAM/KubeVela project Maintainers, Owners, and Admins.
|
||||
> If you are a Contributor, then you will not be able to perform most of the tasks in this topic.
|
||||
|
||||
The core maintainers of the OAM/KubeVela project are responsible for categorizing all incoming issues and delegating
|
||||
any critical or important issue to other maintainers. Currently one maintainer each week is responsible.
|
||||
Besides that part, triage provides an important way to contribute to an open source project.
|
||||
|
||||
Triage helps ensure issues resolve quickly by:
|
||||
|
||||
- Ensuring the issue's intent and purpose is conveyed precisely. This is necessary because it can be difficult for
|
||||
an issue to explain how an end user experiences a problem and what actions they took.
|
||||
- Giving a contributor the information they need before they commit to resolving an issue.
|
||||
- Lowering the issue count by preventing duplicate issues.
|
||||
- Streamlining the development process by preventing duplicate discussions.
|
||||
|
||||
If you don't have the knowledge or time to code, consider helping with triage.
|
||||
The community will thank you for saving them time by spending some of yours.
|
||||
|
||||
## Simplified flowchart diagram of the issue triage process
|
||||
|
||||
<!-- https://textik.com/#908a27a44c590528 -->
|
||||
```
|
||||
+-----------------------------+
|
||||
| |
|
||||
| New Issues Opened |
|
||||
+-----------------+ |
|
||||
| | Or More information needed |
|
||||
| | |
|
||||
| +--------------+--------------+
|
||||
| Ask for more info |
|
||||
| |
|
||||
| +--------------+------------+
|
||||
| | | Yes
|
||||
| | All informatio needed |
|
||||
| +-----------+ to categorize the issue? +---------------+
|
||||
| | No | | |
|
||||
| | +---------------------------+ |
|
||||
| | +-----------+-----------+ +---------------------------+
|
||||
+------------+-----+-----+ | | Yes | |
|
||||
| | | Needs investigation ? +---------+ label: needs investigation|
|
||||
| label: needs more info | | | | |
|
||||
| | +----------+------------+ +-------------+-------------+
|
||||
+------------------------+ | |
|
||||
| No |
|
||||
| |
|
||||
+----------+----------+ investigate |
|
||||
| label: type/* | |
|
||||
| label: area/* +--------------------------+
|
||||
| |
|
||||
+--|-------------|----+
|
||||
| | Yes
|
||||
| +-------|-------------+ +-------------------+
|
||||
| | needs priority? +----+ label: priority/* |
|
||||
| +-------|-------------+ +----------|--------+
|
||||
| | No |
|
||||
| | |
|
||||
+----- ------|---+ +--|----- --+ |
|
||||
| close issue + ---- + done +---------------------+
|
||||
+----------------+ +-----------+
|
||||
```
|
||||
|
||||
## 1. Find uncategorized issues
|
||||
|
||||
To get started with issue triage and finding issues that haven't been triaged you have two alternatives.
|
||||
|
||||
### Browse unlabeled issues
|
||||
|
||||
The easiest and straight forward way of getting started and finding issues that haven't been triaged is to browse
|
||||
[unlabeled issues](https://github.com/kubevela/kubevela/issues?q=is%3Aopen+is%3Aissue+no%3Alabel) and starting from
|
||||
the bottom and working yourself to the top.
|
||||
|
||||
### Subscribe to all notifications
|
||||
|
||||
The more advanced, but recommended way is to subscribe to all notifications from this repository which means that
|
||||
all new issues, pull requests, comments and important status changes are sent to your configured email address.
|
||||
Read this [guide](https://help.github.com/en/articles/watching-and-unwatching-repositories#watching-a-single-repository)
|
||||
for help with setting this up.
|
||||
|
||||
It's highly recommended that you setup filters to automatically remove emails from the inbox and label/categorize
|
||||
them accordingly to make it easy for you to understand when you need to act upon a notification or where to look for
|
||||
finding issues that haven't been triaged etc.
|
||||
|
||||
|
||||
## 2. Ensure the issue contains basic information
|
||||
|
||||
Before triaging an issue very far, make sure that the issue's author provided the standard issue information.
|
||||
This will help you make an educated recommendation on how to categorize the issue.
|
||||
The KubeVela project utilizes [GitHub issue templates](https://help.github.com/en/articles/creating-issue-templates-for-your-repository)
|
||||
to guide contributors to provide standard information that must be included for each type of template or type of issue.
|
||||
|
||||
### Standard issue information that must be included
|
||||
|
||||
Given a certain [issue template]([template](https://github.com/kubevela/kubevela/issues/new/choose)) have been used
|
||||
by the issue author or depending how the issue is perceived by the issue triage responsible, the following should
|
||||
help you understand what standard issue information that must be included.
|
||||
|
||||
#### Bug reports
|
||||
|
||||
Should explain what happened, what was expected and how to reproduce it together with any additional information that
|
||||
may help giving a complete picture of what happened such as screenshots, application related YAMLs, and any environment
|
||||
related information that's applicable and/or maybe related to the reported problem:
|
||||
- KubeVela version
|
||||
- K8s cluster version KubeVela is installed on
|
||||
- Which other K8s CRD controllers used
|
||||
- Development environment like Go versions, if applicable
|
||||
|
||||
#### Enhancement requests
|
||||
|
||||
Should explain what enhancement or feature that the author wants to be added and why that is needed.
|
||||
|
||||
### Good practices
|
||||
|
||||
To make it easier for everyone to understand and find issues they're searching for it's suggested as a general rule of thumbs to:
|
||||
|
||||
- Make sure that issue titles are named to explain the subject of the issue, has a correct spelling and doesn't include irrelevant information and/or sensitive information.
|
||||
- Make sure that issue descriptions doesn't include irrelevant information, information from template that haven't been filled out and/or sensitive information.
|
||||
- Do your best effort to change title and description or request suggested changes by adding a comment.
|
||||
|
||||
> **Note:** Above rules is applicable to both new and existing issues of the KubeVela project.
|
||||
|
||||
### Do you have all the information needed to categorize an issue?
|
||||
|
||||
Depending on the issue, you might not feel all this information is needed. Use your best judgement.
|
||||
If you cannot triage an issue using what its author provided, explain kindly to the author that they must provide the
|
||||
above information to clarify the problem. Label issue with `needs more info` and add any related `area/*` or `type/*` labels.
|
||||
|
||||
If the author provides the standard information but you are still unable to triage the issue, request additional information.
|
||||
Do this kindly and politely because you are asking for more of the author's time.
|
||||
|
||||
If the author does not respond to the requested information within the timespan of a week,
|
||||
close the issue with a kind note stating that the author can request for the issue to be reopened when the necessary information is provided.
|
||||
|
||||
When you feel you have all the information needed you're ready to [categorizing the issue](#3-categorizing-an-issue).
|
||||
|
||||
If you receive a notification with additional information provided but you are not anymore on issue triage and
|
||||
you feel you do not have time to handle it, you should delegate it to the current person on issue triage.
|
||||
|
||||
## 3. Categorizing an issue
|
||||
|
||||
An issue can have multiple of the following labels. Typically, a properly categorized issue should at least have:
|
||||
|
||||
- One label identifying its type (`type/*`).
|
||||
- One or multiple labels identifying the functional areas of interest or component (`area/*`), if applicable.
|
||||
|
||||
| Label | Description |
|
||||
| ------------------------ | ------------------------------------------------------------------------- |
|
||||
| `type/bug` | A feature isn't working as expected given design or documentation. |
|
||||
| `type/enhancement` | Request for a new feature or enhancement. |
|
||||
| `type/docs` | Documentation problem or enhancement. |
|
||||
| `type/question` | Issue is a question or is perceived as such. |
|
||||
| `type/duplicate` | An existing issue of the same subject/request have already been reported. |
|
||||
| `type/wontfix` | A reported bug works as intended/by design. |
|
||||
| `type/invalid` | A reported bug with invalid usage. |
|
||||
| `area/*` | Subject is related to a functional area of interest or component. |
|
||||
|
||||
### Duplicate issues
|
||||
|
||||
Make sure it's not a duplicate by searching existing issues using related terms from the issue title and description.
|
||||
If you think you know there is an existing issue, but can't find it, please reach out to one of the maintainers and ask for help.
|
||||
If you identify that the issue is a duplicate of an existing issue:
|
||||
|
||||
1. Add a comment `/duplicate of #<issue number>`. GitHub will recognize this and add some additional context to the issue activity.
|
||||
2. The KubeVela bot will do the rest, adding the correct label and closing comment
|
||||
3. Optionally add any related `area/*` labels.
|
||||
|
||||
### Bug reports
|
||||
|
||||
If it's not perfectly clear that it's an actual bug, quickly try to reproduce it.
|
||||
|
||||
**It's a bug/it can be reproduced:**
|
||||
|
||||
1. Add a comment describing detailed steps for how to reproduce it, if applicable.
|
||||
2. Label the issue `type/bug` and at least one `area/*` label.
|
||||
3. If you know that maintainers won't be able to put any resources into it for some time then label the issue
|
||||
with `help wanted` and optionally `good first issue` together with pointers on which code to update to fix the bug.
|
||||
This should signal to the community that we would appreciate any help we can get to resolve this.
|
||||
4. Move on to [prioritizing the issue](#4-prioritization-of-issues).
|
||||
|
||||
**It can't be reproduced:**
|
||||
1. Either [ask for more information](#2-ensure-the-issue-contains-basic-information) needed to investigate it more thoroughly.
|
||||
2. Either [delegate further investigations](#investigation-of-issues) to someone else.
|
||||
|
||||
**It works as intended/by design:**
|
||||
1. Kindly and politely add a comment explaining briefly why we think it works as intended and close the issue.
|
||||
2. Label the issue `type/wontfix`.
|
||||
|
||||
### Enhancement/feature?
|
||||
|
||||
1. Label the issue `type/enhancement` and at least one `area/*` label.
|
||||
2. Move on to [prioritizing the issue](#4-prioritization-of-issues).
|
||||
|
||||
### Documentation issue?
|
||||
|
||||
First, evaluate if the documentation makes sense to be included in the KubeVela project:
|
||||
|
||||
- Is this something we want/can maintain as a project?
|
||||
- Is this referring to usage of some specific integration/tool and in that case is that a popular use case in combination with KubeVela?
|
||||
- If unsure, kindly and politely add a comment explaining that we would need [upvotes](https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments)
|
||||
to identify that lots of other users want/need this.
|
||||
|
||||
Second, label the issue `type/docs` and at least one `area/*` label.
|
||||
|
||||
**Minor typo/error/lack of information:**
|
||||
|
||||
There's a minor typo/error/lack of information that adds a lot of confusion for users and given the amount of work is a big win to make sure fixing it:
|
||||
1. Either update the documentation yourself and open a pull request.
|
||||
2. Either delegate the work to someone else by assigning that person to the issue and add the issue to next major/minor milestone.
|
||||
|
||||
**Major error/lack of information:**
|
||||
|
||||
1. Label the issue with `help wanted` and `good first issue`, if applicable, to signal that we find this important to
|
||||
fix and we would appreciate any help we can get from the community.
|
||||
2. Move on to [prioritizing the issue](#4-prioritization-of-issues).
|
||||
|
||||
### Support requests and questions
|
||||
|
||||
1. Kindly and politely direct the issue author to the [github discussion](https://github.com/kubevela/kubevela/discussions)
|
||||
and explain that issue is mainly used for tracking bugs and feature requests.
|
||||
If possible, it's usually a good idea to add some pointers to the issue author's question.
|
||||
2. Close the issue and label it with `type/question`.
|
||||
|
||||
## 4. Prioritization of issues
|
||||
|
||||
In general bugs and enhancement issues should be labeled with a priority.
|
||||
|
||||
This is the most difficult thing with triaging issues since it requires a lot of knowledge, context and experience
|
||||
before being able to think of and start feel comfortable adding a certain priority label.
|
||||
|
||||
The key here is asking for help and discuss issues to understand how more experienced project members think and reason.
|
||||
By doing that you learn more and eventually be more and more comfortable with prioritizing issues.
|
||||
|
||||
In case there is an uncertainty around the prioritization of an issue, please ask the maintainers for help.
|
||||
|
||||
| Label | Description |
|
||||
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `priority/critical` | Highest priority. Must be actively worked on as someone's top priority right now. |
|
||||
| `priority/important-soon` | Must be staffed and worked on either currently, or very soon, ideally in time for the next release. |
|
||||
| `priority/important-longterm` | Important over the long term, but may not be staffed and/or may need multiple releases to complete. |
|
||||
| `priority/nice-to-have` | It's a good idea, but not scheduled for any release. |
|
||||
| `priority/awaiting-more-evidence` | Lowest priority. Possibly useful, but not yet enough interest in it. |
|
||||
| `priority/unscheduled` | Something to look into before and to be discussed during the planning of the next (upcoming) major/minor stable release. |
|
||||
|
||||
**Critical bugs**
|
||||
|
||||
1. If a bug has been categorized and any of the following criteria apply, the bug should be labeled as critical and
|
||||
must be actively worked on as someone's top priority right now.
|
||||
|
||||
- Results in any crash or data loss.
|
||||
- Critical security or performance issues
|
||||
- Problem that makes a feature unusable
|
||||
- Multiple users experience a severe problem affecting their business, users etc.
|
||||
|
||||
2. Label the issue `priority/critical`.
|
||||
3. Add the issue to the next upcoming patch release milestone. Create a new milestone if there are none.
|
||||
4. Escalate the problem to the maintainers.
|
||||
5. Assign or ask a maintainer for help assigning someone to make this issue their top priority right now.
|
||||
|
||||
**Important short-term**
|
||||
|
||||
1. Label the issue `priority/important-soon`.
|
||||
2. Add the issue to the next upcoming patch or major/minor stable release milestone. Ask maintainers for help if unsure if it's a patch or not.
|
||||
Create a new milestone if there are none.
|
||||
3. Make sure to add the issue to a suitable backlog of a GitHub project and prioritize it or assign someone to work on it now or very soon.
|
||||
4. Consider requesting [help from the community](#5-requesting-help-from-the-community), even though it may be problematic given a short amount of time until it should be released.
|
||||
|
||||
**Important long-term**
|
||||
|
||||
1. Label the issue `priority/important-longterm`.
|
||||
2. Consider requesting [help from the community](#5-requesting-help-from-the-community).
|
||||
|
||||
**Nice to have**
|
||||
|
||||
1. Label the issue `priority/nice-to-have`.
|
||||
2. Consider requesting [help from the community](#5-requesting-help-from-the-community).
|
||||
|
||||
**Not critical, but unsure?**
|
||||
|
||||
1. Label the issue `priority/unscheduled`.
|
||||
2. Consider requesting [help from the community](#5-requesting-help-from-the-community).
|
||||
|
||||
## 5. Requesting help from the community
|
||||
|
||||
Depending on the issue and/or priority, it's always a good idea to consider signalling to the community that help from community
|
||||
is appreciated and needed in case an issue is not prioritized to be worked on by maintainers. Use your best judgement.
|
||||
In general, requesting help from the community means that a contribution has a good chance of getting accepted and merged.
|
||||
|
||||
1. Kindly and politely add a comment to signal to users subscribed to updates of the issue.
|
||||
- Explain that the issue would be nice to get resolved, but it isn't prioritized to work on by maintainers for an unforeseen future.
|
||||
- If possible or applicable, try to help contributors getting starting by adding pointers and references to
|
||||
what code/files need to be changed and/or ideas of a good way to solve/implement the issue.
|
||||
2. Label the issue with `help wanted`.
|
||||
3. If applicable, label the issue with `good first issue` to denote that the issue is suitable for a beginner to work on.
|
||||
4. If possible, try to estimate the amount of work by adding `effort/small`, `effort/medium` or `effort/large`.
|
||||
|
||||
## Investigation of issues
|
||||
|
||||
When an issue has all basic information provided, but the triage responsible haven't been able to reproduce the reported
|
||||
problem at a first glance, the issue is labeled [Needs investigation](https://github.com/oam-dev/kubevela/labels/needs%20investigation).
|
||||
Depending on the perceived severity and/or number of [upvotes](https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments),
|
||||
the investigation will either be delegated to another maintainer for further investigation or put on hold until someone else (maintainer or contributor)
|
||||
picks it up and eventually starts investigating it.
|
||||
|
||||
Investigating issues can be a very time consuming task, especially for the maintainers, provide as much related info will
|
||||
make it easier for maintainers to investigate.
|
||||
|
||||
Even if you don't have the time or knowledge to investigate an issue we highly recommend that you [upvote](https://help.github.com/en/articles/about-conversations-on-github#reacting-to-ideas-in-comments)
|
||||
the issue if you happen to have the same problem. If you have further details that may help investigating the issue
|
||||
please provide as much information as possible.
|
||||
|
||||
## Automation
|
||||
|
||||
We have some automation that triggers on comments or labels being added to issues.
|
||||
Many of these automated behaviors are defined in [issue-commands.json](https://github.com/oam-dev/kubevela/blob/master/.github/issue-commands.json).
|
||||
|
||||
* Add comment `/duplicate #<number>` to have `type/duplicate` label, the issue number is required for remind where is the other issue.
|
||||
* Add label `bot/no new info` for bot to close an issue where we asked for more info but has not received any updates in at least 14 days.
|
||||
|
||||
Read more bot actions on [bot.md](https://github.com/oam-dev/kubevela/blob/master/.github/bot.md)
|
||||
291
Makefile
291
Makefile
@@ -1,43 +1,103 @@
|
||||
include makefiles/const.mk
|
||||
include makefiles/dependency.mk
|
||||
include makefiles/release.mk
|
||||
include makefiles/develop.mk
|
||||
include makefiles/build.mk
|
||||
include makefiles/e2e.mk
|
||||
# Vela version
|
||||
VELA_VERSION ?= master
|
||||
# Repo info
|
||||
GIT_COMMIT ?= git-$(shell git rev-parse --short HEAD)
|
||||
GIT_COMMIT_LONG ?= $(shell git rev-parse HEAD)
|
||||
VELA_VERSION_VAR := github.com/oam-dev/kubevela/version.VelaVersion
|
||||
VELA_GITVERSION_VAR := github.com/oam-dev/kubevela/version.GitRevision
|
||||
LDFLAGS ?= "-X $(VELA_VERSION_VAR)=$(VELA_VERSION) -X $(VELA_GITVERSION_VAR)=$(GIT_COMMIT)"
|
||||
|
||||
GOX = go run github.com/mitchellh/gox
|
||||
TARGETS := darwin/amd64 linux/amd64 windows/amd64
|
||||
DIST_DIRS := find * -type d -exec
|
||||
|
||||
TIME_LONG = `date +%Y-%m-%d' '%H:%M:%S`
|
||||
TIME_SHORT = `date +%H:%M:%S`
|
||||
TIME = $(TIME_SHORT)
|
||||
|
||||
BLUE := $(shell printf "\033[34m")
|
||||
YELLOW := $(shell printf "\033[33m")
|
||||
RED := $(shell printf "\033[31m")
|
||||
GREEN := $(shell printf "\033[32m")
|
||||
CNone := $(shell printf "\033[0m")
|
||||
|
||||
INFO = echo ${TIME} ${BLUE}[ .. ]${CNone}
|
||||
WARN = echo ${TIME} ${YELLOW}[WARN]${CNone}
|
||||
ERR = echo ${TIME} ${RED}[FAIL]${CNone}
|
||||
OK = echo ${TIME} ${GREEN}[ OK ]${CNone}
|
||||
FAIL = (echo ${TIME} ${RED}[FAIL]${CNone} && false)
|
||||
|
||||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
|
||||
ifeq (,$(shell go env GOBIN))
|
||||
GOBIN=$(shell go env GOPATH)/bin
|
||||
else
|
||||
GOBIN=$(shell go env GOBIN)
|
||||
endif
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
all: build
|
||||
|
||||
# Run tests
|
||||
test: vet lint staticcheck unit-test-core test-cli-gen
|
||||
test: vet lint staticcheck
|
||||
go test -race -coverprofile=coverage.txt -covermode=atomic ./pkg/... ./cmd/...
|
||||
@$(OK) unit-tests pass
|
||||
|
||||
test-cli-gen:
|
||||
mkdir -p ./bin/doc
|
||||
go run ./hack/docgen/cli/gen.go ./bin/doc
|
||||
unit-test-core:
|
||||
go test -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/... ./apis/... | grep -v apiserver | grep -v applicationconfiguration)
|
||||
go test $(shell go list ./references/... | grep -v apiserver)
|
||||
unit-test-apiserver:
|
||||
go test -gcflags=all=-l -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/... | grep -E 'apiserver|velaql')
|
||||
|
||||
# Build vela cli binary
|
||||
build: fmt vet lint staticcheck vela-cli kubectl-vela
|
||||
# Build manager binary
|
||||
build: fmt vet lint staticcheck
|
||||
go run hack/chart/generate.go
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
|
||||
git checkout cmd/vela/fake/chart_source.go
|
||||
@$(OK) build succeed
|
||||
|
||||
build-cleanup:
|
||||
rm -rf _bin
|
||||
vela-cli:
|
||||
go run hack/chart/generate.go
|
||||
go build -o bin/vela -ldflags ${LDFLAGS} cmd/vela/main.go
|
||||
git checkout cmd/vela/fake/chart_source.go
|
||||
|
||||
dashboard-build:
|
||||
cd dashboard && yarn build && cd ./..
|
||||
|
||||
dashboard-install:
|
||||
cd dashboard && yarn && cd ./..
|
||||
|
||||
doc-gen:
|
||||
rm -r docs/en/cli/*
|
||||
go run hack/docgen/gen.go
|
||||
go run hack/references/generate.go
|
||||
|
||||
api-gen:
|
||||
swag init -g pkg/server/route.go --output pkg/server/docs
|
||||
swagger-codegen generate -l html2 -i pkg/server/docs/swagger.yaml -o pkg/server/docs
|
||||
mv pkg/server/docs/index.html docs/en/developers/references/restful-api/
|
||||
|
||||
generate-source:
|
||||
go run hack/frontend/source.go
|
||||
|
||||
cross-build:
|
||||
go run hack/chart/generate.go
|
||||
GO111MODULE=on CGO_ENABLED=0 $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/{{.OS}}-{{.Arch}}/vela" -osarch='$(TARGETS)' ./cmd/vela/
|
||||
|
||||
compress:
|
||||
( \
|
||||
echo "\n## Release Info\nVERSION: $(VELA_VERSION)" >> README.md && \
|
||||
echo "GIT_COMMIT: $(GIT_COMMIT_LONG)\n" >> README.md && \
|
||||
cd _bin && \
|
||||
$(DIST_DIRS) cp ../LICENSE {} \; && \
|
||||
$(DIST_DIRS) cp ../README.md {} \; && \
|
||||
$(DIST_DIRS) tar -zcf vela-{}.tar.gz {} \; && \
|
||||
$(DIST_DIRS) zip -r vela-{}.zip {} \; && \
|
||||
sha256sum vela-* > sha256sums.txt \
|
||||
)
|
||||
|
||||
# Run against the configured Kubernetes cluster in ~/.kube/config
|
||||
run: fmt vet
|
||||
go run ./cmd/core/main.go
|
||||
|
||||
# Run go fmt against code
|
||||
fmt: goimports installcue
|
||||
go fmt ./...
|
||||
$(GOIMPORTS) -local github.com/oam-dev/kubevela -w $$(go list -f {{.Dir}} ./...)
|
||||
$(CUE) fmt ./vela-templates/definitions/internal/*
|
||||
$(CUE) fmt ./vela-templates/definitions/deprecated/*
|
||||
$(CUE) fmt ./vela-templates/definitions/registry/*
|
||||
$(CUE) fmt ./pkg/stdlib/pkgs/*
|
||||
$(CUE) fmt ./pkg/stdlib/op.cue
|
||||
$(CUE) fmt ./pkg/workflow/tasks/template/static/*
|
||||
$(GOIMPORTS) -local github.com/oam-dev/kubevela -w ./pkg ./cmd
|
||||
$(CUE) fmt ./hack/vela-templates/cue/*
|
||||
|
||||
# Run go vet against code
|
||||
vet:
|
||||
go vet ./...
|
||||
@@ -46,90 +106,167 @@ staticcheck: staticchecktool
|
||||
$(STATICCHECK) ./...
|
||||
|
||||
lint: golangci
|
||||
$(GOLANGCILINT) run ./...
|
||||
$(GOLANGCILINT) run ./...
|
||||
|
||||
reviewable: manifests fmt vet lint staticcheck helm-doc-gen
|
||||
reviewable: manifests fmt vet lint staticcheck
|
||||
go mod tidy
|
||||
|
||||
# Execute auto-gen code commands and ensure branch is clean.
|
||||
check-diff: reviewable
|
||||
git --no-pager diff
|
||||
git diff --quiet || ($(ERR) please run 'make reviewable' to include all changes && false)
|
||||
@$(OK) branch is clean
|
||||
|
||||
# Build the docker image
|
||||
docker-build:
|
||||
docker build --build-arg=VERSION=$(VELA_VERSION) --build-arg=GITVERSION=$(GIT_COMMIT) . -t ${IMG}
|
||||
|
||||
# Push the docker image
|
||||
docker-push:
|
||||
docker push $(VELA_CORE_IMAGE)
|
||||
docker push ${IMG}
|
||||
|
||||
build-swagger:
|
||||
go run ./cmd/apiserver/main.go build-swagger ./docs/apidoc/swagger.json
|
||||
e2e-setup:
|
||||
bin/vela install --set installCertManager=true --image-pull-policy IfNotPresent --image-repo vela-core-test --image-tag $(GIT_COMMIT) --depend-check-wait 10s
|
||||
ginkgo version
|
||||
ginkgo -v -r e2e/setup
|
||||
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=vela-core,app.kubernetes.io/instance=kubevela -n vela-system --timeout=600s
|
||||
bin/vela dashboard &
|
||||
|
||||
e2e-api-test:
|
||||
# Run e2e test
|
||||
ginkgo -v -skipPackage capability,setup,apiserver,application -r e2e
|
||||
ginkgo -v -r e2e/apiserver
|
||||
ginkgo -v -r e2e/application
|
||||
|
||||
e2e-test:
|
||||
# Run e2e test
|
||||
ginkgo -v ./test/e2e-test
|
||||
# integration test will clean environment, please don't put test behind it.
|
||||
CGO_ENABLED=0 go test -timeout 1h -count=1 -v -tags 'integration' ./test/integration
|
||||
@$(OK) tests pass
|
||||
|
||||
compatibility-test: vet lint staticcheck generate-compatibility-testdata
|
||||
# Run compatibility test with old crd
|
||||
COMPATIBILITY_TEST=TRUE go test -race ./pkg/...
|
||||
@$(OK) compatibility-test pass
|
||||
|
||||
generate-compatibility-testdata:
|
||||
mkdir -p ./test/compatibility-test/testdata
|
||||
go run ./test/compatibility-test/convert/main.go ./charts/vela-core/crds ./test/compatibility-test/testdata
|
||||
|
||||
compatibility-testdata-cleanup:
|
||||
rm -f ./test/compatibility-test/testdata/*
|
||||
|
||||
e2e-cleanup:
|
||||
# Clean up
|
||||
rm -rf ~/.vela
|
||||
|
||||
image-cleanup:
|
||||
ifneq (, $(shell which docker))
|
||||
# Delete Docker images
|
||||
|
||||
ifneq ($(shell docker images -q $(VELA_CORE_TEST_IMAGE)),)
|
||||
docker rmi -f $(VELA_CORE_TEST_IMAGE)
|
||||
# Delete Docker image
|
||||
ifneq ($(shell docker images -q vela-core-test:$(GIT_COMMIT)),)
|
||||
docker image rm -f vela-core-test:$(GIT_COMMIT)
|
||||
endif
|
||||
|
||||
ifneq ($(shell docker images -q $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)),)
|
||||
docker rmi -f $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)
|
||||
endif
|
||||
# load docker image to the kind cluster
|
||||
kind-load:
|
||||
docker build -t vela-core-test:$(GIT_COMMIT) .
|
||||
kind load docker-image vela-core-test:$(GIT_COMMIT) || { echo >&2 "kind not installed or error loading image: $(IMAGE)"; exit 1; }
|
||||
|
||||
endif
|
||||
|
||||
|
||||
|
||||
# load docker image to the k3d cluster
|
||||
image-load:
|
||||
docker build -t $(VELA_CORE_TEST_IMAGE) -f Dockerfile.e2e .
|
||||
k3d image import $(VELA_CORE_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; }
|
||||
|
||||
image-load-runtime-cluster:
|
||||
/bin/sh hack/e2e/build_runtime_rollout.sh
|
||||
docker build -t $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) -f runtime/rollout/e2e/Dockerfile.e2e runtime/rollout/e2e/
|
||||
rm -rf runtime/rollout/e2e/tmp
|
||||
k3d image import $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)"; exit 1; }
|
||||
k3d cluster get $(RUNTIME_CLUSTER_NAME) && k3d image import $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) --cluster=$(RUNTIME_CLUSTER_NAME) || echo "no worker cluster"
|
||||
# Image URL to use all building/pushing image targets
|
||||
IMG ?= vela-core:latest
|
||||
|
||||
# Run tests
|
||||
core-test: fmt vet manifests
|
||||
go test ./pkg/... -coverprofile cover.out
|
||||
|
||||
# Build vela core manager and apiserver binary
|
||||
# Build manager binary
|
||||
manager: fmt vet lint manifests
|
||||
$(GOBUILD_ENV) go build -o bin/manager -a -ldflags $(LDFLAGS) ./cmd/core/main.go
|
||||
$(GOBUILD_ENV) go build -o bin/apiserver -a -ldflags $(LDFLAGS) ./cmd/apiserver/main.go
|
||||
go build -o bin/manager ./cmd/core/main.go
|
||||
|
||||
vela-runtime-rollout-manager: fmt vet lint manifests
|
||||
$(GOBUILD_ENV) go build -o ./runtime/rollout/bin/manager -a -ldflags $(LDFLAGS) ./runtime/rollout/cmd/main.go
|
||||
# Run against the configured Kubernetes cluster in ~/.kube/config
|
||||
core-run: fmt vet manifests
|
||||
go run ./cmd/core/main.go
|
||||
|
||||
# Install CRDs and Definitions of Vela Core into a cluster, this is for develop convenient.
|
||||
core-install: manifests
|
||||
kubectl apply -f hack/namespace.yaml
|
||||
kubectl apply -f charts/vela-core/crds/
|
||||
kubectl apply -f charts/vela-core/templates/defwithtemplate/
|
||||
kubectl apply -f charts/vela-core/templates/definitions/
|
||||
kubectl apply -f charts/vela-core/templates/velaConfig.yaml
|
||||
bin/vela workloads
|
||||
@$(OK) install succeed
|
||||
|
||||
# Uninstall CRDs and Definitions of Vela Core from a cluster, this is for develop convenient.
|
||||
core-uninstall: manifests
|
||||
kubectl delete -f charts/vela-core/templates/definitions/
|
||||
kubectl delete -f charts/vela-core/templates/defwithtemplate/
|
||||
kubectl delete -f charts/vela-core/crds/
|
||||
|
||||
# Generate manifests e.g. CRD, RBAC etc.
|
||||
manifests: installcue kustomize
|
||||
manifests:
|
||||
go generate $(foreach t,pkg apis,./$(t)/...)
|
||||
# TODO(yangsoon): kustomize will merge all CRD into a whole file, it may not work if we want patch more than one CRD in this way
|
||||
$(KUSTOMIZE) build config/crd -o config/crd/base/core.oam.dev_applications.yaml
|
||||
./hack/crd/cleanup.sh
|
||||
go run ./hack/crd/dispatch/dispatch.go config/crd/base charts/vela-core/crds runtime/ charts/vela-minimal/crds
|
||||
rm -f config/crd/base/*
|
||||
./vela-templates/gen_definitions.sh
|
||||
|
||||
./hack/vela-templates/gen_definitions.sh
|
||||
|
||||
GOLANGCILINT_VERSION ?= v1.31.0
|
||||
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
HOSTARCH := $(shell uname -m)
|
||||
ifeq ($(HOSTARCH),x86_64)
|
||||
HOSTARCH := amd64
|
||||
endif
|
||||
|
||||
golangci:
|
||||
ifeq (, $(shell which golangci-lint))
|
||||
@{ \
|
||||
set -e ;\
|
||||
echo 'installing golangci-lint-$(GOLANGCILINT_VERSION)' ;\
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) $(GOLANGCILINT_VERSION) ;\
|
||||
echo 'Install succeed' ;\
|
||||
}
|
||||
GOLANGCILINT=$(GOBIN)/golangci-lint
|
||||
else
|
||||
GOLANGCILINT=$(shell which golangci-lint)
|
||||
endif
|
||||
|
||||
check-license-header:
|
||||
./hack/licence/header-check.sh
|
||||
.PHONY: staticchecktool
|
||||
staticchecktool:
|
||||
ifeq (, $(shell which staticcheck))
|
||||
@{ \
|
||||
set -e ;\
|
||||
echo 'installing honnef.co/go/tools/cmd/staticcheck ' ;\
|
||||
GO111MODULE=off go get honnef.co/go/tools/cmd/staticcheck ;\
|
||||
}
|
||||
STATICCHECK=$(GOBIN)/staticcheck
|
||||
else
|
||||
STATICCHECK=$(shell which staticcheck)
|
||||
endif
|
||||
|
||||
def-install:
|
||||
./hack/utils/installdefinition.sh
|
||||
.PHONY: goimports
|
||||
goimports:
|
||||
ifeq (, $(shell which goimports))
|
||||
@{ \
|
||||
set -e ;\
|
||||
GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports ;\
|
||||
}
|
||||
GOIMPORTS=$(GOBIN)/goimports
|
||||
else
|
||||
GOIMPORTS=$(shell which goimports)
|
||||
endif
|
||||
|
||||
helm-doc-gen: helmdoc
|
||||
readme-generator -v charts/vela-core/values.yaml -r charts/vela-core/README.md
|
||||
readme-generator -v charts/vela-minimal/values.yaml -r charts/vela-minimal/README.md
|
||||
.PHONY: installcue
|
||||
installcue:
|
||||
ifeq (, $(shell which cue))
|
||||
@{ \
|
||||
set -e ;\
|
||||
GO111MODULE=off go get -u cuelang.org/go/cmd/cue ;\
|
||||
}
|
||||
CUE=$(GOBIN)/cue
|
||||
else
|
||||
CUE=$(shell which cue)
|
||||
endif
|
||||
|
||||
start-dashboard:
|
||||
go run pkg/server/main/startAPIServer.go &
|
||||
cd dashboard && npm install && npm start && cd ..
|
||||
|
||||
swagger-gen:
|
||||
$(GOBIN)/swag init -g server/route.go -d pkg/ -o pkg/server/docs/
|
||||
|
||||
12
OWNERS
Normal file
12
OWNERS
Normal file
@@ -0,0 +1,12 @@
|
||||
approvers:
|
||||
- kubevela-controller
|
||||
- kubevela-devex
|
||||
- kubevela-dashboard-approver
|
||||
|
||||
reviewers:
|
||||
- kubevela-controller
|
||||
- oam-spec
|
||||
- kubevela-dashboard-reviewer
|
||||
|
||||
members:
|
||||
- community-collaborators
|
||||
@@ -1 +1,44 @@
|
||||
The owner file has been migrated to the community repo, please refer to https://github.com/kubevela/community/blob/main/OWNERS.md
|
||||
aliases:
|
||||
kubevela-devex:
|
||||
- hongchaodeng
|
||||
- wonderflow
|
||||
|
||||
kubevela-dashboard-approver:
|
||||
- zzxwill
|
||||
- hongchaodeng
|
||||
|
||||
kubevela-dashboard-reviewer:
|
||||
- sunny0826
|
||||
- hanxie-crypto
|
||||
|
||||
kubevela-controller:
|
||||
- resouer
|
||||
- wonderflow
|
||||
- hongchaodeng
|
||||
- zzxwill
|
||||
- ryanzhang-oss
|
||||
- captainroy-hy
|
||||
|
||||
oam-spec: # inherit from https://github.com/oam-dev/spec/blob/master/OWNERS.md
|
||||
- hongchaodeng
|
||||
- resouer
|
||||
|
||||
community-collaborators:
|
||||
- Fei-Guo
|
||||
- szihai
|
||||
|
||||
bootstrap-contributors: # thank you for bootstrapping KubeVela at the very early stage!
|
||||
- xiaoyuaiheshui
|
||||
- Ghostbaby
|
||||
- wenxinnnnn
|
||||
- silenceper
|
||||
- erdun
|
||||
- sunny0826
|
||||
- mosesyou
|
||||
- artursouza
|
||||
- wonderflow
|
||||
- hongchaodeng
|
||||
- ryanzhang-oss
|
||||
- woshilanren11
|
||||
- hanxie-crypto
|
||||
- zzxwill
|
||||
7
PROJECT
Normal file
7
PROJECT
Normal file
@@ -0,0 +1,7 @@
|
||||
domain: oam.dev
|
||||
repo: github.com/oam-dev/kubevela
|
||||
resources:
|
||||
- group: standard
|
||||
kind: Route
|
||||
version: v1alpha1
|
||||
version: "2"
|
||||
98
README.md
98
README.md
@@ -1,96 +1,48 @@
|
||||
<div style="text-align: center">
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/kubevela/kubevela.io/main/docs/resources/KubeVela-03.png">
|
||||
<br><br>
|
||||
<i>Make shipping applications more enjoyable.</i>
|
||||
</p>
|
||||
</div>
|
||||
|
||||

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

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

|
||||
[](https://codecov.io/gh/kubevela/kubevela)
|
||||
[](/LICENSE)
|
||||
[](https://github.com/kubevela/kubevela/releases)
|
||||
[](https://www.tickgit.com/browse?repo=github.com/kubevela/kubevela)
|
||||
[](https://codecov.io/gh/oam-dev/kubevela)
|
||||
[](/LICENSE)
|
||||
[](https://github.com/oam-dev/kubevela/releases)
|
||||
[](https://www.tickgit.com/browse?repo=github.com/oam-dev/kubevela)
|
||||
[](https://twitter.com/oam_dev)
|
||||
[](https://artifacthub.io/packages/search?repo=kubevela)
|
||||
[](https://bestpractices.coreinfrastructure.org/projects/4602)
|
||||
|
||||
## Introduction
|
||||

|
||||
|
||||
KubeVela is a modern application delivery platform that makes deploying and operating applications across today's hybrid, multi-cloud environments easier, faster and more reliable.
|
||||
*Make shipping applications more enjoyable.*
|
||||
|
||||

|
||||
# KubeVela
|
||||
|
||||
## Highlights
|
||||
For developers, KubeVela is an easy-to-use yet extensible platform that enables them to design and ship applications with minimal effort.
|
||||
|
||||
KubeVela practices the "render, orchestrate, deploy" workflow with below highlighted values added to existing ecosystem:
|
||||
|
||||
* Deployment as Code
|
||||
|
||||
Declare your deployment plan as workflow, run it automatically with any CI/CD or GitOps system, extend or re-program the workflow steps with CUE. No add-hoc scripts, no dirty glue code, just deploy. The deployment workflow in KubeVela is powered by [Open Application Model](https://oam.dev/).
|
||||
|
||||
* Built-in security and compliance building blocks
|
||||
|
||||
Choose from the wide range of LDAP integrations we provided out-of-box, enjoy multi-cluster authorization that is fully automated, pick and apply fine-grained RBAC modules and customize them per your own supply chain requirements.
|
||||
|
||||
* Multi-cloud/hybrid-environments app delivery as first-class citizen
|
||||
|
||||
Progressive rollout across test/staging/production environments, automatic canary, blue-green and continuous verification, rich placement strategy across clusters and clouds, fully managed cloud environments provision.
|
||||
|
||||
## Getting Started
|
||||
|
||||
* [Introduction](https://kubevela.io/docs)
|
||||
* [Installation](https://kubevela.io/docs/install)
|
||||
* [Deploy Your Application](https://kubevela.io/docs/quick-start)
|
||||
|
||||
## Documentation
|
||||
|
||||
Full documentation is available on the [KubeVela website](https://kubevela.io/).
|
||||
|
||||
## Blog
|
||||
|
||||
Official blog is available on [KubeVela blog](https://kubevela.io/blog).
|
||||
For platform builders, KubeVela is the core engine that empowers them to create above platform with ease.
|
||||
|
||||
## Community
|
||||
|
||||
We want your contributions and suggestions!
|
||||
One of the easiest ways to contribute is to participate in discussions on the Github Issues/Discussion, chat on IM or the bi-weekly community calls.
|
||||
For more information on the community engagement, developer and contributing guidelines and more, head over to the [KubeVela community repo](https://github.com/kubevela/community).
|
||||
- Slack: [CNCF Slack](https://slack.cncf.io/) #kubevela channel
|
||||
- Gitter: [Discussion](https://gitter.im/oam-dev/community)
|
||||
|
||||
### Contact Us
|
||||
> NOTE: KubeVela is still in early stage and iterating quickly. It's currently under preview release.
|
||||
|
||||
Reach out with any questions you may have and we'll make sure to answer them as soon as possible!
|
||||
## How It Works?
|
||||
|
||||
- Slack: [CNCF Slack kubevela channel](https://cloud-native.slack.com/archives/C01BLQ3HTJA) (*English*)
|
||||
- [DingTalk Group](https://page.dingtalk.com/wow/dingtalk/act/en-home): `23310022` (*Chinese*)
|
||||
- Wechat Group (*Chinese*): Broker wechat to add you into the user group.
|
||||
|
||||
<img src="https://static.kubevela.net/images/barnett-wechat.jpg" width="200" />
|
||||

|
||||
|
||||
### Community Call
|
||||
## Quick Start
|
||||
|
||||
Every two weeks we host a community call to showcase new features, review upcoming milestones, and engage in a Q&A. All are welcome!
|
||||
Quick start guides for developers are available on [this section](https://kubevela.io/#/en/quick-start).
|
||||
|
||||
- Bi-weekly Community Call:
|
||||
- [Meeting Notes](https://docs.google.com/document/d/1nqdFEyULekyksFHtFvgvFAYE-0AMHKoS3RMnaKsarjs).
|
||||
- [Video Records](https://www.youtube.com/channel/UCSCTHhGI5XJ0SEhDHVakPAA/videos).
|
||||
- Bi-weekly Chinese Community Call:
|
||||
- [Video Records](https://space.bilibili.com/180074935/channel/seriesdetail?sid=1842207).
|
||||
## Platform Builder Guide
|
||||
|
||||
## Talks and Conferences
|
||||
Detailed guides for platform teams are available on [this section](https://kubevela.io/#/en/platform-engineers/overview).
|
||||
|
||||
Check out [KubeVela videos](https://kubevela.io/videos/talks/en/oam-dapr) for these talks and conferences.
|
||||
## Documentation
|
||||
|
||||
For full documentation, please visit the KubeVela website: [https://kubevela.io](https://kubevela.io/).
|
||||
|
||||
## Contributing
|
||||
|
||||
Check out [CONTRIBUTING](https://kubevela.io/docs/contributor/overview) to see how to develop with KubeVela.
|
||||
|
||||
## Report Vulnerability
|
||||
|
||||
Security is a first priority thing for us at KubeVela. If you come across a related issue, please send email to security@mail.kubevela.io .
|
||||
Check out [CONTRIBUTING](./CONTRIBUTING.md) to see how to develop with KubeVela.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
KubeVela adopts [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
|
||||
This project has adopted the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). See [CODE OF CONDUCT](CODE_OF_CONDUCT.md) for details.
|
||||
|
||||
20
SECURITY.md
20
SECURITY.md
@@ -1,20 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you've found a security issue that you'd like to disclose confidentially please send email to security@mail.kubevela.io .
|
||||
|
||||
### Who Reads Email Sent to security@mail.kubevela.io?
|
||||
|
||||
Only a restricted and carefully chosen group of KubeVela maintainers will have access to material sent to the security@mail.kubevela.io address.
|
||||
No outside users can subscribe to this list.
|
||||
|
||||
### What to Send to security@mail.kubevela.io
|
||||
|
||||
Please provide as much information about your system and the issue as possible when contacting the list.
|
||||
|
||||
## How We Respond
|
||||
|
||||
Email sent to security@mail.kubevela.io is read and acknowledged with a non-automated response within three working days.
|
||||
For issues that are complicated and require significant attention,
|
||||
we will open an investigation and will provide you with a mechanism to check the status of our progress at any time.
|
||||
16
apis/apis.go
16
apis/apis.go
@@ -1,18 +1,2 @@
|
||||
/*
|
||||
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 apis contains all api types of KubeVela
|
||||
package apis
|
||||
|
||||
@@ -1,19 +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 common contains types required for both v1alpha2 and v1beta1
|
||||
// +kubebuilder:object:generate=true
|
||||
package common
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
Copyright 2022 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package common
|
||||
|
||||
const (
|
||||
// Group api group name
|
||||
Group = "core.oam.dev"
|
||||
)
|
||||
@@ -1,688 +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 common
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
types "github.com/oam-dev/terraform-controller/api/types/crossplane-runtime"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
"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
|
||||
|
||||
// data types of parameter value
|
||||
const (
|
||||
StringType ParameterValueType = "string"
|
||||
NumberType ParameterValueType = "number"
|
||||
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.
|
||||
// Template is a required field if CUE is defined in Capability Definition.
|
||||
Template string `json:"template"`
|
||||
}
|
||||
|
||||
// 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
|
||||
Configuration string `json:"configuration"`
|
||||
|
||||
// Type specifies which Terraform configuration it is, HCL or JSON syntax
|
||||
// +kubebuilder:default:=hcl
|
||||
// +kubebuilder:validation:Enum:=hcl;json;remote
|
||||
Type string `json:"type,omitempty"`
|
||||
|
||||
// Path is the sub-directory of remote git repository. It's valid when remote is set
|
||||
Path string `json:"path,omitempty"`
|
||||
|
||||
// WriteConnectionSecretToReference specifies the namespace and name of a
|
||||
// Secret to which any connection details for this managed resource should
|
||||
// be written. Connection details frequently include the endpoint, username,
|
||||
// and password required to connect to the managed resource.
|
||||
// +optional
|
||||
WriteConnectionSecretToReference *types.SecretReference `json:"writeConnectionSecretToRef,omitempty"`
|
||||
|
||||
// ProviderReference specifies the reference to Provider
|
||||
ProviderReference *types.Reference `json:"providerRef,omitempty"`
|
||||
|
||||
// DeleteResource will determine whether provisioned cloud resources will be deleted when CR is deleted
|
||||
// +kubebuilder:default:=true
|
||||
DeleteResource bool `json:"deleteResource,omitempty"`
|
||||
|
||||
// Region is cloud provider's region. It will override the region in the region field of ProviderReference
|
||||
Region string `json:"customRegion,omitempty"`
|
||||
}
|
||||
|
||||
// A WorkloadTypeDescriptor refer to a Workload Type
|
||||
type WorkloadTypeDescriptor struct {
|
||||
// Type ref to a WorkloadDefinition via name
|
||||
Type string `json:"type,omitempty"`
|
||||
// Definition mutually exclusive to workload.type, a embedded WorkloadDefinition
|
||||
Definition WorkloadGVK `json:"definition,omitempty"`
|
||||
}
|
||||
|
||||
// WorkloadGVK refer to a Workload Type
|
||||
type WorkloadGVK struct {
|
||||
APIVersion string `json:"apiVersion"`
|
||||
Kind string `json:"kind"`
|
||||
}
|
||||
|
||||
// A DefinitionReference refers to a CustomResourceDefinition by name.
|
||||
type DefinitionReference struct {
|
||||
// Name of the referenced CustomResourceDefinition.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Version indicate which version should be used if CRD has multiple versions
|
||||
// by default it will use the first one if not specified
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// A ChildResourceKind defines a child Kubernetes resource kind with a selector
|
||||
type ChildResourceKind struct {
|
||||
// APIVersion of the child resource
|
||||
APIVersion string `json:"apiVersion"`
|
||||
|
||||
// Kind of the child resource
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Selector to select the child resources that the workload wants to expose to traits
|
||||
Selector map[string]string `json:"selector,omitempty"`
|
||||
}
|
||||
|
||||
// Status defines the loop back status of the abstraction by using CUE template
|
||||
type Status struct {
|
||||
// CustomStatus defines the custom status message that could display to user
|
||||
// +optional
|
||||
CustomStatus string `json:"customStatus,omitempty"`
|
||||
// HealthPolicy defines the health check policy for the abstraction
|
||||
// +optional
|
||||
HealthPolicy string `json:"healthPolicy,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationPhase is a label for the condition of an application at the current time
|
||||
type ApplicationPhase string
|
||||
|
||||
const (
|
||||
// ApplicationRollingOut means the app is in the middle of rolling out
|
||||
ApplicationRollingOut ApplicationPhase = "rollingOut"
|
||||
// ApplicationStarting means the app is preparing for reconcile
|
||||
ApplicationStarting ApplicationPhase = "starting"
|
||||
// ApplicationRendering means the app is rendering
|
||||
ApplicationRendering ApplicationPhase = "rendering"
|
||||
// ApplicationPolicyGenerating means the app is generating policies
|
||||
ApplicationPolicyGenerating ApplicationPhase = "generatingPolicy"
|
||||
// ApplicationRunningWorkflow means the app is running workflow
|
||||
ApplicationRunningWorkflow ApplicationPhase = "runningWorkflow"
|
||||
// ApplicationWorkflowSuspending means the app's workflow is suspending
|
||||
ApplicationWorkflowSuspending ApplicationPhase = "workflowSuspending"
|
||||
// ApplicationWorkflowTerminated means the app's workflow is terminated
|
||||
ApplicationWorkflowTerminated ApplicationPhase = "workflowTerminated"
|
||||
// ApplicationWorkflowFinished means the app's workflow is finished
|
||||
ApplicationWorkflowFinished ApplicationPhase = "workflowFinished"
|
||||
// ApplicationRunning means the app finished rendering and applied result to the cluster
|
||||
ApplicationRunning ApplicationPhase = "running"
|
||||
// ApplicationUnhealthy means the app finished rendering and applied result to the cluster, but still unhealthy
|
||||
ApplicationUnhealthy ApplicationPhase = "unhealthy"
|
||||
// ApplicationDeleting means application is being deleted
|
||||
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"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
Cluster string `json:"cluster,omitempty"`
|
||||
Env string `json:"env,omitempty"`
|
||||
// WorkloadDefinition is the definition of a WorkloadDefinition, such as deployments/apps.v1
|
||||
WorkloadDefinition WorkloadGVK `json:"workloadDefinition,omitempty"`
|
||||
Healthy bool `json:"healthy"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Traits []ApplicationTraitStatus `json:"traits,omitempty"`
|
||||
Scopes []corev1.ObjectReference `json:"scopes,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationTraitStatus records the trait health status
|
||||
type ApplicationTraitStatus struct {
|
||||
Type string `json:"type"`
|
||||
Healthy bool `json:"healthy"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Revision has name and revision number
|
||||
type Revision struct {
|
||||
Name string `json:"name"`
|
||||
Revision int64 `json:"revision"`
|
||||
|
||||
// RevisionHash record the hash value of the spec of ApplicationRevision object.
|
||||
RevisionHash string `json:"revisionHash,omitempty"`
|
||||
}
|
||||
|
||||
// RawComponent record raw component
|
||||
type RawComponent struct {
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Raw runtime.RawExtension `json:"raw"`
|
||||
}
|
||||
|
||||
// StepStatus record the base status of workflow step, which could be workflow step or subStep
|
||||
type StepStatus struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name,omitempty"`
|
||||
Type string `json:"type,omitempty"`
|
||||
Phase WorkflowStepPhase `json:"phase,omitempty"`
|
||||
// A human readable message indicating details about why the workflowStep is in this state.
|
||||
Message string `json:"message,omitempty"`
|
||||
// A brief CamelCase message indicating details about why the workflowStep is in this state.
|
||||
Reason string `json:"reason,omitempty"`
|
||||
// FirstExecuteTime is the first time this step execution.
|
||||
FirstExecuteTime metav1.Time `json:"firstExecuteTime,omitempty"`
|
||||
// LastExecuteTime is the last time this step execution.
|
||||
LastExecuteTime metav1.Time `json:"lastExecuteTime,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStepStatus record the status of a workflow step, include step status and subStep status
|
||||
type WorkflowStepStatus struct {
|
||||
StepStatus `json:",inline"`
|
||||
SubStepsStatus []WorkflowSubStepStatus `json:"subSteps,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowSubStepStatus record the status of a workflow subStep
|
||||
type WorkflowSubStepStatus struct {
|
||||
StepStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// AppStatus defines the observed state of Application
|
||||
type AppStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
// The generation observed by the application controller.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
|
||||
Phase ApplicationPhase `json:"status,omitempty"`
|
||||
|
||||
// Components record the related Components created by Application Controller
|
||||
Components []corev1.ObjectReference `json:"components,omitempty"`
|
||||
|
||||
// Services record the status of the application services
|
||||
Services []ApplicationComponentStatus `json:"services,omitempty"`
|
||||
|
||||
// Workflow record the status of workflow
|
||||
Workflow *WorkflowStatus `json:"workflow,omitempty"`
|
||||
|
||||
// LatestRevision of the application configuration it generates
|
||||
// +optional
|
||||
LatestRevision *Revision `json:"latestRevision,omitempty"`
|
||||
|
||||
// AppliedResources record the resources that the workflow step apply.
|
||||
AppliedResources []ClusterObjectReference `json:"appliedResources,omitempty"`
|
||||
|
||||
// PolicyStatus records the status of policy
|
||||
PolicyStatus []PolicyStatus `json:"policy,omitempty"`
|
||||
}
|
||||
|
||||
// PolicyStatus records the status of policy
|
||||
type PolicyStatus struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Status *runtime.RawExtension `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStep defines how to execute a workflow step.
|
||||
type WorkflowStep struct {
|
||||
// Name is the unique name of the workflow step.
|
||||
Name string `json:"name"`
|
||||
|
||||
Type string `json:"type"`
|
||||
|
||||
Meta *WorkflowStepMeta `json:"meta,omitempty"`
|
||||
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
|
||||
SubSteps []WorkflowSubStep `json:"subSteps,omitempty"`
|
||||
|
||||
If string `json:"if,omitempty"`
|
||||
|
||||
Timeout string `json:"timeout,omitempty"`
|
||||
|
||||
DependsOn []string `json:"dependsOn,omitempty"`
|
||||
|
||||
Inputs StepInputs `json:"inputs,omitempty"`
|
||||
|
||||
Outputs StepOutputs `json:"outputs,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStepMeta contains the meta data of a workflow step
|
||||
type WorkflowStepMeta struct {
|
||||
Alias string `json:"alias,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowSubStep defines how to execute a workflow subStep.
|
||||
type WorkflowSubStep struct {
|
||||
// Name is the unique name of the workflow step.
|
||||
Name string `json:"name"`
|
||||
|
||||
Type string `json:"type"`
|
||||
|
||||
Meta *WorkflowStepMeta `json:"meta,omitempty"`
|
||||
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
|
||||
If string `json:"if,omitempty"`
|
||||
|
||||
Timeout string `json:"timeout,omitempty"`
|
||||
|
||||
DependsOn []string `json:"dependsOn,omitempty"`
|
||||
|
||||
Inputs StepInputs `json:"inputs,omitempty"`
|
||||
|
||||
Outputs StepOutputs `json:"outputs,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStatus record the status of workflow
|
||||
type WorkflowStatus struct {
|
||||
AppRevision string `json:"appRevision,omitempty"`
|
||||
Mode WorkflowMode `json:"mode"`
|
||||
Message string `json:"message,omitempty"`
|
||||
|
||||
SuspendState string `json:"suspendState,omitempty"`
|
||||
|
||||
Suspend bool `json:"suspend"`
|
||||
Terminated bool `json:"terminated"`
|
||||
Finished bool `json:"finished"`
|
||||
|
||||
ContextBackend *corev1.ObjectReference `json:"contextBackend,omitempty"`
|
||||
Steps []WorkflowStepStatus `json:"steps,omitempty"`
|
||||
|
||||
StartTime metav1.Time `json:"startTime,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStepPhase describes the phase of a workflow step.
|
||||
type WorkflowStepPhase string
|
||||
|
||||
const (
|
||||
// WorkflowStepPhaseSucceeded will make the controller run the next step.
|
||||
WorkflowStepPhaseSucceeded WorkflowStepPhase = "succeeded"
|
||||
// WorkflowStepPhaseFailed will report error in `message`.
|
||||
WorkflowStepPhaseFailed WorkflowStepPhase = "failed"
|
||||
// WorkflowStepPhaseSkipped will make the controller skip the step.
|
||||
WorkflowStepPhaseSkipped WorkflowStepPhase = "skipped"
|
||||
// WorkflowStepPhaseStopped will make the controller stop the workflow.
|
||||
WorkflowStepPhaseStopped WorkflowStepPhase = "stopped"
|
||||
// WorkflowStepPhaseRunning will make the controller continue the workflow.
|
||||
WorkflowStepPhaseRunning WorkflowStepPhase = "running"
|
||||
// WorkflowStepPhasePending will make the controller wait for the step to run.
|
||||
WorkflowStepPhasePending WorkflowStepPhase = "pending"
|
||||
)
|
||||
|
||||
// DefinitionType describes the type of DefinitionRevision.
|
||||
// +kubebuilder:validation:Enum=Component;Trait;Policy;WorkflowStep
|
||||
type DefinitionType string
|
||||
|
||||
const (
|
||||
// ComponentType represents DefinitionRevision refer to type ComponentDefinition
|
||||
ComponentType DefinitionType = "Component"
|
||||
|
||||
// TraitType represents DefinitionRevision refer to type TraitDefinition
|
||||
TraitType DefinitionType = "Trait"
|
||||
|
||||
// PolicyType represents DefinitionRevision refer to type PolicyDefinition
|
||||
PolicyType DefinitionType = "Policy"
|
||||
|
||||
// WorkflowStepType represents DefinitionRevision refer to type WorkflowStepDefinition
|
||||
WorkflowStepType DefinitionType = "WorkflowStep"
|
||||
)
|
||||
|
||||
// WorkflowMode describes the mode of workflow
|
||||
type WorkflowMode string
|
||||
|
||||
const (
|
||||
// WorkflowModeDAG describes the DAG mode of workflow
|
||||
WorkflowModeDAG WorkflowMode = "DAG"
|
||||
// WorkflowModeStep describes the step by step mode of workflow
|
||||
WorkflowModeStep WorkflowMode = "StepByStep"
|
||||
)
|
||||
|
||||
// AppRolloutStatus defines the observed state of AppRollout
|
||||
type AppRolloutStatus struct {
|
||||
v1alpha1.RolloutStatus `json:",inline"`
|
||||
|
||||
// LastUpgradedTargetAppRevision contains the name of the app that we upgraded to
|
||||
// We will restart the rollout if this is not the same as the spec
|
||||
LastUpgradedTargetAppRevision string `json:"lastTargetAppRevision"`
|
||||
|
||||
// LastSourceAppRevision contains the name of the app that we need to upgrade from.
|
||||
// We will restart the rollout if this is not the same as the spec
|
||||
LastSourceAppRevision string `json:"LastSourceAppRevision,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationTrait defines the trait of application
|
||||
type ApplicationTrait struct {
|
||||
Type string `json:"type"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationComponent describe the component of application
|
||||
type ApplicationComponent struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
// ExternalRevision specified the component revisionName
|
||||
ExternalRevision string `json:"externalRevision,omitempty"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
|
||||
DependsOn []string `json:"dependsOn,omitempty"`
|
||||
Inputs StepInputs `json:"inputs,omitempty"`
|
||||
Outputs StepOutputs `json:"outputs,omitempty"`
|
||||
|
||||
// Traits define the trait of one component, the type must be array to keep the order.
|
||||
Traits []ApplicationTrait `json:"traits,omitempty"`
|
||||
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
// scopes in ApplicationComponent defines the component-level scopes
|
||||
// the format is <scope-type:scope-instance-name> pairs, the key represents type of `ScopeDefinition` while the value represent the name of scope instance.
|
||||
Scopes map[string]string `json:"scopes,omitempty"`
|
||||
}
|
||||
|
||||
// StepOutputs defines output variable of WorkflowStep
|
||||
type StepOutputs []outputItem
|
||||
|
||||
// StepInputs defines variable input of WorkflowStep
|
||||
type StepInputs []inputItem
|
||||
|
||||
type inputItem struct {
|
||||
ParameterKey string `json:"parameterKey"`
|
||||
From string `json:"from"`
|
||||
}
|
||||
|
||||
type outputItem struct {
|
||||
ValueFrom string `json:"valueFrom"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ClusterSelector defines the rules to select a Cluster resource.
|
||||
// Either name or labels is needed.
|
||||
type ClusterSelector struct {
|
||||
// Name is the name of the cluster.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Labels defines the label selector to select the cluster.
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// Distribution defines the replica distribution of an AppRevision to a cluster.
|
||||
type Distribution struct {
|
||||
// Replicas is the replica number.
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterPlacement defines the cluster placement rules for an app revision.
|
||||
type ClusterPlacement struct {
|
||||
// ClusterSelector selects the cluster to deploy apps to.
|
||||
// If not specified, it indicates the host cluster per se.
|
||||
ClusterSelector *ClusterSelector `json:"clusterSelector,omitempty"`
|
||||
|
||||
// Distribution defines the replica distribution of an AppRevision to a cluster.
|
||||
Distribution Distribution `json:"distribution,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceCreatorRole defines the resource creator.
|
||||
type ResourceCreatorRole string
|
||||
|
||||
const (
|
||||
// PolicyResourceCreator create the policy resource.
|
||||
PolicyResourceCreator ResourceCreatorRole = "policy"
|
||||
// WorkflowResourceCreator create the resource in workflow.
|
||||
WorkflowResourceCreator ResourceCreatorRole = "workflow"
|
||||
// DebugResourceCreator create the debug resource.
|
||||
DebugResourceCreator ResourceCreatorRole = "debug"
|
||||
)
|
||||
|
||||
// OAMObjectReference defines the object reference for an oam resource
|
||||
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
|
||||
}
|
||||
|
||||
// AddLabelsToObject add labels to object if properties are not empty
|
||||
func (in OAMObjectReference) AddLabelsToObject(obj client.Object) {
|
||||
labels := obj.GetLabels()
|
||||
if labels == nil {
|
||||
labels = map[string]string{}
|
||||
}
|
||||
if in.Component != "" {
|
||||
labels[oam.LabelAppComponent] = in.Component
|
||||
}
|
||||
if in.Trait != "" {
|
||||
labels[oam.TraitTypeLabel] = in.Trait
|
||||
}
|
||||
if in.Env != "" {
|
||||
labels[oam.LabelAppEnv] = in.Env
|
||||
}
|
||||
obj.SetLabels(labels)
|
||||
}
|
||||
|
||||
// NewOAMObjectReferenceFromObject create OAMObjectReference from object
|
||||
func NewOAMObjectReferenceFromObject(obj client.Object) OAMObjectReference {
|
||||
if labels := obj.GetLabels(); labels != nil {
|
||||
return OAMObjectReference{
|
||||
Component: labels[oam.LabelAppComponent],
|
||||
Trait: labels[oam.TraitTypeLabel],
|
||||
Env: labels[oam.LabelAppEnv],
|
||||
}
|
||||
}
|
||||
return OAMObjectReference{}
|
||||
}
|
||||
|
||||
// ClusterObjectReference defines the object reference with cluster.
|
||||
type ClusterObjectReference struct {
|
||||
Cluster string `json:"cluster,omitempty"`
|
||||
Creator ResourceCreatorRole `json:"creator,omitempty"`
|
||||
corev1.ObjectReference `json:",inline"`
|
||||
}
|
||||
|
||||
// Equal check if two references are equal
|
||||
func (in ClusterObjectReference) Equal(r ClusterObjectReference) bool {
|
||||
return in.APIVersion == r.APIVersion && in.Kind == r.Kind && in.Name == r.Name && in.Namespace == r.Namespace && in.UID == r.UID && in.Creator == r.Creator && in.Cluster == r.Cluster
|
||||
}
|
||||
|
||||
// RawExtensionPointer is the pointer of raw extension
|
||||
type RawExtensionPointer struct {
|
||||
RawExtension *runtime.RawExtension
|
||||
}
|
||||
|
||||
// MarshalJSON may get called on pointers or values, so implement MarshalJSON on value.
|
||||
// http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go
|
||||
func (re RawExtensionPointer) MarshalJSON() ([]byte, error) {
|
||||
if re.RawExtension == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if re.RawExtension.Raw == nil {
|
||||
// TODO: this is to support legacy behavior of JSONPrinter and YAMLPrinter, which
|
||||
// expect to call json.Marshal on arbitrary versioned objects (even those not in
|
||||
// the scheme). pkg/kubectl/resource#AsVersionedObjects and its interaction with
|
||||
// kubectl get on objects not in the scheme needs to be updated to ensure that the
|
||||
// objects that are not part of the scheme are correctly put into the right form.
|
||||
if re.RawExtension.Object != nil {
|
||||
return json.Marshal(re.RawExtension.Object)
|
||||
}
|
||||
return []byte("null"), nil
|
||||
}
|
||||
// TODO: Check whether ContentType is actually JSON before returning it.
|
||||
return re.RawExtension.Raw, nil
|
||||
}
|
||||
|
||||
// ApplicationConditionType is a valid value for ApplicationCondition.Type
|
||||
type ApplicationConditionType int
|
||||
|
||||
const (
|
||||
// ParsedCondition indicates whether the parsing is successful.
|
||||
ParsedCondition ApplicationConditionType = iota
|
||||
// RevisionCondition indicates whether the generated revision is successful.
|
||||
RevisionCondition
|
||||
// PolicyCondition indicates whether policy processing is successful.
|
||||
PolicyCondition
|
||||
// RenderCondition indicates whether render processing is successful.
|
||||
RenderCondition
|
||||
// WorkflowCondition indicates whether workflow processing is successful.
|
||||
WorkflowCondition
|
||||
// RolloutCondition indicates whether rollout processing is successful.
|
||||
RolloutCondition
|
||||
// ReadyCondition indicates whether whole application processing is successful.
|
||||
ReadyCondition
|
||||
)
|
||||
|
||||
var conditions = map[ApplicationConditionType]string{
|
||||
ParsedCondition: "Parsed",
|
||||
RevisionCondition: "Revision",
|
||||
PolicyCondition: "Policy",
|
||||
RenderCondition: "Render",
|
||||
WorkflowCondition: "Workflow",
|
||||
RolloutCondition: "Rollout",
|
||||
ReadyCondition: "Ready",
|
||||
}
|
||||
|
||||
// String returns the string corresponding to the condition type.
|
||||
func (ct ApplicationConditionType) String() string {
|
||||
return conditions[ct]
|
||||
}
|
||||
|
||||
// ParseApplicationConditionType parse ApplicationCondition Type.
|
||||
func ParseApplicationConditionType(s string) (ApplicationConditionType, error) {
|
||||
for k, v := range conditions {
|
||||
if v == s {
|
||||
return k, nil
|
||||
}
|
||||
}
|
||||
return -1, errors.New("unknown condition type")
|
||||
}
|
||||
|
||||
// ReferredObject the referred Kubernetes object
|
||||
type ReferredObject struct {
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
runtime.RawExtension `json:",inline"`
|
||||
}
|
||||
|
||||
// ReferredObjectList a list of referred Kubernetes objects
|
||||
type ReferredObjectList struct {
|
||||
// Objects a list of Kubernetes objects.
|
||||
// +optional
|
||||
Objects []ReferredObject `json:"objects,omitempty"`
|
||||
}
|
||||
@@ -1,60 +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 common
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
)
|
||||
|
||||
func TestOAMObjectReference(t *testing.T) {
|
||||
r := require.New(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()))
|
||||
o3 := NewOAMObjectReferenceFromObject(obj)
|
||||
r.True(o1.Equal(o3))
|
||||
o3.Component = "comp"
|
||||
r.False(o3.Equal(o1))
|
||||
|
||||
r.True(o1.Equal(*o1.DeepCopy()))
|
||||
o4 := OAMObjectReference{}
|
||||
o1.DeepCopyInto(&o4)
|
||||
r.True(o4.Equal(o1))
|
||||
}
|
||||
|
||||
func TestClusterObjectReference(t *testing.T) {
|
||||
r := require.New(t)
|
||||
o1 := ClusterObjectReference{
|
||||
Cluster: "cluster",
|
||||
ObjectReference: v1.ObjectReference{Kind: "kind"},
|
||||
}
|
||||
o2 := *o1.DeepCopy()
|
||||
r.True(o1.Equal(o2))
|
||||
o2.Cluster = "c"
|
||||
r.False(o2.Equal(o1))
|
||||
}
|
||||
@@ -1,854 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package common
|
||||
|
||||
import (
|
||||
crossplane_runtime "github.com/oam-dev/terraform-controller/api/types/crossplane-runtime"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *AppRolloutStatus) DeepCopyInto(out *AppRolloutStatus) {
|
||||
*out = *in
|
||||
in.RolloutStatus.DeepCopyInto(&out.RolloutStatus)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppRolloutStatus.
|
||||
func (in *AppRolloutStatus) DeepCopy() *AppRolloutStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AppRolloutStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *AppStatus) DeepCopyInto(out *AppStatus) {
|
||||
*out = *in
|
||||
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]v1.ObjectReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Services != nil {
|
||||
in, out := &in.Services, &out.Services
|
||||
*out = make([]ApplicationComponentStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Workflow != nil {
|
||||
in, out := &in.Workflow, &out.Workflow
|
||||
*out = new(WorkflowStatus)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.LatestRevision != nil {
|
||||
in, out := &in.LatestRevision, &out.LatestRevision
|
||||
*out = new(Revision)
|
||||
**out = **in
|
||||
}
|
||||
if in.AppliedResources != nil {
|
||||
in, out := &in.AppliedResources, &out.AppliedResources
|
||||
*out = make([]ClusterObjectReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.PolicyStatus != nil {
|
||||
in, out := &in.PolicyStatus, &out.PolicyStatus
|
||||
*out = make([]PolicyStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppStatus.
|
||||
func (in *AppStatus) DeepCopy() *AppStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(AppStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationComponent) DeepCopyInto(out *ApplicationComponent) {
|
||||
*out = *in
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.DependsOn != nil {
|
||||
in, out := &in.DependsOn, &out.DependsOn
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Inputs != nil {
|
||||
in, out := &in.Inputs, &out.Inputs
|
||||
*out = make(StepInputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Outputs != nil {
|
||||
in, out := &in.Outputs, &out.Outputs
|
||||
*out = make(StepOutputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Traits != nil {
|
||||
in, out := &in.Traits, &out.Traits
|
||||
*out = make([]ApplicationTrait, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Scopes != nil {
|
||||
in, out := &in.Scopes, &out.Scopes
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationComponent.
|
||||
func (in *ApplicationComponent) DeepCopy() *ApplicationComponent {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationComponent)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationComponentStatus) DeepCopyInto(out *ApplicationComponentStatus) {
|
||||
*out = *in
|
||||
out.WorkloadDefinition = in.WorkloadDefinition
|
||||
if in.Traits != nil {
|
||||
in, out := &in.Traits, &out.Traits
|
||||
*out = make([]ApplicationTraitStatus, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Scopes != nil {
|
||||
in, out := &in.Scopes, &out.Scopes
|
||||
*out = make([]v1.ObjectReference, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationComponentStatus.
|
||||
func (in *ApplicationComponentStatus) DeepCopy() *ApplicationComponentStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationComponentStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationTrait) DeepCopyInto(out *ApplicationTrait) {
|
||||
*out = *in
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTrait.
|
||||
func (in *ApplicationTrait) DeepCopy() *ApplicationTrait {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationTrait)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplicationTraitStatus) DeepCopyInto(out *ApplicationTraitStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplicationTraitStatus.
|
||||
func (in *ApplicationTraitStatus) DeepCopy() *ApplicationTraitStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplicationTraitStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *CUE) DeepCopyInto(out *CUE) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CUE.
|
||||
func (in *CUE) DeepCopy() *CUE {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(CUE)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ChildResourceKind) DeepCopyInto(out *ChildResourceKind) {
|
||||
*out = *in
|
||||
if in.Selector != nil {
|
||||
in, out := &in.Selector, &out.Selector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChildResourceKind.
|
||||
func (in *ChildResourceKind) DeepCopy() *ChildResourceKind {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ChildResourceKind)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterObjectReference) DeepCopyInto(out *ClusterObjectReference) {
|
||||
*out = *in
|
||||
out.ObjectReference = in.ObjectReference
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterObjectReference.
|
||||
func (in *ClusterObjectReference) DeepCopy() *ClusterObjectReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterObjectReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterPlacement) DeepCopyInto(out *ClusterPlacement) {
|
||||
*out = *in
|
||||
if in.ClusterSelector != nil {
|
||||
in, out := &in.ClusterSelector, &out.ClusterSelector
|
||||
*out = new(ClusterSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
out.Distribution = in.Distribution
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterPlacement.
|
||||
func (in *ClusterPlacement) DeepCopy() *ClusterPlacement {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterPlacement)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterSelector) DeepCopyInto(out *ClusterSelector) {
|
||||
*out = *in
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterSelector.
|
||||
func (in *ClusterSelector) DeepCopy() *ClusterSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DefinitionReference) DeepCopyInto(out *DefinitionReference) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DefinitionReference.
|
||||
func (in *DefinitionReference) DeepCopy() *DefinitionReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DefinitionReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Distribution) DeepCopyInto(out *Distribution) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Distribution.
|
||||
func (in *Distribution) DeepCopy() *Distribution {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Distribution)
|
||||
in.DeepCopyInto(out)
|
||||
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
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OAMObjectReference.
|
||||
func (in *OAMObjectReference) DeepCopy() *OAMObjectReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(OAMObjectReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyStatus) DeepCopyInto(out *PolicyStatus) {
|
||||
*out = *in
|
||||
if in.Status != nil {
|
||||
in, out := &in.Status, &out.Status
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyStatus.
|
||||
func (in *PolicyStatus) DeepCopy() *PolicyStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PolicyStatus)
|
||||
in.DeepCopyInto(out)
|
||||
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
|
||||
if in.RawExtension != nil {
|
||||
in, out := &in.RawExtension, &out.RawExtension
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RawExtensionPointer.
|
||||
func (in *RawExtensionPointer) DeepCopy() *RawExtensionPointer {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RawExtensionPointer)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ReferredObject) DeepCopyInto(out *ReferredObject) {
|
||||
*out = *in
|
||||
in.RawExtension.DeepCopyInto(&out.RawExtension)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferredObject.
|
||||
func (in *ReferredObject) DeepCopy() *ReferredObject {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ReferredObject)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ReferredObjectList) DeepCopyInto(out *ReferredObjectList) {
|
||||
*out = *in
|
||||
if in.Objects != nil {
|
||||
in, out := &in.Objects, &out.Objects
|
||||
*out = make([]ReferredObject, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReferredObjectList.
|
||||
func (in *ReferredObjectList) DeepCopy() *ReferredObjectList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ReferredObjectList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Revision) DeepCopyInto(out *Revision) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Revision.
|
||||
func (in *Revision) DeepCopy() *Revision {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Revision)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// 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)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Schematic.
|
||||
func (in *Schematic) DeepCopy() *Schematic {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Schematic)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Status) DeepCopyInto(out *Status) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status.
|
||||
func (in *Status) DeepCopy() *Status {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Status)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in StepInputs) DeepCopyInto(out *StepInputs) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(StepInputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepInputs.
|
||||
func (in StepInputs) DeepCopy() StepInputs {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StepInputs)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in StepOutputs) DeepCopyInto(out *StepOutputs) {
|
||||
{
|
||||
in := &in
|
||||
*out = make(StepOutputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepOutputs.
|
||||
func (in StepOutputs) DeepCopy() StepOutputs {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StepOutputs)
|
||||
in.DeepCopyInto(out)
|
||||
return *out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *StepStatus) DeepCopyInto(out *StepStatus) {
|
||||
*out = *in
|
||||
in.FirstExecuteTime.DeepCopyInto(&out.FirstExecuteTime)
|
||||
in.LastExecuteTime.DeepCopyInto(&out.LastExecuteTime)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepStatus.
|
||||
func (in *StepStatus) DeepCopy() *StepStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(StepStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Terraform) DeepCopyInto(out *Terraform) {
|
||||
*out = *in
|
||||
if in.WriteConnectionSecretToReference != nil {
|
||||
in, out := &in.WriteConnectionSecretToReference, &out.WriteConnectionSecretToReference
|
||||
*out = new(crossplane_runtime.SecretReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.ProviderReference != nil {
|
||||
in, out := &in.ProviderReference, &out.ProviderReference
|
||||
*out = new(crossplane_runtime.Reference)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Terraform.
|
||||
func (in *Terraform) DeepCopy() *Terraform {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Terraform)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkflowStatus) DeepCopyInto(out *WorkflowStatus) {
|
||||
*out = *in
|
||||
if in.ContextBackend != nil {
|
||||
in, out := &in.ContextBackend, &out.ContextBackend
|
||||
*out = new(v1.ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.Steps != nil {
|
||||
in, out := &in.Steps, &out.Steps
|
||||
*out = make([]WorkflowStepStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
in.StartTime.DeepCopyInto(&out.StartTime)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStatus.
|
||||
func (in *WorkflowStatus) DeepCopy() *WorkflowStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkflowStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkflowStep) DeepCopyInto(out *WorkflowStep) {
|
||||
*out = *in
|
||||
if in.Meta != nil {
|
||||
in, out := &in.Meta, &out.Meta
|
||||
*out = new(WorkflowStepMeta)
|
||||
**out = **in
|
||||
}
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.SubSteps != nil {
|
||||
in, out := &in.SubSteps, &out.SubSteps
|
||||
*out = make([]WorkflowSubStep, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.DependsOn != nil {
|
||||
in, out := &in.DependsOn, &out.DependsOn
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Inputs != nil {
|
||||
in, out := &in.Inputs, &out.Inputs
|
||||
*out = make(StepInputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Outputs != nil {
|
||||
in, out := &in.Outputs, &out.Outputs
|
||||
*out = make(StepOutputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStep.
|
||||
func (in *WorkflowStep) DeepCopy() *WorkflowStep {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkflowStep)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkflowStepMeta) DeepCopyInto(out *WorkflowStepMeta) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepMeta.
|
||||
func (in *WorkflowStepMeta) DeepCopy() *WorkflowStepMeta {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkflowStepMeta)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkflowStepStatus) DeepCopyInto(out *WorkflowStepStatus) {
|
||||
*out = *in
|
||||
in.StepStatus.DeepCopyInto(&out.StepStatus)
|
||||
if in.SubStepsStatus != nil {
|
||||
in, out := &in.SubStepsStatus, &out.SubStepsStatus
|
||||
*out = make([]WorkflowSubStepStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStepStatus.
|
||||
func (in *WorkflowStepStatus) DeepCopy() *WorkflowStepStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkflowStepStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkflowSubStep) DeepCopyInto(out *WorkflowSubStep) {
|
||||
*out = *in
|
||||
if in.Meta != nil {
|
||||
in, out := &in.Meta, &out.Meta
|
||||
*out = new(WorkflowStepMeta)
|
||||
**out = **in
|
||||
}
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.DependsOn != nil {
|
||||
in, out := &in.DependsOn, &out.DependsOn
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Inputs != nil {
|
||||
in, out := &in.Inputs, &out.Inputs
|
||||
*out = make(StepInputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Outputs != nil {
|
||||
in, out := &in.Outputs, &out.Outputs
|
||||
*out = make(StepOutputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowSubStep.
|
||||
func (in *WorkflowSubStep) DeepCopy() *WorkflowSubStep {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkflowSubStep)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkflowSubStepStatus) DeepCopyInto(out *WorkflowSubStepStatus) {
|
||||
*out = *in
|
||||
in.StepStatus.DeepCopyInto(&out.StepStatus)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowSubStepStatus.
|
||||
func (in *WorkflowSubStepStatus) DeepCopy() *WorkflowSubStepStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkflowSubStepStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkloadGVK) DeepCopyInto(out *WorkloadGVK) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadGVK.
|
||||
func (in *WorkloadGVK) DeepCopy() *WorkloadGVK {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkloadGVK)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkloadTypeDescriptor) DeepCopyInto(out *WorkloadTypeDescriptor) {
|
||||
*out = *in
|
||||
out.Definition = in.Definition
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadTypeDescriptor.
|
||||
func (in *WorkloadTypeDescriptor) DeepCopy() *WorkloadTypeDescriptor {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkloadTypeDescriptor)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
@@ -1,282 +0,0 @@
|
||||
/*
|
||||
|
||||
// This file is originally from https://github.com/crossplane/crossplane-runtime/blob/master/apis/common/v1/condition.go
|
||||
// We copy it here to reduce dependency and add more
|
||||
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2019 The Crossplane 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 condition
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// A ConditionType represents a condition a resource could be in.
|
||||
// nolint:golint
|
||||
type ConditionType string
|
||||
|
||||
// Condition types.
|
||||
const (
|
||||
// TypeReady resources are believed to be ready to handle work.
|
||||
TypeReady ConditionType = "Ready"
|
||||
|
||||
// TypeSynced resources are believed to be in sync with the
|
||||
// Kubernetes resources that manage their lifecycle.
|
||||
TypeSynced ConditionType = "Synced"
|
||||
)
|
||||
|
||||
// A ConditionReason represents the reason a resource is in a condition.
|
||||
// nolint:golint
|
||||
type ConditionReason string
|
||||
|
||||
// Reasons a resource is or is not ready.
|
||||
const (
|
||||
ReasonAvailable ConditionReason = "Available"
|
||||
ReasonUnavailable ConditionReason = "Unavailable"
|
||||
ReasonCreating ConditionReason = "Creating"
|
||||
ReasonDeleting ConditionReason = "Deleting"
|
||||
)
|
||||
|
||||
// Reasons a resource is or is not synced.
|
||||
const (
|
||||
ReasonReconcileSuccess ConditionReason = "ReconcileSuccess"
|
||||
ReasonReconcileError ConditionReason = "ReconcileError"
|
||||
)
|
||||
|
||||
// A Condition that may apply to a resource.
|
||||
type Condition struct {
|
||||
// Type of this condition. At most one of each condition type may apply to
|
||||
// a resource at any point in time.
|
||||
Type ConditionType `json:"type"`
|
||||
|
||||
// Status of this condition; is it currently True, False, or Unknown?
|
||||
Status corev1.ConditionStatus `json:"status"`
|
||||
|
||||
// LastTransitionTime is the last time this condition transitioned from one
|
||||
// status to another.
|
||||
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
|
||||
|
||||
// A Reason for this condition's last transition from one status to another.
|
||||
Reason ConditionReason `json:"reason"`
|
||||
|
||||
// A Message containing details about this condition's last transition from
|
||||
// one status to another, if any.
|
||||
// +optional
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Equal returns true if the condition is identical to the supplied condition,
|
||||
// ignoring the LastTransitionTime.
|
||||
func (c Condition) Equal(other Condition) bool {
|
||||
return c.Type == other.Type &&
|
||||
c.Status == other.Status &&
|
||||
c.Reason == other.Reason &&
|
||||
c.Message == other.Message
|
||||
}
|
||||
|
||||
// WithMessage returns a condition by adding the provided message to existing
|
||||
// condition.
|
||||
func (c Condition) WithMessage(msg string) Condition {
|
||||
c.Message = msg
|
||||
return c
|
||||
}
|
||||
|
||||
// NOTE(negz): Conditions are implemented as a slice rather than a map to comply
|
||||
// with Kubernetes API conventions. Ideally we'd comply by using a map that
|
||||
// marshalled to a JSON array, but doing so confuses the CRD schema generator.
|
||||
// https://github.com/kubernetes/community/blob/9bf8cd/contributors/devel/sig-architecture/api-conventions.md#lists-of-named-subobjects-preferred-over-maps
|
||||
|
||||
// NOTE(negz): Do not manipulate Conditions directly. Use the Set method.
|
||||
|
||||
// A ConditionedStatus reflects the observed status of a resource. Only
|
||||
// one condition of each type may exist.
|
||||
type ConditionedStatus struct {
|
||||
// Conditions of the resource.
|
||||
// +optional
|
||||
Conditions []Condition `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// NewConditionedStatus returns a stat with the supplied conditions set.
|
||||
func NewConditionedStatus(c ...Condition) *ConditionedStatus {
|
||||
s := &ConditionedStatus{}
|
||||
s.SetConditions(c...)
|
||||
return s
|
||||
}
|
||||
|
||||
// GetCondition returns the condition for the given ConditionType if exists,
|
||||
// otherwise returns nil
|
||||
func (s *ConditionedStatus) GetCondition(ct ConditionType) Condition {
|
||||
for _, c := range s.Conditions {
|
||||
if c.Type == ct {
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
return Condition{Type: ct, Status: corev1.ConditionUnknown}
|
||||
}
|
||||
|
||||
// SetConditions sets the supplied conditions, replacing any existing conditions
|
||||
// of the same type. This is a no-op if all supplied conditions are identical,
|
||||
// ignoring the last transition time, to those already set.
|
||||
func (s *ConditionedStatus) SetConditions(c ...Condition) {
|
||||
for _, new := range c {
|
||||
exists := false
|
||||
for i, existing := range s.Conditions {
|
||||
if existing.Type != new.Type {
|
||||
continue
|
||||
}
|
||||
|
||||
if existing.Equal(new) {
|
||||
exists = true
|
||||
continue
|
||||
}
|
||||
|
||||
s.Conditions[i] = new
|
||||
exists = true
|
||||
}
|
||||
if !exists {
|
||||
s.Conditions = append(s.Conditions, new)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Equal returns true if the status is identical to the supplied status,
|
||||
// ignoring the LastTransitionTimes and order of statuses.
|
||||
func (s *ConditionedStatus) Equal(other *ConditionedStatus) bool {
|
||||
if s == nil || other == nil {
|
||||
return s == nil && other == nil
|
||||
}
|
||||
|
||||
if len(other.Conditions) != len(s.Conditions) {
|
||||
return false
|
||||
}
|
||||
|
||||
sc := make([]Condition, len(s.Conditions))
|
||||
copy(sc, s.Conditions)
|
||||
|
||||
oc := make([]Condition, len(other.Conditions))
|
||||
copy(oc, other.Conditions)
|
||||
|
||||
// We should not have more than one condition of each type.
|
||||
sort.Slice(sc, func(i, j int) bool { return sc[i].Type < sc[j].Type })
|
||||
sort.Slice(oc, func(i, j int) bool { return oc[i].Type < oc[j].Type })
|
||||
|
||||
for i := range sc {
|
||||
if !sc[i].Equal(oc[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// Creating returns a condition that indicates the resource is currently
|
||||
// being created.
|
||||
func Creating() Condition {
|
||||
return Condition{
|
||||
Type: TypeReady,
|
||||
Status: corev1.ConditionFalse,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: ReasonCreating,
|
||||
}
|
||||
}
|
||||
|
||||
// Deleting returns a condition that indicates the resource is currently
|
||||
// being deleted.
|
||||
func Deleting() Condition {
|
||||
return Condition{
|
||||
Type: TypeReady,
|
||||
Status: corev1.ConditionFalse,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: ReasonDeleting,
|
||||
}
|
||||
}
|
||||
|
||||
// Available returns a condition that indicates the resource is
|
||||
// currently observed to be available for use.
|
||||
func Available() Condition {
|
||||
return Condition{
|
||||
Type: TypeReady,
|
||||
Status: corev1.ConditionTrue,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: ReasonAvailable,
|
||||
}
|
||||
}
|
||||
|
||||
// Unavailable returns a condition that indicates the resource is not
|
||||
// currently available for use. Unavailable should be set only when Crossplane
|
||||
// expects the resource to be available but knows it is not, for example
|
||||
// because its API reports it is unhealthy.
|
||||
func Unavailable() Condition {
|
||||
return Condition{
|
||||
Type: TypeReady,
|
||||
Status: corev1.ConditionFalse,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: ReasonUnavailable,
|
||||
}
|
||||
}
|
||||
|
||||
// ReconcileSuccess returns a condition indicating that Crossplane successfully
|
||||
// completed the most recent reconciliation of the resource.
|
||||
func ReconcileSuccess() Condition {
|
||||
return Condition{
|
||||
Type: TypeSynced,
|
||||
Status: corev1.ConditionTrue,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: ReasonReconcileSuccess,
|
||||
}
|
||||
}
|
||||
|
||||
// ReconcileError returns a condition indicating that Crossplane encountered an
|
||||
// error while reconciling the resource. This could mean Crossplane was
|
||||
// unable to update the resource to reflect its desired state, or that
|
||||
// Crossplane was unable to determine the current actual state of the resource.
|
||||
func ReconcileError(err error) Condition {
|
||||
return Condition{
|
||||
Type: TypeSynced,
|
||||
Status: corev1.ConditionFalse,
|
||||
LastTransitionTime: metav1.Now(),
|
||||
Reason: ReasonReconcileError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
|
||||
// ReadyCondition generate ready condition for conditionType
|
||||
func ReadyCondition(tpy string) Condition {
|
||||
return Condition{
|
||||
Type: ConditionType(tpy),
|
||||
Status: corev1.ConditionTrue,
|
||||
Reason: ReasonAvailable,
|
||||
LastTransitionTime: metav1.NewTime(time.Now()),
|
||||
}
|
||||
}
|
||||
|
||||
// ErrorCondition generate error condition for conditionType and error
|
||||
func ErrorCondition(tpy string, err error) Condition {
|
||||
return Condition{
|
||||
Type: ConditionType(tpy),
|
||||
Status: corev1.ConditionFalse,
|
||||
LastTransitionTime: metav1.NewTime(time.Now()),
|
||||
Reason: ReasonReconcileError,
|
||||
Message: err.Error(),
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
// This file is originally from https://github.com/crossplane/crossplane-runtime/blob/master/apis/common/v1/condition_test.go
|
||||
// We copy it here to reduce dependency
|
||||
|
||||
/*
|
||||
Copyright 2019 The Crossplane 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 condition
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/pkg/errors"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
func TestConditionEqual(t *testing.T) {
|
||||
cases := map[string]struct {
|
||||
a Condition
|
||||
b Condition
|
||||
want bool
|
||||
}{
|
||||
"IdenticalIgnoringTimestamp": {
|
||||
a: Condition{Type: TypeReady, LastTransitionTime: metav1.Now()},
|
||||
b: Condition{Type: TypeReady, LastTransitionTime: metav1.Now()},
|
||||
want: true,
|
||||
},
|
||||
"DifferentType": {
|
||||
a: Condition{Type: TypeReady},
|
||||
b: Condition{Type: TypeSynced},
|
||||
want: false,
|
||||
},
|
||||
"DifferentStatus": {
|
||||
a: Condition{Status: corev1.ConditionTrue},
|
||||
b: Condition{Status: corev1.ConditionFalse},
|
||||
want: false,
|
||||
},
|
||||
"DifferentReason": {
|
||||
a: Condition{Reason: ReasonCreating},
|
||||
b: Condition{Reason: ReasonDeleting},
|
||||
want: false,
|
||||
},
|
||||
"DifferentMessage": {
|
||||
a: Condition{Message: "cool"},
|
||||
b: Condition{Message: "uncool"},
|
||||
want: false,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
got := tc.a.Equal(tc.b)
|
||||
|
||||
if diff := cmp.Diff(tc.want, got); diff != "" {
|
||||
t.Errorf("a.Equal(b): -want, +got:\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConditionedStatusEqual(t *testing.T) {
|
||||
cases := map[string]struct {
|
||||
a *ConditionedStatus
|
||||
b *ConditionedStatus
|
||||
want bool
|
||||
}{
|
||||
"Identical": {
|
||||
a: NewConditionedStatus(Available(), ReconcileSuccess()),
|
||||
b: NewConditionedStatus(Available(), ReconcileSuccess()),
|
||||
want: true,
|
||||
},
|
||||
"IdenticalExceptOrder": {
|
||||
a: NewConditionedStatus(Unavailable(), ReconcileSuccess()),
|
||||
b: NewConditionedStatus(ReconcileSuccess(), Unavailable()),
|
||||
want: true,
|
||||
},
|
||||
"DifferentLength": {
|
||||
a: NewConditionedStatus(Available(), ReconcileSuccess()),
|
||||
b: NewConditionedStatus(ReconcileSuccess()),
|
||||
want: false,
|
||||
},
|
||||
"DifferentCondition": {
|
||||
a: NewConditionedStatus(Creating(), ReconcileSuccess()),
|
||||
b: NewConditionedStatus(Creating(), ReconcileError(errors.New("boom"))),
|
||||
want: false,
|
||||
},
|
||||
"AIsNil": {
|
||||
a: nil,
|
||||
b: NewConditionedStatus(Deleting(), ReconcileSuccess()),
|
||||
want: false,
|
||||
},
|
||||
"BIsNil": {
|
||||
a: NewConditionedStatus(Available(), ReconcileSuccess()),
|
||||
b: nil,
|
||||
want: false,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
got := tc.a.Equal(tc.b)
|
||||
|
||||
if diff := cmp.Diff(tc.want, got); diff != "" {
|
||||
t.Errorf("a.Equal(b): -want, +got:\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetConditions(t *testing.T) {
|
||||
cases := map[string]struct {
|
||||
cs *ConditionedStatus
|
||||
c []Condition
|
||||
want *ConditionedStatus
|
||||
}{
|
||||
"TypeIsIdentical": {
|
||||
cs: NewConditionedStatus(Available()),
|
||||
c: []Condition{Available()},
|
||||
want: NewConditionedStatus(Available()),
|
||||
},
|
||||
"TypeIsDifferent": {
|
||||
cs: NewConditionedStatus(Creating()),
|
||||
c: []Condition{Available()},
|
||||
want: NewConditionedStatus(Available()),
|
||||
},
|
||||
"TypeDoesNotExist": {
|
||||
cs: NewConditionedStatus(ReconcileSuccess()),
|
||||
c: []Condition{Available()},
|
||||
want: NewConditionedStatus(ReconcileSuccess(), Available()),
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
tc.cs.SetConditions(tc.c...)
|
||||
|
||||
got := tc.cs
|
||||
if diff := cmp.Diff(tc.want, got); diff != "" {
|
||||
t.Errorf("tc.cs.SetConditions(...): -want, +got:\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetCondition(t *testing.T) {
|
||||
cases := map[string]struct {
|
||||
cs *ConditionedStatus
|
||||
t ConditionType
|
||||
want Condition
|
||||
}{
|
||||
"ConditionExists": {
|
||||
cs: NewConditionedStatus(Available()),
|
||||
t: TypeReady,
|
||||
want: Available(),
|
||||
},
|
||||
"ConditionDoesNotExist": {
|
||||
cs: NewConditionedStatus(Available()),
|
||||
t: TypeSynced,
|
||||
want: Condition{
|
||||
Type: TypeSynced,
|
||||
Status: corev1.ConditionUnknown,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
got := tc.cs.GetCondition(tc.t)
|
||||
if diff := cmp.Diff(tc.want, got); diff != "" {
|
||||
t.Errorf("tc.cs.GetConditions(...): -want, +got:\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestConditionWithMessage(t *testing.T) {
|
||||
testMsg := "Something went wrong on cloud side"
|
||||
cases := map[string]struct {
|
||||
c Condition
|
||||
msg string
|
||||
want Condition
|
||||
}{
|
||||
"MessageAdded": {
|
||||
c: Condition{Type: TypeReady, Reason: ReasonUnavailable},
|
||||
msg: testMsg,
|
||||
want: Condition{Type: TypeReady, Reason: ReasonUnavailable, Message: testMsg},
|
||||
},
|
||||
"MessageChanged": {
|
||||
c: Condition{Type: TypeReady, Reason: ReasonUnavailable, Message: "Some other message"},
|
||||
msg: testMsg,
|
||||
want: Condition{Type: TypeReady, Reason: ReasonUnavailable, Message: testMsg},
|
||||
},
|
||||
"MessageCleared": {
|
||||
c: Condition{Type: TypeReady, Reason: ReasonUnavailable, Message: testMsg},
|
||||
msg: "",
|
||||
want: Condition{Type: TypeReady, Reason: ReasonUnavailable},
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
got := tc.c.WithMessage(tc.msg)
|
||||
|
||||
if diff := cmp.Diff(tc.want, got); diff != "" {
|
||||
t.Errorf("a.Equal(b): -want, +got:\n%s", diff)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,19 +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 condition contains condition types
|
||||
// +kubebuilder:object:generate=true
|
||||
package condition
|
||||
@@ -1,60 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package condition
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Condition) DeepCopyInto(out *Condition) {
|
||||
*out = *in
|
||||
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
|
||||
func (in *Condition) DeepCopy() *Condition {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Condition)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ConditionedStatus) DeepCopyInto(out *ConditionedStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]Condition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConditionedStatus.
|
||||
func (in *ConditionedStatus) DeepCopy() *ConditionedStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ConditionedStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -20,14 +20,12 @@ package core_oam_dev
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha1"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha2"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Register the types with the Scheme so the resources can map objects to GroupVersionKinds and back
|
||||
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme, v1alpha2.SchemeBuilder.AddToScheme, v1beta1.SchemeBuilder.AddToScheme)
|
||||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme)
|
||||
}
|
||||
|
||||
// AddToSchemes may be used to add all resources defined in the project to a Scheme
|
||||
|
||||
@@ -1,61 +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 v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
)
|
||||
|
||||
const (
|
||||
// ApplyOncePolicyType refers to the type of configuration drift policy
|
||||
ApplyOncePolicyType = "apply-once"
|
||||
)
|
||||
|
||||
// ApplyOncePolicySpec defines the spec of preventing configuration drift
|
||||
type ApplyOncePolicySpec struct {
|
||||
Enable bool `json:"enable"`
|
||||
// +optional
|
||||
Rules []ApplyOncePolicyRule `json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
// ApplyOncePolicyRule defines a single apply-once policy rule
|
||||
type ApplyOncePolicyRule struct {
|
||||
// +optional
|
||||
Selector ResourcePolicyRuleSelector `json:"selector,omitempty"`
|
||||
// +optional
|
||||
Strategy *ApplyOnceStrategy `json:"strategy,omitempty"`
|
||||
}
|
||||
|
||||
// ApplyOnceStrategy the strategy for resource path to allow configuration drift
|
||||
type ApplyOnceStrategy struct {
|
||||
// Path the specified path that allow configuration drift
|
||||
// like 'spec.template.spec.containers[0].resources' and '*' means the whole target allow configuration drift
|
||||
Path []string `json:"path"`
|
||||
}
|
||||
|
||||
// FindStrategy find apply-once strategy for target resource
|
||||
func (in ApplyOncePolicySpec) FindStrategy(manifest *unstructured.Unstructured) *ApplyOnceStrategy {
|
||||
if !in.Enable {
|
||||
return nil
|
||||
}
|
||||
for _, rule := range in.Rules {
|
||||
if rule.Selector.Match(manifest) {
|
||||
return rule.Strategy
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,76 +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 v1alpha1
|
||||
|
||||
const (
|
||||
// RefObjectsComponentType refers to the type of ref-objects
|
||||
RefObjectsComponentType = "ref-objects"
|
||||
)
|
||||
|
||||
// RefObjectsComponentSpec defines the spec of ref-objects component
|
||||
type RefObjectsComponentSpec struct {
|
||||
// Objects the referrers to the Kubernetes objects
|
||||
Objects []ObjectReferrer `json:"objects,omitempty"`
|
||||
// URLs are the links that stores the referred objects
|
||||
URLs []string `json:"urls,omitempty"`
|
||||
}
|
||||
|
||||
// ObjectReferrer selects Kubernetes objects
|
||||
type ObjectReferrer struct {
|
||||
// ObjectTypeIdentifier identifies the type of referred objects
|
||||
ObjectTypeIdentifier `json:",inline"`
|
||||
// ObjectSelector select object by name or labelSelector
|
||||
ObjectSelector `json:",inline"`
|
||||
}
|
||||
|
||||
// ObjectTypeIdentifier identifies the scheme of Kubernetes object
|
||||
type ObjectTypeIdentifier struct {
|
||||
// Resource is the resource name of the Kubernetes object.
|
||||
Resource string `json:"resource"`
|
||||
// Group is the API Group of the Kubernetes object.
|
||||
Group string `json:"group"`
|
||||
// LegacyObjectTypeIdentifier is the legacy identifier
|
||||
// Deprecated: use resource/group instead
|
||||
LegacyObjectTypeIdentifier `json:",inline"`
|
||||
}
|
||||
|
||||
// LegacyObjectTypeIdentifier legacy object type identifier
|
||||
type LegacyObjectTypeIdentifier struct {
|
||||
// APIVersion is the APIVersion of the Kubernetes object.
|
||||
APIVersion string `json:"apiVersion"`
|
||||
// APIVersion is the Kind of the Kubernetes object.
|
||||
Kind string `json:"kind"`
|
||||
}
|
||||
|
||||
// ObjectSelector selector for Kubernetes object
|
||||
type ObjectSelector struct {
|
||||
// Name is the name of the Kubernetes object.
|
||||
// If empty, it will inherit the application component's name.
|
||||
Name string `json:"name,omitempty"`
|
||||
// Namespace is the namespace for selecting Kubernetes objects.
|
||||
// If empty, it will inherit the application's namespace.
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
// Cluster is the cluster for selecting Kubernetes objects.
|
||||
// If empty, it will use the local cluster
|
||||
Cluster string `json:"cluster,omitempty"`
|
||||
// LabelSelector selects Kubernetes objects by labels
|
||||
// Exclusive to "name"
|
||||
LabelSelector map[string]string `json:"labelSelector,omitempty"`
|
||||
// DeprecatedLabelSelector a deprecated alias to LabelSelector
|
||||
// Deprecated: use labelSelector instead.
|
||||
DeprecatedLabelSelector map[string]string `json:"selector,omitempty"`
|
||||
}
|
||||
@@ -1,22 +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 v1alpha1 contains resources relating to the Open Application Model.
|
||||
// See https://github.com/oam-dev/spec for more details.
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=core.oam.dev
|
||||
// +versionName=v1alpha1
|
||||
package v1alpha1
|
||||
@@ -1,142 +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 v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
const (
|
||||
// EnvBindingPolicyType refers to the type of EnvBinding
|
||||
EnvBindingPolicyType = "env-binding"
|
||||
)
|
||||
|
||||
// EnvTraitPatch is the patch to trait
|
||||
type EnvTraitPatch struct {
|
||||
Type string `json:"type"`
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
Disable bool `json:"disable,omitempty"`
|
||||
}
|
||||
|
||||
// ToApplicationTrait convert EnvTraitPatch into ApplicationTrait
|
||||
func (in *EnvTraitPatch) ToApplicationTrait() *common.ApplicationTrait {
|
||||
out := &common.ApplicationTrait{Type: in.Type}
|
||||
if in.Properties != nil {
|
||||
out.Properties = in.Properties.DeepCopy()
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// EnvComponentPatch is the patch to component
|
||||
type EnvComponentPatch struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
Traits []EnvTraitPatch `json:"traits,omitempty"`
|
||||
ExternalRevision string `json:"externalRevision,omitempty"`
|
||||
}
|
||||
|
||||
// ToApplicationComponent convert EnvComponentPatch into ApplicationComponent
|
||||
func (in *EnvComponentPatch) ToApplicationComponent() *common.ApplicationComponent {
|
||||
out := &common.ApplicationComponent{
|
||||
Name: in.Name,
|
||||
Type: in.Type,
|
||||
}
|
||||
if in.Properties != nil {
|
||||
out.Properties = in.Properties.DeepCopy()
|
||||
}
|
||||
if in.Traits != nil {
|
||||
for _, trait := range in.Traits {
|
||||
if !trait.Disable {
|
||||
out.Traits = append(out.Traits, *trait.ToApplicationTrait())
|
||||
}
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// EnvPatch specify the parameter configuration for different environments
|
||||
type EnvPatch struct {
|
||||
Components []EnvComponentPatch `json:"components,omitempty"`
|
||||
}
|
||||
|
||||
// NamespaceSelector defines the rules to select a Namespace resource.
|
||||
// Either name or labels is needed.
|
||||
type NamespaceSelector struct {
|
||||
// Name is the name of the namespace.
|
||||
Name string `json:"name,omitempty"`
|
||||
// Labels defines the label selector to select the namespace.
|
||||
Labels map[string]string `json:"labels,omitempty"`
|
||||
}
|
||||
|
||||
// EnvPlacement defines the placement rules for an app.
|
||||
type EnvPlacement struct {
|
||||
ClusterSelector *common.ClusterSelector `json:"clusterSelector,omitempty"`
|
||||
NamespaceSelector *NamespaceSelector `json:"namespaceSelector,omitempty"`
|
||||
}
|
||||
|
||||
// EnvSelector defines which components should this env contains
|
||||
type EnvSelector struct {
|
||||
Components []string `json:"components,omitempty"`
|
||||
}
|
||||
|
||||
// EnvConfig is the configuration for different environments.
|
||||
type EnvConfig struct {
|
||||
Name string `json:"name"`
|
||||
Placement EnvPlacement `json:"placement,omitempty"`
|
||||
Selector *EnvSelector `json:"selector,omitempty"`
|
||||
Patch EnvPatch `json:"patch,omitempty"`
|
||||
}
|
||||
|
||||
// EnvBindingSpec defines a list of envs
|
||||
type EnvBindingSpec struct {
|
||||
Envs []EnvConfig `json:"envs"`
|
||||
}
|
||||
|
||||
// PlacementDecision describes the placement of one application instance
|
||||
type PlacementDecision struct {
|
||||
Cluster string `json:"cluster"`
|
||||
Namespace string `json:"namespace"`
|
||||
}
|
||||
|
||||
// String encode placement decision
|
||||
func (in PlacementDecision) String() string {
|
||||
if in.Namespace == "" {
|
||||
return in.Cluster
|
||||
}
|
||||
return in.Cluster + "/" + in.Namespace
|
||||
}
|
||||
|
||||
// EnvStatus records the status of one env
|
||||
type EnvStatus struct {
|
||||
Env string `json:"env"`
|
||||
Placements []PlacementDecision `json:"placements"`
|
||||
}
|
||||
|
||||
// ClusterConnection records the connection with clusters and the last active app revision when they are active (still be used)
|
||||
type ClusterConnection struct {
|
||||
ClusterName string `json:"clusterName"`
|
||||
LastActiveRevision string `json:"lastActiveRevision"`
|
||||
}
|
||||
|
||||
// EnvBindingStatus records the status of all env
|
||||
type EnvBindingStatus struct {
|
||||
Envs []EnvStatus `json:"envs"`
|
||||
ClusterConnections []ClusterConnection `json:"clusterConnections"`
|
||||
}
|
||||
@@ -1,75 +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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// Policy is the Schema for the policy API
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:printcolumn:name="TYPE",type=string,JSONPath=`.type`
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type Policy struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Type string `json:"type"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// PolicyList contains a list of Policy
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PolicyList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Policy `json:"items"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// Workflow is the Schema for the policy API
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type Workflow struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Steps []common.WorkflowStep `json:"steps,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// WorkflowList contains a list of Workflow
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type WorkflowList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Workflow `json:"items"`
|
||||
}
|
||||
@@ -1,134 +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 v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/utils/pointer"
|
||||
"k8s.io/utils/strings/slices"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
const (
|
||||
// GarbageCollectPolicyType refers to the type of garbage-collect
|
||||
GarbageCollectPolicyType = "garbage-collect"
|
||||
)
|
||||
|
||||
// GarbageCollectPolicySpec defines the spec of configuration drift
|
||||
type GarbageCollectPolicySpec struct {
|
||||
// KeepLegacyResource if is set, outdated versioned resourcetracker will not be recycled automatically
|
||||
// outdated resources will be kept until resourcetracker be deleted manually
|
||||
KeepLegacyResource bool `json:"keepLegacyResource,omitempty"`
|
||||
|
||||
// Order defines the order of garbage collect
|
||||
Order GarbageCollectOrder `json:"order,omitempty"`
|
||||
|
||||
// Rules defines list of rules to control gc strategy at resource level
|
||||
// if one resource is controlled by multiple rules, first rule will be used
|
||||
Rules []GarbageCollectPolicyRule `json:"rules,omitempty"`
|
||||
}
|
||||
|
||||
// GarbageCollectOrder is the order of garbage collect
|
||||
type GarbageCollectOrder string
|
||||
|
||||
const (
|
||||
// OrderDependency is the order of dependency
|
||||
OrderDependency GarbageCollectOrder = "dependency"
|
||||
)
|
||||
|
||||
// GarbageCollectPolicyRule defines a single garbage-collect policy rule
|
||||
type GarbageCollectPolicyRule struct {
|
||||
Selector ResourcePolicyRuleSelector `json:"selector"`
|
||||
Strategy GarbageCollectStrategy `json:"strategy"`
|
||||
}
|
||||
|
||||
// ResourcePolicyRuleSelector select the targets of the rule
|
||||
// if multiple conditions are specified, combination logic is AND
|
||||
type ResourcePolicyRuleSelector struct {
|
||||
CompNames []string `json:"componentNames,omitempty"`
|
||||
CompTypes []string `json:"componentTypes,omitempty"`
|
||||
OAMResourceTypes []string `json:"oamTypes,omitempty"`
|
||||
TraitTypes []string `json:"traitTypes,omitempty"`
|
||||
ResourceTypes []string `json:"resourceTypes,omitempty"`
|
||||
ResourceNames []string `json:"resourceNames,omitempty"`
|
||||
}
|
||||
|
||||
// Match check if current rule selector match the target resource
|
||||
// If at least one condition is matched and no other condition failed (could be empty), return true
|
||||
// Otherwise, return false
|
||||
func (in *ResourcePolicyRuleSelector) Match(manifest *unstructured.Unstructured) bool {
|
||||
var compName, compType, oamType, traitType, resourceType, resourceName string
|
||||
if labels := manifest.GetLabels(); labels != nil {
|
||||
compName = labels[oam.LabelAppComponent]
|
||||
compType = labels[oam.WorkloadTypeLabel]
|
||||
oamType = labels[oam.LabelOAMResourceType]
|
||||
traitType = labels[oam.TraitTypeLabel]
|
||||
}
|
||||
resourceType = manifest.GetKind()
|
||||
resourceName = manifest.GetName()
|
||||
match := func(src []string, val string) (found *bool) {
|
||||
if len(src) == 0 {
|
||||
return nil
|
||||
}
|
||||
return pointer.Bool(val != "" && slices.Contains(src, val))
|
||||
}
|
||||
conditions := []*bool{
|
||||
match(in.CompNames, compName),
|
||||
match(in.CompTypes, compType),
|
||||
match(in.OAMResourceTypes, oamType),
|
||||
match(in.TraitTypes, traitType),
|
||||
match(in.ResourceTypes, resourceType),
|
||||
match(in.ResourceNames, resourceName),
|
||||
}
|
||||
hasMatched := false
|
||||
for _, cond := range conditions {
|
||||
// if any non-empty condition failed, return false
|
||||
if cond != nil && !*cond {
|
||||
return false
|
||||
}
|
||||
// if condition succeed, record it
|
||||
if cond != nil && *cond {
|
||||
hasMatched = true
|
||||
}
|
||||
}
|
||||
// if at least one condition is met, return true
|
||||
return hasMatched
|
||||
}
|
||||
|
||||
// GarbageCollectStrategy the strategy for target resource to recycle
|
||||
type GarbageCollectStrategy string
|
||||
|
||||
const (
|
||||
// GarbageCollectStrategyNever do not recycle target resource, leave it
|
||||
GarbageCollectStrategyNever GarbageCollectStrategy = "never"
|
||||
// GarbageCollectStrategyOnAppDelete do not recycle target resource until application is deleted
|
||||
// this means the resource will be kept even it is not used in the latest version
|
||||
GarbageCollectStrategyOnAppDelete GarbageCollectStrategy = "onAppDelete"
|
||||
// GarbageCollectStrategyOnAppUpdate recycle target resource when it is not inUse
|
||||
GarbageCollectStrategyOnAppUpdate GarbageCollectStrategy = "onAppUpdate"
|
||||
)
|
||||
|
||||
// FindStrategy find gc strategy for target resource
|
||||
func (in GarbageCollectPolicySpec) FindStrategy(manifest *unstructured.Unstructured) *GarbageCollectStrategy {
|
||||
for _, rule := range in.Rules {
|
||||
if rule.Selector.Match(manifest) {
|
||||
return &rule.Strategy
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,137 +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 v1alpha1
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
func TestGarbageCollectPolicySpec_FindStrategy(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
rules []GarbageCollectPolicyRule
|
||||
input *unstructured.Unstructured
|
||||
notFound bool
|
||||
expectStrategy GarbageCollectStrategy
|
||||
}{
|
||||
"trait type rule match": {
|
||||
rules: []GarbageCollectPolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{TraitTypes: []string{"a"}},
|
||||
Strategy: GarbageCollectStrategyNever,
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"labels": map[string]interface{}{oam.TraitTypeLabel: "a"},
|
||||
},
|
||||
}},
|
||||
expectStrategy: GarbageCollectStrategyNever,
|
||||
},
|
||||
"trait type rule mismatch": {
|
||||
rules: []GarbageCollectPolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{TraitTypes: []string{"a"}},
|
||||
Strategy: GarbageCollectStrategyNever,
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{}},
|
||||
notFound: true,
|
||||
},
|
||||
"trait type rule multiple match": {
|
||||
rules: []GarbageCollectPolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{TraitTypes: []string{"a"}},
|
||||
Strategy: GarbageCollectStrategyOnAppDelete,
|
||||
}, {
|
||||
Selector: ResourcePolicyRuleSelector{TraitTypes: []string{"a"}},
|
||||
Strategy: GarbageCollectStrategyNever,
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"labels": map[string]interface{}{oam.TraitTypeLabel: "a"},
|
||||
},
|
||||
}},
|
||||
expectStrategy: GarbageCollectStrategyOnAppDelete,
|
||||
},
|
||||
"component type rule match": {
|
||||
rules: []GarbageCollectPolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{CompTypes: []string{"comp"}},
|
||||
Strategy: GarbageCollectStrategyNever,
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"labels": map[string]interface{}{oam.WorkloadTypeLabel: "comp"},
|
||||
},
|
||||
}},
|
||||
expectStrategy: GarbageCollectStrategyNever,
|
||||
},
|
||||
"rule match both component type and trait type, component type first": {
|
||||
rules: []GarbageCollectPolicyRule{
|
||||
{
|
||||
Selector: ResourcePolicyRuleSelector{CompTypes: []string{"comp"}},
|
||||
Strategy: GarbageCollectStrategyNever,
|
||||
},
|
||||
{
|
||||
Selector: ResourcePolicyRuleSelector{TraitTypes: []string{"trait"}},
|
||||
Strategy: GarbageCollectStrategyOnAppDelete,
|
||||
},
|
||||
},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"labels": map[string]interface{}{oam.WorkloadTypeLabel: "comp", oam.TraitTypeLabel: "trait"},
|
||||
},
|
||||
}},
|
||||
expectStrategy: GarbageCollectStrategyNever,
|
||||
},
|
||||
"component name rule match": {
|
||||
rules: []GarbageCollectPolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{CompNames: []string{"comp-name"}},
|
||||
Strategy: GarbageCollectStrategyNever,
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"labels": map[string]interface{}{oam.LabelAppComponent: "comp-name"},
|
||||
},
|
||||
}},
|
||||
expectStrategy: GarbageCollectStrategyNever,
|
||||
},
|
||||
"resource type rule match": {
|
||||
rules: []GarbageCollectPolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{OAMResourceTypes: []string{"TRAIT"}},
|
||||
Strategy: GarbageCollectStrategyNever,
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"labels": map[string]interface{}{oam.LabelOAMResourceType: "TRAIT"},
|
||||
},
|
||||
}},
|
||||
expectStrategy: GarbageCollectStrategyNever,
|
||||
},
|
||||
}
|
||||
for name, tc := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
r := require.New(t)
|
||||
spec := GarbageCollectPolicySpec{Rules: tc.rules}
|
||||
strategy := spec.FindStrategy(tc.input)
|
||||
if tc.notFound {
|
||||
r.Nil(strategy)
|
||||
} else {
|
||||
r.Equal(tc.expectStrategy, *strategy)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,79 +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 v1alpha1
|
||||
|
||||
import "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
const (
|
||||
// TopologyPolicyType refers to the type of topology policy
|
||||
TopologyPolicyType = "topology"
|
||||
// OverridePolicyType refers to the type of override policy
|
||||
OverridePolicyType = "override"
|
||||
// DebugPolicyType refers to the type of debug policy
|
||||
DebugPolicyType = "debug"
|
||||
// SharedResourcePolicyType refers to the type of shared resource policy
|
||||
SharedResourcePolicyType = "shared-resource"
|
||||
)
|
||||
|
||||
// TopologyPolicySpec defines the spec of topology policy
|
||||
type TopologyPolicySpec struct {
|
||||
// Placement embeds the selectors for choosing cluster
|
||||
Placement `json:",inline"`
|
||||
// Namespace is the target namespace to deploy in the selected clusters.
|
||||
// +optional
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// Placement describes which clusters to be selected in this topology
|
||||
type Placement struct {
|
||||
// Clusters is the names of the clusters to select.
|
||||
Clusters []string `json:"clusters,omitempty"`
|
||||
|
||||
// ClusterLabelSelector is the label selector for clusters.
|
||||
// Exclusive to "clusters"
|
||||
ClusterLabelSelector map[string]string `json:"clusterLabelSelector,omitempty"`
|
||||
|
||||
// DeprecatedClusterSelector is a depreciated alias for ClusterLabelSelector.
|
||||
// Deprecated: Use clusterLabelSelector instead.
|
||||
DeprecatedClusterSelector map[string]string `json:"clusterSelector,omitempty"`
|
||||
}
|
||||
|
||||
// OverridePolicySpec defines the spec of override policy
|
||||
type OverridePolicySpec struct {
|
||||
Components []EnvComponentPatch `json:"components,omitempty"`
|
||||
Selector []string `json:"selector,omitempty"`
|
||||
}
|
||||
|
||||
// SharedResourcePolicySpec defines the spec of shared-resource policy
|
||||
type SharedResourcePolicySpec struct {
|
||||
Rules []SharedResourcePolicyRule `json:"rules"`
|
||||
}
|
||||
|
||||
// SharedResourcePolicyRule defines the rule for sharing resources
|
||||
type SharedResourcePolicyRule struct {
|
||||
Selector ResourcePolicyRuleSelector `json:"selector"`
|
||||
}
|
||||
|
||||
// FindStrategy return if the target resource should be shared
|
||||
func (in SharedResourcePolicySpec) FindStrategy(manifest *unstructured.Unstructured) bool {
|
||||
for _, rule := range in.Rules {
|
||||
if rule.Selector.Match(manifest) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
Copyright 2022 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
)
|
||||
|
||||
func TestSharedResourcePolicySpec_FindStrategy(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
rules []SharedResourcePolicyRule
|
||||
input *unstructured.Unstructured
|
||||
matched bool
|
||||
}{
|
||||
"shared resource rule resourceName match": {
|
||||
rules: []SharedResourcePolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{ResourceNames: []string{"example"}},
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"metadata": map[string]interface{}{
|
||||
"name": "example",
|
||||
},
|
||||
}},
|
||||
matched: true,
|
||||
},
|
||||
"shared resource rule resourceType match": {
|
||||
rules: []SharedResourcePolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{ResourceTypes: []string{"ConfigMap", "Namespace"}},
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"kind": "Namespace",
|
||||
}},
|
||||
matched: true,
|
||||
},
|
||||
"shared resource rule mismatch": {
|
||||
rules: []SharedResourcePolicyRule{{
|
||||
Selector: ResourcePolicyRuleSelector{ResourceNames: []string{"mismatch"}},
|
||||
}},
|
||||
input: &unstructured.Unstructured{Object: map[string]interface{}{
|
||||
"kind": "Namespace",
|
||||
}},
|
||||
matched: false,
|
||||
},
|
||||
}
|
||||
for name, tc := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
r := require.New(t)
|
||||
spec := SharedResourcePolicySpec{Rules: tc.rules}
|
||||
r.Equal(tc.matched, spec.FindStrategy(tc.input))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,58 +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 v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// Package type metadata.
|
||||
const (
|
||||
Group = common.Group
|
||||
Version = "v1alpha1"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
|
||||
// AddToScheme is a global function that registers this API group & version to a scheme
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// Policy meta
|
||||
var (
|
||||
PolicyKind = "Policy"
|
||||
PolicyGroupVersionKind = SchemeGroupVersion.WithKind(PolicyKind)
|
||||
)
|
||||
|
||||
// Workflow meta
|
||||
var (
|
||||
WorkflowKind = "Workflow"
|
||||
WorkflowGroupVersionKind = SchemeGroupVersion.WithKind(WorkflowKind)
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Policy{}, &PolicyList{})
|
||||
SchemeBuilder.Register(&Workflow{}, &WorkflowList{})
|
||||
}
|
||||
@@ -1,776 +0,0 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// Code generated by controller-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplyOncePolicyRule) DeepCopyInto(out *ApplyOncePolicyRule) {
|
||||
*out = *in
|
||||
in.Selector.DeepCopyInto(&out.Selector)
|
||||
if in.Strategy != nil {
|
||||
in, out := &in.Strategy, &out.Strategy
|
||||
*out = new(ApplyOnceStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplyOncePolicyRule.
|
||||
func (in *ApplyOncePolicyRule) DeepCopy() *ApplyOncePolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplyOncePolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplyOncePolicySpec) DeepCopyInto(out *ApplyOncePolicySpec) {
|
||||
*out = *in
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]ApplyOncePolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplyOncePolicySpec.
|
||||
func (in *ApplyOncePolicySpec) DeepCopy() *ApplyOncePolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplyOncePolicySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ApplyOnceStrategy) DeepCopyInto(out *ApplyOnceStrategy) {
|
||||
*out = *in
|
||||
if in.Path != nil {
|
||||
in, out := &in.Path, &out.Path
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplyOnceStrategy.
|
||||
func (in *ApplyOnceStrategy) DeepCopy() *ApplyOnceStrategy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplyOnceStrategy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ClusterConnection) DeepCopyInto(out *ClusterConnection) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterConnection.
|
||||
func (in *ClusterConnection) DeepCopy() *ClusterConnection {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterConnection)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvBindingSpec) DeepCopyInto(out *EnvBindingSpec) {
|
||||
*out = *in
|
||||
if in.Envs != nil {
|
||||
in, out := &in.Envs, &out.Envs
|
||||
*out = make([]EnvConfig, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvBindingSpec.
|
||||
func (in *EnvBindingSpec) DeepCopy() *EnvBindingSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvBindingSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvBindingStatus) DeepCopyInto(out *EnvBindingStatus) {
|
||||
*out = *in
|
||||
if in.Envs != nil {
|
||||
in, out := &in.Envs, &out.Envs
|
||||
*out = make([]EnvStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.ClusterConnections != nil {
|
||||
in, out := &in.ClusterConnections, &out.ClusterConnections
|
||||
*out = make([]ClusterConnection, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvBindingStatus.
|
||||
func (in *EnvBindingStatus) DeepCopy() *EnvBindingStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvBindingStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvComponentPatch) DeepCopyInto(out *EnvComponentPatch) {
|
||||
*out = *in
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Traits != nil {
|
||||
in, out := &in.Traits, &out.Traits
|
||||
*out = make([]EnvTraitPatch, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvComponentPatch.
|
||||
func (in *EnvComponentPatch) DeepCopy() *EnvComponentPatch {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvComponentPatch)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvConfig) DeepCopyInto(out *EnvConfig) {
|
||||
*out = *in
|
||||
in.Placement.DeepCopyInto(&out.Placement)
|
||||
if in.Selector != nil {
|
||||
in, out := &in.Selector, &out.Selector
|
||||
*out = new(EnvSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.Patch.DeepCopyInto(&out.Patch)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvConfig.
|
||||
func (in *EnvConfig) DeepCopy() *EnvConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvPatch) DeepCopyInto(out *EnvPatch) {
|
||||
*out = *in
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]EnvComponentPatch, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvPatch.
|
||||
func (in *EnvPatch) DeepCopy() *EnvPatch {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvPatch)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvPlacement) DeepCopyInto(out *EnvPlacement) {
|
||||
*out = *in
|
||||
if in.ClusterSelector != nil {
|
||||
in, out := &in.ClusterSelector, &out.ClusterSelector
|
||||
*out = new(common.ClusterSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.NamespaceSelector != nil {
|
||||
in, out := &in.NamespaceSelector, &out.NamespaceSelector
|
||||
*out = new(NamespaceSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvPlacement.
|
||||
func (in *EnvPlacement) DeepCopy() *EnvPlacement {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvPlacement)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvSelector) DeepCopyInto(out *EnvSelector) {
|
||||
*out = *in
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvSelector.
|
||||
func (in *EnvSelector) DeepCopy() *EnvSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvStatus) DeepCopyInto(out *EnvStatus) {
|
||||
*out = *in
|
||||
if in.Placements != nil {
|
||||
in, out := &in.Placements, &out.Placements
|
||||
*out = make([]PlacementDecision, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvStatus.
|
||||
func (in *EnvStatus) DeepCopy() *EnvStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvTraitPatch) DeepCopyInto(out *EnvTraitPatch) {
|
||||
*out = *in
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvTraitPatch.
|
||||
func (in *EnvTraitPatch) DeepCopy() *EnvTraitPatch {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvTraitPatch)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GarbageCollectPolicyRule) DeepCopyInto(out *GarbageCollectPolicyRule) {
|
||||
*out = *in
|
||||
in.Selector.DeepCopyInto(&out.Selector)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollectPolicyRule.
|
||||
func (in *GarbageCollectPolicyRule) DeepCopy() *GarbageCollectPolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GarbageCollectPolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *GarbageCollectPolicySpec) DeepCopyInto(out *GarbageCollectPolicySpec) {
|
||||
*out = *in
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]GarbageCollectPolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GarbageCollectPolicySpec.
|
||||
func (in *GarbageCollectPolicySpec) DeepCopy() *GarbageCollectPolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(GarbageCollectPolicySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LegacyObjectTypeIdentifier) DeepCopyInto(out *LegacyObjectTypeIdentifier) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LegacyObjectTypeIdentifier.
|
||||
func (in *LegacyObjectTypeIdentifier) DeepCopy() *LegacyObjectTypeIdentifier {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LegacyObjectTypeIdentifier)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NamespaceSelector) DeepCopyInto(out *NamespaceSelector) {
|
||||
*out = *in
|
||||
if in.Labels != nil {
|
||||
in, out := &in.Labels, &out.Labels
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceSelector.
|
||||
func (in *NamespaceSelector) DeepCopy() *NamespaceSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(NamespaceSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ObjectReferrer) DeepCopyInto(out *ObjectReferrer) {
|
||||
*out = *in
|
||||
out.ObjectTypeIdentifier = in.ObjectTypeIdentifier
|
||||
in.ObjectSelector.DeepCopyInto(&out.ObjectSelector)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectReferrer.
|
||||
func (in *ObjectReferrer) DeepCopy() *ObjectReferrer {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ObjectReferrer)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ObjectSelector) DeepCopyInto(out *ObjectSelector) {
|
||||
*out = *in
|
||||
if in.LabelSelector != nil {
|
||||
in, out := &in.LabelSelector, &out.LabelSelector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.DeprecatedLabelSelector != nil {
|
||||
in, out := &in.DeprecatedLabelSelector, &out.DeprecatedLabelSelector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectSelector.
|
||||
func (in *ObjectSelector) DeepCopy() *ObjectSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ObjectSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ObjectTypeIdentifier) DeepCopyInto(out *ObjectTypeIdentifier) {
|
||||
*out = *in
|
||||
out.LegacyObjectTypeIdentifier = in.LegacyObjectTypeIdentifier
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ObjectTypeIdentifier.
|
||||
func (in *ObjectTypeIdentifier) DeepCopy() *ObjectTypeIdentifier {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ObjectTypeIdentifier)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OverridePolicySpec) DeepCopyInto(out *OverridePolicySpec) {
|
||||
*out = *in
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]EnvComponentPatch, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.Selector != nil {
|
||||
in, out := &in.Selector, &out.Selector
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OverridePolicySpec.
|
||||
func (in *OverridePolicySpec) DeepCopy() *OverridePolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(OverridePolicySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Placement) DeepCopyInto(out *Placement) {
|
||||
*out = *in
|
||||
if in.Clusters != nil {
|
||||
in, out := &in.Clusters, &out.Clusters
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ClusterLabelSelector != nil {
|
||||
in, out := &in.ClusterLabelSelector, &out.ClusterLabelSelector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.DeprecatedClusterSelector != nil {
|
||||
in, out := &in.DeprecatedClusterSelector, &out.DeprecatedClusterSelector
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Placement.
|
||||
func (in *Placement) DeepCopy() *Placement {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Placement)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PlacementDecision) DeepCopyInto(out *PlacementDecision) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlacementDecision.
|
||||
func (in *PlacementDecision) DeepCopy() *PlacementDecision {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PlacementDecision)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Policy) DeepCopyInto(out *Policy) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Properties != nil {
|
||||
in, out := &in.Properties, &out.Properties
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Policy.
|
||||
func (in *Policy) DeepCopy() *Policy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Policy)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Policy) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *PolicyList) DeepCopyInto(out *PolicyList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Policy, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyList.
|
||||
func (in *PolicyList) DeepCopy() *PolicyList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(PolicyList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *PolicyList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *RefObjectsComponentSpec) DeepCopyInto(out *RefObjectsComponentSpec) {
|
||||
*out = *in
|
||||
if in.Objects != nil {
|
||||
in, out := &in.Objects, &out.Objects
|
||||
*out = make([]ObjectReferrer, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.URLs != nil {
|
||||
in, out := &in.URLs, &out.URLs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RefObjectsComponentSpec.
|
||||
func (in *RefObjectsComponentSpec) DeepCopy() *RefObjectsComponentSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(RefObjectsComponentSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourcePolicyRuleSelector) DeepCopyInto(out *ResourcePolicyRuleSelector) {
|
||||
*out = *in
|
||||
if in.CompNames != nil {
|
||||
in, out := &in.CompNames, &out.CompNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.CompTypes != nil {
|
||||
in, out := &in.CompTypes, &out.CompTypes
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.OAMResourceTypes != nil {
|
||||
in, out := &in.OAMResourceTypes, &out.OAMResourceTypes
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.TraitTypes != nil {
|
||||
in, out := &in.TraitTypes, &out.TraitTypes
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceTypes != nil {
|
||||
in, out := &in.ResourceTypes, &out.ResourceTypes
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceNames != nil {
|
||||
in, out := &in.ResourceNames, &out.ResourceNames
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePolicyRuleSelector.
|
||||
func (in *ResourcePolicyRuleSelector) DeepCopy() *ResourcePolicyRuleSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourcePolicyRuleSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SharedResourcePolicyRule) DeepCopyInto(out *SharedResourcePolicyRule) {
|
||||
*out = *in
|
||||
in.Selector.DeepCopyInto(&out.Selector)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SharedResourcePolicyRule.
|
||||
func (in *SharedResourcePolicyRule) DeepCopy() *SharedResourcePolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SharedResourcePolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SharedResourcePolicySpec) DeepCopyInto(out *SharedResourcePolicySpec) {
|
||||
*out = *in
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]SharedResourcePolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SharedResourcePolicySpec.
|
||||
func (in *SharedResourcePolicySpec) DeepCopy() *SharedResourcePolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SharedResourcePolicySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TopologyPolicySpec) DeepCopyInto(out *TopologyPolicySpec) {
|
||||
*out = *in
|
||||
in.Placement.DeepCopyInto(&out.Placement)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologyPolicySpec.
|
||||
func (in *TopologyPolicySpec) DeepCopy() *TopologyPolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TopologyPolicySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Workflow) DeepCopyInto(out *Workflow) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
if in.Steps != nil {
|
||||
in, out := &in.Steps, &out.Steps
|
||||
*out = make([]common.WorkflowStep, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Workflow.
|
||||
func (in *Workflow) DeepCopy() *Workflow {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(Workflow)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *Workflow) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *WorkflowList) DeepCopyInto(out *WorkflowList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]Workflow, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowList.
|
||||
func (in *WorkflowList) DeepCopy() *WorkflowList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(WorkflowList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *WorkflowList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
81
apis/core.oam.dev/v1alpha2/appdeploy_types.go
Normal file
81
apis/core.oam.dev/v1alpha2/appdeploy_types.go
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
)
|
||||
|
||||
// ApplicationDeploymentSpec defines how to describe an upgrade between different application
|
||||
type ApplicationDeploymentSpec struct {
|
||||
// TargetApplicationName contains the name of the application that we need to upgrade to.
|
||||
// We assume that an application is immutable, thus the name alone is suffice
|
||||
TargetApplicationName string `json:"targetApplicationName"`
|
||||
|
||||
// SourceApplicationName contains the name of the application that we need to upgrade from.
|
||||
// it can be empty only when it's the first time to deploy the application
|
||||
SourceApplicationName string `json:"sourceApplicationName,omitempty"`
|
||||
|
||||
// The list of component to upgrade in the application.
|
||||
// We only support single component application so far
|
||||
// TODO: (RZ) Support multiple components in an application
|
||||
// +optional
|
||||
ComponentList []string `json:"componentList,omitempty"`
|
||||
|
||||
// RolloutPlan is the details on how to rollout the resources
|
||||
RolloutPlan v1alpha1.RolloutPlan `json:"rolloutPlan"`
|
||||
|
||||
// RevertOnDelete revert the rollout when the rollout CR is deleted, default is false
|
||||
// It will remove the target application from the kubernetes
|
||||
// +optional
|
||||
RevertOnDelete *bool `json:"revertOnDelete,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationDeploymentStatus defines the observed state of ApplicationDeployment
|
||||
type ApplicationDeploymentStatus struct {
|
||||
v1alpha1.RolloutStatus `json:",inline"`
|
||||
|
||||
// LastTargetApplicationName contains the name of the application that we upgraded to
|
||||
// We will restart the rollout if this is not the same as the spec
|
||||
LastTargetApplicationName string `json:"lastTargetApplicationName"`
|
||||
|
||||
// LastSourceApplicationName contains the name of the application that we need to upgrade from.
|
||||
// We will restart the rollout if this is not the same as the spec
|
||||
LastSourceApplicationName string `json:"lastSourceApplicationName,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationDeployment is the Schema for the ApplicationDeployment API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ApplicationDeployment struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationDeploymentSpec `json:"spec,omitempty"`
|
||||
Status ApplicationDeploymentStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationDeploymentList contains a list of ApplicationDeployment
|
||||
// +kubebuilder:object:root=true
|
||||
type ApplicationDeploymentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApplicationDeployment `json:"items"`
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
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.
|
||||
@@ -17,44 +17,65 @@ limitations under the License.
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// ApplicationPhase is a label for the condition of a application at the current time
|
||||
type ApplicationPhase string
|
||||
|
||||
const (
|
||||
// ApplicationRollingOut means the app is in the middle of rolling out
|
||||
ApplicationRollingOut ApplicationPhase = "rollingOut"
|
||||
// ApplicationRendering means the app is rendering
|
||||
ApplicationRendering ApplicationPhase = "rendering"
|
||||
// ApplicationRunning means the app finished rendering and applied result to the cluster
|
||||
ApplicationRunning ApplicationPhase = "running"
|
||||
// ApplicationHealthChecking means the app finished rendering and applied result to the cluster, but still unhealthy
|
||||
ApplicationHealthChecking ApplicationPhase = "healthChecking"
|
||||
)
|
||||
|
||||
// AppStatus defines the observed state of Application
|
||||
type AppStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
v1alpha1.RolloutStatus `json:",inline"`
|
||||
|
||||
Phase common.ApplicationPhase `json:"status,omitempty"`
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
Phase ApplicationPhase `json:"status,omitempty"`
|
||||
|
||||
// Components record the related Components created by Application Controller
|
||||
Components []corev1.ObjectReference `json:"components,omitempty"`
|
||||
Components []runtimev1alpha1.TypedReference `json:"components,omitempty"`
|
||||
|
||||
// Services record the status of the application services
|
||||
Services []common.ApplicationComponentStatus `json:"services,omitempty"`
|
||||
Services []ApplicationComponentStatus `json:"services,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceTracker record the status of the ResourceTracker
|
||||
ResourceTracker *corev1.ObjectReference `json:"resourceTracker,omitempty"`
|
||||
// ApplicationComponentStatus record the health status of App component
|
||||
type ApplicationComponentStatus struct {
|
||||
Name string `json:"name"`
|
||||
Healthy bool `json:"healthy"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Traits []ApplicationTraitStatus `json:"traits,omitempty"`
|
||||
}
|
||||
|
||||
// LatestRevision of the application configuration it generates
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
// ApplicationTraitStatus records the trait health status
|
||||
type ApplicationTraitStatus struct {
|
||||
Type string `json:"type"`
|
||||
Healthy bool `json:"healthy"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationTrait defines the trait of application
|
||||
type ApplicationTrait struct {
|
||||
Name string `json:"name"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
Properties runtime.RawExtension `json:"properties"`
|
||||
}
|
||||
|
||||
// ApplicationComponent describe the component of application
|
||||
@@ -62,7 +83,7 @@ type ApplicationComponent struct {
|
||||
Name string `json:"name"`
|
||||
WorkloadType string `json:"type"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Settings runtime.RawExtension `json:"settings,omitempty"`
|
||||
Settings runtime.RawExtension `json:"settings"`
|
||||
|
||||
// Traits define the trait of one component, the type must be array to keep the order.
|
||||
Traits []ApplicationTrait `json:"traits,omitempty"`
|
||||
@@ -78,29 +99,18 @@ type ApplicationSpec struct {
|
||||
Components []ApplicationComponent `json:"components"`
|
||||
|
||||
// TODO(wonderflow): we should have application level scopes supported here
|
||||
|
||||
// RolloutPlan is the details on how to rollout the resources
|
||||
// The controller simply replace the old resources with the new one if there is no rollout plan involved
|
||||
// +optional
|
||||
RolloutPlan *v1alpha1.RolloutPlan `json:"rolloutPlan,omitempty"`
|
||||
}
|
||||
|
||||
// Application is the Schema for the applications API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam},shortName={app,velaapp}
|
||||
|
||||
// Application is the Schema for the applications API
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="COMPONENT",type=string,JSONPath=`.spec.components[*].name`
|
||||
// +kubebuilder:printcolumn:name="TYPE",type=string,JSONPath=`.spec.components[*].type`
|
||||
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.status`
|
||||
// +kubebuilder:printcolumn:name="HEALTHY",type=boolean,JSONPath=`.status.services[*].healthy`
|
||||
// +kubebuilder:printcolumn:name="STATUS",type=string,JSONPath=`.status.services[*].message`
|
||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
||||
type Application struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationSpec `json:"spec,omitempty"`
|
||||
Status common.AppStatus `json:"status,omitempty"`
|
||||
Spec ApplicationSpec `json:"spec,omitempty"`
|
||||
Status AppStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
/*
|
||||
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 v1alpha2
|
||||
|
||||
import (
|
||||
@@ -21,7 +5,7 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestApplicationGetComponent(t *testing.T) {
|
||||
func TestApplication_GetComponent(t *testing.T) {
|
||||
ac1 := ApplicationComponent{
|
||||
Name: "ac1",
|
||||
WorkloadType: "type1",
|
||||
|
||||
@@ -1,73 +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 v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// ApplicationRevisionSpec is the spec of ApplicationRevision
|
||||
type ApplicationRevisionSpec struct {
|
||||
// Application records the snapshot of the created/modified Application
|
||||
Application Application `json:"application"`
|
||||
|
||||
// ComponentDefinitions records the snapshot of the componentDefinitions related with the created/modified Application
|
||||
ComponentDefinitions map[string]ComponentDefinition `json:"componentDefinitions,omitempty"`
|
||||
|
||||
// WorkloadDefinitions records the snapshot of the workloadDefinitions related with the created/modified Application
|
||||
WorkloadDefinitions map[string]WorkloadDefinition `json:"workloadDefinitions,omitempty"`
|
||||
|
||||
// TraitDefinitions records the snapshot of the traitDefinitions related with the created/modified Application
|
||||
TraitDefinitions map[string]TraitDefinition `json:"traitDefinitions,omitempty"`
|
||||
|
||||
// ScopeDefinitions records the snapshot of the scopeDefinitions related with the created/modified Application
|
||||
ScopeDefinitions map[string]ScopeDefinition `json:"scopeDefinitions,omitempty"`
|
||||
|
||||
// Components records the rendered components from Application, it will contains the whole K8s CR of workload in it.
|
||||
|
||||
Components []common.RawComponent `json:"components,omitempty"`
|
||||
|
||||
// ApplicationConfiguration records the rendered applicationConfiguration from Application,
|
||||
// it will contains the whole K8s CR of trait and the reference component in it.
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
ApplicationConfiguration runtime.RawExtension `json:"applicationConfiguration"`
|
||||
}
|
||||
|
||||
// ApplicationRevision is the Schema for the ApplicationRevision API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam},shortName=apprev
|
||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
||||
type ApplicationRevision struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationRevisionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationRevisionList contains a list of ApplicationRevision
|
||||
// +kubebuilder:object:root=true
|
||||
type ApplicationRevisionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApplicationRevision `json:"items"`
|
||||
}
|
||||
@@ -1,103 +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 v1alpha2
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// ComponentDefinitionSpec defines the desired state of ComponentDefinition
|
||||
type ComponentDefinitionSpec struct {
|
||||
// Workload is a workload type descriptor
|
||||
Workload common.WorkloadTypeDescriptor `json:"workload"`
|
||||
|
||||
// ChildResourceKinds are the list of GVK of the child resources this workload generates
|
||||
ChildResourceKinds []common.ChildResourceKind `json:"childResourceKinds,omitempty"`
|
||||
|
||||
// RevisionLabel indicates which label for underlying resources(e.g. pods) of this workload
|
||||
// can be used by trait to create resource selectors(e.g. label selector for pods).
|
||||
// +optional
|
||||
RevisionLabel string `json:"revisionLabel,omitempty"`
|
||||
|
||||
// PodSpecPath indicates where/if this workload has K8s podSpec field
|
||||
// if one workload has podSpec, trait can do lot's of assumption such as port, env, volume fields.
|
||||
// +optional
|
||||
PodSpecPath string `json:"podSpecPath,omitempty"`
|
||||
|
||||
// Status defines the custom health policy and status message for workload
|
||||
// +optional
|
||||
Status *common.Status `json:"status,omitempty"`
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the workload
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// ComponentDefinitionStatus is the status of ComponentDefinition
|
||||
type ComponentDefinitionStatus struct {
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
// ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters.
|
||||
ConfigMapRef string `json:"configMapRef,omitempty"`
|
||||
// LatestRevision of the component definition
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ComponentDefinition is the Schema for the componentdefinitions API
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=comp
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="WORKLOAD-KIND",type=string,JSONPath=".spec.workload.definition.kind"
|
||||
// +kubebuilder:printcolumn:name="DESCRIPTION",type=string,JSONPath=".metadata.annotations.definition\\.oam\\.dev/description"
|
||||
type ComponentDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ComponentDefinitionSpec `json:"spec,omitempty"`
|
||||
Status ComponentDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for WorkloadDefinition
|
||||
func (cd *ComponentDefinition) SetConditions(c ...condition.Condition) {
|
||||
cd.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from WorkloadDefinition
|
||||
func (cd *ComponentDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return cd.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ComponentDefinitionList contains a list of ComponentDefinition
|
||||
type ComponentDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ComponentDefinition `json:"items"`
|
||||
}
|
||||
@@ -1,139 +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 v1alpha2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/klog/v2"
|
||||
"sigs.k8s.io/controller-runtime/pkg/conversion"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
)
|
||||
|
||||
// ApplicationV1alpha2ToV1beta1 will convert v1alpha2 to v1beta1
|
||||
func ApplicationV1alpha2ToV1beta1(v1a2 *Application, v1b1 *v1beta1.Application) {
|
||||
// 1) convert metav1.TypeMeta
|
||||
// apiVersion and Kind automatically converted
|
||||
|
||||
// 2) convert metav1.ObjectMeta
|
||||
v1b1.ObjectMeta = *v1a2.ObjectMeta.DeepCopy()
|
||||
|
||||
// 3) convert Spec ApplicationSpec
|
||||
// 3.1) convert Spec.Components
|
||||
for _, comp := range v1a2.Spec.Components {
|
||||
|
||||
// convert trait, especially for `.name` -> `.type`
|
||||
var traits = make([]common.ApplicationTrait, len(comp.Traits))
|
||||
for j, trait := range comp.Traits {
|
||||
traits[j] = common.ApplicationTrait{
|
||||
Type: trait.Name,
|
||||
Properties: trait.Properties.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
// deep copy scopes
|
||||
scopes := make(map[string]string)
|
||||
for k, v := range comp.Scopes {
|
||||
scopes[k] = v
|
||||
}
|
||||
// convert component
|
||||
// `.settings` -> `.properties`
|
||||
v1b1.Spec.Components = append(v1b1.Spec.Components, common.ApplicationComponent{
|
||||
Name: comp.Name,
|
||||
Type: comp.WorkloadType,
|
||||
Properties: comp.Settings.DeepCopy(),
|
||||
Traits: traits,
|
||||
Scopes: scopes,
|
||||
})
|
||||
}
|
||||
|
||||
// 4) convert Status common.AppStatus
|
||||
v1b1.Status = *v1a2.Status.DeepCopy()
|
||||
}
|
||||
|
||||
// ConvertTo converts this Application to the Hub version (v1beta1 only for now).
|
||||
func (app *Application) ConvertTo(dst conversion.Hub) error {
|
||||
switch convertedApp := dst.(type) {
|
||||
case *v1beta1.Application:
|
||||
klog.Infof("convert *v1alpha2.Application [%s] to *v1beta1.Application", app.Name)
|
||||
ApplicationV1alpha2ToV1beta1(app, convertedApp)
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
return fmt.Errorf("unsupported convertTo object %v", reflect.TypeOf(dst))
|
||||
}
|
||||
|
||||
// ConvertFrom converts from the Hub version (v1beta1) to this version (v1alpha2).
|
||||
func (app *Application) ConvertFrom(src conversion.Hub) error {
|
||||
switch sourceApp := src.(type) {
|
||||
case *v1beta1.Application:
|
||||
|
||||
klog.Infof("convert *v1alpha2.Application from *v1beta1.Application [%s]", sourceApp.Name)
|
||||
|
||||
// 1) convert metav1.TypeMeta
|
||||
// apiVersion and Kind automatically converted
|
||||
|
||||
// 2) convert metav1.ObjectMeta
|
||||
app.ObjectMeta = *sourceApp.ObjectMeta.DeepCopy()
|
||||
|
||||
// 3) convert Spec ApplicationSpec
|
||||
// 3.1) convert Spec.Components
|
||||
for _, comp := range sourceApp.Spec.Components {
|
||||
|
||||
// convert trait, especially for `.type` -> `.name`
|
||||
var traits = make([]ApplicationTrait, len(comp.Traits))
|
||||
for j, trait := range comp.Traits {
|
||||
traits[j] = ApplicationTrait{
|
||||
Name: trait.Type,
|
||||
Properties: trait.Properties.DeepCopy(),
|
||||
}
|
||||
}
|
||||
|
||||
// deep copy scopes
|
||||
scopes := make(map[string]string)
|
||||
for k, v := range comp.Scopes {
|
||||
scopes[k] = v
|
||||
}
|
||||
// convert component
|
||||
// `.properties` -> `.settings`
|
||||
|
||||
var compProperties runtime.RawExtension
|
||||
|
||||
if comp.Properties != nil {
|
||||
compProperties = *comp.Properties.DeepCopy()
|
||||
}
|
||||
|
||||
app.Spec.Components = append(app.Spec.Components, ApplicationComponent{
|
||||
Name: comp.Name,
|
||||
WorkloadType: comp.Type,
|
||||
Settings: compProperties,
|
||||
Traits: traits,
|
||||
Scopes: scopes,
|
||||
})
|
||||
}
|
||||
|
||||
// 4) convert Status common.AppStatus
|
||||
app.Status = *sourceApp.Status.DeepCopy()
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
return fmt.Errorf("unsupported ConvertFrom object %v", reflect.TypeOf(src))
|
||||
}
|
||||
@@ -1,117 +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 v1alpha2
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
)
|
||||
|
||||
var app = Application{
|
||||
Spec: ApplicationSpec{
|
||||
Components: []ApplicationComponent{{
|
||||
Name: "test-component",
|
||||
WorkloadType: "worker",
|
||||
Traits: []ApplicationTrait{},
|
||||
Scopes: map[string]string{},
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
type errType struct {
|
||||
}
|
||||
|
||||
func (*errType) Hub() {}
|
||||
|
||||
func (*errType) DeepCopyObject() runtime.Object {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (*errType) GetObjectKind() schema.ObjectKind {
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestApplicationV1alpha2ToV1beta1(t *testing.T) {
|
||||
r := require.New(t)
|
||||
expected := &v1beta1.Application{}
|
||||
ApplicationV1alpha2ToV1beta1(&app, expected)
|
||||
|
||||
r.Equal(expected, &v1beta1.Application{
|
||||
Spec: v1beta1.ApplicationSpec{
|
||||
Components: []common.ApplicationComponent{{
|
||||
Name: "test-component",
|
||||
Type: "worker",
|
||||
Properties: &runtime.RawExtension{},
|
||||
Traits: []common.ApplicationTrait{},
|
||||
Scopes: map[string]string{},
|
||||
}},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestConvertTo(t *testing.T) {
|
||||
r := require.New(t)
|
||||
expected := &v1beta1.Application{}
|
||||
err := app.ConvertTo(expected)
|
||||
r.NoError(err)
|
||||
r.Equal(expected, &v1beta1.Application{
|
||||
Spec: v1beta1.ApplicationSpec{
|
||||
Components: []common.ApplicationComponent{{
|
||||
Name: "test-component",
|
||||
Type: "worker",
|
||||
Properties: &runtime.RawExtension{},
|
||||
Traits: []common.ApplicationTrait{},
|
||||
Scopes: map[string]string{},
|
||||
}},
|
||||
},
|
||||
})
|
||||
|
||||
errCase := &errType{}
|
||||
err = app.ConvertTo(errCase)
|
||||
r.Equal(err, fmt.Errorf("unsupported convertTo object *v1alpha2.errType"))
|
||||
}
|
||||
|
||||
func TestConvertFrom(t *testing.T) {
|
||||
r := require.New(t)
|
||||
to := &Application{}
|
||||
from := &v1beta1.Application{
|
||||
Spec: v1beta1.ApplicationSpec{
|
||||
Components: []common.ApplicationComponent{{
|
||||
Name: "test-component",
|
||||
Type: "worker",
|
||||
Properties: &runtime.RawExtension{},
|
||||
Traits: []common.ApplicationTrait{},
|
||||
Scopes: map[string]string{},
|
||||
}},
|
||||
},
|
||||
}
|
||||
err := to.ConvertFrom(from)
|
||||
r.NoError(err)
|
||||
r.Equal(to.Spec, app.Spec)
|
||||
|
||||
errCase := &errType{}
|
||||
err = app.ConvertFrom(errCase)
|
||||
r.Equal(err, fmt.Errorf("unsupported ConvertFrom object *v1alpha2.errType"))
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -17,11 +17,9 @@ limitations under the License.
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
@@ -47,50 +45,21 @@ type HealthScopeSpec struct {
|
||||
// ProbeInterval is the amount of time in seconds between probing tries.
|
||||
ProbeInterval *int32 `json:"probe-interval,omitempty"`
|
||||
|
||||
// AppRefs records references of applications' components
|
||||
AppRefs []AppReference `json:"appReferences,omitempty"`
|
||||
|
||||
// WorkloadReferences to the workloads that are in this scope.
|
||||
// +deprecated
|
||||
WorkloadReferences []corev1.ObjectReference `json:"workloadRefs"`
|
||||
}
|
||||
|
||||
// AppReference records references of an application's components
|
||||
type AppReference struct {
|
||||
AppName string `json:"appName,omitempty"`
|
||||
CompReferences []CompReference `json:"compReferences,omitempty"`
|
||||
}
|
||||
|
||||
// CompReference records references of a component's resources
|
||||
type CompReference struct {
|
||||
CompName string `json:"compName,omitempty"`
|
||||
Workload corev1.ObjectReference `json:"workload,omitempty"`
|
||||
Traits []corev1.ObjectReference `json:"traits,omitempty"`
|
||||
WorkloadReferences []runtimev1alpha1.TypedReference `json:"workloadRefs"`
|
||||
}
|
||||
|
||||
// A HealthScopeStatus represents the observed state of a HealthScope.
|
||||
type HealthScopeStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// ScopeHealthCondition represents health condition summary of the scope
|
||||
ScopeHealthCondition ScopeHealthCondition `json:"scopeHealthCondition"`
|
||||
|
||||
// AppHealthConditions represents health condition of applications in the scope
|
||||
AppHealthConditions []*AppHealthCondition `json:"appHealthConditions,omitempty"`
|
||||
|
||||
// WorkloadHealthConditions represents health condition of workloads in the scope
|
||||
// Use AppHealthConditions to provide app level status
|
||||
// +deprecated
|
||||
WorkloadHealthConditions []*WorkloadHealthCondition `json:"healthConditions,omitempty"`
|
||||
}
|
||||
|
||||
// AppHealthCondition represents health condition of an application
|
||||
type AppHealthCondition struct {
|
||||
AppName string `json:"appName"`
|
||||
EnvName string `json:"envName,omitempty"`
|
||||
Components []*WorkloadHealthCondition `json:"components,omitempty"`
|
||||
}
|
||||
|
||||
// ScopeHealthCondition represents health condition summary of a scope.
|
||||
type ScopeHealthCondition struct {
|
||||
HealthStatus HealthStatus `json:"healthStatus"`
|
||||
@@ -100,32 +69,21 @@ type ScopeHealthCondition struct {
|
||||
UnknownWorkloads int64 `json:"unknownWorkloads,omitempty"`
|
||||
}
|
||||
|
||||
// WorkloadHealthCondition represents informative health condition of a workload.
|
||||
// WorkloadHealthCondition represents informative health condition.
|
||||
type WorkloadHealthCondition struct {
|
||||
// ComponentName represents the component name if target is a workload
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
TargetWorkload corev1.ObjectReference `json:"targetWorkload,omitempty"`
|
||||
HealthStatus HealthStatus `json:"healthStatus"`
|
||||
Diagnosis string `json:"diagnosis,omitempty"`
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
TargetWorkload runtimev1alpha1.TypedReference `json:"targetWorkload,omitempty"`
|
||||
HealthStatus HealthStatus `json:"healthStatus"`
|
||||
Diagnosis string `json:"diagnosis,omitempty"`
|
||||
// WorkloadStatus represents status of workloads whose HealthStatus is UNKNOWN.
|
||||
WorkloadStatus string `json:"workloadStatus,omitempty"`
|
||||
CustomStatusMsg string `json:"customStatusMsg,omitempty"`
|
||||
Traits []*TraitHealthCondition `json:"traits,omitempty"`
|
||||
}
|
||||
|
||||
// TraitHealthCondition represents informative health condition of a trait.
|
||||
type TraitHealthCondition struct {
|
||||
Type string `json:"type"`
|
||||
Resource string `json:"resource"`
|
||||
HealthStatus HealthStatus `json:"healthStatus"`
|
||||
Diagnosis string `json:"diagnosis,omitempty"`
|
||||
CustomStatusMsg string `json:"customStatusMsg,omitempty"`
|
||||
WorkloadStatus string `json:"workloadStatus,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A HealthScope determines an aggregate health status based of the health of components.
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:JSONPath=".status.health",name=HEALTH,type=string
|
||||
type HealthScope struct {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -17,11 +17,9 @@ limitations under the License.
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
@@ -33,19 +31,19 @@ type ManualScalerTraitSpec struct {
|
||||
ReplicaCount int32 `json:"replicaCount"`
|
||||
|
||||
// WorkloadReference to the workload this trait applies to.
|
||||
WorkloadReference corev1.ObjectReference `json:"workloadRef"`
|
||||
WorkloadReference runtimev1alpha1.TypedReference `json:"workloadRef"`
|
||||
}
|
||||
|
||||
// A ManualScalerTraitStatus represents the observed state of a
|
||||
// ManualScalerTrait.
|
||||
type ManualScalerTraitStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A ManualScalerTrait determines how many replicas a workload should have.
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ManualScalerTrait struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -17,24 +17,56 @@ limitations under the License.
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
)
|
||||
|
||||
// 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.
|
||||
// Template is a required field if CUE is defined in Capability Definition.
|
||||
Template string `json:"template"`
|
||||
}
|
||||
|
||||
// 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 {
|
||||
CUE *CUE `json:"cue,omitempty"`
|
||||
// TODO(wonderflow): support HCL(terraform)/KUBE(K8s Object)/HELM here.
|
||||
}
|
||||
|
||||
// A DefinitionReference refers to a CustomResourceDefinition by name.
|
||||
type DefinitionReference struct {
|
||||
// Name of the referenced CustomResourceDefinition.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Version indicate which version should be used if CRD has multiple versions
|
||||
// by default it will use the first one if not specified
|
||||
Version string `json:"version,omitempty"`
|
||||
}
|
||||
|
||||
// A ChildResourceKind defines a child Kubernetes resource kind with a selector
|
||||
type ChildResourceKind struct {
|
||||
// APIVersion of the child resource
|
||||
APIVersion string `json:"apiVersion"`
|
||||
|
||||
// Kind of the child resource
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Selector to select the child resources that the workload wants to expose to traits
|
||||
Selector map[string]string `json:"selector,omitempty"`
|
||||
}
|
||||
|
||||
// A WorkloadDefinitionSpec defines the desired state of a WorkloadDefinition.
|
||||
type WorkloadDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this workload kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef"`
|
||||
Reference DefinitionReference `json:"definitionRef"`
|
||||
|
||||
// ChildResourceKinds are the list of GVK of the child resources this workload generates
|
||||
ChildResourceKinds []common.ChildResourceKind `json:"childResourceKinds,omitempty"`
|
||||
ChildResourceKinds []ChildResourceKind `json:"childResourceKinds,omitempty"`
|
||||
|
||||
// RevisionLabel indicates which label for underlying resources(e.g. pods) of this workload
|
||||
// can be used by trait to create resource selectors(e.g. label selector for pods).
|
||||
@@ -48,11 +80,16 @@ type WorkloadDefinitionSpec struct {
|
||||
|
||||
// Status defines the custom health policy and status message for workload
|
||||
// +optional
|
||||
Status *common.Status `json:"status,omitempty"`
|
||||
Status *Status `json:"status,omitempty"`
|
||||
|
||||
// Template defines the abstraction template data of the workload, it will replace the old template in extension field.
|
||||
// the data format depends on templateType, by default it's CUE
|
||||
// +optional
|
||||
Template string `json:"template,omitempty"`
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the workload
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
Schematic *Schematic `json:"schematic,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
@@ -60,9 +97,14 @@ type WorkloadDefinitionSpec struct {
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// WorkloadDefinitionStatus is the status of WorkloadDefinition
|
||||
type WorkloadDefinitionStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
// Status defines the loop back status of the abstraction by using CUE template
|
||||
type Status struct {
|
||||
// CustomStatus defines the custom status message that could display to user
|
||||
// +optional
|
||||
CustomStatus string `json:"customStatus,omitempty"`
|
||||
// HealthPolicy defines the health check policy for the abstraction
|
||||
// +optional
|
||||
HealthPolicy string `json:"healthPolicy,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
@@ -71,24 +113,13 @@ type WorkloadDefinitionStatus struct {
|
||||
// valid OAM workload kind by referencing its CustomResourceDefinition. The CRD
|
||||
// is used to validate the schema of the workload when it is embedded in an OAM
|
||||
// Component.
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=workload
|
||||
// +kubebuilder:printcolumn:name="DEFINITION-NAME",type=string,JSONPath=".spec.definitionRef.name"
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.definitionRef.name",name=DEFINITION-NAME,type=string
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={crossplane,oam}
|
||||
type WorkloadDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec WorkloadDefinitionSpec `json:"spec,omitempty"`
|
||||
Status WorkloadDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for WorkloadDefinition
|
||||
func (wd *WorkloadDefinition) SetConditions(c ...condition.Condition) {
|
||||
wd.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from WorkloadDefinition
|
||||
func (wd *WorkloadDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return wd.Status.GetCondition(conditionType)
|
||||
Spec WorkloadDefinitionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
@@ -103,7 +134,7 @@ type WorkloadDefinitionList struct {
|
||||
// A TraitDefinitionSpec defines the desired state of a TraitDefinition.
|
||||
type TraitDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this trait kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef,omitempty"`
|
||||
Reference DefinitionReference `json:"definitionRef,omitempty"`
|
||||
|
||||
// Revision indicates whether a trait is aware of component revision
|
||||
// +optional
|
||||
@@ -113,10 +144,6 @@ type TraitDefinitionSpec struct {
|
||||
// +optional
|
||||
WorkloadRefPath string `json:"workloadRefPath,omitempty"`
|
||||
|
||||
// PodDisruptive specifies whether using the trait will cause the pod to restart or not.
|
||||
// +optional
|
||||
PodDisruptive bool `json:"podDisruptive,omitempty"`
|
||||
|
||||
// AppliesToWorkloads specifies the list of workload kinds this trait
|
||||
// applies to. Workload kinds are specified in kind.group/version format,
|
||||
// e.g. server.core.oam.dev/v1alpha2. Traits that omit this field apply to
|
||||
@@ -138,11 +165,11 @@ type TraitDefinitionSpec struct {
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the trait
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
Schematic *Schematic `json:"schematic,omitempty"`
|
||||
|
||||
// Status defines the custom health policy and status message for trait
|
||||
// +optional
|
||||
Status *common.Status `json:"status,omitempty"`
|
||||
Status *Status `json:"status,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
@@ -150,43 +177,19 @@ type TraitDefinitionSpec struct {
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// TraitDefinitionStatus is the status of TraitDefinition
|
||||
type TraitDefinitionStatus struct {
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
// ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters.
|
||||
ConfigMapRef string `json:"configMapRef,omitempty"`
|
||||
// LatestRevision of the trait definition
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A TraitDefinition registers a kind of Kubernetes custom resource as a valid
|
||||
// OAM trait kind by referencing its CustomResourceDefinition. The CRD is used
|
||||
// to validate the schema of the trait when it is embedded in an OAM
|
||||
// ApplicationConfiguration.
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=trait
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="APPLIES-TO",type=string,JSONPath=".spec.appliesToWorkloads"
|
||||
// +kubebuilder:printcolumn:name="DESCRIPTION",type=string,JSONPath=".metadata.annotations.definition\\.oam\\.dev/description"
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.definitionRef.name",name=DEFINITION-NAME,type=string
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={crossplane,oam}
|
||||
type TraitDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec TraitDefinitionSpec `json:"spec,omitempty"`
|
||||
Status TraitDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for TraitDefinition
|
||||
func (td *TraitDefinition) SetConditions(c ...condition.Condition) {
|
||||
td.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from TraitDefinition
|
||||
func (td *TraitDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return td.Status.GetCondition(conditionType)
|
||||
Spec TraitDefinitionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
@@ -201,7 +204,7 @@ type TraitDefinitionList struct {
|
||||
// A ScopeDefinitionSpec defines the desired state of a ScopeDefinition.
|
||||
type ScopeDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this scope kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef"`
|
||||
Reference DefinitionReference `json:"definitionRef"`
|
||||
|
||||
// WorkloadRefsPath indicates if/where a scope accepts workloadRef objects
|
||||
WorkloadRefsPath string `json:"workloadRefsPath,omitempty"`
|
||||
@@ -223,7 +226,7 @@ type ScopeDefinitionSpec struct {
|
||||
// to validate the schema of the scope when it is embedded in an OAM
|
||||
// ApplicationConfiguration.
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.definitionRef.name",name=DEFINITION-NAME,type=string
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=scope
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={crossplane,oam}
|
||||
type ScopeDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
@@ -274,10 +277,6 @@ type ComponentSpec struct {
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Workload runtime.RawExtension `json:"workload"`
|
||||
|
||||
// HelmRelease records a Helm release used by a Helm module workload.
|
||||
// +optional
|
||||
Helm *common.Helm `json:"helm,omitempty"`
|
||||
|
||||
// Parameters exposed by this component. ApplicationConfigurations that
|
||||
// reference this component may specify values for these parameters, which
|
||||
// will in turn be injected into the embedded workload.
|
||||
@@ -291,19 +290,25 @@ type ComponentStatus struct {
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration"`
|
||||
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// LatestRevision of component
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
LatestRevision *Revision `json:"latestRevision,omitempty"`
|
||||
|
||||
// One Component should only be used by one AppConfig
|
||||
}
|
||||
|
||||
// Revision has name and revision number
|
||||
type Revision struct {
|
||||
Name string `json:"name"`
|
||||
Revision int64 `json:"revision"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A Component describes how an OAM workload kind may be instantiated.
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.workload.kind",name=WORKLOAD-KIND,type=string
|
||||
// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
@@ -353,7 +358,7 @@ type ComponentTrait struct {
|
||||
// A ComponentScope specifies a scope in which a component should exist.
|
||||
type ComponentScope struct {
|
||||
// A ScopeReference must refer to an OAM scope resource.
|
||||
ScopeReference corev1.ObjectReference `json:"scopeRef"`
|
||||
ScopeReference runtimev1alpha1.TypedReference `json:"scopeRef"`
|
||||
}
|
||||
|
||||
// An ApplicationConfigurationComponent specifies a component of an
|
||||
@@ -410,7 +415,7 @@ type WorkloadTrait struct {
|
||||
Status TraitStatus `json:"status,omitempty"`
|
||||
|
||||
// Reference to a trait created by an ApplicationConfiguration.
|
||||
Reference corev1.ObjectReference `json:"traitRef"`
|
||||
Reference runtimev1alpha1.TypedReference `json:"traitRef"`
|
||||
|
||||
// Message will allow controller to leave some additional information for this trait
|
||||
Message string `json:"message,omitempty"`
|
||||
@@ -436,7 +441,7 @@ type WorkloadScope struct {
|
||||
Status ScopeStatus `json:"status,omitempty"`
|
||||
|
||||
// Reference to a scope created by an ApplicationConfiguration.
|
||||
Reference corev1.ObjectReference `json:"scopeRef"`
|
||||
Reference runtimev1alpha1.TypedReference `json:"scopeRef"`
|
||||
}
|
||||
|
||||
// A WorkloadStatus represents the status of a workload.
|
||||
@@ -458,7 +463,7 @@ type WorkloadStatus struct {
|
||||
AppliedComponentRevision string `json:"appliedComponentRevision,omitempty"`
|
||||
|
||||
// Reference to a workload created by an ApplicationConfiguration.
|
||||
Reference corev1.ObjectReference `json:"workloadRef,omitempty"`
|
||||
Reference runtimev1alpha1.TypedReference `json:"workloadRef,omitempty"`
|
||||
|
||||
// Traits associated with this workload.
|
||||
Traits []WorkloadTrait `json:"traits,omitempty"`
|
||||
@@ -473,7 +478,7 @@ type HistoryWorkload struct {
|
||||
Revision string `json:"revision,omitempty"`
|
||||
|
||||
// Reference to running workload.
|
||||
Reference corev1.ObjectReference `json:"workloadRef,omitempty"`
|
||||
Reference runtimev1alpha1.TypedReference `json:"workloadRef,omitempty"`
|
||||
}
|
||||
|
||||
// A ApplicationStatus represents the state of the entire application.
|
||||
@@ -482,7 +487,7 @@ type ApplicationStatus string
|
||||
// An ApplicationConfigurationStatus represents the observed state of a
|
||||
// ApplicationConfiguration.
|
||||
type ApplicationConfigurationStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the status of the entire application
|
||||
@@ -490,9 +495,6 @@ type ApplicationConfigurationStatus struct {
|
||||
|
||||
Dependency DependencyStatus `json:"dependency,omitempty"`
|
||||
|
||||
// RollingStatus indicates what phase are we in the rollout phase
|
||||
RollingStatus types.RollingStatus `json:"rollingStatus,omitempty"`
|
||||
|
||||
// Workloads created by this ApplicationConfiguration.
|
||||
Workloads []WorkloadStatus `json:"workloads,omitempty"`
|
||||
|
||||
@@ -520,20 +522,20 @@ type UnstaifiedDependency struct {
|
||||
|
||||
// DependencyFromObject represents the object that dependency data comes from.
|
||||
type DependencyFromObject struct {
|
||||
corev1.ObjectReference `json:",inline"`
|
||||
FieldPath string `json:"fieldPath,omitempty"`
|
||||
runtimev1alpha1.TypedReference `json:",inline"`
|
||||
FieldPath string `json:"fieldPath,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyToObject represents the object that dependency data goes to.
|
||||
type DependencyToObject struct {
|
||||
corev1.ObjectReference `json:",inline"`
|
||||
FieldPaths []string `json:"fieldPaths,omitempty"`
|
||||
runtimev1alpha1.TypedReference `json:",inline"`
|
||||
FieldPaths []string `json:"fieldPaths,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// An ApplicationConfiguration represents an OAM application.
|
||||
// +kubebuilder:resource:shortName=appconfig,categories={oam}
|
||||
// +kubebuilder:resource:shortName=appconfig,categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ApplicationConfiguration struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
@@ -565,50 +567,8 @@ type DataOutput struct {
|
||||
// If no conditions is specified, it is by default to check output value not empty.
|
||||
// +optional
|
||||
Conditions []ConditionRequirement `json:"conditions,omitempty"`
|
||||
// OutputStore specifies the object used to store intermediate data generated by Operations
|
||||
OutputStore StoreReference `json:"outputStore,omitempty"`
|
||||
}
|
||||
|
||||
// StoreReference specifies the referenced object in DataOutput or DataInput
|
||||
type StoreReference struct {
|
||||
corev1.ObjectReference `json:",inline"`
|
||||
// Operations specify the data processing operations
|
||||
Operations []DataOperation `json:"operations,omitempty"`
|
||||
}
|
||||
|
||||
// DataOperation defines the specific operation for data
|
||||
type DataOperation struct {
|
||||
// Type specifies the type of DataOperation
|
||||
Type string `json:"type"`
|
||||
// Operator specifies the operation under this DataOperation type
|
||||
Operator DataOperator `json:"op"`
|
||||
// ToFieldPath refers to the value of an object's field
|
||||
ToFieldPath string `json:"toFieldPath"`
|
||||
// ToDataPath refers to the value of an object's specfied by ToDataPath. For example the ToDataPath "redis" specifies "redis info" in '{"redis":"redis info"}'
|
||||
ToDataPath string `json:"toDataPath,omitempty"`
|
||||
// +optional
|
||||
// Value specifies an expected value
|
||||
// This is mutually exclusive with ValueFrom
|
||||
Value string `json:"value,omitempty"`
|
||||
// +optional
|
||||
// ValueFrom specifies expected value from object such as workload and trait
|
||||
// This is mutually exclusive with Value
|
||||
ValueFrom ValueFrom `json:"valueFrom,omitempty"`
|
||||
Conditions []ConditionRequirement `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// DataOperator defines the type of Operator in DataOperation
|
||||
type DataOperator string
|
||||
|
||||
const (
|
||||
// AddOperator specifies the add operation for data passing
|
||||
AddOperator DataOperator = "add"
|
||||
// DeleteOperator specifies the delete operation for data passing
|
||||
DeleteOperator DataOperator = "delete"
|
||||
// ReplaceOperator specifies the replace operation for data passing
|
||||
ReplaceOperator DataOperator = "replace"
|
||||
)
|
||||
|
||||
// DataInput specifies a data input sink to an object.
|
||||
// If input is array, it will be appended to the target field paths.
|
||||
type DataInput struct {
|
||||
@@ -623,12 +583,6 @@ type DataInput struct {
|
||||
// If StrategyMergeKeys specified, we will check the key in the target array.
|
||||
// If any key exist, do update; if no key exist, append.
|
||||
StrategyMergeKeys []string `json:"strategyMergeKeys,omitempty"`
|
||||
|
||||
// When the Conditions is satified, ToFieldPaths will be filled with passed value
|
||||
Conditions []ConditionRequirement `json:"conditions,omitempty"`
|
||||
|
||||
// InputStore specifies the object used to read intermediate data genereted by DataOutput
|
||||
InputStore StoreReference `json:"inputStore,omitempty"`
|
||||
}
|
||||
|
||||
// DataInputValueFrom specifies the value source for a data input.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -19,8 +19,12 @@ limitations under the License.
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// An OperatingSystem required by a containerised workload.
|
||||
@@ -353,3 +357,53 @@ type Container struct {
|
||||
// +optional
|
||||
ImagePullSecret *string `json:"imagePullSecret,omitempty"`
|
||||
}
|
||||
|
||||
// A ContainerizedWorkloadSpec defines the desired state of a
|
||||
// ContainerizedWorkload.
|
||||
type ContainerizedWorkloadSpec struct {
|
||||
// OperatingSystem required by this workload.
|
||||
// +kubebuilder:validation:Enum=linux;windows
|
||||
// +optional
|
||||
OperatingSystem *OperatingSystem `json:"osType,omitempty"`
|
||||
|
||||
// CPUArchitecture required by this workload.
|
||||
// +kubebuilder:validation:Enum=i386;amd64;arm;arm64
|
||||
// +optional
|
||||
CPUArchitecture *CPUArchitecture `json:"arch,omitempty"`
|
||||
|
||||
// Containers of which this workload consists.
|
||||
Containers []Container `json:"containers"`
|
||||
}
|
||||
|
||||
// A ContainerizedWorkloadStatus represents the observed state of a
|
||||
// ContainerizedWorkload.
|
||||
type ContainerizedWorkloadStatus struct {
|
||||
runtimev1alpha1.ConditionedStatus `json:",inline"`
|
||||
|
||||
// Resources managed by this containerised workload.
|
||||
Resources []runtimev1alpha1.TypedReference `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
var _ oam.Workload = &ContainerizedWorkload{}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A ContainerizedWorkload is a workload that runs OCI containers.
|
||||
// +kubebuilder:resource:categories={crossplane,oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ContainerizedWorkload struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ContainerizedWorkloadSpec `json:"spec,omitempty"`
|
||||
Status ContainerizedWorkloadStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ContainerizedWorkloadList contains a list of ContainerizedWorkload.
|
||||
type ContainerizedWorkloadList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ContainerizedWorkload `json:"items"`
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -19,67 +19,75 @@ limitations under the License.
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
runtimev1alpha1 "github.com/crossplane/crossplane-runtime/apis/core/v1alpha1"
|
||||
)
|
||||
|
||||
// GetCondition of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
func (tr *ManualScalerTrait) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return tr.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) SetConditions(c ...condition.Condition) {
|
||||
func (tr *ManualScalerTrait) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
tr.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetWorkloadReference of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) GetWorkloadReference() corev1.ObjectReference {
|
||||
func (tr *ManualScalerTrait) GetWorkloadReference() runtimev1alpha1.TypedReference {
|
||||
return tr.Spec.WorkloadReference
|
||||
}
|
||||
|
||||
// SetWorkloadReference of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) SetWorkloadReference(r corev1.ObjectReference) {
|
||||
func (tr *ManualScalerTrait) SetWorkloadReference(r runtimev1alpha1.TypedReference) {
|
||||
tr.Spec.WorkloadReference = r
|
||||
}
|
||||
|
||||
// GetCondition of this ApplicationConfiguration.
|
||||
func (ac *ApplicationConfiguration) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
func (ac *ApplicationConfiguration) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return ac.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ApplicationConfiguration.
|
||||
func (ac *ApplicationConfiguration) SetConditions(c ...condition.Condition) {
|
||||
func (ac *ApplicationConfiguration) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
ac.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this Component.
|
||||
func (cm *Component) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
func (cm *Component) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return cm.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this Component.
|
||||
func (cm *Component) SetConditions(c ...condition.Condition) {
|
||||
func (cm *Component) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
cm.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this ContainerizedWorkload.
|
||||
func (wl *ContainerizedWorkload) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return wl.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ContainerizedWorkload.
|
||||
func (wl *ContainerizedWorkload) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
wl.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this HealthScope.
|
||||
func (hs *HealthScope) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
func (hs *HealthScope) GetCondition(ct runtimev1alpha1.ConditionType) runtimev1alpha1.Condition {
|
||||
return hs.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this HealthScope.
|
||||
func (hs *HealthScope) SetConditions(c ...condition.Condition) {
|
||||
func (hs *HealthScope) SetConditions(c ...runtimev1alpha1.Condition) {
|
||||
hs.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetWorkloadReferences to get all workload references for scope.
|
||||
func (hs *HealthScope) GetWorkloadReferences() []corev1.ObjectReference {
|
||||
func (hs *HealthScope) GetWorkloadReferences() []runtimev1alpha1.TypedReference {
|
||||
return hs.Spec.WorkloadReferences
|
||||
}
|
||||
|
||||
// AddWorkloadReference to add a workload reference to this scope.
|
||||
func (hs *HealthScope) AddWorkloadReference(r corev1.ObjectReference) {
|
||||
func (hs *HealthScope) AddWorkloadReference(r runtimev1alpha1.TypedReference) {
|
||||
hs.Spec.WorkloadReferences = append(hs.Spec.WorkloadReferences, r)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
Copyright 2020 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@@ -21,13 +21,11 @@ import (
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// Package type metadata.
|
||||
const (
|
||||
Group = common.Group
|
||||
Group = "core.oam.dev"
|
||||
Version = "v1alpha2"
|
||||
)
|
||||
|
||||
@@ -39,14 +37,6 @@ var (
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
)
|
||||
|
||||
// ComponentDefinition type metadata.
|
||||
var (
|
||||
ComponentDefinitionKind = reflect.TypeOf(ComponentDefinition{}).Name()
|
||||
ComponentDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: ComponentDefinitionKind}.String()
|
||||
ComponentDefinitionKindAPIVersion = ComponentDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
ComponentDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(ComponentDefinitionKind)
|
||||
)
|
||||
|
||||
// WorkloadDefinition type metadata.
|
||||
var (
|
||||
WorkloadDefinitionKind = reflect.TypeOf(WorkloadDefinition{}).Name()
|
||||
@@ -87,6 +77,14 @@ var (
|
||||
ApplicationConfigurationGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationConfigurationKind)
|
||||
)
|
||||
|
||||
// ContainerizedWorkload type metadata.
|
||||
var (
|
||||
ContainerizedWorkloadKind = reflect.TypeOf(ContainerizedWorkload{}).Name()
|
||||
ContainerizedWorkloadGroupKind = schema.GroupKind{Group: Group, Kind: ContainerizedWorkloadKind}.String()
|
||||
ContainerizedWorkloadKindAPIVersion = ContainerizedWorkloadKind + "." + SchemeGroupVersion.String()
|
||||
ContainerizedWorkloadGroupVersionKind = SchemeGroupVersion.WithKind(ContainerizedWorkloadKind)
|
||||
)
|
||||
|
||||
// ManualScalerTrait type metadata.
|
||||
var (
|
||||
ManualScalerTraitKind = reflect.TypeOf(ManualScalerTrait{}).Name()
|
||||
@@ -111,23 +109,23 @@ var (
|
||||
ApplicationKindVersionKind = SchemeGroupVersion.WithKind(ApplicationKind)
|
||||
)
|
||||
|
||||
// ApplicationRevision type metadata
|
||||
// Application type metadata.
|
||||
var (
|
||||
ApplicationRevisionKind = reflect.TypeOf(ApplicationRevision{}).Name()
|
||||
ApplicationRevisionGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationRevisionKind}.String()
|
||||
ApplicationRevisionKindAPIVersion = ApplicationRevisionKind + "." + SchemeGroupVersion.String()
|
||||
ApplicationRevisionGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationRevisionKind)
|
||||
ApplicationDeploymentKind = reflect.TypeOf(ApplicationDeployment{}).Name()
|
||||
ApplicationDeploymentGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationDeploymentKind}.String()
|
||||
ApplicationDeploymentKindAPIVersion = ApplicationKind + "." + SchemeGroupVersion.String()
|
||||
ApplicationDeploymentKindVersionKind = SchemeGroupVersion.WithKind(ApplicationDeploymentKind)
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&ComponentDefinition{}, &ComponentDefinitionList{})
|
||||
SchemeBuilder.Register(&WorkloadDefinition{}, &WorkloadDefinitionList{})
|
||||
SchemeBuilder.Register(&TraitDefinition{}, &TraitDefinitionList{})
|
||||
SchemeBuilder.Register(&ScopeDefinition{}, &ScopeDefinitionList{})
|
||||
SchemeBuilder.Register(&Component{}, &ComponentList{})
|
||||
SchemeBuilder.Register(&ApplicationConfiguration{}, &ApplicationConfigurationList{})
|
||||
SchemeBuilder.Register(&ContainerizedWorkload{}, &ContainerizedWorkloadList{})
|
||||
SchemeBuilder.Register(&ManualScalerTrait{}, &ManualScalerTraitList{})
|
||||
SchemeBuilder.Register(&HealthScope{}, &HealthScopeList{})
|
||||
SchemeBuilder.Register(&Application{}, &ApplicationList{})
|
||||
SchemeBuilder.Register(&ApplicationRevision{}, &ApplicationRevisionList{})
|
||||
SchemeBuilder.Register(&ApplicationDeployment{}, &ApplicationDeploymentList{})
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
)
|
||||
|
||||
const (
|
||||
// TypeHealthy application are believed to be determined as healthy by a health scope.
|
||||
TypeHealthy condition.ConditionType = "Healthy"
|
||||
)
|
||||
|
||||
// Reasons an application is or is not healthy
|
||||
const (
|
||||
ReasonHealthy condition.ConditionReason = "AllComponentsHealthy"
|
||||
ReasonUnhealthy condition.ConditionReason = "UnhealthyOrUnknownComponents"
|
||||
ReasonHealthCheckErr condition.ConditionReason = "HealthCheckeError"
|
||||
)
|
||||
|
||||
// AppPolicy defines a global policy for all components in the app.
|
||||
type AppPolicy struct {
|
||||
// Name is the unique name of the policy.
|
||||
Name string `json:"name"`
|
||||
|
||||
Type string `json:"type"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStep defines how to execute a workflow step.
|
||||
type WorkflowStep common.WorkflowStep
|
||||
|
||||
// Workflow defines workflow steps and other attributes
|
||||
type Workflow struct {
|
||||
Ref string `json:"ref,omitempty"`
|
||||
Mode *WorkflowExecuteMode `json:"mode,omitempty"`
|
||||
Steps []WorkflowStep `json:"steps,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowExecuteMode defines the mode of workflow execution
|
||||
type WorkflowExecuteMode struct {
|
||||
Steps common.WorkflowMode `json:"steps,omitempty"`
|
||||
SubSteps common.WorkflowMode `json:"subSteps,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationSpec is the spec of Application
|
||||
type ApplicationSpec struct {
|
||||
Components []common.ApplicationComponent `json:"components"`
|
||||
|
||||
// Policies defines the global policies for all components in the app, e.g. security, metrics, gitops,
|
||||
// multi-cluster placement rules, etc.
|
||||
// Policies are applied after components are rendered and before workflow steps are executed.
|
||||
Policies []AppPolicy `json:"policies,omitempty"`
|
||||
|
||||
// Workflow defines how to customize the control logic.
|
||||
// If workflow is specified, Vela won't apply any resource, but provide rendered output in AppRevision.
|
||||
// Workflow steps are executed in array order, and each step:
|
||||
// - will have a context in annotation.
|
||||
// - should mark "finish" phase in status.conditions.
|
||||
Workflow *Workflow `json:"workflow,omitempty"`
|
||||
|
||||
// TODO(wonderflow): we should have application level scopes supported here
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// Application is the Schema for the applications API
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:resource:categories={oam},shortName={app,velaapp}
|
||||
// +kubebuilder:printcolumn:name="COMPONENT",type=string,JSONPath=`.spec.components[*].name`
|
||||
// +kubebuilder:printcolumn:name="TYPE",type=string,JSONPath=`.spec.components[*].type`
|
||||
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.status`
|
||||
// +kubebuilder:printcolumn:name="HEALTHY",type=boolean,JSONPath=`.status.services[*].healthy`
|
||||
// +kubebuilder:printcolumn:name="STATUS",type=string,JSONPath=`.status.services[*].message`
|
||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type Application struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationSpec `json:"spec,omitempty"`
|
||||
Status common.AppStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationList contains a list of Application
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ApplicationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Application `json:"items"`
|
||||
}
|
||||
|
||||
// SetConditions set condition to application
|
||||
func (app *Application) SetConditions(c ...condition.Condition) {
|
||||
app.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition get condition by given condition type
|
||||
func (app *Application) GetCondition(t condition.ConditionType) condition.Condition {
|
||||
return app.Status.GetCondition(t)
|
||||
}
|
||||
|
||||
// GetComponent get the component from the application based on its workload type
|
||||
func (app *Application) GetComponent(workloadType string) *common.ApplicationComponent {
|
||||
for _, c := range app.Spec.Components {
|
||||
if c.Type == workloadType {
|
||||
return &c
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unstructured convert application to unstructured.Unstructured.
|
||||
func (app *Application) Unstructured() (*unstructured.Unstructured, error) {
|
||||
var obj = &unstructured.Unstructured{}
|
||||
app.SetGroupVersionKind(ApplicationKindVersionKind)
|
||||
bt, err := json.Marshal(app)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := obj.UnmarshalJSON(bt); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if app.Status.Services == nil {
|
||||
if err := unstructured.SetNestedSlice(obj.Object, []interface{}{}, "status", "services"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if app.Status.AppliedResources == nil {
|
||||
if err := unstructured.SetNestedSlice(obj.Object, []interface{}{}, "status", "appliedResources"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if wfStatus := app.Status.Workflow; wfStatus != nil && wfStatus.Steps == nil {
|
||||
if err := unstructured.SetNestedSlice(obj.Object, []interface{}{}, "status", "workflow", "steps"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return obj, nil
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1alpha1"
|
||||
)
|
||||
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// ApplicationRevisionSpec is the spec of ApplicationRevision
|
||||
type ApplicationRevisionSpec struct {
|
||||
// Application records the snapshot of the created/modified Application
|
||||
Application Application `json:"application"`
|
||||
|
||||
// ComponentDefinitions records the snapshot of the componentDefinitions related with the created/modified Application
|
||||
ComponentDefinitions map[string]ComponentDefinition `json:"componentDefinitions,omitempty"`
|
||||
|
||||
// WorkloadDefinitions records the snapshot of the workloadDefinitions related with the created/modified Application
|
||||
WorkloadDefinitions map[string]WorkloadDefinition `json:"workloadDefinitions,omitempty"`
|
||||
|
||||
// TraitDefinitions records the snapshot of the traitDefinitions related with the created/modified Application
|
||||
TraitDefinitions map[string]TraitDefinition `json:"traitDefinitions,omitempty"`
|
||||
|
||||
// ScopeDefinitions records the snapshot of the scopeDefinitions related with the created/modified Application
|
||||
ScopeDefinitions map[string]ScopeDefinition `json:"scopeDefinitions,omitempty"`
|
||||
|
||||
// PolicyDefinitions records the snapshot of the PolicyDefinitions related with the created/modified Application
|
||||
PolicyDefinitions map[string]PolicyDefinition `json:"policyDefinitions,omitempty"`
|
||||
|
||||
// WorkflowStepDefinitions records the snapshot of the WorkflowStepDefinitions related with the created/modified Application
|
||||
WorkflowStepDefinitions map[string]WorkflowStepDefinition `json:"workflowStepDefinitions,omitempty"`
|
||||
|
||||
// ScopeGVK records the apiVersion to GVK mapping
|
||||
ScopeGVK map[string]metav1.GroupVersionKind `json:"scopeGVK,omitempty"`
|
||||
|
||||
// Policies records the external policies
|
||||
Policies map[string]v1alpha1.Policy `json:"policies,omitempty"`
|
||||
|
||||
// Workflow records the external workflow
|
||||
Workflow *v1alpha1.Workflow `json:"workflow,omitempty"`
|
||||
|
||||
// ReferredObjects records the referred objects used in the ref-object typed components
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
ReferredObjects []common.ReferredObject `json:"referredObjects,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationRevisionStatus is the status of ApplicationRevision
|
||||
type ApplicationRevisionStatus struct {
|
||||
// Succeeded records if the workflow finished running with success
|
||||
Succeeded bool `json:"succeeded"`
|
||||
// Workflow the running status of the workflow
|
||||
Workflow *common.WorkflowStatus `json:"workflow,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationRevision is the Schema for the ApplicationRevision API
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:resource:categories={oam},shortName=apprev
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
||||
// +kubebuilder:printcolumn:name="PUBLISH_VERSION",type=string,JSONPath=`.metadata.annotations['app\.oam\.dev\/publishVersion']`
|
||||
// +kubebuilder:printcolumn:name="SUCCEEDED",type=string,JSONPath=`.status.succeeded`
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ApplicationRevision struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationRevisionSpec `json:"spec,omitempty"`
|
||||
Status ApplicationRevisionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationRevisionList contains a list of ApplicationRevision
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ApplicationRevisionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApplicationRevision `json:"items"`
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// ComponentDefinitionSpec defines the desired state of ComponentDefinition
|
||||
type ComponentDefinitionSpec struct {
|
||||
// Workload is a workload type descriptor
|
||||
Workload common.WorkloadTypeDescriptor `json:"workload"`
|
||||
|
||||
// ChildResourceKinds are the list of GVK of the child resources this workload generates
|
||||
ChildResourceKinds []common.ChildResourceKind `json:"childResourceKinds,omitempty"`
|
||||
|
||||
// RevisionLabel indicates which label for underlying resources(e.g. pods) of this workload
|
||||
// can be used by trait to create resource selectors(e.g. label selector for pods).
|
||||
// +optional
|
||||
RevisionLabel string `json:"revisionLabel,omitempty"`
|
||||
|
||||
// PodSpecPath indicates where/if this workload has K8s podSpec field
|
||||
// if one workload has podSpec, trait can do lot's of assumption such as port, env, volume fields.
|
||||
// +optional
|
||||
PodSpecPath string `json:"podSpecPath,omitempty"`
|
||||
|
||||
// Status defines the custom health policy and status message for workload
|
||||
// +optional
|
||||
Status *common.Status `json:"status,omitempty"`
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the workload
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// ComponentDefinitionStatus is the status of ComponentDefinition
|
||||
type ComponentDefinitionStatus struct {
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
// ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters.
|
||||
ConfigMapRef string `json:"configMapRef,omitempty"`
|
||||
// LatestRevision of the component definition
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ComponentDefinition is the Schema for the componentdefinitions API
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=comp
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="WORKLOAD-KIND",type=string,JSONPath=".spec.workload.definition.kind"
|
||||
// +kubebuilder:printcolumn:name="DESCRIPTION",type=string,JSONPath=".metadata.annotations.definition\\.oam\\.dev/description"
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ComponentDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ComponentDefinitionSpec `json:"spec,omitempty"`
|
||||
Status ComponentDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for ComponentDefinition
|
||||
func (cd *ComponentDefinition) SetConditions(c ...condition.Condition) {
|
||||
cd.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from ComponentDefinition
|
||||
func (cd *ComponentDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return cd.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ComponentDefinitionList contains a list of ComponentDefinition
|
||||
type ComponentDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ComponentDefinition `json:"items"`
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
// Hub marks this type as a conversion hub.
|
||||
func (*Application) Hub() {}
|
||||
@@ -1,261 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// A WorkloadDefinitionSpec defines the desired state of a WorkloadDefinition.
|
||||
type WorkloadDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this workload kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef"`
|
||||
|
||||
// ChildResourceKinds are the list of GVK of the child resources this workload generates
|
||||
ChildResourceKinds []common.ChildResourceKind `json:"childResourceKinds,omitempty"`
|
||||
|
||||
// RevisionLabel indicates which label for underlying resources(e.g. pods) of this workload
|
||||
// can be used by trait to create resource selectors(e.g. label selector for pods).
|
||||
// +optional
|
||||
RevisionLabel string `json:"revisionLabel,omitempty"`
|
||||
|
||||
// PodSpecPath indicates where/if this workload has K8s podSpec field
|
||||
// if one workload has podSpec, trait can do lot's of assumption such as port, env, volume fields.
|
||||
// +optional
|
||||
PodSpecPath string `json:"podSpecPath,omitempty"`
|
||||
|
||||
// Status defines the custom health policy and status message for workload
|
||||
// +optional
|
||||
Status *common.Status `json:"status,omitempty"`
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the workload
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// WorkloadDefinitionStatus is the status of WorkloadDefinition
|
||||
type WorkloadDefinitionStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A WorkloadDefinition registers a kind of Kubernetes custom resource as a
|
||||
// valid OAM workload kind by referencing its CustomResourceDefinition. The CRD
|
||||
// is used to validate the schema of the workload when it is embedded in an OAM
|
||||
// Component.
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=workload
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:printcolumn:name="DEFINITION-NAME",type=string,JSONPath=".spec.definitionRef.name"
|
||||
// +kubebuilder:printcolumn:name="DESCRIPTION",type=string,JSONPath=".metadata.annotations.definition\\.oam\\.dev/description"
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type WorkloadDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec WorkloadDefinitionSpec `json:"spec,omitempty"`
|
||||
Status WorkloadDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for WorkloadDefinition
|
||||
func (wd *WorkloadDefinition) SetConditions(c ...condition.Condition) {
|
||||
wd.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from WorkloadDefinition
|
||||
func (wd *WorkloadDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return wd.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// WorkloadDefinitionList contains a list of WorkloadDefinition.
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type WorkloadDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []WorkloadDefinition `json:"items"`
|
||||
}
|
||||
|
||||
// A TraitDefinitionSpec defines the desired state of a TraitDefinition.
|
||||
type TraitDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this trait kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef,omitempty"`
|
||||
|
||||
// Revision indicates whether a trait is aware of component revision
|
||||
// +optional
|
||||
RevisionEnabled bool `json:"revisionEnabled,omitempty"`
|
||||
|
||||
// WorkloadRefPath indicates where/if a trait accepts a workloadRef object
|
||||
// +optional
|
||||
WorkloadRefPath string `json:"workloadRefPath,omitempty"`
|
||||
|
||||
// PodDisruptive specifies whether using the trait will cause the pod to restart or not.
|
||||
// +optional
|
||||
PodDisruptive bool `json:"podDisruptive,omitempty"`
|
||||
|
||||
// AppliesToWorkloads specifies the list of workload kinds this trait
|
||||
// applies to. Workload kinds are specified in resource.group/version format,
|
||||
// e.g. server.core.oam.dev/v1alpha2. Traits that omit this field apply to
|
||||
// all workload kinds.
|
||||
// +optional
|
||||
AppliesToWorkloads []string `json:"appliesToWorkloads,omitempty"`
|
||||
|
||||
// ConflictsWith specifies the list of traits(CRD name, Definition name, CRD group)
|
||||
// which could not apply to the same workloads with this trait.
|
||||
// Traits that omit this field can work with any other traits.
|
||||
// Example rules:
|
||||
// "service" # Trait definition name
|
||||
// "services.k8s.io" # API resource/crd name
|
||||
// "*.networking.k8s.io" # API group
|
||||
// "labelSelector:foo=bar" # label selector
|
||||
// labelSelector format: https://pkg.go.dev/k8s.io/apimachinery/pkg/labels#Parse
|
||||
// +optional
|
||||
ConflictsWith []string `json:"conflictsWith,omitempty"`
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the trait
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
|
||||
// Status defines the custom health policy and status message for trait
|
||||
// +optional
|
||||
Status *common.Status `json:"status,omitempty"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
|
||||
// ManageWorkload defines the trait would be responsible for creating the workload
|
||||
// +optional
|
||||
ManageWorkload bool `json:"manageWorkload,omitempty"`
|
||||
// SkipRevisionAffect defines the update this trait will not generate a new application Revision
|
||||
// +optional
|
||||
SkipRevisionAffect bool `json:"skipRevisionAffect,omitempty"`
|
||||
// ControlPlaneOnly defines which cluster is dispatched to
|
||||
// +optional
|
||||
ControlPlaneOnly bool `json:"controlPlaneOnly,omitempty"`
|
||||
}
|
||||
|
||||
// TraitDefinitionStatus is the status of TraitDefinition
|
||||
type TraitDefinitionStatus struct {
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
// ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters.
|
||||
ConfigMapRef string `json:"configMapRef,omitempty"`
|
||||
// LatestRevision of the component definition
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A TraitDefinition registers a kind of Kubernetes custom resource as a valid
|
||||
// OAM trait kind by referencing its CustomResourceDefinition. The CRD is used
|
||||
// to validate the schema of the trait when it is embedded in an OAM
|
||||
// ApplicationConfiguration.
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=trait
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:printcolumn:name="APPLIES-TO",type=string,JSONPath=".spec.appliesToWorkloads"
|
||||
// +kubebuilder:printcolumn:name="DESCRIPTION",type=string,JSONPath=".metadata.annotations.definition\\.oam\\.dev/description"
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type TraitDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec TraitDefinitionSpec `json:"spec,omitempty"`
|
||||
Status TraitDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for TraitDefinition
|
||||
func (td *TraitDefinition) SetConditions(c ...condition.Condition) {
|
||||
td.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from TraitDefinition
|
||||
func (td *TraitDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return td.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// TraitDefinitionList contains a list of TraitDefinition.
|
||||
type TraitDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []TraitDefinition `json:"items"`
|
||||
}
|
||||
|
||||
// A ScopeDefinitionSpec defines the desired state of a ScopeDefinition.
|
||||
type ScopeDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this scope kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef"`
|
||||
|
||||
// WorkloadRefsPath indicates if/where a scope accepts workloadRef objects
|
||||
WorkloadRefsPath string `json:"workloadRefsPath,omitempty"`
|
||||
|
||||
// AllowComponentOverlap specifies whether an OAM component may exist in
|
||||
// multiple instances of this kind of scope.
|
||||
AllowComponentOverlap bool `json:"allowComponentOverlap"`
|
||||
|
||||
// Extension is used for extension needs by OAM platform builders
|
||||
// +optional
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Extension *runtime.RawExtension `json:"extension,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A ScopeDefinition registers a kind of Kubernetes custom resource as a valid
|
||||
// OAM scope kind by referencing its CustomResourceDefinition. The CRD is used
|
||||
// to validate the schema of the scope when it is embedded in an OAM
|
||||
// ApplicationConfiguration.
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.definitionRef.name",name=DEFINITION-NAME,type=string
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=scope
|
||||
// +kubebuilder:storageversion
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type ScopeDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ScopeDefinitionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// ScopeDefinitionList contains a list of ScopeDefinition.
|
||||
type ScopeDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ScopeDefinition `json:"items"`
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// DefinitionRevisionSpec is the spec of DefinitionRevision
|
||||
type DefinitionRevisionSpec struct {
|
||||
// Revision record revision number of DefinitionRevision
|
||||
Revision int64 `json:"revision"`
|
||||
|
||||
// RevisionHash record the hash value of the spec of DefinitionRevision object.
|
||||
RevisionHash string `json:"revisionHash"`
|
||||
|
||||
// DefinitionType
|
||||
DefinitionType common.DefinitionType `json:"definitionType"`
|
||||
|
||||
// ComponentDefinition records the snapshot of the created/modified ComponentDefinition
|
||||
ComponentDefinition ComponentDefinition `json:"componentDefinition,omitempty"`
|
||||
|
||||
// TraitDefinition records the snapshot of the created/modified TraitDefinition
|
||||
TraitDefinition TraitDefinition `json:"traitDefinition,omitempty"`
|
||||
|
||||
// PolicyDefinition records the snapshot of the created/modified PolicyDefinition
|
||||
PolicyDefinition PolicyDefinition `json:"policyDefinition,omitempty"`
|
||||
|
||||
// WorkflowStepDefinition records the snapshot of the created/modified WorkflowStepDefinition
|
||||
WorkflowStepDefinition WorkflowStepDefinition `json:"workflowStepDefinition,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// DefinitionRevision is the Schema for the DefinitionRevision API
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=defrev
|
||||
// +kubebuilder:printcolumn:name="REVISION",type=integer,JSONPath=".spec.revision"
|
||||
// +kubebuilder:printcolumn:name="HASH",type=string,JSONPath=".spec.revisionHash"
|
||||
// +kubebuilder:printcolumn:name="TYPE",type=string,JSONPath=".spec.definitionType"
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type DefinitionRevision struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec DefinitionRevisionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// DefinitionRevisionList contains a list of DefinitionRevision
|
||||
type DefinitionRevisionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []DefinitionRevision `json:"items"`
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1beta1 contains resources relating to the Open Application Model.
|
||||
// See https://github.com/oam-dev/spec for more details.
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=core.oam.dev
|
||||
// +versionName=v1beta1
|
||||
package v1beta1
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// PolicyDefinitionSpec defines the desired state of PolicyDefinition
|
||||
type PolicyDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this trait kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef,omitempty"`
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the policy definition
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
|
||||
// ManageHealthCheck means the policy will handle health checking and skip application controller
|
||||
// built-in health checking.
|
||||
ManageHealthCheck bool `json:"manageHealthCheck,omitempty"`
|
||||
}
|
||||
|
||||
// PolicyDefinitionStatus is the status of PolicyDefinition
|
||||
type PolicyDefinitionStatus struct {
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
// ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters.
|
||||
ConfigMapRef string `json:"configMapRef,omitempty"`
|
||||
|
||||
// LatestRevision of the component definition
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for PolicyDefinition
|
||||
func (d *PolicyDefinition) SetConditions(c ...condition.Condition) {
|
||||
d.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from PolicyDefinition
|
||||
func (d *PolicyDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return d.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// PolicyDefinition is the Schema for the policydefinitions API
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=def-policy
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:subresource:status
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type PolicyDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec PolicyDefinitionSpec `json:"spec,omitempty"`
|
||||
Status PolicyDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// PolicyDefinitionList contains a list of PolicyDefinition
|
||||
type PolicyDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []PolicyDefinition `json:"items"`
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// Package type metadata.
|
||||
const (
|
||||
Group = common.Group
|
||||
Version = "v1beta1"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
|
||||
// AddToScheme is a global function that registers this API group & version to a scheme
|
||||
AddToScheme = SchemeBuilder.AddToScheme
|
||||
)
|
||||
|
||||
// ComponentDefinition type metadata.
|
||||
var (
|
||||
ComponentDefinitionKind = reflect.TypeOf(ComponentDefinition{}).Name()
|
||||
ComponentDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: ComponentDefinitionKind}.String()
|
||||
ComponentDefinitionKindAPIVersion = ComponentDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
ComponentDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(ComponentDefinitionKind)
|
||||
)
|
||||
|
||||
// WorkloadDefinition type metadata.
|
||||
var (
|
||||
WorkloadDefinitionKind = reflect.TypeOf(WorkloadDefinition{}).Name()
|
||||
WorkloadDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: WorkloadDefinitionKind}.String()
|
||||
WorkloadDefinitionKindAPIVersion = WorkloadDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
WorkloadDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(WorkloadDefinitionKind)
|
||||
)
|
||||
|
||||
// TraitDefinition type metadata.
|
||||
var (
|
||||
TraitDefinitionKind = reflect.TypeOf(TraitDefinition{}).Name()
|
||||
TraitDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: TraitDefinitionKind}.String()
|
||||
TraitDefinitionKindAPIVersion = TraitDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
TraitDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(TraitDefinitionKind)
|
||||
)
|
||||
|
||||
// PolicyDefinition type metadata.
|
||||
var (
|
||||
PolicyDefinitionKind = reflect.TypeOf(PolicyDefinition{}).Name()
|
||||
PolicyDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: PolicyDefinitionKind}.String()
|
||||
PolicyDefinitionKindAPIVersion = PolicyDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
PolicyDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(PolicyDefinitionKind)
|
||||
)
|
||||
|
||||
// WorkflowStepDefinition type metadata.
|
||||
var (
|
||||
WorkflowStepDefinitionKind = reflect.TypeOf(WorkflowStepDefinition{}).Name()
|
||||
WorkflowStepDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: WorkflowStepDefinitionKind}.String()
|
||||
WorkflowStepDefinitionKindAPIVersion = WorkflowStepDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
WorkflowStepDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(WorkflowStepDefinitionKind)
|
||||
)
|
||||
|
||||
// DefinitionRevision type metadata.
|
||||
var (
|
||||
DefinitionRevisionKind = reflect.TypeOf(DefinitionRevision{}).Name()
|
||||
DefinitionRevisionGroupKind = schema.GroupKind{Group: Group, Kind: DefinitionRevisionKind}.String()
|
||||
DefinitionRevisionKindAPIVersion = DefinitionRevisionKind + "." + SchemeGroupVersion.String()
|
||||
DefinitionRevisionGroupVersionKind = SchemeGroupVersion.WithKind(DefinitionRevisionKind)
|
||||
)
|
||||
|
||||
// Application type metadata.
|
||||
var (
|
||||
ApplicationKind = reflect.TypeOf(Application{}).Name()
|
||||
ApplicationGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationKind}.String()
|
||||
ApplicationKindAPIVersion = ApplicationKind + "." + SchemeGroupVersion.String()
|
||||
ApplicationKindVersionKind = SchemeGroupVersion.WithKind(ApplicationKind)
|
||||
)
|
||||
|
||||
// ApplicationRevision type metadata
|
||||
var (
|
||||
ApplicationRevisionKind = reflect.TypeOf(ApplicationRevision{}).Name()
|
||||
ApplicationRevisionGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationRevisionKind}.String()
|
||||
ApplicationRevisionKindAPIVersion = ApplicationRevisionKind + "." + SchemeGroupVersion.String()
|
||||
ApplicationRevisionGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationRevisionKind)
|
||||
)
|
||||
|
||||
// ScopeDefinition type metadata.
|
||||
var (
|
||||
ScopeDefinitionKind = reflect.TypeOf(ScopeDefinition{}).Name()
|
||||
ScopeDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: ScopeDefinitionKind}.String()
|
||||
ScopeDefinitionKindAPIVersion = ScopeDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
ScopeDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(ScopeDefinitionKind)
|
||||
)
|
||||
|
||||
// ResourceTracker type metadata.
|
||||
var (
|
||||
ResourceTrackerKind = reflect.TypeOf(ResourceTracker{}).Name()
|
||||
ResourceTrackerGroupKind = schema.GroupKind{Group: Group, Kind: ResourceTrackerKind}.String()
|
||||
ResourceTrackerKindAPIVersion = ResourceTrackerKind + "." + SchemeGroupVersion.String()
|
||||
ResourceTrackerKindVersionKind = SchemeGroupVersion.WithKind(ResourceTrackerKind)
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&ComponentDefinition{}, &ComponentDefinitionList{})
|
||||
SchemeBuilder.Register(&WorkloadDefinition{}, &WorkloadDefinitionList{})
|
||||
SchemeBuilder.Register(&TraitDefinition{}, &TraitDefinitionList{})
|
||||
SchemeBuilder.Register(&PolicyDefinition{}, &PolicyDefinitionList{})
|
||||
SchemeBuilder.Register(&WorkflowStepDefinition{}, &WorkflowStepDefinitionList{})
|
||||
SchemeBuilder.Register(&DefinitionRevision{}, &DefinitionRevisionList{})
|
||||
SchemeBuilder.Register(&ScopeDefinition{}, &ScopeDefinitionList{})
|
||||
SchemeBuilder.Register(&Application{}, &ApplicationList{})
|
||||
SchemeBuilder.Register(&ApplicationRevision{}, &ApplicationRevisionList{})
|
||||
SchemeBuilder.Register(&ResourceTracker{}, &ResourceTrackerList{})
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
}
|
||||
@@ -1,300 +0,0 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
errors2 "github.com/pkg/errors"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
|
||||
"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"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/errors"
|
||||
)
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// An ResourceTracker represents a tracker for track cross namespace resources
|
||||
// +kubebuilder:printcolumn:name="TYPE",type=string,JSONPath=`.spec.type`
|
||||
// +kubebuilder:printcolumn:name="APP",type=string,JSONPath=`.metadata.labels['app\.oam\.dev\/name']`
|
||||
// +kubebuilder:printcolumn:name="APP-NS",type=string,JSONPath=`.metadata.labels['app\.oam\.dev\/namespace']`
|
||||
// +kubebuilder:printcolumn:name="APP-GEN",type=number,JSONPath=`.spec.applicationGeneration`
|
||||
// +kubebuilder:resource:scope=Cluster,categories={oam},shortName=rt
|
||||
type ResourceTracker struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ResourceTrackerSpec `json:"spec,omitempty"`
|
||||
Status ResourceTrackerStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceTrackerType defines the type of resourceTracker
|
||||
type ResourceTrackerType string
|
||||
|
||||
const (
|
||||
// ResourceTrackerTypeRoot means resources in this resourceTracker will only be recycled when application is deleted
|
||||
ResourceTrackerTypeRoot = ResourceTrackerType("root")
|
||||
// ResourceTrackerTypeVersioned means resources in this resourceTracker will be recycled when this version is unused and this resource is not managed by latest RT
|
||||
ResourceTrackerTypeVersioned = ResourceTrackerType("versioned")
|
||||
// ResourceTrackerTypeComponentRevision stores all component revisions used
|
||||
ResourceTrackerTypeComponentRevision = ResourceTrackerType("component-revision")
|
||||
)
|
||||
|
||||
// ResourceTrackerSpec define the spec of resourceTracker
|
||||
type ResourceTrackerSpec struct {
|
||||
Type ResourceTrackerType `json:"type,omitempty"`
|
||||
ApplicationGeneration int64 `json:"applicationGeneration"`
|
||||
ManagedResources []ManagedResource `json:"managedResources,omitempty"`
|
||||
}
|
||||
|
||||
// ManagedResource define the resource to be managed by ResourceTracker
|
||||
type ManagedResource struct {
|
||||
common.ClusterObjectReference `json:",inline"`
|
||||
common.OAMObjectReference `json:",inline"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Data *runtime.RawExtension `json:"raw,omitempty"`
|
||||
// Deleted marks the resource to be deleted
|
||||
Deleted bool `json:"deleted,omitempty"`
|
||||
// SkipGC marks the resource to skip gc
|
||||
SkipGC bool `json:"skipGC,omitempty"`
|
||||
}
|
||||
|
||||
// Equal check if two managed resource equals
|
||||
func (in ManagedResource) Equal(r ManagedResource) bool {
|
||||
if !in.ClusterObjectReference.Equal(r.ClusterObjectReference) {
|
||||
return false
|
||||
}
|
||||
if !in.OAMObjectReference.Equal(r.OAMObjectReference) {
|
||||
return false
|
||||
}
|
||||
return reflect.DeepEqual(in.Data, r.Data)
|
||||
}
|
||||
|
||||
// DisplayName readable name for locating resource
|
||||
func (in ManagedResource) DisplayName() string {
|
||||
s := in.Kind + " " + in.Name
|
||||
if in.Namespace != "" || in.Cluster != "" {
|
||||
s += " ("
|
||||
if in.Cluster != "" {
|
||||
s += "Cluster: " + in.Cluster
|
||||
if in.Namespace != "" {
|
||||
s += ", "
|
||||
}
|
||||
}
|
||||
if in.Namespace != "" {
|
||||
s += "Namespace: " + in.Namespace
|
||||
}
|
||||
s += ")"
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// NamespacedName 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 {
|
||||
group := in.GroupVersionKind().Group
|
||||
kind := in.GroupVersionKind().Kind
|
||||
cluster := in.Cluster
|
||||
if cluster == "" {
|
||||
cluster = velatypes.ClusterLocalName
|
||||
}
|
||||
return strings.Join([]string{group, kind, cluster, in.Namespace, in.Name}, "/")
|
||||
}
|
||||
|
||||
// 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}, "/")
|
||||
}
|
||||
|
||||
// UnmarshalTo unmarshal ManagedResource into target object
|
||||
func (in ManagedResource) UnmarshalTo(obj interface{}) error {
|
||||
if in.Data == nil || in.Data.Raw == nil {
|
||||
return errors.ManagedResourceHasNoDataError{}
|
||||
}
|
||||
return json.Unmarshal(in.Data.Raw, obj)
|
||||
}
|
||||
|
||||
// ToUnstructured converts managed resource into unstructured
|
||||
func (in ManagedResource) ToUnstructured() *unstructured.Unstructured {
|
||||
obj := &unstructured.Unstructured{}
|
||||
obj.SetGroupVersionKind(in.GroupVersionKind())
|
||||
obj.SetName(in.Name)
|
||||
if in.Namespace != "" {
|
||||
obj.SetNamespace(in.Namespace)
|
||||
}
|
||||
oam.SetCluster(obj, in.Cluster)
|
||||
return obj
|
||||
}
|
||||
|
||||
// ToUnstructuredWithData converts managed resource into unstructured and unmarshal data
|
||||
func (in ManagedResource) ToUnstructuredWithData() (*unstructured.Unstructured, error) {
|
||||
obj := in.ToUnstructured()
|
||||
if err := in.UnmarshalTo(obj); err != nil {
|
||||
if errors2.Is(err, errors.ManagedResourceHasNoDataError{}) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
// ResourceTrackerList contains a list of ResourceTracker
|
||||
type ResourceTrackerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ResourceTracker `json:"items"`
|
||||
}
|
||||
|
||||
func (in *ResourceTracker) findMangedResourceIndex(mr ManagedResource) int {
|
||||
for i, _mr := range in.Spec.ManagedResources {
|
||||
if mr.ClusterObjectReference.Equal(_mr.ClusterObjectReference) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func newManagedResourceFromResource(rsc client.Object) ManagedResource {
|
||||
gvk := rsc.GetObjectKind().GroupVersionKind()
|
||||
return ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{
|
||||
ObjectReference: v1.ObjectReference{
|
||||
APIVersion: gvk.GroupVersion().String(),
|
||||
Kind: gvk.Kind,
|
||||
Name: rsc.GetName(),
|
||||
Namespace: rsc.GetNamespace(),
|
||||
},
|
||||
Cluster: oam.GetCluster(rsc),
|
||||
},
|
||||
OAMObjectReference: common.NewOAMObjectReferenceFromObject(rsc),
|
||||
Deleted: false,
|
||||
}
|
||||
}
|
||||
|
||||
// ContainsManagedResource check if resource exists in ResourceTracker
|
||||
func (in *ResourceTracker) ContainsManagedResource(rsc client.Object) bool {
|
||||
mr := newManagedResourceFromResource(rsc)
|
||||
return in.findMangedResourceIndex(mr) >= 0
|
||||
}
|
||||
|
||||
// AddManagedResource add object to managed resources, if exists, update
|
||||
func (in *ResourceTracker) AddManagedResource(rsc client.Object, metaOnly bool, skipGC bool, creator common.ResourceCreatorRole) (updated bool) {
|
||||
mr := newManagedResourceFromResource(rsc)
|
||||
mr.SkipGC = skipGC
|
||||
if !metaOnly {
|
||||
mr.Data = &runtime.RawExtension{Object: rsc}
|
||||
}
|
||||
if creator != "" {
|
||||
mr.ClusterObjectReference.Creator = creator
|
||||
}
|
||||
if idx := in.findMangedResourceIndex(mr); idx >= 0 {
|
||||
if reflect.DeepEqual(in.Spec.ManagedResources[idx], mr) {
|
||||
return false
|
||||
}
|
||||
in.Spec.ManagedResources[idx] = mr
|
||||
} else {
|
||||
in.Spec.ManagedResources = append(in.Spec.ManagedResources, mr)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// DeleteManagedResource if remove flag is on, it will remove the object from recorded resources.
|
||||
// otherwise, it will mark the object as deleted instead of removing it
|
||||
// workflow stage: resources are marked as deleted (and execute the deletion action)
|
||||
// state-keep stage: resources marked as deleted and successfully deleted will be removed from resourcetracker
|
||||
func (in *ResourceTracker) DeleteManagedResource(rsc client.Object, remove bool) (updated bool) {
|
||||
gvk := rsc.GetObjectKind().GroupVersionKind()
|
||||
mr := ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{
|
||||
ObjectReference: v1.ObjectReference{
|
||||
APIVersion: gvk.GroupVersion().String(),
|
||||
Kind: gvk.Kind,
|
||||
Name: rsc.GetName(),
|
||||
Namespace: rsc.GetNamespace(),
|
||||
},
|
||||
Cluster: oam.GetCluster(rsc),
|
||||
},
|
||||
Deleted: true,
|
||||
}
|
||||
if idx := in.findMangedResourceIndex(mr); idx >= 0 {
|
||||
if remove {
|
||||
in.Spec.ManagedResources = append(in.Spec.ManagedResources[:idx], in.Spec.ManagedResources[idx+1:]...)
|
||||
} else {
|
||||
if reflect.DeepEqual(in.Spec.ManagedResources[idx], mr) {
|
||||
return false
|
||||
}
|
||||
in.Spec.ManagedResources[idx] = mr
|
||||
}
|
||||
} else {
|
||||
if !remove {
|
||||
in.Spec.ManagedResources = append(in.Spec.ManagedResources, mr)
|
||||
}
|
||||
}
|
||||
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: v1.ObjectReference{
|
||||
APIVersion: rsc.GetAPIVersion(),
|
||||
Kind: rsc.GetKind(),
|
||||
Name: rsc.GetName(),
|
||||
Namespace: rsc.GetNamespace(),
|
||||
UID: rsc.GetUID(),
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
/*
|
||||
Copyright 2021 The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
v12 "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
v13 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/utils/pointer"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/pkg/utils/errors"
|
||||
)
|
||||
|
||||
func TestManagedResource_DeepCopyEqual(t *testing.T) {
|
||||
r := require.New(t)
|
||||
mr := ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{Cluster: "cluster"},
|
||||
OAMObjectReference: common.OAMObjectReference{Component: "component"},
|
||||
Data: &runtime.RawExtension{Raw: []byte("data")},
|
||||
}
|
||||
r.True(mr.Equal(*mr.DeepCopy()))
|
||||
}
|
||||
|
||||
func TestManagedResource_Equal(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
input1 ManagedResource
|
||||
input2 ManagedResource
|
||||
equal bool
|
||||
}{
|
||||
"equal": {
|
||||
input1: ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{Cluster: "cluster"},
|
||||
OAMObjectReference: common.OAMObjectReference{Component: "component"},
|
||||
Data: &runtime.RawExtension{Raw: []byte("data")},
|
||||
},
|
||||
input2: ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{Cluster: "cluster"},
|
||||
OAMObjectReference: common.OAMObjectReference{Component: "component"},
|
||||
Data: &runtime.RawExtension{Raw: []byte("data")},
|
||||
},
|
||||
equal: true,
|
||||
},
|
||||
"ClusterObjectReference not equal": {
|
||||
input1: ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{Cluster: "cluster"},
|
||||
},
|
||||
input2: ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{Cluster: "c"},
|
||||
},
|
||||
equal: false,
|
||||
},
|
||||
"OAMObjectReference not equal": {
|
||||
input1: ManagedResource{
|
||||
OAMObjectReference: common.OAMObjectReference{Component: "component"},
|
||||
},
|
||||
input2: ManagedResource{
|
||||
OAMObjectReference: common.OAMObjectReference{Component: "c"},
|
||||
},
|
||||
equal: false,
|
||||
},
|
||||
"Data content not equal": {
|
||||
input1: ManagedResource{
|
||||
Data: &runtime.RawExtension{Raw: []byte("data")},
|
||||
},
|
||||
input2: ManagedResource{
|
||||
Data: &runtime.RawExtension{Raw: []byte("d")},
|
||||
},
|
||||
equal: false,
|
||||
},
|
||||
"one data empty, one data not empty": {
|
||||
input1: ManagedResource{Data: nil},
|
||||
input2: ManagedResource{
|
||||
Data: &runtime.RawExtension{Raw: []byte("d")},
|
||||
},
|
||||
equal: false,
|
||||
},
|
||||
}
|
||||
for name, tc := range testCases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
r := require.New(t)
|
||||
r.Equal(tc.equal, tc.input1.Equal(tc.input2))
|
||||
r.Equal(tc.equal, tc.input2.Equal(tc.input1))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestManagedResourceKeys(t *testing.T) {
|
||||
r := require.New(t)
|
||||
input := ManagedResource{
|
||||
ClusterObjectReference: common.ClusterObjectReference{
|
||||
Cluster: "cluster",
|
||||
ObjectReference: v1.ObjectReference{
|
||||
Namespace: "namespace",
|
||||
Name: "name",
|
||||
APIVersion: v12.SchemeGroupVersion.String(),
|
||||
Kind: "Deployment",
|
||||
},
|
||||
},
|
||||
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("Deployment name (Cluster: cluster, Namespace: namespace)", input.DisplayName())
|
||||
var deploy1, deploy2 v12.Deployment
|
||||
deploy1.Spec.Replicas = pointer.Int32(5)
|
||||
bs, err := json.Marshal(deploy1)
|
||||
r.NoError(err)
|
||||
r.ErrorIs(input.UnmarshalTo(&deploy2), errors.ManagedResourceHasNoDataError{})
|
||||
_, err = input.ToUnstructuredWithData()
|
||||
r.ErrorIs(err, errors.ManagedResourceHasNoDataError{})
|
||||
input.Data = &runtime.RawExtension{Raw: bs}
|
||||
r.NoError(input.UnmarshalTo(&deploy2))
|
||||
r.Equal(deploy1, deploy2)
|
||||
obj := input.ToUnstructured()
|
||||
r.Equal("Deployment", obj.GetKind())
|
||||
r.Equal("apps/v1", obj.GetAPIVersion())
|
||||
r.Equal("name", obj.GetName())
|
||||
r.Equal("namespace", obj.GetNamespace())
|
||||
r.Equal("cluster", oam.GetCluster(obj))
|
||||
obj, err = input.ToUnstructuredWithData()
|
||||
r.NoError(err)
|
||||
val, correct, err := unstructured.NestedInt64(obj.Object, "spec", "replicas")
|
||||
r.NoError(err)
|
||||
r.True(correct)
|
||||
r.Equal(int64(5), val)
|
||||
}
|
||||
|
||||
func TestResourceTracker_ManagedResource(t *testing.T) {
|
||||
r := require.New(t)
|
||||
input := &ResourceTracker{}
|
||||
deploy1 := v12.Deployment{ObjectMeta: v13.ObjectMeta{Name: "deploy1"}}
|
||||
input.AddManagedResource(&deploy1, true, false, "")
|
||||
r.Equal(1, len(input.Spec.ManagedResources))
|
||||
cm2 := v1.ConfigMap{ObjectMeta: v13.ObjectMeta{Name: "cm2"}}
|
||||
input.AddManagedResource(&cm2, false, false, "")
|
||||
r.Equal(2, len(input.Spec.ManagedResources))
|
||||
pod3 := v1.Pod{ObjectMeta: v13.ObjectMeta{Name: "pod3"}}
|
||||
input.AddManagedResource(&pod3, false, false, "")
|
||||
r.Equal(3, len(input.Spec.ManagedResources))
|
||||
deploy1.Spec.Replicas = pointer.Int32(5)
|
||||
input.AddManagedResource(&deploy1, false, false, "")
|
||||
r.Equal(3, len(input.Spec.ManagedResources))
|
||||
input.DeleteManagedResource(&cm2, false)
|
||||
r.Equal(3, len(input.Spec.ManagedResources))
|
||||
r.True(input.Spec.ManagedResources[1].Deleted)
|
||||
input.DeleteManagedResource(&cm2, true)
|
||||
r.Equal(2, len(input.Spec.ManagedResources))
|
||||
input.DeleteManagedResource(&deploy1, true)
|
||||
r.Equal(1, len(input.Spec.ManagedResources))
|
||||
input.DeleteManagedResource(&pod3, true)
|
||||
r.Equal(0, len(input.Spec.ManagedResources))
|
||||
secret4 := v1.Secret{ObjectMeta: v13.ObjectMeta{Name: "secret4"}}
|
||||
input.DeleteManagedResource(&secret4, true)
|
||||
r.Equal(0, len(input.Spec.ManagedResources))
|
||||
input.DeleteManagedResource(&secret4, false)
|
||||
r.Equal(1, len(input.Spec.ManagedResources))
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
Copyright 2021. The KubeVela Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// WorkflowStepDefinitionSpec defines the desired state of WorkflowStepDefinition
|
||||
type WorkflowStepDefinitionSpec struct {
|
||||
// Reference to the CustomResourceDefinition that defines this trait kind.
|
||||
Reference common.DefinitionReference `json:"definitionRef,omitempty"`
|
||||
|
||||
// Schematic defines the data format and template of the encapsulation of the workflow step definition
|
||||
// +optional
|
||||
Schematic *common.Schematic `json:"schematic,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStepDefinitionStatus is the status of WorkflowStepDefinition
|
||||
type WorkflowStepDefinitionStatus struct {
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
// ConfigMapRef refer to a ConfigMap which contains OpenAPI V3 JSON schema of Component parameters.
|
||||
ConfigMapRef string `json:"configMapRef,omitempty"`
|
||||
// LatestRevision of the component definition
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for WorkflowStepDefinition
|
||||
func (d *WorkflowStepDefinition) SetConditions(c ...condition.Condition) {
|
||||
d.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from WorkflowStepDefinition
|
||||
func (d *WorkflowStepDefinition) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return d.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// WorkflowStepDefinition is the Schema for the workflowstepdefinitions API
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=workflowstep
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:subresource:status
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type WorkflowStepDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec WorkflowStepDefinitionSpec `json:"spec,omitempty"`
|
||||
Status WorkflowStepDefinitionStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
|
||||
// WorkflowStepDefinitionList contains a list of WorkflowStepDefinition
|
||||
type WorkflowStepDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []WorkflowStepDefinition `json:"items"`
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user