mirror of
https://github.com/kubevela/kubevela.git
synced 2026-02-14 18:10:21 +00:00
Compare commits
75 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c4c00637bd | ||
|
|
493d8bdc5d | ||
|
|
e636d7c48c | ||
|
|
1fafe5f05e | ||
|
|
ed574179d4 | ||
|
|
378ab1b81f | ||
|
|
d16ae2a6f7 | ||
|
|
de5f140b08 | ||
|
|
93faf41ac4 | ||
|
|
1d7ace119d | ||
|
|
44bdf033ad | ||
|
|
69008da5e8 | ||
|
|
514ef7ff03 | ||
|
|
bce3e158ca | ||
|
|
8a9df2dd39 | ||
|
|
9a0ea76210 | ||
|
|
156f165b5c | ||
|
|
fce05bffc5 | ||
|
|
6c0b943dfc | ||
|
|
d83fa47741 | ||
|
|
e8fe203265 | ||
|
|
a075830ae1 | ||
|
|
8ab4634701 | ||
|
|
9838eff9c7 | ||
|
|
476de5e4f1 | ||
|
|
c89d1e1713 | ||
|
|
4e9a7fc82e | ||
|
|
3b62e44ef8 | ||
|
|
066c448c1a | ||
|
|
8de80ebdb2 | ||
|
|
855cbfe3ec | ||
|
|
162534b611 | ||
|
|
6bd5d8e6e2 | ||
|
|
22079aacd3 | ||
|
|
b2329d548d | ||
|
|
9152c15a88 | ||
|
|
73b3d3106b | ||
|
|
237c71d94e | ||
|
|
2200d199f3 | ||
|
|
d083039a32 | ||
|
|
5e6be649c1 | ||
|
|
706a65beae | ||
|
|
d21a337dd7 | ||
|
|
b53f4f4fdd | ||
|
|
24970cd990 | ||
|
|
844f479f54 | ||
|
|
91d336b469 | ||
|
|
516156f32f | ||
|
|
eb5808e4ea | ||
|
|
66f794e9fd | ||
|
|
90f46c57e8 | ||
|
|
95496e55c0 | ||
|
|
3009d02fcd | ||
|
|
df8b60d521 | ||
|
|
6c6e834155 | ||
|
|
cc3d2e28c0 | ||
|
|
f95ff4f06e | ||
|
|
e30876e4d2 | ||
|
|
141c6bb2ef | ||
|
|
bdfd8e1f8d | ||
|
|
cfbaf38715 | ||
|
|
d3006f2d9e | ||
|
|
8f7aa9b746 | ||
|
|
8431cdb10d | ||
|
|
66013a9607 | ||
|
|
1d133df1dd | ||
|
|
c66f5f103f | ||
|
|
e6779f6906 | ||
|
|
a48b74d4be | ||
|
|
2da80af3c4 | ||
|
|
7bf5e17262 | ||
|
|
53a6d54b73 | ||
|
|
bcd072507b | ||
|
|
ae075e6cb6 | ||
|
|
b2127ee4fa |
47
.github/CODEOWNERS
vendored
47
.github/CODEOWNERS
vendored
@@ -1,35 +1,36 @@
|
||||
# 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 @jefree-cat @FogDong @wangyikewxgm @chivalryq @anoop2811 @briankane @jguionnet
|
||||
design/ @barnettZQG @leejanee @wonderflow @Somefive @jefree-cat @FogDong @anoop2811 @briankane @jguionnet
|
||||
|
||||
# Owner of Core Controllers
|
||||
pkg/controller/core.oam.dev @Somefive @FogDong @barnettZQG @wonderflow @wangyikewxgm @chivalryq @anoop2811 @briankane @jguionnet
|
||||
|
||||
# Owner of Standard Controllers
|
||||
pkg/controller/standard.oam.dev @wangyikewxgm @barnettZQG @wonderflow @Somefive @anoop2811 @FogDong @briankane @jguionnet
|
||||
* @hongchaodeng @wonderflow @leejanee
|
||||
design/ @hongchaodeng @resouer @wonderflow
|
||||
|
||||
# Owner of CUE
|
||||
pkg/cue @leejanee @FogDong @Somefive @anoop2811 @briankane @jguionnet
|
||||
pkg/stdlib @leejanee @FogDong @Somefive @anoop2811 @briankane @jguionnet
|
||||
pkg/cue @leejanee @FogDong
|
||||
pkg/stdlib @leejanee @FogDong
|
||||
|
||||
# Owner of Workflow
|
||||
pkg/workflow @leejanee @FogDong @Somefive @wangyikewxgm @chivalryq @anoop2811 @briankane @jguionnet
|
||||
pkg/workflow @leejanee @FogDong
|
||||
|
||||
# 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
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/policies/policydefinition @yangsoon @Somefive
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/components/componentdefinition @yangsoon @zzxwill
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/traits/traitdefinition @yangsoon @zzxwill
|
||||
|
||||
# Owner of health scope controller
|
||||
pkg/controller/core.oam.dev/v1alpha2/core/scopes/healthscope @captainroy-hy @zzxwill
|
||||
|
||||
# Owner of vela templates
|
||||
vela-templates/ @Somefive @barnettZQG @wonderflow @FogDong @wangyikewxgm @chivalryq @anoop2811 @briankane @jguionnet
|
||||
vela-templates/ @Somefive @barnettZQG @wonderflow
|
||||
|
||||
# Owner of vela CLI
|
||||
references/cli/ @Somefive @StevenLeiZhang @charlie0129 @wangyikewxgm @chivalryq @anoop2811 @FogDong @briankane @jguionnet
|
||||
references/cli/ @Somefive @zzxwill
|
||||
|
||||
# Owner of vela addon framework
|
||||
pkg/addon/ @wangyikewxgm @wonderflow @charlie0129 @anoop2811 @FogDong @briankane @jguionnet
|
||||
|
||||
# Owner of resource keeper and tracker
|
||||
pkg/resourcekeeper @Somefive @FogDong @chivalryq @anoop2811 @briankane @jguionnet
|
||||
pkg/resourcetracker @Somefive @FogDong @chivalryq @anoop2811 @briankane @jguionnet
|
||||
|
||||
.github/ @chivalryq @wonderflow @Somefive @FogDong @wangyikewxgm @anoop2811 @briankane @jguionnet
|
||||
makefiles @chivalryq @wonderflow @Somefive @FogDong @wangyikewxgm @anoop2811 @briankane @jguionnet
|
||||
go.* @chivalryq @wonderflow @Somefive @FogDong @wangyikewxgm @anoop2811 @briankane @jguionnet
|
||||
# Owner of vela APIServer
|
||||
pkg/apiserver/ @barnettZQG @yangsoon
|
||||
|
||||
|
||||
53
.github/PULL_REQUEST_TEMPLATE.md
vendored
53
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,39 +1,36 @@
|
||||
<!--
|
||||
|
||||
### Description of your changes
|
||||
Thank you for sending a pull request! Here are some tips:
|
||||
|
||||
copilot:all
|
||||
1. If this is your first time, please read our contribution guide at https://github.com/oam-dev/kubevela/blob/master/CONTRIBUTING.md
|
||||
|
||||
2. Ensure you include and run the appropriate tests as part of your Pull Request.
|
||||
|
||||
3. In a new feature or configuration option, an update to the documentation is necessary. Everything related to the documentation is under the docs folder in the root of the repository.
|
||||
|
||||
4. If the Pull Request is a work in progress, make use of GitHub's "Draft PR" feature and mark it as such.
|
||||
|
||||
5. If you can not merge your Pull Request due to a merge conflict, Rebase it. This gets it in sync with the master branch.
|
||||
|
||||
6. Name your PR as "<FeatureArea>: Describe your change", e.g. Application: Add health check for application.
|
||||
If it's a fix or feature relevant for the changelog describe the user impact in the title.
|
||||
The PR title is used to auto-generate the changelog for issues marked with the "add to changelog" label.
|
||||
|
||||
-->
|
||||
|
||||
**What this PR does / why we need it**:
|
||||
|
||||
**Which issue(s) this PR fixes**:
|
||||
|
||||
<!--
|
||||
|
||||
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":
|
||||
- Automatically closes linked issue when the Pull Request is merged.
|
||||
|
||||
Usage: "Fixes #<issue number>", or "Fixes (paste link of issue)"
|
||||
|
||||
-->
|
||||
|
||||
Fixes #
|
||||
|
||||
I have:
|
||||
**Special notes for your reviewer**:
|
||||
|
||||
- [ ] 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.
|
||||
|
||||
-->
|
||||
35
.github/actions/deploy-current-branch/README.md
vendored
35
.github/actions/deploy-current-branch/README.md
vendored
@@ -1,35 +0,0 @@
|
||||
# Deploy Current Branch Action
|
||||
|
||||
This GitHub composite action builds a Docker image from the current branch commit and deploys it to a KubeVela cluster for development testing.
|
||||
|
||||
## What it does
|
||||
|
||||
- Generates a unique image tag from the latest commit hash
|
||||
- Builds and loads the Docker image into a KinD cluster
|
||||
- Applies KubeVela CRDs for upgrade safety
|
||||
- Upgrades the KubeVela Helm release to use the local development image
|
||||
- Verifies deployment status and the running image version
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- name: Deploy Current Branch
|
||||
uses: ./path/to/this/action
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker, Helm, kubectl, and KinD must be available in your runner environment
|
||||
- Kubernetes cluster access
|
||||
- `charts/vela-core/crds` directory with CRDs
|
||||
- Valid Helm chart at `charts/vela-core`
|
||||
|
||||
## Steps performed
|
||||
|
||||
1. **Generate commit hash for image tag**
|
||||
2. **Build & load Docker image into KinD**
|
||||
3. **Pre-apply chart CRDs**
|
||||
4. **Upgrade KubeVela using local image**
|
||||
5. **Verify deployment and image version**
|
||||
|
||||
---
|
||||
@@ -1,89 +0,0 @@
|
||||
name: 'Deploy Current Branch'
|
||||
description: 'Builds Docker image from current branch commit and deploys it to KubeVela cluster for development testing'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Git Commit Hash Generation
|
||||
# Generate unique image tag from current branch's latest commit
|
||||
# ========================================================================
|
||||
- name: Get commit hash
|
||||
id: commit_hash
|
||||
shell: bash
|
||||
run: |
|
||||
COMMIT_HASH="git-$(git rev-parse --short HEAD)"
|
||||
echo "Using commit hash: $COMMIT_HASH"
|
||||
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV
|
||||
|
||||
# ========================================================================
|
||||
# Docker Image Build and Cluster Loading
|
||||
# Build development image from current code and load into KinD cluster
|
||||
# ========================================================================
|
||||
- name: Build and load Docker image
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Building development image: vela-core-test:${{ env.COMMIT_HASH }}"
|
||||
|
||||
mkdir -p $HOME/tmp/
|
||||
|
||||
docker build --no-cache \
|
||||
-t vela-core-test:${{ env.COMMIT_HASH }} \
|
||||
-f Dockerfile .
|
||||
|
||||
echo "Loading image into KinD cluster..."
|
||||
TMPDIR=$HOME/tmp/ kind load docker-image vela-core-test:${{ env.COMMIT_HASH }}
|
||||
|
||||
# ========================================================================
|
||||
# Custom Resource Definitions Application
|
||||
# Pre-apply CRDs to ensure upgrade compatibility and prevent conflicts
|
||||
# ========================================================================
|
||||
- name: Pre-apply CRDs from target chart (upgrade-safe)
|
||||
shell: bash
|
||||
run: |
|
||||
CRD_DIR="charts/vela-core/crds"
|
||||
|
||||
echo "Applying CRDs idempotently..."
|
||||
kubectl apply -f "${CRD_DIR}"
|
||||
|
||||
# ========================================================================
|
||||
# KubeVela Helm Chart Upgrade
|
||||
# Upgrade existing installation to use locally built development image
|
||||
# ========================================================================
|
||||
- name: Upgrade KubeVela to development image
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Upgrading KubeVela to development version..."
|
||||
helm upgrade kubevela ./charts/vela-core \
|
||||
--namespace vela-system \
|
||||
--set image.repository=vela-core-test \
|
||||
--set image.tag=${{ env.COMMIT_HASH }} \
|
||||
--set image.pullPolicy=IfNotPresent \
|
||||
--timeout 5m \
|
||||
--wait \
|
||||
--debug
|
||||
|
||||
# ========================================================================
|
||||
# Deployment Status Verification
|
||||
# Verify successful upgrade and confirm correct image deployment
|
||||
# ========================================================================
|
||||
- name: Verify deployment status
|
||||
shell: bash
|
||||
run: |
|
||||
echo "=== DEPLOYMENT VERIFICATION ==="
|
||||
echo "Verifying upgrade to local development image..."
|
||||
|
||||
echo "--- Pod Status ---"
|
||||
kubectl get pods -n vela-system
|
||||
|
||||
echo "--- Deployment Rollout ---"
|
||||
kubectl rollout status deployment/kubevela-vela-core \
|
||||
-n vela-system \
|
||||
--timeout=300s
|
||||
|
||||
echo "--- Deployed Image Version ---"
|
||||
kubectl get deployment kubevela-vela-core \
|
||||
-n vela-system \
|
||||
-o yaml | grep "image:" | head -1
|
||||
|
||||
echo "Deployment verification completed successfully!"
|
||||
32
.github/actions/deploy-latest-release/README.md
vendored
32
.github/actions/deploy-latest-release/README.md
vendored
@@ -1,32 +0,0 @@
|
||||
# Install Latest KubeVela Release Action
|
||||
|
||||
This GitHub composite action installs the latest stable KubeVela release from the official Helm repository and verifies its deployment status.
|
||||
|
||||
## What it does
|
||||
|
||||
- Discovers the latest stable KubeVela release tag from GitHub
|
||||
- Adds and updates the official KubeVela Helm chart repository
|
||||
- Installs KubeVela into the `vela-system` namespace (using Helm)
|
||||
- Verifies pod status and deployment rollout for successful installation
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- name: Install Latest KubeVela Release
|
||||
uses: ./path/to/this/action
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Helm, kubectl, jq, and curl must be available in your runner environment
|
||||
- Kubernetes cluster access
|
||||
|
||||
## Steps performed
|
||||
|
||||
1. **Release Tag Discovery:** Fetches latest stable tag (without `v` prefix)
|
||||
2. **Helm Repo Setup:** Adds/updates KubeVela Helm chart repo
|
||||
3. **Install KubeVela:** Installs latest release in the `vela-system` namespace
|
||||
4. **Status Verification:** Checks pod status and rollout for readiness
|
||||
|
||||
---
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
name: 'Install Latest KubeVela Release'
|
||||
description: 'Installs the latest stable KubeVela release from official Helm repository with status verification'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Latest Release Tag Discovery
|
||||
# Fetch current stable release version from GitHub API
|
||||
# ========================================================================
|
||||
- name: Get latest KubeVela release tag (no v prefix)
|
||||
id: get_latest_tag
|
||||
shell: bash
|
||||
run: |
|
||||
TAG=$(curl -s https://api.github.com/repos/kubevela/kubevela/releases/latest | \
|
||||
jq -r ".tag_name" | \
|
||||
awk '{sub(/^v/, ""); print}')
|
||||
echo "LATEST_TAG=$TAG" >> $GITHUB_ENV
|
||||
echo "Discovered latest release: $TAG"
|
||||
|
||||
# ========================================================================
|
||||
# Helm Repository Configuration
|
||||
# Add and update official KubeVela chart repository
|
||||
# ========================================================================
|
||||
- name: Add KubeVela Helm repo
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Adding KubeVela Helm repository..."
|
||||
helm repo add kubevela https://kubevela.github.io/charts
|
||||
helm repo update
|
||||
echo "Helm repository configuration completed"
|
||||
|
||||
# ========================================================================
|
||||
# KubeVela Stable Release Installation
|
||||
# Deploy latest stable version to vela-system namespace
|
||||
# ========================================================================
|
||||
- name: Install KubeVela ${{ env.LATEST_TAG }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing KubeVela version: ${{ env.LATEST_TAG }}"
|
||||
helm install \
|
||||
--create-namespace \
|
||||
-n vela-system \
|
||||
kubevela kubevela/vela-core \
|
||||
--version ${{ env.LATEST_TAG }} \
|
||||
--timeout 10m \
|
||||
--wait
|
||||
echo "KubeVela installation completed"
|
||||
|
||||
# ========================================================================
|
||||
# Installation Status Verification
|
||||
# Verify successful deployment and readiness of KubeVela components
|
||||
# ========================================================================
|
||||
- name: Post-install status
|
||||
shell: bash
|
||||
run: |
|
||||
echo "=== INSTALLATION VERIFICATION ==="
|
||||
echo "Verifying KubeVela deployment status..."
|
||||
|
||||
echo "--- Pod Status ---"
|
||||
kubectl get pods -n vela-system
|
||||
|
||||
echo "--- Deployment Rollout ---"
|
||||
kubectl rollout status deployment/kubevela-vela-core \
|
||||
-n vela-system \
|
||||
--timeout=300s
|
||||
|
||||
echo "KubeVela installation verification completed successfully!"
|
||||
51
.github/actions/e2e-test/README.md
vendored
51
.github/actions/e2e-test/README.md
vendored
@@ -1,51 +0,0 @@
|
||||
# Kubevela K8s Upgrade E2E Test Action
|
||||
|
||||
A comprehensive GitHub composite action for running KubeVela Kubernetes upgrade end-to-end (E2E) tests with complete environment setup, multiple test suites, and failure diagnostics.
|
||||
|
||||
|
||||
> **Note**: This action requires the `GO_VERSION` environment variable to be set in your workflow.
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```yaml
|
||||
name: E2E Tests
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
e2e-tests:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GO_VERSION: '1.23.8'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run KubeVela E2E Tests
|
||||
uses: ./.github/actions/upgrade-e2e-test
|
||||
```
|
||||
|
||||
## Test Flow Diagram
|
||||
|
||||
```
|
||||
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
|
||||
│ Environment │ │ E2E Environment │ │ Test Execution │
|
||||
│ Setup │───▶│ Preparation │───▶│ (3 Suites) │
|
||||
│ │ │ │ │ │
|
||||
│ • Install tools │ │ • Cleanup │ │ • API tests │
|
||||
│ • Setup Go │ │ • Core setup │ │ • Addon tests │
|
||||
│ • Dependencies │ │ • Helm tests │ │ • General tests │
|
||||
│ • Build project │ │ │ │ │
|
||||
└─────────────────┘ └──────────────────┘ └─────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────┐
|
||||
│ Diagnostics │
|
||||
│ (On Failure) │
|
||||
│ │
|
||||
│ • Cluster logs │
|
||||
│ • System events │
|
||||
│ • Test artifacts│
|
||||
└─────────────────┘
|
||||
```
|
||||
100
.github/actions/e2e-test/action.yaml
vendored
100
.github/actions/e2e-test/action.yaml
vendored
@@ -1,100 +0,0 @@
|
||||
name: 'Kubevela K8s Upgrade e2e Test'
|
||||
description: 'Runs Kubevela K8s upgrade e2e tests, uploads coverage, and collects diagnostics on failure.'
|
||||
|
||||
inputs:
|
||||
codecov-token:
|
||||
description: 'Codecov token for uploading coverage reports'
|
||||
required: false
|
||||
default: ''
|
||||
codecov-enable:
|
||||
description: 'Enable codecov coverage upload'
|
||||
required: false
|
||||
default: 'false'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Environment Setup
|
||||
# ========================================================================
|
||||
- name: Configure environment setup
|
||||
uses: ./.github/actions/env-setup
|
||||
with:
|
||||
install-ginkgo: 'true'
|
||||
install-setup-envtest: 'false'
|
||||
install-kustomize: 'false'
|
||||
|
||||
- name: Build project
|
||||
shell: bash
|
||||
run: make
|
||||
|
||||
# ========================================================================
|
||||
# E2E Test Environment Preparation
|
||||
# ========================================================================
|
||||
- name: Prepare e2e environment
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Preparing e2e test environment..."
|
||||
make e2e-cleanup
|
||||
make e2e-setup-core
|
||||
|
||||
echo "Running Helm tests..."
|
||||
helm test -n vela-system kubevela --timeout 5m
|
||||
|
||||
# ========================================================================
|
||||
# E2E Test Execution
|
||||
# ========================================================================
|
||||
- name: Run API e2e tests
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Running API e2e tests..."
|
||||
make e2e-api-test
|
||||
|
||||
- name: Run addon e2e tests
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Running addon e2e tests..."
|
||||
make e2e-addon-test
|
||||
|
||||
- name: Run general e2e tests
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Running general e2e tests..."
|
||||
make e2e-test
|
||||
|
||||
- name: Upload coverage report
|
||||
if: ${{ inputs.codecov-enable == 'true' }}
|
||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
|
||||
with:
|
||||
token: ${{ inputs.codecov-token }}
|
||||
files: ./coverage.txt
|
||||
flags: core-unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
# ========================================================================
|
||||
# Failure Diagnostics
|
||||
# ========================================================================
|
||||
- name: Collect failure diagnostics
|
||||
if: failure()
|
||||
shell: bash
|
||||
run: |
|
||||
echo "=== FAILURE DIAGNOSTICS ==="
|
||||
echo "Collecting diagnostic information for debugging..."
|
||||
|
||||
echo "--- Cluster Status ---"
|
||||
kubectl get nodes -o wide || true
|
||||
kubectl get pods -A || true
|
||||
|
||||
echo "--- KubeVela System Logs ---"
|
||||
kubectl logs -n vela-system -l app.kubernetes.io/name=vela-core --tail=100 || true
|
||||
|
||||
echo "--- Recent Events ---"
|
||||
kubectl get events -A --sort-by='.lastTimestamp' --field-selector type!=Normal || true
|
||||
|
||||
echo "--- Helm Release Status ---"
|
||||
helm list -A || true
|
||||
helm status kubevela -n vela-system || true
|
||||
|
||||
echo "--- Test Artifacts ---"
|
||||
find . -name "*.log" -type f -exec echo "=== {} ===" \; -exec cat {} \; || true
|
||||
67
.github/actions/env-setup/README.md
vendored
67
.github/actions/env-setup/README.md
vendored
@@ -1,67 +0,0 @@
|
||||
# Kubevela Test Environment Setup Action
|
||||
|
||||
A GitHub Actions composite action that sets up a complete testing environment for Kubevela projects with Go, Kubernetes tools, and the Ginkgo testing framework.
|
||||
|
||||
## Features
|
||||
|
||||
- 🛠️ **System Dependencies**: Installs essential build tools (make, gcc, jq, curl, etc.)
|
||||
- ☸️ **Kubernetes Tools**: Sets up kubectl and Helm for cluster operations
|
||||
- 🐹 **Go Environment**: Configurable Go version with module caching
|
||||
- 📦 **Dependency Management**: Downloads and verifies Go module dependencies
|
||||
- 🧪 **Testing Framework**: Installs Ginkgo v2 for BDD-style testing
|
||||
|
||||
## Usage
|
||||
|
||||
```yaml
|
||||
- name: Setup Kubevela Test Environment
|
||||
uses: ./path/to/this/action
|
||||
with:
|
||||
go-version: '1.23.8' # Optional: Go version (default: 1.23.8)
|
||||
```
|
||||
|
||||
### Example Workflow
|
||||
|
||||
```yaml
|
||||
name: Kubevela Tests
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Test Environment
|
||||
uses: ./path/to/this/action
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Run Tests
|
||||
run: |
|
||||
ginkgo -r ./tests/e2e/
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Description | Required | Default | Usage |
|
||||
|-------|-------------|----------|---------|-------|
|
||||
| `go-version` | Go version to install and use | No | `1.23.8` | Specify Go version for your project |
|
||||
|
||||
## What This Action Installs
|
||||
|
||||
### System Tools
|
||||
- **make**: Build automation tool
|
||||
- **gcc**: GNU Compiler Collection
|
||||
- **jq**: JSON processor for shell scripts
|
||||
- **ca-certificates**: SSL/TLS certificates
|
||||
- **curl**: HTTP client for downloads
|
||||
- **gnupg**: GNU Privacy Guard for security
|
||||
|
||||
### Kubernetes Ecosystem
|
||||
- **kubectl**: Kubernetes command-line tool (latest stable)
|
||||
- **helm**: Kubernetes package manager (latest stable)
|
||||
|
||||
### Go Development
|
||||
- **Go Runtime**: Specified version with module caching enabled
|
||||
- **Go Modules**: Downloaded and verified dependencies
|
||||
- **Ginkgo v2.14.0**: BDD testing framework for Go
|
||||
120
.github/actions/env-setup/action.yaml
vendored
120
.github/actions/env-setup/action.yaml
vendored
@@ -1,120 +0,0 @@
|
||||
name: 'Kubevela Test Environment Setup'
|
||||
description: 'Sets up complete testing environment for Kubevela with Go, Kubernetes tools, and testing frameworks.'
|
||||
|
||||
inputs:
|
||||
go-version:
|
||||
description: 'Go version to use for testing'
|
||||
required: false
|
||||
default: '1.23.8'
|
||||
install-ginkgo:
|
||||
description: 'Install Ginkgo testing framework'
|
||||
required: false
|
||||
default: 'true'
|
||||
install-setup-envtest:
|
||||
description: 'Install setup-envtest for integration testing'
|
||||
required: false
|
||||
default: 'false'
|
||||
install-kustomize:
|
||||
description: 'Install kustomize for manifest management'
|
||||
required: false
|
||||
default: 'false'
|
||||
kustomize-version:
|
||||
description: 'Kustomize version to install'
|
||||
required: false
|
||||
default: '4.5.4'
|
||||
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Environment Setup
|
||||
# ========================================================================
|
||||
- name: Install system dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
# Update package manager and install essential tools
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
make \
|
||||
gcc \
|
||||
jq \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg
|
||||
|
||||
- name: Install kubectl and helm
|
||||
shell: bash
|
||||
run: |
|
||||
# Detect architecture
|
||||
ARCH=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')
|
||||
|
||||
# Install kubectl using a known stable version to avoid network issues
|
||||
# The dl.k8s.io/release/stable.txt endpoint can return garbage due to CDN issues
|
||||
KUBECTL_VERSION="v1.31.0"
|
||||
echo "Installing kubectl version: $KUBECTL_VERSION for architecture: $ARCH"
|
||||
curl -LO --retry 3 --fail "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${ARCH}/kubectl"
|
||||
chmod +x kubectl
|
||||
sudo mv kubectl /usr/local/bin/
|
||||
|
||||
# Install helm using the official script
|
||||
echo "Installing Helm using official script..."
|
||||
curl -fsSL --retry 3 -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
|
||||
chmod 700 get_helm.sh
|
||||
./get_helm.sh
|
||||
rm get_helm.sh
|
||||
|
||||
# Verify installations
|
||||
echo "Verifying installations..."
|
||||
kubectl version --client
|
||||
helm version
|
||||
|
||||
|
||||
- name: Setup Go environment
|
||||
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
cache: true
|
||||
|
||||
- name: Download Go dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
# Download and cache Go module dependencies
|
||||
go mod download
|
||||
go mod verify
|
||||
|
||||
- name: Install Ginkgo testing framework
|
||||
if: ${{ inputs.install-ginkgo == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing Ginkgo testing framework..."
|
||||
go install github.com/onsi/ginkgo/v2/ginkgo@v2.14.0
|
||||
echo "Ginkgo installed successfully"
|
||||
|
||||
- name: Install setup-envtest
|
||||
if: ${{ inputs.install-setup-envtest == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing setup-envtest for integration testing..."
|
||||
mkdir -p ./bin
|
||||
GOBIN=$(pwd)/bin go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240522175850-2e9781e9fc60
|
||||
echo "setup-envtest installed successfully at ./bin/setup-envtest"
|
||||
ls -la ./bin/setup-envtest
|
||||
|
||||
# Download and cache the Kubernetes binaries for envtest
|
||||
echo "Downloading Kubernetes binaries for envtest..."
|
||||
KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.31.0 --bin-dir ./bin -p path)
|
||||
echo "Kubernetes binaries downloaded successfully"
|
||||
echo "KUBEBUILDER_ASSETS=${KUBEBUILDER_ASSETS}"
|
||||
# Export for subsequent steps
|
||||
echo "KUBEBUILDER_ASSETS=${KUBEBUILDER_ASSETS}" >> $GITHUB_ENV
|
||||
|
||||
- name: Install kustomize
|
||||
if: ${{ inputs.install-kustomize == 'true' }}
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Installing kustomize version ${{ inputs.kustomize-version }}..."
|
||||
mkdir -p ./bin
|
||||
curl -sS https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash -s ${{ inputs.kustomize-version }} $(pwd)/bin
|
||||
echo "kustomize installed successfully at ./bin/kustomize"
|
||||
./bin/kustomize version
|
||||
35
.github/actions/multicluster-test/README.md
vendored
35
.github/actions/multicluster-test/README.md
vendored
@@ -1,35 +0,0 @@
|
||||
# Kubevela K8s Upgrade Multicluster E2E Test Action
|
||||
|
||||
A comprehensive GitHub Actions composite action for running Kubevela Kubernetes upgrade multicluster end-to-end tests with automated coverage reporting and failure diagnostics.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
```yaml
|
||||
name: Kubevela Multicluster E2E Tests
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
multicluster-e2e:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Multicluster E2E Tests
|
||||
uses: ./.github/actions/multicluster-test
|
||||
with:
|
||||
codecov-enable: 'true'
|
||||
codecov-token: ${{ secrets.CODECOV_TOKEN }}
|
||||
```
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Description | Required | Default | Type |
|
||||
|-------|-------------|----------|---------|------|
|
||||
| `codecov-token` | Codecov token for uploading coverage reports | No | `''` | string |
|
||||
| `codecov-enable` | Enable codecov coverage upload | No | `'false'` | string |
|
||||
80
.github/actions/multicluster-test/action.yaml
vendored
80
.github/actions/multicluster-test/action.yaml
vendored
@@ -1,80 +0,0 @@
|
||||
name: 'Kubevela K8s Upgrade Multicluster E2E Test'
|
||||
description: 'Runs Kubevela Kubernetes upgrade multicluster end-to-end tests, uploads coverage, and collects diagnostics on failure.'
|
||||
author: 'viskumar_gwre'
|
||||
|
||||
inputs:
|
||||
codecov-token:
|
||||
description: 'Codecov token for uploading coverage reports'
|
||||
required: false
|
||||
default: ''
|
||||
codecov-enable:
|
||||
description: 'Enable codecov coverage upload'
|
||||
required: false
|
||||
default: 'false'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Environment Setup
|
||||
# ========================================================================
|
||||
- name: Configure environment setup
|
||||
uses: ./.github/actions/env-setup
|
||||
with:
|
||||
install-ginkgo: 'true'
|
||||
install-setup-envtest: 'false'
|
||||
install-kustomize: 'false'
|
||||
|
||||
# ========================================================================
|
||||
# E2E Test Execution
|
||||
# ========================================================================
|
||||
- name: Prepare e2e test environment
|
||||
shell: bash
|
||||
run: |
|
||||
# Build CLI tools and prepare test environment
|
||||
echo "Building KubeVela CLI..."
|
||||
make vela-cli
|
||||
|
||||
echo "Cleaning up previous test artifacts..."
|
||||
make e2e-cleanup
|
||||
|
||||
echo "Setting up core authentication for e2e tests..."
|
||||
make e2e-setup-core-auth
|
||||
|
||||
- name: Execute multicluster upgrade e2e tests
|
||||
shell: bash
|
||||
run: |
|
||||
# Add built CLI to PATH and run multicluster tests
|
||||
export PATH=$(pwd)/bin:$PATH
|
||||
|
||||
echo "Running e2e multicluster upgrade tests..."
|
||||
make e2e-multicluster-test
|
||||
|
||||
- name: Upload coverage report
|
||||
if: ${{ inputs.codecov-enable == 'true' }}
|
||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
|
||||
with:
|
||||
token: ${{ inputs.codecov-token }}
|
||||
files: /tmp/e2e-profile.out,/tmp/e2e_multicluster_test.out
|
||||
flags: e2e-multicluster-test
|
||||
name: codecov-umbrella
|
||||
|
||||
# ========================================================================
|
||||
# Failure Diagnostics
|
||||
# ========================================================================
|
||||
- name: Collect failure diagnostics
|
||||
if: failure()
|
||||
shell: bash
|
||||
run: |
|
||||
echo "=== FAILURE DIAGNOSTICS ==="
|
||||
echo "Collecting diagnostic information for debugging..."
|
||||
|
||||
echo "--- Cluster Status ---"
|
||||
kubectl get nodes -o wide || true
|
||||
kubectl get pods -A || true
|
||||
|
||||
echo "--- KubeVela System Logs ---"
|
||||
kubectl logs -n vela-system -l app.kubernetes.io/name=vela-core --tail=100 || true
|
||||
|
||||
echo "--- Recent Events ---"
|
||||
kubectl get events -A --sort-by='.lastTimestamp' --field-selector type!=Normal || true
|
||||
78
.github/actions/setup-kind-cluster/README.md
vendored
78
.github/actions/setup-kind-cluster/README.md
vendored
@@ -1,78 +0,0 @@
|
||||
# Setup Kind Cluster Action
|
||||
|
||||
A GitHub Action that sets up a Kubernetes testing environment using Kind (Kubernetes in Docker) for E2E testing.
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `k8s-version` | Kubernetes version for the kind cluster | No | `v1.31.9` |
|
||||
|
||||
## Quick Start
|
||||
|
||||
```yaml
|
||||
name: E2E Tests
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Setup Kind Cluster
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
k8s-version: 'v1.31.9'
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
kubectl cluster-info
|
||||
make test-e2e
|
||||
```
|
||||
|
||||
## What it does
|
||||
|
||||
1. **Installs Kind CLI** - Downloads Kind v0.29.0 using Go
|
||||
2. **Cleans up** - Removes any existing Kind clusters
|
||||
3. **Creates cluster** - Spins up Kubernetes v1.31.9 cluster
|
||||
4. **Sets up environment** - Configures KUBECONFIG for kubectl access
|
||||
5. **Loads images** - Builds and loads Docker images using `make image-load`
|
||||
|
||||
## File Structure
|
||||
|
||||
Save as `.github/actions/setup-kind-cluster/action.yaml`:
|
||||
|
||||
```yaml
|
||||
name: 'SetUp kind cluster'
|
||||
description: 'Sets up complete testing environment for Kubevela with Go, Kubernetes tools, and Ginkgo framework for E2E testing.'
|
||||
|
||||
inputs:
|
||||
k8s-version:
|
||||
description: 'Kubernetes version for the kind cluster'
|
||||
required: false
|
||||
default: 'v1.31.9'
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Kind cluster Setup
|
||||
# ========================================================================
|
||||
- name: Setup KinD
|
||||
run: |
|
||||
go install sigs.k8s.io/kind@v0.29.0
|
||||
kind delete cluster || true
|
||||
kind create cluster --image=kindest/node:${{ inputs.k8s-version }}
|
||||
shell: bash
|
||||
|
||||
- name: Load image
|
||||
run: |
|
||||
mkdir -p $HOME/tmp/
|
||||
TMPDIR=$HOME/tmp/ make image-load
|
||||
shell: bash
|
||||
```
|
||||
36
.github/actions/setup-kind-cluster/action.yaml
vendored
36
.github/actions/setup-kind-cluster/action.yaml
vendored
@@ -1,36 +0,0 @@
|
||||
name: 'SetUp kind cluster'
|
||||
description: 'Sets up a KinD (Kubernetes in Docker) cluster with configurable Kubernetes version and optional cluster naming for testing and development workflows.'
|
||||
inputs:
|
||||
k8s-version:
|
||||
description: 'Kubernetes version for the kind cluster'
|
||||
required: false
|
||||
default: 'v1.31.9'
|
||||
name:
|
||||
description: 'Name of the kind cluster'
|
||||
required: false
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Kind cluster Setup
|
||||
# ========================================================================
|
||||
- name: Setup KinD
|
||||
run: |
|
||||
go install sigs.k8s.io/kind@v0.29.0
|
||||
if [ -n "${{ inputs.name }}" ]; then
|
||||
kind delete cluster --name="${{ inputs.name }}" || true
|
||||
kind create cluster --name="${{ inputs.name }}" --image=kindest/node:${{ inputs.k8s-version }}
|
||||
kind export kubeconfig --internal --name="${{ inputs.name }}" --kubeconfig /tmp/${{ inputs.name }}.kubeconfig
|
||||
else
|
||||
kind delete cluster || true
|
||||
kind create cluster --image=kindest/node:${{ inputs.k8s-version }}
|
||||
fi
|
||||
shell: bash
|
||||
|
||||
- name: Load image
|
||||
run: |
|
||||
if [ -z "${{ inputs.name }}" ]; then
|
||||
mkdir -p $HOME/tmp/
|
||||
TMPDIR=$HOME/tmp/ make image-load
|
||||
fi
|
||||
shell: bash
|
||||
34
.github/actions/unit-test/README.md
vendored
34
.github/actions/unit-test/README.md
vendored
@@ -1,34 +0,0 @@
|
||||
# Kubevela K8s Upgrade Unit Test Action
|
||||
|
||||
A comprehensive GitHub composite action for running KubeVela Kubernetes upgrade unit tests with coverage reporting and failure diagnostics.
|
||||
|
||||
## Inputs
|
||||
|
||||
| Input | Description | Required | Default |
|
||||
|-------|-------------|----------|---------|
|
||||
| `codecov-token` | Codecov token for uploading coverage reports | ❌ | `''` |
|
||||
| `codecov-enable` | Enable Codecov coverage upload (`'true'` or `'false'`) | ❌ | `'false'` |
|
||||
| `go-version` | Go version to use for testing | ❌ | `'1.23.8'` |
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```yaml
|
||||
name: Unit Tests with Coverage
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run KubeVela Unit Tests
|
||||
uses: viskumar_gwre/kubevela-k8s-upgrade-unit-test-action@v1
|
||||
with:
|
||||
codecov-enable: 'true'
|
||||
codecov-token: ${{ secrets.CODECOV_TOKEN }}
|
||||
go-version: '1.23.8'
|
||||
```
|
||||
71
.github/actions/unit-test/action.yaml
vendored
71
.github/actions/unit-test/action.yaml
vendored
@@ -1,71 +0,0 @@
|
||||
name: 'Kubevela K8s Upgrade Unit Test'
|
||||
description: 'Runs Kubevela K8s upgrade unit tests, uploads coverage, and collects diagnostics on failure.'
|
||||
|
||||
inputs:
|
||||
codecov-token:
|
||||
description: 'Codecov token for uploading coverage reports'
|
||||
required: false
|
||||
default: ''
|
||||
codecov-enable:
|
||||
description: 'Enable codecov coverage upload'
|
||||
required: false
|
||||
default: 'false'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Environment Setup
|
||||
# ========================================================================
|
||||
- name: Configure environment setup
|
||||
uses: ./.github/actions/env-setup
|
||||
with:
|
||||
install-ginkgo: 'true'
|
||||
install-setup-envtest: 'true'
|
||||
install-kustomize: 'true'
|
||||
|
||||
# ========================================================================
|
||||
# Unit Test Execution
|
||||
# ========================================================================
|
||||
- name: Run unit tests
|
||||
shell: bash
|
||||
run: |
|
||||
echo "Running unit tests..."
|
||||
make test
|
||||
|
||||
- name: Upload coverage report
|
||||
if: ${{ inputs.codecov-enable == 'true' }}
|
||||
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
|
||||
with:
|
||||
token: ${{ inputs.codecov-token }}
|
||||
files: ./coverage.txt
|
||||
flags: core-unittests
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: false
|
||||
|
||||
# ========================================================================
|
||||
# Failure Diagnostics
|
||||
# ========================================================================
|
||||
- name: Collect failure diagnostics
|
||||
if: failure()
|
||||
shell: bash
|
||||
run: |
|
||||
echo "=== FAILURE DIAGNOSTICS ==="
|
||||
echo "Collecting diagnostic information for debugging..."
|
||||
|
||||
echo "--- Go Environment ---"
|
||||
go version || true
|
||||
go env || true
|
||||
|
||||
echo "--- Cluster Status ---"
|
||||
kubectl get nodes -o wide || true
|
||||
kubectl get pods -A || true
|
||||
|
||||
echo "--- KubeVela System Logs ---"
|
||||
kubectl logs -n vela-system -l app.kubernetes.io/name=vela-core --tail=100 || true
|
||||
|
||||
echo "--- Recent Events ---"
|
||||
kubectl get events -A --sort-by='.lastTimestamp' --field-selector type!=Normal || true
|
||||
|
||||
echo "--- Test Artifacts ---"
|
||||
find . -name "*.log" -o -name "*test*.xml" -o -name "coverage.*" | head -20 || true
|
||||
8
.github/bot.md
vendored
8
.github/bot.md
vendored
@@ -1,9 +1,9 @@
|
||||
### GitHub & kubevela automation
|
||||
|
||||
The bot is configured via [issue-commands.json](https://github.com/kubevela/kubevela/blob/master/.github/issue-commands.json)
|
||||
and some other GitHub [workflows](https://github.com/kubevela/kubevela/blob/master/.github/workflows).
|
||||
The bot is configured via [issue-commands.json](https://github.com/oam-dev/kubevela/blob/master/.github/workflows/issue-commands.json)
|
||||
and some other GitHub [workflows](https://github.com/oam-dev/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)
|
||||
the [userlist](https://github.com/oam-dev/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:
|
||||
@@ -14,7 +14,7 @@ Comment commands:
|
||||
* 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)
|
||||
The `*` mention above represent a specific word. Please read the details about label category in [ISSUE_TRIAGE.md](https://github.com/oam-dev/kubevela/blob/master/ISSUE_TRIAGE.md)
|
||||
|
||||
Label commands:
|
||||
|
||||
|
||||
5
.github/comment.userlist
vendored
5
.github/comment.userlist
vendored
@@ -11,7 +11,4 @@ wangyuan249
|
||||
chivalryq
|
||||
FogDong
|
||||
leejanee
|
||||
barnettZQG
|
||||
anoop2811
|
||||
briankane
|
||||
jguionnet
|
||||
barnettZQG
|
||||
23
.github/dependabot.yml
vendored
23
.github/dependabot.yml
vendored
@@ -1,23 +0,0 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gomod" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
commit-message:
|
||||
prefix: "Chore: "
|
||||
include: "scope"
|
||||
ignore:
|
||||
- dependency-name: k8s.io/*
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
commit-message:
|
||||
prefix: "Chore: "
|
||||
include: "scope"
|
||||
6
.github/pr-title-checker-config.json
vendored
6
.github/pr-title-checker-config.json
vendored
@@ -4,7 +4,7 @@
|
||||
"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"]
|
||||
"prefixes": ["Fix: ", "Feat: ", "Docs: ", "Test: ", "Chore: ", "CI: ", "Perf: ", "Refactor: ", "Revert: ", "Style: ", "Test: ", "Backport: ", "Backport",
|
||||
"Fix(", "Feat(", "Docs(", "Test(", "Chore(", "CI(", "Perf(", "Refactor(", "Revert(", "Style(", "Test(", "Backport("]
|
||||
}
|
||||
}
|
||||
}
|
||||
28
.github/workflows/back-port.yml
vendored
28
.github/workflows/back-port.yml
vendored
@@ -1,28 +0,0 @@
|
||||
name: Backport
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- closed
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
# align with crossplane's choice https://github.com/crossplane/crossplane/blob/master/.github/workflows/backport.yml
|
||||
open-pr:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.event.pull_request.merged
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Open Backport PR
|
||||
uses: zeebe-io/backport-action@0193454f0c5947491d348f33a275c119f30eb736
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_workspace: ${{ github.workspace }}
|
||||
67
.github/workflows/chart.yml
vendored
67
.github/workflows/chart.yml
vendored
@@ -1,67 +0,0 @@
|
||||
name: Publish Chart
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
workflow_dispatch: { }
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish-charts:
|
||||
env:
|
||||
HELM_CHARTS_DIR: charts
|
||||
HELM_CHART: charts/vela-core
|
||||
HELM_CHART_NAME: vela-core
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
- name: Get git revision
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
echo "git_revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78
|
||||
with:
|
||||
version: v3.4.0
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: '14'
|
||||
- name: Generate helm doc
|
||||
run: |
|
||||
make helm-doc-gen
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
||||
- 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
|
||||
chart_smever=${chart_version#"v"}
|
||||
sed -i "s/0.1.0/$chart_smever/g" $HELM_CHART/Chart.yaml
|
||||
|
||||
- uses: jnwng/github-app-installation-token-action@c54add4c02866dc41e106745ac6dcf5cdd6339e5 # v2
|
||||
id: get_app_token
|
||||
with:
|
||||
appId: 340472
|
||||
installationId: 38064967
|
||||
privateKey: ${{ secrets.GH_KUBEVELA_APP_PRIVATE_KEY }}
|
||||
- name: Sync Chart Repo
|
||||
run: |
|
||||
git config --global user.email "135009839+kubevela[bot]@users.noreply.github.com"
|
||||
git config --global user.name "kubevela[bot]"
|
||||
git clone https://x-access-token:${{ steps.get_app_token.outputs.token }}@github.com/kubevela/charts.git kubevela-charts
|
||||
helm package $HELM_CHART --destination ./kubevela-charts/docs/
|
||||
helm repo index --url https://kubevela.github.io/charts ./kubevela-charts/docs/
|
||||
cd kubevela-charts/
|
||||
git add docs/
|
||||
chart_version=${{ steps.get_version.outputs.VERSION }}
|
||||
git commit -m "update vela-core chart ${chart_version}"
|
||||
git push https://x-access-token:${{ steps.get_app_token.outputs.token }}@github.com/kubevela/charts.git
|
||||
29
.github/workflows/codeql-analysis.yml
vendored
29
.github/workflows/codeql-analysis.yml
vendored
@@ -4,17 +4,10 @@ on:
|
||||
push:
|
||||
branches: [ master, release-* ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
permissions:
|
||||
actions: read # for github/codeql-action/init to get workflow details
|
||||
security-events: write # for github/codeql-action/autobuild to send a status report
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -22,16 +15,16 @@ jobs:
|
||||
language: [ 'go' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
|
||||
9
.github/workflows/commit-lint.yml
vendored
9
.github/workflows/commit-lint.yml
vendored
@@ -8,15 +8,12 @@ on:
|
||||
- labeled
|
||||
- unlabeled
|
||||
|
||||
permissions:
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: thehanimo/pr-title-checker@5652588c80c479af803eabfbdb5a3895a77c1388 # v1.4.1
|
||||
- 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"
|
||||
configuration_path: ".github/pr-title-checker-config.json"
|
||||
40
.github/workflows/core-api-test.yml
vendored
40
.github/workflows/core-api-test.yml
vendored
@@ -1,40 +0,0 @@
|
||||
name: core-api-test
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'apis/**'
|
||||
- 'pkg/oam/**'
|
||||
- "hack/apis/**"
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
core-api-test:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Set up Go 1.23.8
|
||||
uses: actions/setup-go@v5
|
||||
env:
|
||||
GO_VERSION: '1.23.8'
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Test build kubevela-core-api
|
||||
env:
|
||||
VERSION: ${{ steps.get_version.outputs.VERSION }}
|
||||
COMMIT_ID: ${{ github.sha }}
|
||||
run: |
|
||||
bash ./hack/apis/clientgen.sh
|
||||
bash ./hack/apis/sync.sh test
|
||||
46
.github/workflows/definition-lint.yml
vendored
46
.github/workflows/definition-lint.yml
vendored
@@ -1,46 +0,0 @@
|
||||
name: Definition-Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.23.8'
|
||||
|
||||
jobs:
|
||||
definition-doc:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup KinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
name: linter
|
||||
|
||||
- name: Definition Doc generate check
|
||||
run: |
|
||||
go build -o docgen hack/docgen/def/gen.go
|
||||
./docgen --type=comp --force-example-doc --path=./comp-def-check.md
|
||||
./docgen --type=trait --force-example-doc --path=./trait-def-check.md
|
||||
./docgen --type=wf --force-example-doc --path=./wf-def-check.md --def-dir=./vela-templates/definitions/internal/workflowstep/
|
||||
./docgen --type=policy --force-example-doc --path=./policy-def-check.md
|
||||
107
.github/workflows/e2e-multicluster-test.yml
vendored
107
.github/workflows/e2e-multicluster-test.yml
vendored
@@ -5,82 +5,105 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.23.8'
|
||||
GO_VERSION: '1.16'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
permissions:
|
||||
actions: write
|
||||
runs-on: ubuntu-22.04
|
||||
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@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
uses: fkirc/skip-duplicate-actions@v3.3.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
continue-on-error: true
|
||||
concurrent_skipping: false
|
||||
|
||||
e2e-multi-cluster-tests:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [ detect-noop ]
|
||||
runs-on: aliyun
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
strategy:
|
||||
matrix:
|
||||
k8s-version: ["v1.31.9"]
|
||||
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup worker cluster kinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
name: worker
|
||||
k8s-version: ${{ matrix.k8s-version }}
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Setup master cluster kinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
k8s-version: ${{ matrix.k8s-version }}
|
||||
- name: Get dependencies
|
||||
run: |
|
||||
go get -v -t -d ./...
|
||||
|
||||
- name: Run upgrade multicluster tests
|
||||
uses: ./.github/actions/multicluster-test
|
||||
- name: Setup Kind
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
codecov-enable: true
|
||||
codecov-token: ${{ secrets.CODECOV_TOKEN }}
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
skipClusterCreation: true
|
||||
|
||||
- name: Setup Kind Cluster (Worker)
|
||||
run: |
|
||||
kind delete cluster --name worker
|
||||
kind create cluster --image kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4 --name worker
|
||||
kubectl version
|
||||
kubectl cluster-info
|
||||
kind get kubeconfig --name worker --internal > /tmp/worker.kubeconfig
|
||||
kind get kubeconfig --name worker > /tmp/worker.client.kubeconfig
|
||||
|
||||
- name: Setup Kind Cluster (Hub)
|
||||
run: |
|
||||
kind delete cluster
|
||||
kind create cluster --image kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
|
||||
kubectl version
|
||||
kubectl cluster-info
|
||||
|
||||
- name: Load Image to kind cluster (Hub)
|
||||
run: make kind-load
|
||||
|
||||
- name: Load Image to kind cluster (Worker)
|
||||
run: |
|
||||
make kind-load-runtime-cluster
|
||||
|
||||
- name: Cleanup for e2e tests
|
||||
run: |
|
||||
make e2e-cleanup
|
||||
make e2e-setup-core
|
||||
make
|
||||
make setup-runtime-e2e-cluster
|
||||
|
||||
- name: Run e2e multicluster tests
|
||||
run: 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: |
|
||||
if [ -f /tmp/e2e-profile.out ]; then
|
||||
rm /tmp/e2e-profile.out
|
||||
echo "E2E profile cleaned"
|
||||
else
|
||||
echo "E2E profile not found, skipping cleanup"
|
||||
fi
|
||||
run: rm /tmp/e2e-profile.out
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
make image-cleanup
|
||||
docker image prune -f --filter "until=24h"
|
||||
run: make image-cleanup
|
||||
|
||||
102
.github/workflows/e2e-rollout-test.yml
vendored
Normal file
102
.github/workflows/e2e-rollout-test.yml
vendored
Normal file
@@ -0,0 +1,102 @@
|
||||
name: E2E Rollout Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.16'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
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@v3.3.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
concurrent_skipping: false
|
||||
|
||||
e2e-rollout-tests:
|
||||
runs-on: aliyun
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != '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: 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 --image kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
|
||||
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
|
||||
helm lint ./charts/vela-core
|
||||
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,/tmp/oam-e2e-profile.out
|
||||
flags: e2e-rollout-tests
|
||||
name: codecov-umbrella
|
||||
|
||||
- name: Clean e2e profile
|
||||
run: rm /tmp/e2e-profile.out /tmp/oam-e2e-profile.out
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: make image-cleanup
|
||||
107
.github/workflows/e2e-test.yml
vendored
107
.github/workflows/e2e-test.yml
vendored
@@ -5,77 +5,104 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.23.8'
|
||||
GO_VERSION: '1.16'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
permissions:
|
||||
actions: write
|
||||
runs-on: ubuntu-22.04
|
||||
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@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
uses: fkirc/skip-duplicate-actions@v3.3.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
continue-on-error: true
|
||||
concurrent_skipping: false
|
||||
|
||||
e2e-tests:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [ detect-noop ]
|
||||
runs-on: aliyun
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
strategy:
|
||||
matrix:
|
||||
k8s-version: ["v1.31"]
|
||||
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup KinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
|
||||
# ========================================================================
|
||||
# E2E Test Execution
|
||||
# ========================================================================
|
||||
- name: Run upgrade e2e tests
|
||||
uses: ./.github/actions/e2e-test
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
codecov-enable: true
|
||||
codecov-token: ${{ secrets.CODECOV_TOKEN }}
|
||||
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 --image kindest/node:v1.18.15@sha256:5c1b980c4d0e0e8e7eb9f36f7df525d079a96169c8a8f20d8bd108c0d0889cc4
|
||||
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
|
||||
helm lint ./charts/vela-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,/tmp/oam-e2e-profile.out
|
||||
flags: e2etests
|
||||
name: codecov-umbrella
|
||||
|
||||
- name: Clean e2e profile
|
||||
run: |
|
||||
if [ -f /tmp/e2e-profile.out ]; then
|
||||
rm /tmp/e2e-profile.out
|
||||
echo "E2E profile cleaned"
|
||||
else
|
||||
echo "E2E profile not found, skipping cleanup"
|
||||
fi
|
||||
run: rm /tmp/e2e-profile.out /tmp/oam-e2e-profile.out
|
||||
|
||||
- name: Cleanup image
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
make image-cleanup
|
||||
docker image prune -f --filter "until=24h"
|
||||
run: make image-cleanup
|
||||
|
||||
230
.github/workflows/go.yml
vendored
230
.github/workflows/go.yml
vendored
@@ -11,214 +11,164 @@ on:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions: # added using https://github.com/step-security/secure-workflows
|
||||
contents: read
|
||||
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: "1.23.8"
|
||||
GOLANGCI_VERSION: "v1.60.1"
|
||||
GO_VERSION: '1.16'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
outputs:
|
||||
noop: ${{ steps.noop.outputs.should_skip }}
|
||||
permissions:
|
||||
actions: write
|
||||
steps:
|
||||
- name: Detect No-op Changes
|
||||
id: noop
|
||||
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
uses: fkirc/skip-duplicate-actions@v3.3.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
continue-on-error: true
|
||||
concurrent_skipping: false
|
||||
|
||||
compatibility-test:
|
||||
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 Kind Cluster
|
||||
uses: engineerd/setup-kind@v0.5.0
|
||||
with:
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
|
||||
- name: install Kubebuilder
|
||||
uses: RyanSiu1995/kubebuilder-action@v1.2
|
||||
with:
|
||||
version: 3.1.0
|
||||
kubebuilderOnly: false
|
||||
kubernetesVersion: v1.21.2
|
||||
|
||||
- name: Run Make compatibility-test
|
||||
run: make compatibility-test
|
||||
|
||||
- name: Clean up testdata
|
||||
run: make compatibility-testdata-cleanup
|
||||
|
||||
staticcheck:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
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 StaticCheck
|
||||
run: GO111MODULE=off go get honnef.co/go/tools/cmd/staticcheck
|
||||
|
||||
- name: Static Check
|
||||
run: make staticcheck
|
||||
run: staticcheck ./...
|
||||
|
||||
- name: License Header Check
|
||||
run: make check-license-header
|
||||
|
||||
lint:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
permissions:
|
||||
contents: read # for actions/checkout to fetch code
|
||||
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
|
||||
|
||||
steps:
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-pkg-
|
||||
|
||||
# This action uses its own setup-go, which always seems to use the latest
|
||||
# stable version of Go. We could run 'make lint' to ensure our desired Go
|
||||
# version, but we prefer this action because it leaves 'annotations' (i.e.
|
||||
# it comments on PRs to point out linter violations).
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v2
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_VERSION }}
|
||||
|
||||
check-diff:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: aliyun
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Free Disk Space
|
||||
run: |
|
||||
echo "Disk space before cleanup:"
|
||||
df -h
|
||||
|
||||
# Remove unnecessary software to free up disk space
|
||||
sudo rm -rf /usr/share/dotnet
|
||||
sudo rm -rf /usr/local/lib/android
|
||||
sudo rm -rf /opt/ghc
|
||||
sudo rm -rf /opt/hostedtoolcache/CodeQL
|
||||
sudo docker image prune --all --force
|
||||
|
||||
echo "Disk space after cleanup:"
|
||||
df -h
|
||||
|
||||
- name: Setup Env
|
||||
uses: ./.github/actions/env-setup
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
|
||||
with:
|
||||
node-version: "14"
|
||||
|
||||
- name: Setup kinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
|
||||
- name: Run cross-build
|
||||
run: make cross-build
|
||||
|
||||
- name: Free Disk Space After Cross-Build
|
||||
run: |
|
||||
echo "Disk space before cleanup:"
|
||||
df -h
|
||||
|
||||
# Remove cross-build artifacts to free up space
|
||||
# (make build will rebuild binaries for current platform)
|
||||
rm -rf _bin
|
||||
|
||||
# Clean Go build cache and test cache
|
||||
go clean -cache -testcache
|
||||
|
||||
# Remove Docker build cache
|
||||
sudo docker builder prune --all --force || true
|
||||
|
||||
echo "Disk space after cleanup:"
|
||||
df -h
|
||||
|
||||
- name: Check Diff
|
||||
run: |
|
||||
export PATH=$(pwd)/bin/:$PATH
|
||||
make check-diff
|
||||
|
||||
- name: Cleanup binary
|
||||
run: make build-cleanup
|
||||
|
||||
check-windows:
|
||||
runs-on: windows-latest
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .work/pkg
|
||||
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: ${{ runner.os }}-pkg-
|
||||
|
||||
- name: Run Build CLI
|
||||
run: make vela-cli
|
||||
- name: Check code formatting
|
||||
run: go install golang.org/x/tools/cmd/goimports && make fmt
|
||||
|
||||
- name: Run CLI for version
|
||||
shell: cmd
|
||||
run: |
|
||||
move .\bin\vela .\bin\vela.exe
|
||||
.\bin\vela.exe version
|
||||
- name: Run cross-build
|
||||
run: make cross-build
|
||||
|
||||
check-core-image-build:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
with:
|
||||
submodules: true
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
|
||||
- name: Build Test for vela core
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
check-cli-image-build:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: detect-noop
|
||||
if: needs.detect-noop.outputs.noop != 'true'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
with:
|
||||
submodules: true
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435
|
||||
- name: Build Test for CLI
|
||||
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.cli
|
||||
- name: Check Diff
|
||||
run: make check-diff
|
||||
|
||||
- name: Cleanup binary
|
||||
run: make build-cleanup
|
||||
|
||||
135
.github/workflows/issue-commands.yml
vendored
135
.github/workflows/issue-commands.yml
vendored
@@ -1,143 +1,24 @@
|
||||
name: Run commands for issues and pull requests
|
||||
name: Run commands when issues are labeled or comments added
|
||||
on:
|
||||
issues:
|
||||
types: [labeled, opened]
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
bot:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
pull-requests: write
|
||||
issues: write
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Actions
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
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@1e60f620b9541d16bece96c5465dc8ee9832be0b
|
||||
with:
|
||||
node-version: "14"
|
||||
cache: "npm"
|
||||
cache-dependency-path: ./actions/package-lock.json
|
||||
- name: Install Dependencies
|
||||
run: npm ci --production --prefix ./actions
|
||||
ref: v0.4.1
|
||||
- name: Install Actions
|
||||
run: npm install --production --prefix ./actions
|
||||
- name: Run Commands
|
||||
uses: ./actions/commands
|
||||
with:
|
||||
token: ${{ secrets.GH_KUBEVELA_COMMAND_WORKFLOW }}
|
||||
token: ${{secrets.VELA_BOT_TOKEN}}
|
||||
configPath: issue-commands
|
||||
|
||||
backport:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/backport')
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
steps:
|
||||
- name: Extract Command
|
||||
id: command
|
||||
uses: xt0rted/slash-command-action@bf51f8f5f4ea3d58abc7eca58f77104182b23e88
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
command: backport
|
||||
reaction: "true"
|
||||
reaction-type: "eyes"
|
||||
allow-edits: "false"
|
||||
permission-level: read
|
||||
- name: Handle Command
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
||||
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.rest.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@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Open Backport PR
|
||||
uses: zeebe-io/backport-action@0193454f0c5947491d348f33a275c119f30eb736
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
github_workspace: ${{ github.workspace }}
|
||||
|
||||
retest:
|
||||
runs-on: ubuntu-22.04
|
||||
if: github.event.issue.pull_request && contains(github.event.comment.body, '/retest')
|
||||
permissions:
|
||||
actions: write
|
||||
pull-requests: write
|
||||
issues: write
|
||||
steps:
|
||||
- name: Retest the current pull request
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
||||
env:
|
||||
PULL_REQUEST_ID: ${{ github.event.issue.number }}
|
||||
COMMENT_ID: ${{ github.event.comment.id }}
|
||||
COMMENT_BODY: ${{ github.event.comment.body }}
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const pull_request_id = process.env.PULL_REQUEST_ID
|
||||
const comment_id = process.env.COMMENT_ID
|
||||
const comment_body = process.env.COMMENT_BODY
|
||||
console.log("retest pr: #" + pull_request_id + " comment: " + comment_body)
|
||||
const {data: pr} = await github.rest.pulls.get({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
pull_number: pull_request_id,
|
||||
})
|
||||
console.log("pr: " + JSON.stringify(pr))
|
||||
const action = comment_body.split(" ")[0]
|
||||
let workflow_ids = comment_body.split(" ").slice(1).filter(line => line.length > 0).map(line => line + ".yml")
|
||||
if (workflow_ids.length == 0) workflow_ids = ["go.yml", "unit-test.yml", "e2e-test.yml", "e2e-multicluster-test.yml"]
|
||||
for (let i = 0; i < workflow_ids.length; i++) {
|
||||
const workflow_id = workflow_ids[i]
|
||||
const {data: runs} = await github.rest.actions.listWorkflowRuns({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
workflow_id: workflow_id,
|
||||
head_sha: pr.head.sha,
|
||||
})
|
||||
console.log("runs for " + workflow_id + ": ", JSON.stringify(runs))
|
||||
runs.workflow_runs.forEach((workflow_run) => {
|
||||
if (workflow_run.status === "in_progress") return
|
||||
let handler = github.rest.actions.reRunWorkflow
|
||||
if (action === "/retest-failed") handler = github.rest.actions.reRunWorkflowFailedJobs
|
||||
handler({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: workflow_run.id
|
||||
})
|
||||
})
|
||||
}
|
||||
github.rest.reactions.createForIssueComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: comment_id,
|
||||
content: "eyes",
|
||||
});
|
||||
|
||||
8
.github/workflows/license.yml
vendored
8
.github/workflows/license.yml
vendored
@@ -9,17 +9,15 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
license_check:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
name: Check for unapproved licenses
|
||||
steps:
|
||||
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.6
|
||||
- name: Install dependencies
|
||||
|
||||
318
.github/workflows/registry.yml
vendored
318
.github/workflows/registry.yml
vendored
@@ -1,87 +1,59 @@
|
||||
name: Registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
- "v*"
|
||||
workflow_dispatch: {}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
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-vela-images:
|
||||
name: Build and Push Vela Images
|
||||
permissions:
|
||||
packages: write
|
||||
id-token: write
|
||||
attestations: write
|
||||
contents: write
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
vela_core_image: ${{ steps.meta-vela-core.outputs.image }}
|
||||
vela_core_digest: ${{ steps.meta-vela-core.outputs.digest }}
|
||||
vela_core_dockerhub_image: ${{ steps.meta-vela-core.outputs.dockerhub_image }}
|
||||
vela_cli_image: ${{ steps.meta-vela-cli.outputs.image }}
|
||||
vela_cli_digest: ${{ steps.meta-vela-cli.outputs.digest }}
|
||||
vela_cli_dockerhub_image: ${{ steps.meta-vela-cli.outputs.dockerhub_image }}
|
||||
publish-images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.1
|
||||
|
||||
- name: Install Crane
|
||||
uses: imjasonh/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # v0.1
|
||||
|
||||
- name: Install Cosign
|
||||
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # main
|
||||
with:
|
||||
cosign-release: 'v2.5.0'
|
||||
|
||||
- name: Get the image version
|
||||
- uses: actions/checkout@master
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: |
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then
|
||||
VERSION=latest
|
||||
fi
|
||||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
|
||||
|
||||
echo ::set-output name=VERSION::${VERSION}
|
||||
- name: Get git revision
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
echo "git_revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
||||
echo "::set-output name=git_revision::$(git rev-parse --short HEAD)"
|
||||
- name: Login ghcr.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
||||
- name: Login docker.io
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: docker.io
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Setup QEMU
|
||||
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
|
||||
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
|
||||
- uses: docker/setup-qemu-action@v1
|
||||
- uses: docker/setup-buildx-action@v1
|
||||
with:
|
||||
driver-opts: image=moby/buildkit:master
|
||||
|
||||
- name: Build & Push Vela Core for Dockerhub, GHCR
|
||||
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
|
||||
- uses: docker/build-push-action@v2
|
||||
name: Build & Pushing
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
labels: |
|
||||
labels: |-
|
||||
org.opencontainers.image.source=https://github.com/${{ github.repository }}
|
||||
org.opencontainers.image.revision=${{ github.sha }}
|
||||
platforms: linux/amd64,linux/arm64
|
||||
@@ -89,56 +61,15 @@ jobs:
|
||||
build-args: |
|
||||
GITVERSION=git-${{ steps.vars.outputs.git_revision }}
|
||||
VERSION=${{ steps.get_version.outputs.VERSION }}
|
||||
GOPROXY=https://proxy.golang.org
|
||||
tags: |
|
||||
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 }}
|
||||
|
||||
- name: Get Vela Core Image Digest
|
||||
id: meta-vela-core
|
||||
run: |
|
||||
GHCR_IMAGE=ghcr.io/${{ github.repository_owner }}/oamdev/vela-core
|
||||
DOCKER_IMAGE=docker.io/oamdev/vela-core
|
||||
TAG=${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
DIGEST=$(crane digest $GHCR_IMAGE:$TAG)
|
||||
|
||||
echo "image=$GHCR_IMAGE" >> $GITHUB_OUTPUT
|
||||
echo "dockerhub_image=$DOCKER_IMAGE" >> $GITHUB_OUTPUT
|
||||
echo "digest=$DIGEST" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate SBOM for Vela Core Image
|
||||
id: generate_vela_core_sbom
|
||||
uses: anchore/sbom-action@v0.17.0
|
||||
with:
|
||||
image: ghcr.io/${{ github.repository_owner }}/oamdev/vela-core:${{ steps.get_version.outputs.VERSION }}
|
||||
registry-username: ${{ github.actor }}
|
||||
registry-password: ${{ secrets.GITHUB_TOKEN }}
|
||||
format: spdx-json
|
||||
artifact-name: sbom-vela-core.spdx.json
|
||||
output-file: ${{ github.workspace }}/sbom-vela-core.spdx.json
|
||||
|
||||
- name: Sign Vela Core Image and Attest SBOM
|
||||
env:
|
||||
COSIGN_EXPERIMENTAL: 'true'
|
||||
run: |
|
||||
echo "signing vela core images..."
|
||||
cosign sign --yes ghcr.io/${{ github.repository_owner }}/oamdev/vela-core@${{ steps.meta-vela-core.outputs.digest }}
|
||||
cosign sign --yes docker.io/oamdev/vela-core@${{ steps.meta-vela-core.outputs.digest }}
|
||||
|
||||
echo "attesting SBOM against the vela core image..."
|
||||
cosign attest --yes --predicate ${{ github.workspace }}/sbom-vela-core.spdx.json --type spdx \
|
||||
ghcr.io/${{ github.repository_owner }}/oamdev/vela-core@${{ steps.meta-vela-core.outputs.digest }}
|
||||
|
||||
cosign attest --yes --predicate ${{ github.workspace }}/sbom-vela-core.spdx.json --type spdx \
|
||||
docker.io/oamdev/vela-core@${{ steps.meta-vela-core.outputs.digest }}
|
||||
|
||||
- name: Build & Push Vela CLI for Dockerhub, GHCR
|
||||
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
|
||||
- uses: docker/build-push-action@v2
|
||||
name: Build & Pushing runtime rollout
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile.cli
|
||||
labels: |
|
||||
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
|
||||
@@ -146,101 +77,108 @@ jobs:
|
||||
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 }}
|
||||
tags: |-
|
||||
ghcr.io/${{ github.repository }}/vela-rollout:${{ steps.get_version.outputs.VERSION }}
|
||||
docker.io/oamdev/vela-rollout:${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
- name: Get Vela CLI Image Digest
|
||||
id: meta-vela-cli
|
||||
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
|
||||
OAM_RUNTIME_HELM_CHART: charts/oam-runtime
|
||||
VELA_ROLLOUT_HELM_CHART: runtime/rollout/charts
|
||||
LOCAL_OSS_DIRECTORY: .oss/
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Get git revision
|
||||
id: vars
|
||||
shell: bash
|
||||
run: |
|
||||
GHCR_IMAGE=ghcr.io/${{ github.repository_owner }}/oamdev/vela-cli
|
||||
DOCKER_IMAGE=docker.io/oamdev/vela-cli
|
||||
TAG=${{ steps.get_version.outputs.VERSION }}
|
||||
|
||||
DIGEST=$(crane digest $GHCR_IMAGE:$TAG)
|
||||
|
||||
echo "image=$GHCR_IMAGE" >> $GITHUB_OUTPUT
|
||||
echo "dockerhub_image=$DOCKER_IMAGE" >> $GITHUB_OUTPUT
|
||||
echo "digest=$DIGEST" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate SBOM for Vela CLI Image
|
||||
id: generate_sbom
|
||||
uses: anchore/sbom-action@v0.17.0
|
||||
echo "::set-output name=git_revision::$(git rev-parse --short HEAD)"
|
||||
- name: Install Helm
|
||||
uses: azure/setup-helm@v1
|
||||
with:
|
||||
image: ghcr.io/${{ github.repository_owner }}/oamdev/vela-cli:${{ steps.get_version.outputs.VERSION }}
|
||||
registry-username: ${{ github.actor }}
|
||||
registry-password: ${{ secrets.GITHUB_TOKEN }}
|
||||
format: spdx-json
|
||||
artifact-name: sbom-vela-cli.spdx.json
|
||||
output-file: ${{ github.workspace }}/sbom-vela-cli.spdx.json
|
||||
|
||||
- name: Sign Vela CLI Image and Attest SBOM
|
||||
env:
|
||||
COSIGN_EXPERIMENTAL: 'true'
|
||||
version: v3.4.0
|
||||
- name: Prepare legacy chart
|
||||
run: |
|
||||
echo "signing vela CLI images..."
|
||||
cosign sign --yes ghcr.io/${{ github.repository_owner }}/oamdev/vela-cli@${{ steps.meta-vela-cli.outputs.digest }}
|
||||
cosign sign --yes docker.io/oamdev/vela-cli@${{ steps.meta-vela-cli.outputs.digest }}
|
||||
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
|
||||
- uses: oprypin/find-latest-tag@v1
|
||||
with:
|
||||
repository: oam-dev/kubevela
|
||||
releases-only: true
|
||||
id: latest_tag
|
||||
- name: Tag helm chart image
|
||||
run: |
|
||||
latest_repo_tag=${{ steps.latest_tag.outputs.tag }}
|
||||
sub="."
|
||||
major="$(cut -d"$sub" -f1 <<<"$latest_repo_tag")"
|
||||
minor="$(cut -d"$sub" -f2 <<<"$latest_repo_tag")"
|
||||
patch="0"
|
||||
current_repo_tag="$major.$minor.$patch"
|
||||
image_tag=${GITHUB_REF#refs/tags/}
|
||||
chart_version=$latest_repo_tag
|
||||
if [[ ${GITHUB_REF} == "refs/heads/master" ]]; then
|
||||
image_tag=latest
|
||||
chart_version=${current_repo_tag}-nightly-build
|
||||
fi
|
||||
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" $OAM_RUNTIME_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" $OAM_RUNTIME_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 README.md $HELM_CHART/README.md
|
||||
rsync README.md $LEGACY_HELM_CHART/README.md
|
||||
rsync README.md $OAM_RUNTIME_HELM_CHART/README.md
|
||||
rsync 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 $OAM_RUNTIME_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: ./ossutil --config-file .ossutilconfig sync $LOCAL_OSS_DIRECTORY oss://$BUCKET/core -f
|
||||
|
||||
echo "attesting SBOM against the vela cli image..."
|
||||
cosign attest --yes --predicate ${{ github.workspace }}/sbom-vela-cli.spdx.json --type spdx \
|
||||
ghcr.io/${{ github.repository_owner }}/oamdev/vela-cli@${{ steps.meta-vela-cli.outputs.digest }}
|
||||
|
||||
cosign attest --yes --predicate ${{ github.workspace }}/sbom-vela-cli.spdx.json --type spdx \
|
||||
docker.io/oamdev/vela-cli@${{ steps.meta-vela-cli.outputs.digest }}
|
||||
|
||||
- name: Publish SBOMs as release artifacts
|
||||
uses: anchore/sbom-action/publish-sbom@v0.17.0
|
||||
|
||||
provenance-ghcr:
|
||||
name: Generate and Push Provenance to GCHR
|
||||
needs: publish-vela-images
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- name: 'Vela Core Image'
|
||||
image: ${{ needs.publish-vela-images.outputs.vela_core_image }}
|
||||
digest: ${{ needs.publish-vela-images.outputs.vela_core_digest }}
|
||||
- name: 'Vela CLI Image'
|
||||
image: ${{ needs.publish-vela-images.outputs.vela_cli_image }}
|
||||
digest: ${{ needs.publish-vela-images.outputs.vela_cli_digest }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
actions: read
|
||||
packages: write
|
||||
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0 # has to be sem var
|
||||
with:
|
||||
image: ${{ matrix.image }}
|
||||
digest: ${{ matrix.digest }}
|
||||
registry-username: ${{ github.actor }}
|
||||
secrets:
|
||||
registry-password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
provenance-dockerhub:
|
||||
name: Generate and Push Provenance to DockerHub
|
||||
needs: publish-vela-images
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- name: 'Vela Core Image'
|
||||
image: ${{ needs.publish-vela-images.outputs.vela_core_dockerhub_image }}
|
||||
digest: ${{ needs.publish-vela-images.outputs.vela_core_digest }}
|
||||
- name: 'Vela CLI Image'
|
||||
image: ${{ needs.publish-vela-images.outputs.vela_cli_dockerhub_image }}
|
||||
digest: ${{ needs.publish-vela-images.outputs.vela_cli_digest }}
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
packages: write
|
||||
actions: read
|
||||
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v2.1.0
|
||||
with:
|
||||
image: ${{ matrix.image }}
|
||||
digest: ${{ matrix.digest }}
|
||||
secrets:
|
||||
registry-username: ${{ secrets.DOCKER_USERNAME }}
|
||||
registry-password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
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
|
||||
- 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
|
||||
- name: sync local to cloud
|
||||
run: ./ossutil --config-file .ossutilconfig sync $CAPABILITY_DIR oss://$CAPABILITY_BUCKET -f
|
||||
228
.github/workflows/release.yml
vendored
228
.github/workflows/release.yml
vendored
@@ -6,124 +6,124 @@ on:
|
||||
- "v*"
|
||||
workflow_dispatch: {}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
name: goreleaser
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
checks: write
|
||||
issues: read
|
||||
packages: write
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
statuses: read
|
||||
id-token: write
|
||||
outputs:
|
||||
hashes: ${{ steps.hash.outputs.hashes }}
|
||||
publish-cli:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
VELA_VERSION: ${{ github.ref }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Check disk (before)
|
||||
run: |
|
||||
df -h
|
||||
sudo du -sh /usr/local/lib/android /usr/share/dotnet /opt/ghc || true
|
||||
|
||||
- name: Free Disk Space (Ubuntu)
|
||||
uses: insightsengineering/disk-space-reclaimer@v1
|
||||
with:
|
||||
# this might remove tools that are actually needed,
|
||||
# if set to "true" but frees about 6 GB
|
||||
tools-cache: false
|
||||
# all of these default to true, but feel free to set to
|
||||
# "false" if necessary for your workflow
|
||||
android: true
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: true
|
||||
swap-storage: true
|
||||
docker-images: true
|
||||
|
||||
# Extra prune in case your job builds/pulls images
|
||||
- name: Deep Docker prune
|
||||
run: |
|
||||
docker system prune -af || true
|
||||
docker builder prune -af || true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Git tags
|
||||
run: git fetch --force --tags
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.23.8
|
||||
cache: true
|
||||
|
||||
- name: Install Cosign
|
||||
uses: sigstore/cosign-installer@main
|
||||
go-version: 1.16
|
||||
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: 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 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: Upload Vela Linux amd64 tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
cosign-release: "v2.5.0"
|
||||
|
||||
- name: Install syft
|
||||
uses: anchore/sbom-action/download-syft@f325610c9f50a54015d37c8d16cb3b0e2c8f4de0 # v0.18.0
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/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 Linux amd64 zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: 1.14.1
|
||||
args: release --rm-dist --timeout 60m
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Generate hashes
|
||||
id: hash
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
set -euo pipefail
|
||||
HASHES=$(find dist -type f -exec sha256sum {} \; | base64 -w0)
|
||||
echo "hashes=$HASHES" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Check disk (after)
|
||||
run: df -h
|
||||
|
||||
upload-plugin-homebrew:
|
||||
name: upload-sha256sums
|
||||
needs: goreleaser
|
||||
runs-on: ubuntu-22.04
|
||||
if: ${{ !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc') }}
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
checks: write
|
||||
issues: read
|
||||
packages: write
|
||||
pull-requests: read
|
||||
repository-projects: read
|
||||
statuses: read
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/vela-linux-amd64.zip
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Vela MacOS tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/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 Vela MacOS zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/vela-darwin-amd64.zip
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Vela Windows tar.gz
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/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 Vela Windows zip
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_path: ./_bin/vela/vela-windows-amd64.zip
|
||||
asset_name: vela-${{ steps.get_version.outputs.VERSION }}-windows-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela Linux amd64 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-linux-amd64.tar.gz
|
||||
asset_name: kubectl-vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64.tar.gz
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela Linux amd64 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-linux-amd64.zip
|
||||
asset_name: kubectl-vela-${{ steps.get_version.outputs.VERSION }}-linux-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela 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-darwin-amd64.tar.gz
|
||||
asset_name: kubectl-vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.tar.gz
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela 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-darwin-amd64.zip
|
||||
asset_name: kubectl-vela-${{ steps.get_version.outputs.VERSION }}-darwin-amd64.zip
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela Windows 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-windows-amd64.tar.gz
|
||||
asset_name: kubectl-vela-${{ steps.get_version.outputs.VERSION }}-windows-amd64.tar.gz
|
||||
asset_content_type: binary/octet-stream
|
||||
- name: Upload Kubectl-Vela Windows 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-windows-amd64.zip
|
||||
asset_name: kubectl-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: ./_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@df3eb197549e3568be8b4767eec31c5e8e8e6ad8 # v0.0.46
|
||||
|
||||
provenance-vela-bins:
|
||||
name: generate provenance for binaries
|
||||
needs: [goreleaser]
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
actions: read
|
||||
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.1.0 # has to be sem var
|
||||
with:
|
||||
base64-subjects: "${{ needs.goreleaser.outputs.hashes }}"
|
||||
upload-assets: true
|
||||
uses: rajatjindal/krew-release-bot@v0.0.38
|
||||
|
||||
60
.github/workflows/scorecards.yml
vendored
60
.github/workflows/scorecards.yml
vendored
@@ -1,60 +0,0 @@
|
||||
name: Scorecards supply-chain security
|
||||
on:
|
||||
schedule:
|
||||
# Weekly on Saturdays.
|
||||
- cron: '30 1 * * 6'
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
analysis:
|
||||
name: Scorecards analysis
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
# Needed to upload the results to code-scanning dashboard.
|
||||
security-events: write
|
||||
# Used to receive a badge. (Upcoming feature)
|
||||
id-token: write
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # tag=v2.4.1
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
|
||||
# - you want to enable the Branch-Protection check on a *public* repository, or
|
||||
# - you are installing Scorecards on a *private* repository
|
||||
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
|
||||
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
|
||||
|
||||
# Publish the results for public repositories to enable scorecard badges. For more details, see
|
||||
# https://github.com/ossf/scorecard-action#publishing-results.
|
||||
# For private repositories, `publish_results` will automatically be set to `false`, regardless
|
||||
# of the value entered here.
|
||||
publish_results: true
|
||||
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@134dcf33c0b9454c4b17a936843d7e21dccdc335 # v4.3.6
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
retention-days: 5
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
49
.github/workflows/sdk-test.yml
vendored
49
.github/workflows/sdk-test.yml
vendored
@@ -1,49 +0,0 @@
|
||||
name: SDK Test
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
paths:
|
||||
- "vela-templates/definitions/**"
|
||||
- "pkg/definition/gen_sdk/**"
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
sdk-tests:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
|
||||
- name: Setup Env
|
||||
uses: ./.github/actions/env-setup
|
||||
|
||||
- name: Install Go tools
|
||||
run: |
|
||||
make goimports
|
||||
make golangci
|
||||
|
||||
- name: Setup KinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
name: sdk-test
|
||||
|
||||
- name: Build CLI
|
||||
run: make vela-cli
|
||||
|
||||
- name: Build SDK
|
||||
run: bin/vela def gen-api -f vela-templates/definitions/internal/ -o ./kubevela-go-sdk --package=github.com/kubevela-contrib/kubevela-go-sdk --init
|
||||
|
||||
- name: Validate SDK
|
||||
run: |
|
||||
cd kubevela-go-sdk
|
||||
go mod tidy
|
||||
golangci-lint run --timeout 5m -e "exported:" -e "dot-imports" ./...
|
||||
23
.github/workflows/sync-api.yml
vendored
23
.github/workflows/sync-api.yml
vendored
@@ -7,22 +7,25 @@ on:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
sync-core-api:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
- name: Set up Go 1.16
|
||||
uses: actions/setup-go@v1
|
||||
env:
|
||||
GO_VERSION: '1.16'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
id: go
|
||||
|
||||
- name: Setup Env
|
||||
uses: ./.github/actions/env-setup
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
|
||||
|
||||
- name: Sync to kubevela-core-api Repo
|
||||
env:
|
||||
@@ -31,4 +34,4 @@ jobs:
|
||||
COMMIT_ID: ${{ github.sha }}
|
||||
run: |
|
||||
bash ./hack/apis/clientgen.sh
|
||||
bash ./hack/apis/sync.sh sync
|
||||
bash ./hack/apis/sync.sh
|
||||
|
||||
49
.github/workflows/sync-sdk.yaml
vendored
49
.github/workflows/sync-sdk.yaml
vendored
@@ -1,49 +0,0 @@
|
||||
name: Sync SDK
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- vela-templates/definitions/internal/**
|
||||
- pkg/definition/gen_sdk/**
|
||||
- .github/workflows/sync-sdk.yaml
|
||||
tags:
|
||||
- "v*"
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
sync_sdk:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- name: Env setup
|
||||
uses: ./.github/actions/env-setup
|
||||
|
||||
- name: Install Go tools
|
||||
run: |
|
||||
make goimports
|
||||
|
||||
- name: Build CLI
|
||||
run: make vela-cli
|
||||
|
||||
- name: Setup KinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
name: sync-sdk
|
||||
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo "VERSION=${GITHUB_REF}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Sync SDK to kubevela/kubevela-go-sdk
|
||||
run: bash ./hack/sdk/sync.sh
|
||||
env:
|
||||
SSH_DEPLOY_KEY: ${{ secrets.GO_SDK_DEPLOY_KEY }}
|
||||
VERSION: ${{ steps.get_version.outputs.VERSION }}
|
||||
COMMIT_ID: ${{ github.sha }}
|
||||
10
.github/workflows/timed-task.yml
vendored
Normal file
10
.github/workflows/timed-task.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
name: Timed Task
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 * * * *'
|
||||
jobs:
|
||||
clean-image:
|
||||
runs-on: aliyun
|
||||
steps:
|
||||
- name: Cleanup image
|
||||
run: docker image prune -f
|
||||
33
.github/workflows/trivy-scan.yml
vendored
33
.github/workflows/trivy-scan.yml
vendored
@@ -1,33 +0,0 @@
|
||||
name: "Trivy Scan"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
images:
|
||||
name: Image Scan
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608
|
||||
|
||||
- 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@d9cd5b1c23aaf8cb31bb09141028215828364bbb # 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@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
68
.github/workflows/unit-test.yml
vendored
68
.github/workflows/unit-test.yml
vendored
@@ -11,45 +11,75 @@ on:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
# Common versions
|
||||
GO_VERSION: '1.16'
|
||||
GOLANGCI_VERSION: 'v1.38'
|
||||
KIND_VERSION: 'v0.7.0'
|
||||
|
||||
jobs:
|
||||
|
||||
detect-noop:
|
||||
permissions:
|
||||
actions: write # for fkirc/skip-duplicate-actions to skip or stop workflow runs
|
||||
runs-on: ubuntu-22.04
|
||||
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@f75f66ce1886f00957d99748a42c724f4330bdcf
|
||||
uses: fkirc/skip-duplicate-actions@v3.3.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
|
||||
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
|
||||
continue-on-error: true
|
||||
concurrent_skipping: false
|
||||
|
||||
unit-tests:
|
||||
runs-on: ubuntu-22.04
|
||||
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Setup Env
|
||||
uses: ./.github/actions/env-setup
|
||||
|
||||
- name: Setup KinD with Kubernetes
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
|
||||
- name: Run unit tests
|
||||
uses: ./.github/actions/unit-test
|
||||
- name: Cache Go Dependencies
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
codecov-enable: true
|
||||
codecov-token: ${{ secrets.CODECOV_TOKEN }}
|
||||
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: 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: unittests
|
||||
name: codecov-umbrella
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
# =============================================================================
|
||||
# E2E Upgrade Multicluster Test Workflow
|
||||
# =============================================================================
|
||||
# This workflow performs end-to-end testing for KubeVela multicluster upgrades.
|
||||
# It tests the upgrade path from the latest released version to the current
|
||||
# development branch across multiple Kubernetes versions.
|
||||
#
|
||||
# Test Flow:
|
||||
# 1. Install latest KubeVela release
|
||||
# 2. Build and upgrade to current development version
|
||||
# 3. Run multicluster e2e tests to verify functionality
|
||||
# =============================================================================
|
||||
|
||||
name: E2E Upgrade Multicluster Test
|
||||
|
||||
# =============================================================================
|
||||
# Trigger Configuration
|
||||
# =============================================================================
|
||||
on:
|
||||
# Trigger on pull requests targeting main branches
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
# Allow manual workflow execution
|
||||
workflow_dispatch: {}
|
||||
|
||||
# =============================================================================
|
||||
# Security Configuration
|
||||
# =============================================================================
|
||||
permissions:
|
||||
contents: read # Read-only access to repository contents
|
||||
|
||||
# =============================================================================
|
||||
# Global Environment Variables
|
||||
# =============================================================================
|
||||
env:
|
||||
GO_VERSION: '1.23.8' # Go version for building and testing
|
||||
|
||||
# =============================================================================
|
||||
# Job Definitions
|
||||
# =============================================================================
|
||||
jobs:
|
||||
upgrade-multicluster-tests:
|
||||
name: Upgrade Multicluster Tests
|
||||
runs-on: ubuntu-22.04
|
||||
if: startsWith(github.head_ref, 'chore/upgrade-k8s-')
|
||||
timeout-minutes: 60 # Prevent hanging jobs
|
||||
|
||||
# ==========================================================================
|
||||
# Matrix Strategy - Test against multiple Kubernetes versions
|
||||
# ==========================================================================
|
||||
strategy:
|
||||
fail-fast: false # Continue testing other versions if one fails
|
||||
matrix:
|
||||
k8s-version: ['v1.31.9']
|
||||
|
||||
# ==========================================================================
|
||||
# Concurrency Control - Prevent overlapping runs
|
||||
# ==========================================================================
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Environment Setup
|
||||
# ========================================================================
|
||||
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
|
||||
# ========================================================================
|
||||
# Kubernetes Cluster Setup
|
||||
# ========================================================================
|
||||
|
||||
- name: Setup worker cluster kinD
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
name: worker
|
||||
|
||||
- name: Setup KinD master clusters for multicluster testing
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
k8s-version: ${{ matrix.k8s-version }}
|
||||
|
||||
- name: Deploy latest release
|
||||
uses: ./.github/actions/deploy-latest-release
|
||||
|
||||
- name: Upgrade from current branch
|
||||
uses: ./.github/actions/deploy-current-branch
|
||||
|
||||
- name: Run upgarde multicluster tests
|
||||
uses: ./.github/actions/multicluster-test
|
||||
with:
|
||||
codecov-enable: false
|
||||
codecov-token: ''
|
||||
102
.github/workflows/upgrade-e2e-test.yml
vendored
102
.github/workflows/upgrade-e2e-test.yml
vendored
@@ -1,102 +0,0 @@
|
||||
# =============================================================================
|
||||
# Upgrade E2E Test Workflow
|
||||
# =============================================================================
|
||||
# This workflow performs comprehensive end-to-end testing for KubeVela upgrades.
|
||||
# It validates the upgrade path from the latest stable release to the current
|
||||
# development version by running multiple test suites including API, addon,
|
||||
# and general e2e tests.
|
||||
#
|
||||
# Test Flow:
|
||||
# 1. Install latest KubeVela release
|
||||
# 2. Build and upgrade to current development version
|
||||
# 3. Run comprehensive e2e test suites (API, addon, general)
|
||||
# 4. Validate upgrade functionality and compatibility
|
||||
# =============================================================================
|
||||
|
||||
name: Upgrade E2E Test
|
||||
|
||||
# =============================================================================
|
||||
# Trigger Configuration
|
||||
# =============================================================================
|
||||
on:
|
||||
# Trigger on pull requests targeting main branches
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
# Allow manual workflow execution
|
||||
workflow_dispatch: {}
|
||||
|
||||
# =============================================================================
|
||||
# Environment Variables
|
||||
# =============================================================================
|
||||
env:
|
||||
GO_VERSION: '1.23.8'
|
||||
|
||||
# =============================================================================
|
||||
# Security Configuration
|
||||
# =============================================================================
|
||||
permissions:
|
||||
contents: read # Read-only access to repository contents
|
||||
|
||||
# =============================================================================
|
||||
# Job Definitions
|
||||
# =============================================================================
|
||||
jobs:
|
||||
upgrade-tests:
|
||||
name: Upgrade E2E Tests
|
||||
runs-on: ubuntu-22.04
|
||||
if: startsWith(github.head_ref, 'chore/upgrade-k8s-')
|
||||
timeout-minutes: 90 # Extended timeout for comprehensive e2e testing
|
||||
|
||||
# ==========================================================================
|
||||
# Matrix Strategy - Test against multiple Kubernetes versions
|
||||
# ==========================================================================
|
||||
strategy:
|
||||
fail-fast: false # Continue testing other versions if one fails
|
||||
matrix:
|
||||
k8s-version: ['v1.31.9']
|
||||
|
||||
# ==========================================================================
|
||||
# Concurrency Control - Prevent overlapping runs
|
||||
# ==========================================================================
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Repository Setup
|
||||
# ========================================================================
|
||||
- name: Check out code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
|
||||
# ========================================================================
|
||||
# Kubernetes Cluster Setup
|
||||
# ========================================================================
|
||||
- name: Setup KinD with Kubernetes ${{ matrix.k8s-version }}
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
k8s-version: ${{ matrix.k8s-version }}
|
||||
|
||||
- name: Build vela CLI
|
||||
run: make vela-cli
|
||||
|
||||
- name: Build kubectl-vela plugin
|
||||
run: make kubectl-vela
|
||||
|
||||
- name: Install kustomize
|
||||
run: make kustomize
|
||||
|
||||
- name: Deploy latest release
|
||||
uses: ./.github/actions/deploy-latest-release
|
||||
|
||||
- name: Upgrade from current branch
|
||||
uses: ./.github/actions/deploy-current-branch
|
||||
|
||||
# ========================================================================
|
||||
# E2E Test Execution
|
||||
# ========================================================================
|
||||
- name: Run upgrade e2e tests
|
||||
uses: ./.github/actions/e2e-test
|
||||
83
.github/workflows/upgrade-unit-test.yml
vendored
83
.github/workflows/upgrade-unit-test.yml
vendored
@@ -1,83 +0,0 @@
|
||||
# =============================================================================
|
||||
# Upgrade Unit Test Workflow
|
||||
# =============================================================================
|
||||
# This workflow performs unit testing for KubeVela upgrades by:
|
||||
# 1. Installing the latest stable KubeVela release
|
||||
# 2. Building and upgrading to the current development version
|
||||
# 3. Running unit tests to validate the upgrade functionality
|
||||
# =============================================================================
|
||||
|
||||
name: Upgrade Unit Test
|
||||
|
||||
# =============================================================================
|
||||
# Trigger Configuration
|
||||
# =============================================================================
|
||||
on:
|
||||
# Trigger on pull requests targeting main and release branches
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
# Allow manual workflow execution
|
||||
workflow_dispatch: {}
|
||||
|
||||
# =============================================================================
|
||||
# Security Configuration
|
||||
# =============================================================================
|
||||
permissions:
|
||||
contents: read # Read-only access to repository contents
|
||||
|
||||
# =============================================================================
|
||||
# Job Definitions
|
||||
# =============================================================================
|
||||
jobs:
|
||||
upgrade-tests:
|
||||
name: Upgrade Unit Tests
|
||||
runs-on: ubuntu-22.04
|
||||
if: startsWith(github.head_ref, 'chore/upgrade-k8s-')
|
||||
timeout-minutes: 45 # Prevent hanging jobs
|
||||
|
||||
# ==========================================================================
|
||||
# Matrix Strategy - Test against multiple Kubernetes versions
|
||||
# ==========================================================================
|
||||
strategy:
|
||||
fail-fast: false # Continue testing other versions if one fails
|
||||
matrix:
|
||||
k8s-version: ['v1.31.9']
|
||||
|
||||
# ==========================================================================
|
||||
# Concurrency Control - Prevent overlapping runs
|
||||
# ==========================================================================
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
|
||||
cancel-in-progress: true
|
||||
|
||||
steps:
|
||||
# ========================================================================
|
||||
# Environment Setup
|
||||
# ========================================================================
|
||||
|
||||
- name: Check out code
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
|
||||
# ========================================================================
|
||||
# Kubernetes Cluster Setup
|
||||
# ========================================================================
|
||||
|
||||
- name: Setup KinD with Kubernetes ${{ matrix.k8s-version }}
|
||||
uses: ./.github/actions/setup-kind-cluster
|
||||
with:
|
||||
k8s-version: ${{ matrix.k8s-version }}
|
||||
|
||||
- name: Deploy latest release
|
||||
uses: ./.github/actions/deploy-latest-release
|
||||
|
||||
- name: Upgrade from current branch
|
||||
uses: ./.github/actions/deploy-current-branch
|
||||
|
||||
- name: Run unit tests
|
||||
uses: ./.github/actions/unit-test
|
||||
with:
|
||||
codecov-enable: false
|
||||
codecov-token: ''
|
||||
165
.github/workflows/webhook-upgrade-validation.yml
vendored
165
.github/workflows/webhook-upgrade-validation.yml
vendored
@@ -1,165 +0,0 @@
|
||||
name: Webhook Upgrade Validation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
workflow_dispatch: {}
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- release-*
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
GO_VERSION: '1.23.8'
|
||||
|
||||
jobs:
|
||||
webhook-upgrade-check:
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- name: Check out code into the Go module directory
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
|
||||
|
||||
- name: Setup Env
|
||||
uses: ./.github/actions/env-setup
|
||||
|
||||
- name: Setup KinD
|
||||
run: |
|
||||
go install sigs.k8s.io/kind@v0.29.0
|
||||
kind delete cluster || true
|
||||
kind create cluster --image=kindest/node:v1.31.9
|
||||
|
||||
- name: Install KubeVela CLI
|
||||
run: curl -fsSL https://kubevela.io/script/install.sh | bash
|
||||
|
||||
- name: Install KubeVela baseline
|
||||
run: |
|
||||
vela install --set featureGates.enableCueValidation=true
|
||||
kubectl wait --namespace vela-system --for=condition=Available deployment/kubevela-vela-core --timeout=300s
|
||||
|
||||
- name: Prepare failing chart changes
|
||||
run: |
|
||||
cat <<'CHART' > charts/vela-core/templates/defwithtemplate/resource.yaml
|
||||
# Code generated by KubeVela templates. DO NOT EDIT. Please edit the original cue file.
|
||||
# Definition source cue file: vela-templates/definitions/internal/resource.cue
|
||||
apiVersion: core.oam.dev/v1beta1
|
||||
kind: TraitDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
definition.oam.dev/description: Add resource requests and limits on K8s pod for your workload which follows the pod spec in path 'spec.template.'
|
||||
name: resource
|
||||
namespace: {{ include "systemDefinitionNamespace" . }}
|
||||
spec:
|
||||
appliesToWorkloads:
|
||||
- deployments.apps
|
||||
- statefulsets.apps
|
||||
- daemonsets.apps
|
||||
- jobs.batch
|
||||
- cronjobs.batch
|
||||
podDisruptive: true
|
||||
schematic:
|
||||
cue:
|
||||
template: |2
|
||||
let resourceContent = {
|
||||
resources: {
|
||||
if parameter.cpu != _|_ if parameter.memory != _|_ if parameter.requests == _|_ if parameter.limits == _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
requests: {
|
||||
cpu: parameter.cpu
|
||||
memory: parameter.memory
|
||||
}
|
||||
// +patchStrategy=retainKeys
|
||||
limits: {
|
||||
cpu: parameter.cpu
|
||||
memory: parameter.memory
|
||||
}
|
||||
}
|
||||
if parameter.requests != _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
requests: {
|
||||
cpu: parameter.requests.cpu
|
||||
memory: parameter.requests.memory
|
||||
}
|
||||
}
|
||||
if parameter.limits != _|_ {
|
||||
// +patchStrategy=retainKeys
|
||||
limits: {
|
||||
cpu: parameter.limits.cpu
|
||||
memory: parameter.limits.memory
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if context.output.spec != _|_ if context.output.spec.template != _|_ {
|
||||
patch: spec: template: spec: {
|
||||
// +patchKey=name
|
||||
containers: [resourceContent]
|
||||
}
|
||||
}
|
||||
if context.output.spec != _|_ if context.output.spec.jobTemplate != _|_ {
|
||||
patch: spec: jobTemplate: spec: template: spec: {
|
||||
// +patchKey=name
|
||||
containers: [resourceContent]
|
||||
}
|
||||
}
|
||||
parameter: {
|
||||
// +usage=Specify the amount of cpu for requests and limits
|
||||
cpu?: *1 | number | string
|
||||
// +usage=Specify the amount of memory for requests and limits
|
||||
memory?: *"2048Mi" | =~"^([1-9][0-9]{0,63})(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)$"
|
||||
// +usage=Specify the resources in requests
|
||||
requests?: {
|
||||
// +usage=Specify the amount of cpu for requests
|
||||
cpu: *1 | number | string
|
||||
// +usage=Specify the amount of memory for requests
|
||||
memory: *"2048Mi" | =~"^([1-9][0-9]{0,63})(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)$"
|
||||
}
|
||||
// +usage=Specify the resources in limits
|
||||
limits?: {
|
||||
// +usage=Specify the amount of cpu for limits
|
||||
cpu: *1 | number | string
|
||||
// +usage=Specify the amount of memory for limits
|
||||
memory: *"2048Mi" | =~"^([1-9][0-9]{0,63})(E|P|T|G|M|K|Ei|Pi|Ti|Gi|Mi|Ki)$"
|
||||
}
|
||||
}
|
||||
|
||||
- name: Load image
|
||||
run: |
|
||||
mkdir -p $HOME/tmp/
|
||||
TMPDIR=$HOME/tmp/ make image-load
|
||||
|
||||
- name: Run Helm upgrade (expected to fail)
|
||||
run: |
|
||||
set +e
|
||||
helm upgrade \
|
||||
--set image.repository=vela-core-test \
|
||||
--set image.tag=$(git rev-parse --short HEAD) \
|
||||
--set featureGates.enableCueValidation=true \
|
||||
--wait kubevela ./charts/vela-core --debug -n vela-system
|
||||
status=$?
|
||||
echo "Helm upgrade exit code: ${status}"
|
||||
if [ $status -eq 0 ]; then
|
||||
echo "Expected helm upgrade to fail" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Helm upgrade failed as expected"
|
||||
|
||||
- name: Dump webhook configurations
|
||||
if: ${{ always() }}
|
||||
run: |
|
||||
kubectl get mutatingwebhookconfiguration kubevela-vela-core-admission -o yaml
|
||||
kubectl get validatingwebhookconfiguration kubevela-vela-core-admission -o yaml
|
||||
|
||||
- name: Verify webhook validation remains active
|
||||
run: ginkgo -v --focus-file requiredparam_validation_test.go ./test/e2e-test
|
||||
|
||||
- name: Cleanup kind cluster
|
||||
if: ${{ always() }}
|
||||
run: kind delete cluster --name kind
|
||||
19
.gitignore
vendored
19
.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
|
||||
@@ -33,15 +32,6 @@ vendor/
|
||||
|
||||
# Vscode files
|
||||
.vscode
|
||||
.history
|
||||
|
||||
# Debug binaries generated by VS Code/Delve
|
||||
__debug_bin*
|
||||
*/__debug_bin*
|
||||
|
||||
# Webhook certificates generated at runtime
|
||||
k8s-webhook-server/
|
||||
options.go.bak
|
||||
|
||||
pkg/test/vela
|
||||
config/crd/bases
|
||||
@@ -49,16 +39,13 @@ _tmp/
|
||||
|
||||
references/cmd/cli/fake/source.go
|
||||
references/cmd/cli/fake/chart_source.go
|
||||
references/vela-sdk-gen/*
|
||||
charts/vela-core/crds/_.yaml
|
||||
.test_vela
|
||||
tmp/
|
||||
|
||||
.vela/
|
||||
|
||||
# check docs
|
||||
git-page/
|
||||
|
||||
vela.json
|
||||
|
||||
dist/
|
||||
# e2e rollout runtime image build
|
||||
runtime/rollout/e2e/tmp
|
||||
105
.golangci.yml
105
.golangci.yml
@@ -1,6 +1,18 @@
|
||||
run:
|
||||
timeout: 10m
|
||||
|
||||
skip-files:
|
||||
- "zz_generated\\..+\\.go$"
|
||||
- ".*_test.go$"
|
||||
|
||||
skip-dirs:
|
||||
- "hack"
|
||||
- "e2e"
|
||||
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
format: colored-line-number
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
|
||||
@@ -11,12 +23,24 @@ linters-settings:
|
||||
# default is false: such cases aren't reported by default.
|
||||
check-blank: false
|
||||
|
||||
# [deprecated] comma-separated list of pairs of the form pkg:regex
|
||||
# the regex is used to ignore names within pkg. (default "fmt:.*").
|
||||
# see https://github.com/kisielk/errcheck#the-deprecated-method for details
|
||||
ignore: fmt:.*,io/ioutil:^Read.*
|
||||
|
||||
exhaustive:
|
||||
# indicates that switch statements are to be considered exhaustive if a
|
||||
# 'default' case is present, even if all enum members aren't listed in the
|
||||
# switch
|
||||
default-signifies-exhaustive: true
|
||||
|
||||
govet:
|
||||
# report about shadowed variables
|
||||
check-shadowing: false
|
||||
|
||||
golint:
|
||||
# minimal confidence for issues, default is 0.8
|
||||
min-confidence: 0.8
|
||||
|
||||
gofmt:
|
||||
# simplify code: gofmt with `-s` option, true by default
|
||||
@@ -29,8 +53,11 @@ linters-settings:
|
||||
|
||||
gocyclo:
|
||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||
min-complexity: 35
|
||||
min-complexity: 30
|
||||
|
||||
maligned:
|
||||
# print struct with more effective memory layout or not, false by default
|
||||
suggest-new: true
|
||||
|
||||
dupl:
|
||||
# tokens count to trigger issue, 150 by default
|
||||
@@ -46,6 +73,13 @@ linters-settings:
|
||||
# tab width in spaces. Default to 1.
|
||||
tab-width: 1
|
||||
|
||||
unused:
|
||||
# treat code as a program (not a library) and report unused exported identifiers; default is false.
|
||||
# XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
|
||||
# if it's called for subdir of a project it can't find funcs usages. All text editor integrations
|
||||
# with golangci-lint call it on a directory with the changed file.
|
||||
check-exported: false
|
||||
|
||||
unparam:
|
||||
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
|
||||
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
|
||||
@@ -73,32 +107,20 @@ linters-settings:
|
||||
# Allow only slices initialized with a length of zero. Default is false.
|
||||
always: false
|
||||
|
||||
revive:
|
||||
rules:
|
||||
- name: unused-parameter
|
||||
disabled: true
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- megacheck
|
||||
- govet
|
||||
- gocyclo
|
||||
- gocritic
|
||||
- goconst
|
||||
- goimports
|
||||
- gofmt # We enable this as well as goimports for its simplify mode.
|
||||
- revive
|
||||
- golint
|
||||
- unconvert
|
||||
- misspell
|
||||
- nakedret
|
||||
- exportloopref
|
||||
- unused
|
||||
- gosimple
|
||||
- staticcheck
|
||||
disable:
|
||||
- rowserrcheck
|
||||
- sqlclosecheck
|
||||
- errchkjson
|
||||
- contextcheck
|
||||
|
||||
presets:
|
||||
- bugs
|
||||
- unused
|
||||
@@ -106,28 +128,8 @@ linters:
|
||||
|
||||
|
||||
issues:
|
||||
|
||||
exclude-files:
|
||||
- "zz_generated\\..+\\.go$"
|
||||
- ".*_test.go$"
|
||||
|
||||
exclude-dirs:
|
||||
- "hack"
|
||||
- "e2e"
|
||||
|
||||
# Excluding configuration per-path and per-linter
|
||||
exclude-rules:
|
||||
- path: .*\.go
|
||||
linters:
|
||||
- errcheck
|
||||
text: "fmt\\."
|
||||
|
||||
# Ignore unchecked errors from io/ioutil functions starting with Read
|
||||
- path: .*\.go
|
||||
linters:
|
||||
- errcheck
|
||||
text: "io/ioutil.*Read"
|
||||
|
||||
# Exclude some linters from running on tests files.
|
||||
- path: _test(ing)?\.go
|
||||
linters:
|
||||
@@ -135,7 +137,7 @@ issues:
|
||||
- errcheck
|
||||
- dupl
|
||||
- gosec
|
||||
- exportloopref
|
||||
- scopelint
|
||||
- unparam
|
||||
|
||||
# Ease some gocritic warnings on test files.
|
||||
@@ -144,21 +146,6 @@ issues:
|
||||
linters:
|
||||
- gocritic
|
||||
|
||||
# The preferFprint suggestion (sb.WriteString(fmt.Sprintf(...)) -> fmt.Fprintf(sb, ...))
|
||||
# is a micro-optimization. The defkit package generates CUE code infrequently,
|
||||
# so the performance difference is negligible and the current style is more readable.
|
||||
- path: pkg/definition/defkit/
|
||||
text: "preferFprint"
|
||||
linters:
|
||||
- gocritic
|
||||
|
||||
# Gosmopolitan complains of internationalization issues on the file that actually defines
|
||||
# the translation.
|
||||
- path: i18n\.go
|
||||
text: "Han"
|
||||
linters:
|
||||
- gosmopolitan
|
||||
|
||||
# These are performance optimisations rather than style issues per se.
|
||||
# They warn when function arguments or range values copy a lot of memory
|
||||
# rather than using a pointer.
|
||||
@@ -199,15 +186,7 @@ issues:
|
||||
|
||||
- text: "don't use an underscore"
|
||||
linters:
|
||||
- revive
|
||||
|
||||
- text: "package-comments: should have a package comment"
|
||||
linters:
|
||||
- revive
|
||||
|
||||
- text: "error-strings: error strings should not be capitalized or end with punctuation or a newline"
|
||||
linters:
|
||||
- revive
|
||||
- golint
|
||||
|
||||
# Independently from option `exclude` we use default exclude patterns,
|
||||
# it can be disabled by this option. To list all
|
||||
@@ -224,7 +203,7 @@ issues:
|
||||
new: false
|
||||
|
||||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
|
||||
max-issues-per-linter: 0
|
||||
max-per-linter: 0
|
||||
|
||||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
||||
max-same-issues: 0
|
||||
max-same-issues: 0
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
# This is an example .goreleaser.yml file with some sensible defaults.
|
||||
# Make sure to check the documentation at https://goreleaser.com
|
||||
builds:
|
||||
- id: vela-cli
|
||||
binary: vela
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
main: ./references/cmd/cli/main.go
|
||||
ldflags:
|
||||
- -s -w -X github.com/oam-dev/kubevela/version.VelaVersion={{ .Version }} -X github.com/oam-dev/kubevela/version.GitRevision=git-{{.ShortCommit}}
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
- id: kubectl-vela
|
||||
binary: kubectl-vela
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
main: ./cmd/plugin/main.go
|
||||
ldflags:
|
||||
- -s -w -X github.com/oam-dev/kubevela/version.VelaVersion={{ .Version }} -X github.com/oam-dev/kubevela/version.GitRevision=git-{{.ShortCommit}}
|
||||
|
||||
sboms:
|
||||
- id: kubevela-binaries-sboms
|
||||
artifacts: binary
|
||||
documents:
|
||||
- "${artifact}-{{ .Version }}-{{ .Os }}-{{ .Arch }}.spdx.sbom.json"
|
||||
|
||||
signs:
|
||||
- id: kubevela-cosign-keyless
|
||||
artifacts: checksum # sign the checksum file over individual artifacts
|
||||
signature: "${artifact}-keyless.sig"
|
||||
certificate: "${artifact}-keyless.pem"
|
||||
cmd: cosign
|
||||
args:
|
||||
- "sign-blob"
|
||||
- "--yes"
|
||||
- "--output-signature"
|
||||
- "${artifact}-keyless.sig"
|
||||
- "--output-certificate"
|
||||
- "${artifact}-keyless.pem"
|
||||
- "${artifact}"
|
||||
output: true
|
||||
|
||||
archives:
|
||||
- format: tar.gz
|
||||
id: vela-cli-tgz
|
||||
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
|
||||
builds:
|
||||
- vela-cli
|
||||
name_template: '{{ trimsuffix .ArtifactName ".exe" }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
|
||||
files: [ LICENSE, README.md ]
|
||||
- format: zip
|
||||
id: vela-cli-zip
|
||||
builds:
|
||||
- vela-cli
|
||||
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
|
||||
name_template: '{{ trimsuffix .ArtifactName ".exe" }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
|
||||
files: [ LICENSE, README.md ]
|
||||
- format: tar.gz
|
||||
id: plugin-tgz
|
||||
builds:
|
||||
- kubectl-vela
|
||||
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
|
||||
name_template: '{{ trimsuffix .ArtifactName ".exe" }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
|
||||
files: [ LICENSE, README.md ]
|
||||
- format: zip
|
||||
id: plugin-zip
|
||||
builds:
|
||||
- kubectl-vela
|
||||
wrap_in_directory: '{{ .Os }}-{{ .Arch }}'
|
||||
name_template: '{{ trimsuffix .ArtifactName ".exe" }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}'
|
||||
files: [ LICENSE, README.md ]
|
||||
|
||||
checksum:
|
||||
name_template: 'sha256sums.txt'
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
|
||||
# The lines beneath this are called `modelines`. See `:help modeline`
|
||||
# Feel free to remove those if you don't want/use them.
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||
@@ -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): separate 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)
|
||||
@@ -1,3 +1,66 @@
|
||||
# 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.
|
||||
To help us create a safe and positive community experience for all, we require all participants to adhere to the [Code of Conduct](./CODE_OF_CONDUCT.md).
|
||||
|
||||
This document is a guide to help you through the process of contributing to KubeVela.
|
||||
|
||||
## Become a contributor
|
||||
|
||||
You can contribute to KubeVela in several ways. Here are some examples:
|
||||
|
||||
* Contribute to the KubeVela codebase.
|
||||
* Contribute to the [KubeVela docs](https://github.com/oam-dev/kubevela.io).
|
||||
* Report and triage bugs.
|
||||
* Develop community CRD operators as workload or trait and contribute to [catalog](https://github.com/oam-dev/catalog).
|
||||
* Write technical documentation and blog posts, for users and contributors.
|
||||
* Organize meetups and user groups in your local area.
|
||||
* Help others by answering questions about KubeVela.
|
||||
|
||||
For more ways to contribute, check out the [Open Source Guides](https://opensource.guide/how-to-contribute/).
|
||||
|
||||
|
||||
### Report bugs
|
||||
|
||||
Before submitting a new issue, try to make sure someone hasn't already reported the problem.
|
||||
Look through the [existing issues](https://github.com/oam-dev/kubevela/issues) for similar issues.
|
||||
|
||||
Report a bug by submitting a [bug report](https://github.com/oam-dev/kubevela/issues/new?assignees=&labels=kind%2Fbug&template=bug_report.md&title=).
|
||||
Make sure that you provide as much information as possible on how to reproduce the bug.
|
||||
|
||||
Follow the issue template and add additional information that will help us replicate the problem.
|
||||
|
||||
#### Security issues
|
||||
|
||||
If you believe you've found a security vulnerability, please read our [security policy](https://github.com/oam-dev/kubevela/blob/master/SECURITY.md) for more details.
|
||||
|
||||
### Suggest enhancements
|
||||
|
||||
If you have an idea to improve KubeVela, submit an [feature request](https://github.com/oam-dev/kubevela/issues/new?assignees=&labels=kind%2Ffeature&template=feature_request.md&title=%5BFeature%5D).
|
||||
|
||||
### Triage issues
|
||||
|
||||
If you don't have the knowledge or time to code, consider helping with _issue triage_. The community will thank you for saving them time by spending some of yours.
|
||||
|
||||
Read more about the ways you can [Triage issues](/contribute/triage-issues.md).
|
||||
|
||||
### Answering questions
|
||||
|
||||
If you have a question and you can't find the answer in the [documentation](https://kubevela.io/docs/),
|
||||
the next step is to ask it on the [github discussion](https://github.com/oam-dev/kubevela/discussions).
|
||||
|
||||
It's important to us to help these users, and we'd love your help. You can help other KubeVela users by answering [their questions](https://github.com/oam-dev/kubevela/discussions).
|
||||
|
||||
### Your first contribution
|
||||
|
||||
Unsure where to begin contributing to KubeVela? Start by browsing issues labeled `good first issue` or `help wanted`.
|
||||
|
||||
- [Good first issue](https://github.com/oam-dev/kubevela/labels/good%20first%20issue) issues are generally straightforward to complete.
|
||||
- [Help wanted](https://github.com/oam-dev/kubevela/labels/help%20wanted) issues are problems we would like the community to help us with regardless of complexity.
|
||||
|
||||
If you're looking to make a code change, see how to set up your environment for [local development](contribute/developer-guide.md).
|
||||
|
||||
When you're ready to contribute, it's time to [Create a pull request](/contribute/create-pull-request.md).
|
||||
|
||||
26
Dockerfile
26
Dockerfile
@@ -1,6 +1,5 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the manager binary
|
||||
FROM golang:1.23.8-alpine@sha256:b7486658b87d34ecf95125e5b97e8dfe86c21f712aa36fc0c702e5dc41dc63e1 AS builder
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16-alpine as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
@@ -8,19 +7,18 @@ 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://proxy.golang.org}
|
||||
# RUN go env -w GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
# 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 for building core
|
||||
COPY cmd/core/ cmd/core/
|
||||
# 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
|
||||
@@ -28,20 +26,26 @@ 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 manager-${TARGETARCH} cmd/core/main.go
|
||||
-o manager-${TARGETARCH} main.go
|
||||
|
||||
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.18}
|
||||
# This is required by daemon connecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash expat
|
||||
ARG BASE_IMAGE
|
||||
FROM ${BASE_IMAGE:-alpine:latest}
|
||||
# This is required by daemon connnecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash
|
||||
|
||||
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/
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the cli binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23.8-alpine@sha256:b7486658b87d34ecf95125e5b97e8dfe86c21f712aa36fc0c702e5dc41dc63e1 AS builder
|
||||
ARG GOPROXY
|
||||
ENV GOPROXY=${GOPROXY:-https://proxy.golang.org}
|
||||
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@sha256:cf34c62ee8eb3fe8aa24c1fab45d7e9d12768d945c3f5a6fd6a63d901e898479}
|
||||
# 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,6 +1,5 @@
|
||||
ARG BASE_IMAGE
|
||||
# Build the manager binary
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23.8-alpine@sha256:b7486658b87d34ecf95125e5b97e8dfe86c21f712aa36fc0c702e5dc41dc63e1 AS builder
|
||||
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.16-alpine as builder
|
||||
|
||||
WORKDIR /workspace
|
||||
# Copy the Go Modules manifests
|
||||
@@ -13,11 +12,11 @@ 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
|
||||
@@ -25,22 +24,27 @@ 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 ./... .
|
||||
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@sha256:cf34c62ee8eb3fe8aa24c1fab45d7e9d12768d945c3f5a6fd6a63d901e898479}
|
||||
# This is required by daemon connecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash expat
|
||||
ARG BASE_IMAGE
|
||||
FROM ${BASE_IMAGE:-alpine:latest}
|
||||
# This is required by daemon connnecting with cri
|
||||
RUN apk add --no-cache ca-certificates bash
|
||||
|
||||
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/
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Refer to https://github.com/kubevela/community/blob/main/GOVERNANCE.md
|
||||
@@ -71,7 +71,7 @@ To get started with issue triage and finding issues that haven't been triaged yo
|
||||
### 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
|
||||
[unlabeled issues](https://github.com/oam-dev/kubevela/issues?q=is%3Aopen+is%3Aissue+no%3Alabel) and starting from
|
||||
the bottom and working yourself to the top.
|
||||
|
||||
### Subscribe to all notifications
|
||||
@@ -95,7 +95,7 @@ to guide contributors to provide standard information that must be included for
|
||||
|
||||
### Standard issue information that must be included
|
||||
|
||||
Given a certain [issue template]([template](https://github.com/kubevela/kubevela/issues/new/choose)) have been used
|
||||
Given a certain [issue template]([template](https://github.com/oam-dev/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.
|
||||
|
||||
@@ -219,7 +219,7 @@ There's a minor typo/error/lack of information that adds a lot of confusion for
|
||||
|
||||
### Support requests and questions
|
||||
|
||||
1. Kindly and politely direct the issue author to the [github discussion](https://github.com/kubevela/kubevela/discussions)
|
||||
1. Kindly and politely direct the issue author to the [github discussion](https://github.com/oam-dev/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`.
|
||||
|
||||
382
Makefile
382
Makefile
@@ -1,144 +1,356 @@
|
||||
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_KEY := github.com/oam-dev/kubevela/version.VelaVersion
|
||||
VELA_GITVERSION_KEY := github.com/oam-dev/kubevela/version.GitRevision
|
||||
LDFLAGS ?= "-s -w -X $(VELA_VERSION_KEY)=$(VELA_VERSION) -X $(VELA_GITVERSION_KEY)=$(GIT_COMMIT)"
|
||||
|
||||
GOBUILD_ENV = GO111MODULE=on CGO_ENABLED=0
|
||||
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
|
||||
|
||||
# Image URL to use all building/pushing image targets
|
||||
VELA_CORE_IMAGE ?= vela-core:latest
|
||||
VELA_CORE_TEST_IMAGE ?= vela-core-test:$(GIT_COMMIT)
|
||||
VELA_RUNTIME_ROLLOUT_IMAGE ?= vela-runtime-rollout:latest
|
||||
VELA_RUNTIME_ROLLOUT_TEST_IMAGE ?= vela-runtime-rollout-test:$(GIT_COMMIT)
|
||||
RUNTIME_CLUSTER_CONFIG ?= /tmp/worker.kubeconfig
|
||||
RUNTIME_CLUSTER_NAME ?= worker
|
||||
|
||||
.DEFAULT_GOAL := all
|
||||
all: build
|
||||
|
||||
# ==============================================================================
|
||||
# Targets
|
||||
|
||||
## test: Run tests
|
||||
test: envtest unit-test-core test-cli-gen
|
||||
# Run tests
|
||||
test: vet lint staticcheck
|
||||
go test -coverprofile=coverage.txt ./pkg/... ./cmd/...
|
||||
go test ./references/appfile/... ./references/cli/... ./references/common/... ./references/plugins/...
|
||||
@$(OK) unit-tests pass
|
||||
|
||||
## test-cli-gen: Run the unit tests for cli gen
|
||||
test-cli-gen:
|
||||
@mkdir -p ./bin/doc
|
||||
@go run ./hack/docgen/cli/gen.go ./bin/doc
|
||||
|
||||
## unit-test-core: Run the unit tests for core
|
||||
unit-test-core:
|
||||
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/... ./apis/... | grep -v apiserver | grep -v applicationconfiguration)
|
||||
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test $(shell go list ./references/... | grep -v apiserver)
|
||||
|
||||
## build: Build vela cli binary
|
||||
build: vela-cli kubectl-vela
|
||||
# Build vela cli binary
|
||||
build: fmt vet lint staticcheck vela-cli kubectl-vela
|
||||
@$(OK) build succeed
|
||||
|
||||
## build-cli: Clean build
|
||||
build-cleanup:
|
||||
@echo "===========> Cleaning all build output"
|
||||
@rm -rf _bin
|
||||
vela-cli:
|
||||
$(GOBUILD_ENV) go build -o bin/vela -a -ldflags $(LDFLAGS) ./references/cmd/cli/main.go
|
||||
|
||||
## fmt: Run go fmt against code
|
||||
kubectl-vela:
|
||||
$(GOBUILD_ENV) go build -o bin/kubectl-vela -a -ldflags $(LDFLAGS) ./cmd/plugin/main.go
|
||||
|
||||
doc-gen:
|
||||
rm -r docs/en/cli/*
|
||||
go run hack/docgen/gen.go
|
||||
|
||||
PWD := $(shell pwd)
|
||||
cross-build:
|
||||
rm -rf _bin
|
||||
go get github.com/mitchellh/gox@v0.4.0
|
||||
$(GOBUILD_ENV) $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/vela/{{.OS}}-{{.Arch}}/vela" -osarch='$(TARGETS)' ./references/cmd/cli
|
||||
$(GOBUILD_ENV) $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/kubectl-vela/{{.OS}}-{{.Arch}}/kubectl-vela" -osarch='$(TARGETS)' ./cmd/plugin
|
||||
$(GOBUILD_ENV) $(GOX) -ldflags $(LDFLAGS) -parallel=2 -output="_bin/apiserver/{{.OS}}-{{.Arch}}/apiserver" -osarch="$(TARGETS)" ./cmd/apiserver
|
||||
|
||||
build-cleanup:
|
||||
rm -rf _bin
|
||||
|
||||
compress:
|
||||
( \
|
||||
echo "\n## Release Info\nVERSION: $(VELA_VERSION)" >> README.md && \
|
||||
echo "GIT_COMMIT: $(GIT_COMMIT_LONG)\n" >> README.md && \
|
||||
cd _bin/vela && \
|
||||
$(DIST_DIRS) cp ../../LICENSE {} \; && \
|
||||
$(DIST_DIRS) cp ../../README.md {} \; && \
|
||||
$(DIST_DIRS) tar -zcf vela-{}.tar.gz {} \; && \
|
||||
$(DIST_DIRS) zip -r vela-{}.zip {} \; && \
|
||||
cd ../kubectl-vela && \
|
||||
$(DIST_DIRS) cp ../../LICENSE {} \; && \
|
||||
$(DIST_DIRS) cp ../../README.md {} \; && \
|
||||
$(DIST_DIRS) tar -zcf kubectl-vela-{}.tar.gz {} \; && \
|
||||
$(DIST_DIRS) zip -r kubectl-vela-{}.zip {} \; && \
|
||||
cd .. && \
|
||||
sha256sum vela/vela-* kubectl-vela/kubectl-vela-* > sha256sums.txt \
|
||||
)
|
||||
|
||||
# Run against the configured Kubernetes cluster in ~/.kube/config
|
||||
run:
|
||||
go run ./cmd/core/main.go --application-revision-limit 5
|
||||
|
||||
run-apiserver:
|
||||
go run ./cmd/apiserver/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/workflow/template/static/*
|
||||
$(CUE) fmt ./pkg/workflow/providers/...
|
||||
|
||||
## sdk_fmt: Run go fmt against code
|
||||
sdk_fmt:
|
||||
./hack/sdk/reviewable.sh
|
||||
|
||||
## vet: Run go vet against code
|
||||
$(CUE) fmt ./pkg/stdlib/pkgs/*
|
||||
$(CUE) fmt ./pkg/stdlib/op.cue
|
||||
$(CUE) fmt ./pkg/workflow/tasks/template/static/*
|
||||
# Run go vet against code
|
||||
vet:
|
||||
@$(INFO) go vet
|
||||
@go vet $(shell go list ./...|grep -v scaffold)
|
||||
go vet ./...
|
||||
|
||||
## staticcheck: Run the staticcheck
|
||||
staticcheck: staticchecktool
|
||||
@$(INFO) staticcheck
|
||||
@$(STATICCHECK) $(shell go list ./...|grep -v scaffold)
|
||||
$(STATICCHECK) ./...
|
||||
|
||||
## lint: Run the golangci-lint
|
||||
lint: golangci
|
||||
@$(INFO) lint
|
||||
@GOLANGCILINT=$(GOLANGCILINT) ./hack/utils/golangci-lint-wrapper.sh
|
||||
$(GOLANGCILINT) run ./...
|
||||
|
||||
## reviewable: Run the reviewable
|
||||
## Run make build to compile vela binary before running this target to ensure all generated definitions are up to date.
|
||||
reviewable: build manifests fmt vet lint staticcheck helm-doc-gen sdk_fmt
|
||||
reviewable: manifests fmt vet lint staticcheck
|
||||
go mod tidy
|
||||
|
||||
# check-diff: Execute auto-gen code commands and ensure branch is clean.
|
||||
# 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
|
||||
|
||||
## docker-push: Push the docker image
|
||||
docker-push:
|
||||
@echo "===========> Pushing docker image"
|
||||
@docker push $(VELA_CORE_IMAGE)
|
||||
# Build the docker image
|
||||
docker-build:
|
||||
docker build --build-arg=VERSION=$(VELA_VERSION) --build-arg=GITVERSION=$(GIT_COMMIT) -t $(VELA_CORE_IMAGE) .
|
||||
|
||||
# Build the runtime docker image
|
||||
docker-build-runtime-rollout:
|
||||
docker build --build-arg=VERSION=$(VELA_VERSION) --build-arg=GITVERSION=$(GIT_COMMIT) -t $(VELA_RUNTIME_ROLLOUT_IMAGE) -f runtime/rollout/Dockerfile .
|
||||
|
||||
# Push the docker image
|
||||
docker-push:
|
||||
docker push $(VELA_CORE_IMAGE)
|
||||
|
||||
e2e-setup-core:
|
||||
sh ./hack/e2e/modify_charts.sh
|
||||
helm upgrade --install --create-namespace --namespace vela-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set applicationRevisionLimit=5 --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --set multicluster.enabled=true --wait kubevela ./charts/vela-core
|
||||
kubectl wait --for=condition=Available deployment/kubevela-vela-core -n vela-system --timeout=180s
|
||||
|
||||
setup-runtime-e2e-cluster:
|
||||
helm upgrade --install --create-namespace --namespace vela-system --kubeconfig=$(RUNTIME_CLUSTER_CONFIG) --set image.pullPolicy=IfNotPresent --set image.repository=vela-runtime-rollout-test --set image.tag=$(GIT_COMMIT) --wait vela-rollout ./runtime/rollout/charts
|
||||
|
||||
e2e-setup:
|
||||
helm install kruise https://github.com/openkruise/kruise/releases/download/v0.9.0/kruise-chart.tgz --set featureGates="PreDownloadImageForInPlaceUpdate=true"
|
||||
sh ./hack/e2e/modify_charts.sh
|
||||
helm upgrade --install --create-namespace --namespace vela-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set applicationRevisionLimit=5 --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --wait kubevela ./charts/vela-core
|
||||
helm upgrade --install --create-namespace --namespace oam-runtime-system --set image.pullPolicy=IfNotPresent --set image.repository=vela-core-test --set dependCheckWait=10s --set image.tag=$(GIT_COMMIT) --wait oam-runtime ./charts/oam-runtime
|
||||
bin/vela addon enable fluxcd
|
||||
bin/vela addon enable terraform-alibaba ALICLOUD_ACCESS_KEY=xxx ALICLOUD_SECRET_KEY=yyy ALICLOUD_REGION=cn-beijing
|
||||
ginkgo version
|
||||
ginkgo -v -r e2e/setup
|
||||
|
||||
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
|
||||
|
||||
e2e-api-test:
|
||||
# Run e2e test
|
||||
ginkgo -v -skipPackage capability,setup,application -r e2e
|
||||
ginkgo -v -r e2e/application
|
||||
|
||||
e2e-test:
|
||||
# Run e2e test
|
||||
ginkgo -v --skip="rollout related e2e-test." ./test/e2e-test
|
||||
@$(OK) tests pass
|
||||
|
||||
e2e-addon-test:
|
||||
cp bin/vela /tmp/
|
||||
ginkgo -v ./test/e2e-addon-test
|
||||
@$(OK) tests pass
|
||||
|
||||
e2e-rollout-test:
|
||||
ginkgo -v --focus="rollout related e2e-test." ./test/e2e-test
|
||||
@$(OK) tests pass
|
||||
|
||||
e2e-multicluster-test:
|
||||
go test -v -coverpkg=./... -coverprofile=/tmp/e2e_multicluster_test.out ./test/e2e-multicluster-test
|
||||
@$(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: Delete Docker images
|
||||
image-cleanup:
|
||||
ifneq (, $(shell which docker))
|
||||
# Delete Docker images
|
||||
|
||||
# Delete Docker image
|
||||
ifneq ($(shell docker images -q $(VELA_CORE_TEST_IMAGE)),)
|
||||
docker rmi -f $(VELA_CORE_TEST_IMAGE)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
## image-load: load docker image to the kind cluster
|
||||
image-load:
|
||||
end-e2e-core:
|
||||
sh ./hack/e2e/end_e2e_core.sh
|
||||
|
||||
end-e2e:
|
||||
sh ./hack/e2e/end_e2e.sh
|
||||
|
||||
# load docker image to the kind cluster
|
||||
kind-load:
|
||||
docker build -t $(VELA_CORE_TEST_IMAGE) -f Dockerfile.e2e .
|
||||
kind load docker-image $(VELA_CORE_TEST_IMAGE) || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; }
|
||||
|
||||
## core-test: Run tests
|
||||
core-test:
|
||||
kind-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
|
||||
kind load docker-image $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE) --name=$(RUNTIME_CLUSTER_NAME) || { echo >&2 "kind not installed or error loading image: $(VELA_RUNTIME_ROLLOUT_TEST_IMAGE)"; exit 1; }
|
||||
|
||||
# Run tests
|
||||
core-test: fmt vet manifests
|
||||
go test ./pkg/... -coverprofile cover.out
|
||||
|
||||
## manager: Build vela core manager binary
|
||||
manager:
|
||||
# Build vela core manager and apiserver 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
|
||||
|
||||
## manifests: Generate manifests e.g. CRD, RBAC etc.
|
||||
manifests: tidy installcue kustomize sync-crds
|
||||
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
|
||||
|
||||
# Run against the configured Kubernetes cluster in ~/.kube/config with debug logs
|
||||
core-debug-run: fmt vet manifests
|
||||
go run ./cmd/core/main.go --log-debug=true
|
||||
|
||||
# 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/
|
||||
@$(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/crds/
|
||||
|
||||
# Generate manifests e.g. CRD, RBAC etc.
|
||||
manifests: installcue kustomize addon
|
||||
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
|
||||
go run ./hack/crd/dispatch/dispatch.go config/crd/base charts/vela-core/crds
|
||||
./hack/crd/cleanup.sh
|
||||
go run ./hack/crd/dispatch/dispatch.go config/crd/base charts/vela-core/crds charts/oam-runtime/crds runtime/ charts/vela-minimal/crds
|
||||
rm -f config/crd/base/*
|
||||
./vela-templates/gen_definitions.sh
|
||||
|
||||
|
||||
GOLANGCILINT_VERSION ?= v1.38.0
|
||||
HOSTOS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
HOSTARCH := $(shell uname -m)
|
||||
ifeq ($(HOSTARCH),x86_64)
|
||||
HOSTARCH := amd64
|
||||
endif
|
||||
|
||||
golangci:
|
||||
ifneq ($(shell which golangci-lint),)
|
||||
@$(OK) golangci-lint is already installed
|
||||
GOLANGCILINT=$(shell which golangci-lint)
|
||||
else ifeq (, $(shell which $(GOBIN)/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 'Successfully installed' ;\
|
||||
}
|
||||
GOLANGCILINT=$(GOBIN)/golangci-lint
|
||||
else
|
||||
@$(OK) golangci-lint is already installed
|
||||
GOLANGCILINT=$(GOBIN)/golangci-lint
|
||||
endif
|
||||
|
||||
.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
|
||||
|
||||
.PHONY: goimports
|
||||
goimports:
|
||||
ifeq (, $(shell which goimports))
|
||||
@{ \
|
||||
set -e ;\
|
||||
GO111MODULE=off go get -u golang.org/x/tools/cmd/goimports ;\
|
||||
}
|
||||
GOIMPORTS=$(GOBIN)/goimports
|
||||
else
|
||||
GOIMPORTS=$(shell which goimports)
|
||||
endif
|
||||
|
||||
.PHONY: installcue
|
||||
installcue:
|
||||
ifeq (, $(shell which cue))
|
||||
@{ \
|
||||
set -e ;\
|
||||
GO111MODULE=off go get -u cuelang.org/go/cmd/cue ;\
|
||||
}
|
||||
CUE=$(GOBIN)/cue
|
||||
else
|
||||
CUE=$(shell which cue)
|
||||
endif
|
||||
|
||||
KUSTOMIZE_VERSION ?= 3.8.2
|
||||
|
||||
.PHONY: kustomize
|
||||
kustomize:
|
||||
ifeq (, $(shell kustomize version | grep $(KUSTOMIZE_VERSION)))
|
||||
@{ \
|
||||
set -e ;\
|
||||
echo 'installing kustomize-v$(KUSTOMIZE_VERSION) into $(GOBIN)' ;\
|
||||
curl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash -s $(KUSTOMIZE_VERSION) $(GOBIN);\
|
||||
echo 'Install succeed' ;\
|
||||
}
|
||||
KUSTOMIZE=$(GOBIN)/kustomize
|
||||
else
|
||||
KUSTOMIZE=$(shell which kustomize)
|
||||
endif
|
||||
|
||||
## check-license-header: Check license header
|
||||
check-license-header:
|
||||
./hack/licence/header-check.sh
|
||||
|
||||
## def-gen: Install definitions
|
||||
def-install:
|
||||
./hack/utils/installdefinition.sh
|
||||
|
||||
## helm-doc-gen: Generate helm chart README.md
|
||||
helm-doc-gen: helmdoc
|
||||
readme-generator -v charts/vela-core/values.yaml -r charts/vela-core/README.md
|
||||
|
||||
## help: Display help information
|
||||
help: Makefile
|
||||
@echo ""
|
||||
@echo "Usage:"
|
||||
@echo ""
|
||||
@echo " make [target]"
|
||||
@echo ""
|
||||
@echo "Targets:"
|
||||
@echo ""
|
||||
@awk -F ':|##' '/^[^\.%\t][^\t]*:.*##/{printf " \033[36m%-20s\033[0m %s\n", $$1, $$NF}' $(MAKEFILE_LIST) | sort
|
||||
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
|
||||
# generate addons to auto-gen and charts
|
||||
addon:
|
||||
go run ./vela-templates/gen_addons.go
|
||||
|
||||
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
|
||||
109
README.md
109
README.md
@@ -1,118 +1,63 @@
|
||||
<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)
|
||||

|
||||
[](https://scorecard.dev/viewer/?uri=github.com/kubevela/kubevela)
|
||||
[](https://opensource.alibaba.com/contribution_leaderboard/details?projectValue=kubevela)
|
||||
|
||||
## 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
|
||||
KubeVela is a modern application platform that makes deploying and managing applications across today's hybrid, multi-cloud environments easier and faster.
|
||||
|
||||
KubeVela practices the "render, orchestrate, deploy" workflow with below highlighted values added to existing ecosystem:
|
||||
## Features
|
||||
|
||||
#### **Deployment as Code**
|
||||
**Application Centric** - KubeVela introduces [Open Application Model (OAM)](https://oam.dev/) as the consistent yet higher level API to capture a full deployment of microservices on top of hybrid environments. Placement strategy, traffic shifting and rolling update are declared at application level. No infrastructure level concern, simply deploy.
|
||||
|
||||
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](https://cuelang.org/).
|
||||
No ad-hoc scripts, no dirty glue code, just deploy. The deployment workflow in KubeVela is powered by [Open Application Model](https://oam.dev/).
|
||||
**Programmable Workflow** - KubeVela leverages [CUE](https://cuelang.org/) to implement its model layer. This allows you to declare application deployment workflow as a DAG, with all steps and application's needs glued together in programmable approach. No restrictions, natively extensible.
|
||||
|
||||
#### **Built-in observability, multi-tenancy and security support**
|
||||
|
||||
Choose from the wide range of LDAP integrations we provided out-of-box, enjoy enhanced [multi-tenancy and multi-cluster authorization and authentication](https://kubevela.net/docs/platform-engineers/auth/advance),
|
||||
pick and apply fine-grained RBAC modules and customize them as per your own supply chain requirements.
|
||||
All delivery process has fully [automated observability dashboards](https://kubevela.net/docs/platform-engineers/operations/observability).
|
||||
|
||||
#### **Multi-cloud/hybrid-environments app delivery as first-class citizen**
|
||||
|
||||
Natively supports multi-cluster/hybrid-cloud scenarios such as progressive rollout across test/staging/production environments,
|
||||
automatic canary, blue-green and continuous verification, rich placement strategy across clusters and clouds,
|
||||
along with automated cloud environments provision.
|
||||
|
||||
#### **Lightweight but highly extensible architecture**
|
||||
|
||||
Minimize your control plane deployment with only one pod and 0.5c1g resources to handle thousands of application delivery.
|
||||
Glue and orchestrate all your infrastructure capabilities as reusable modules with a highly extensible architecture
|
||||
and share the large growing community [addons](https://kubevela.net/docs/reference/addons/overview).
|
||||
**Runtime Agnostic** - KubeVela works as an application delivery control plane that is fully runtime agnostic. It can deploy and manage any application components including containers, cloud functions, databases, or even EC2 instances across hybrid environments, following the workflow you defined.
|
||||
|
||||
## Getting Started
|
||||
|
||||
* [Introduction](https://kubevela.io/docs)
|
||||
* [Installation](https://kubevela.io/docs/install)
|
||||
* [Deploy Your Application](https://kubevela.io/docs/quick-start)
|
||||
|
||||
### Get Your Own Demo with Alibaba Cloud
|
||||
|
||||
- install KubeVela on a Serverless K8S cluster in 3 minutes, try:
|
||||
|
||||
<a href="https://acs.console.aliyun.com/quick-deploy?repo=kubevela/kubevela&branch=master" target="_blank">
|
||||
<img src="https://img.alicdn.com/imgextra/i1/O1CN01aiPSuA1Wiz7wkgF5u_!!6000000002823-55-tps-399-70.svg" width="200" alt="Deploy on Alibaba Cloud">
|
||||
</a>
|
||||
- [Introduction](https://kubevela.io/docs)
|
||||
- [Installation](https://kubevela.io/docs/install)
|
||||
- [Design Your First Deployment Plan](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).
|
||||
|
||||
## 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).
|
||||
|
||||
### Contact Us
|
||||
|
||||
Reach out with any questions you may have and we'll make sure to answer them as soon as possible!
|
||||
|
||||
- Slack: [CNCF Slack kubevela channel](https://cloud-native.slack.com/archives/C01BLQ3HTJA) (*English*)
|
||||
- Slack: [CNCF Slack](https://slack.cncf.io/) #kubevela channel (*English*)
|
||||
- Gitter: [oam-dev](https://gitter.im/oam-dev/community) (*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
|
||||
|
||||
Every two weeks we host a community call to showcase new features, review upcoming milestones, and engage in a Q&A. All are welcome!
|
||||
|
||||
- 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).
|
||||
- Bi-weekly Community Call: [Meeting Notes](https://docs.google.com/document/d/1nqdFEyULekyksFHtFvgvFAYE-0AMHKoS3RMnaKsarjs)
|
||||
|
||||
## Talks and Conferences
|
||||
|
||||
Check out [KubeVela videos](https://kubevela.io/videos/talks/en/oam-dapr) for these talks and conferences.
|
||||
| Engagement | Link |
|
||||
|:-----------|:------------|
|
||||
| 🎤 Talks | - [KubeVela - The Modern App Delivery System in Alibaba](https://docs.google.com/presentation/d/1CWCLcsKpDQB3bBDTfdv2BZ8ilGGJv2E8L-iOA5HMrV0/edit?usp=sharing) |
|
||||
| 🌎 KubeCon | - [ [NA 2020] Standardizing Cloud Native Application Delivery Across Different Clouds](https://www.youtube.com/watch?v=0yhVuBIbHcI) <br> - [ [EU 2021] Zero Pain Microservice Development and Deployment with Dapr and KubeVela](https://sched.co/iE4S) |
|
||||
| 📺 Conferences | - [Dapr, Rudr, OAM: Mark Russinovich presents next gen app development & deployment](https://www.youtube.com/watch?v=eJCu6a-x9uo) <br> - [Mark Russinovich presents "The Future of Cloud Native Applications with OAM and Dapr"](https://myignite.techcommunity.microsoft.com/sessions/82059)|
|
||||
|
||||
## Contributing
|
||||
|
||||
Check out [CONTRIBUTING](https://kubevela.io/docs/contributor/overview) to see how to develop with KubeVela
|
||||
Check out [CONTRIBUTING](./CONTRIBUTING.md) 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 .
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
KubeVela adopts [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
|
||||
KubeVela adopts [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md).
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
@@ -18,21 +18,25 @@ package common
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
types "github.com/oam-dev/terraform-controller/api/types/crossplane-runtime"
|
||||
"github.com/oam-dev/terraform-controller/api/v1beta1"
|
||||
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"
|
||||
|
||||
wfTypesv1alpha1 "github.com/kubevela/pkg/apis/oam/v1alpha1"
|
||||
workflowv1alpha1 "github.com/kubevela/workflow/api/v1alpha1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
)
|
||||
|
||||
// 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
|
||||
|
||||
@@ -43,6 +47,31 @@ const (
|
||||
BooleanType ParameterValueType = "boolean"
|
||||
)
|
||||
|
||||
// A KubeParameter defines a configurable parameter of a component.
|
||||
type KubeParameter struct {
|
||||
// Name of this parameter
|
||||
Name string `json:"name"`
|
||||
|
||||
// +kubebuilder:validation:Enum:=string;number;boolean
|
||||
// ValueType indicates the type of the parameter value, and
|
||||
// only supports basic data types: string, number, boolean.
|
||||
ValueType ParameterValueType `json:"type"`
|
||||
|
||||
// FieldPaths specifies an array of fields within this workload that will be
|
||||
// overwritten by the value of this parameter. All fields must be of the
|
||||
// same type. Fields are specified as JSON field paths without a leading
|
||||
// dot, for example 'spec.replicas'.
|
||||
FieldPaths []string `json:"fieldPaths"`
|
||||
|
||||
// +kubebuilder:default:=false
|
||||
// Required specifies whether or not a value for this parameter must be
|
||||
// supplied when authoring an Application.
|
||||
Required *bool `json:"required,omitempty"`
|
||||
|
||||
// Description of this parameter.
|
||||
Description *string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// CUE defines the encapsulation in CUE format
|
||||
type CUE struct {
|
||||
// Template defines the abstraction template data of the capability, it will replace the old CUE template in extension field.
|
||||
@@ -53,11 +82,26 @@ type CUE struct {
|
||||
// Schematic defines the encapsulation of this capability(workload/trait/scope),
|
||||
// the encapsulation can be defined in different ways, e.g. CUE/HCL(terraform)/KUBE(K8s Object)/HELM, etc...
|
||||
type Schematic struct {
|
||||
KUBE *Kube `json:"kube,omitempty"`
|
||||
|
||||
CUE *CUE `json:"cue,omitempty"`
|
||||
|
||||
HELM *Helm `json:"helm,omitempty"`
|
||||
|
||||
Terraform *Terraform `json:"terraform,omitempty"`
|
||||
}
|
||||
|
||||
// A Helm represents resources used by a Helm module
|
||||
type Helm struct {
|
||||
// Release records a Helm release used by a Helm module workload.
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Release runtime.RawExtension `json:"release"`
|
||||
|
||||
// HelmRelease records a Helm repository used by a Helm module workload.
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Repository runtime.RawExtension `json:"repository"`
|
||||
}
|
||||
|
||||
// Terraform is the struct to describe cloud resources managed by Hashicorp Terraform
|
||||
type Terraform struct {
|
||||
// Configuration is Terraform Configuration
|
||||
@@ -68,28 +112,7 @@ type Terraform struct {
|
||||
// +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"`
|
||||
|
||||
// GitCredentialsSecretReference specifies the reference to the secret containing the git credentials
|
||||
GitCredentialsSecretReference *corev1.SecretReference `json:"gitCredentialsSecretReference,omitempty"`
|
||||
v1beta1.BaseConfigurationSpec `json:",inline"`
|
||||
}
|
||||
|
||||
// A WorkloadTypeDescriptor refer to a Workload Type
|
||||
@@ -136,15 +159,14 @@ type Status struct {
|
||||
// HealthPolicy defines the health check policy for the abstraction
|
||||
// +optional
|
||||
HealthPolicy string `json:"healthPolicy,omitempty"`
|
||||
// Details stores a string representation of a CUE status map to be evaluated at runtime for display
|
||||
// +optional
|
||||
Details string `json:"details,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationPhase is a label for the condition of an application at the current time
|
||||
// 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"
|
||||
// ApplicationStarting means the app is preparing for reconcile
|
||||
ApplicationStarting ApplicationPhase = "starting"
|
||||
// ApplicationRendering means the app is rendering
|
||||
@@ -157,47 +179,45 @@ const (
|
||||
ApplicationWorkflowSuspending ApplicationPhase = "workflowSuspending"
|
||||
// ApplicationWorkflowTerminated means the app's workflow is terminated
|
||||
ApplicationWorkflowTerminated ApplicationPhase = "workflowTerminated"
|
||||
// ApplicationWorkflowFailed means the app's workflow is failed
|
||||
ApplicationWorkflowFailed ApplicationPhase = "workflowFailed"
|
||||
// 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 (
|
||||
// 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"
|
||||
// WorkflowStateFinished means workflow is running successfully, all steps finished.
|
||||
WorkflowStateFinished WorkflowState = "finished"
|
||||
// WorkflowStateExecuting means workflow is still running or waiting some steps.
|
||||
WorkflowStateExecuting WorkflowState = "executing"
|
||||
)
|
||||
|
||||
// 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"`
|
||||
Name string `json:"name"`
|
||||
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"`
|
||||
// WorkloadHealthy indicates the workload health without considering trait health.
|
||||
// +optional
|
||||
WorkloadHealthy bool `json:"workloadHealthy,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Traits []ApplicationTraitStatus `json:"traits,omitempty"`
|
||||
Scopes []corev1.ObjectReference `json:"scopes,omitempty"`
|
||||
}
|
||||
|
||||
// Equal check if two ApplicationComponentStatus are equal
|
||||
func (in ApplicationComponentStatus) Equal(r ApplicationComponentStatus) bool {
|
||||
return in.Name == r.Name && in.Namespace == r.Namespace &&
|
||||
in.Cluster == r.Cluster && in.Env == r.Env
|
||||
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"`
|
||||
Pending bool `json:"pending,omitempty"`
|
||||
Details map[string]string `json:"details,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
Type string `json:"type"`
|
||||
Healthy bool `json:"healthy"`
|
||||
Message string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// Revision has name and revision number
|
||||
@@ -209,6 +229,38 @@ type Revision struct {
|
||||
RevisionHash string `json:"revisionHash,omitempty"`
|
||||
}
|
||||
|
||||
// RawComponent record raw component
|
||||
type RawComponent struct {
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Raw runtime.RawExtension `json:"raw"`
|
||||
}
|
||||
|
||||
// WorkflowStepStatus record the status of a workflow step
|
||||
type WorkflowStepStatus 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"`
|
||||
SubSteps *SubStepsStatus `json:"subSteps,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowSubStepStatus record the status of a workflow step
|
||||
type WorkflowSubStepStatus 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"`
|
||||
}
|
||||
|
||||
// AppStatus defines the observed state of Application
|
||||
type AppStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
@@ -219,6 +271,8 @@ type AppStatus struct {
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
|
||||
|
||||
Rollout AppRolloutStatus `json:"rollout,omitempty"`
|
||||
|
||||
Phase ApplicationPhase `json:"status,omitempty"`
|
||||
|
||||
// Components record the related Components created by Application Controller
|
||||
@@ -227,57 +281,53 @@ type AppStatus struct {
|
||||
// Services record the status of the application services
|
||||
Services []ApplicationComponentStatus `json:"services,omitempty"`
|
||||
|
||||
// ResourceTracker record the status of the ResourceTracker
|
||||
ResourceTracker *corev1.ObjectReference `json:"resourceTracker,omitempty"`
|
||||
|
||||
// Workflow record the status of workflow
|
||||
Workflow *WorkflowStatus `json:"workflow,omitempty"`
|
||||
|
||||
// WorkflowRestartScheduledAt schedules a workflow restart at the specified time.
|
||||
// This field is automatically set when the app.oam.dev/restart-workflow annotation is present,
|
||||
// and is cleared after the restart is triggered. Use RFC3339 format or set to current time for immediate restart.
|
||||
// +optional
|
||||
WorkflowRestartScheduledAt *metav1.Time `json:"workflowRestartScheduledAt,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
|
||||
// Deprecated This field is only used by EnvBinding Policy which is deprecated.
|
||||
PolicyStatus []PolicyStatus `json:"policy,omitempty"`
|
||||
}
|
||||
|
||||
// PolicyStatus records the status of policy
|
||||
// Deprecated
|
||||
type PolicyStatus struct {
|
||||
Name string `json:"name"`
|
||||
Type string `json:"type"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Status *runtime.RawExtension `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// WorkflowStatus record the status of workflow
|
||||
type WorkflowStatus struct {
|
||||
AppRevision string `json:"appRevision,omitempty"`
|
||||
Mode string `json:"mode"`
|
||||
Phase workflowv1alpha1.WorkflowRunPhase `json:"status,omitempty"`
|
||||
Message string `json:"message,omitempty"`
|
||||
|
||||
Suspend bool `json:"suspend"`
|
||||
SuspendState string `json:"suspendState,omitempty"`
|
||||
AppRevision string `json:"appRevision,omitempty"`
|
||||
Mode WorkflowMode `json:"mode"`
|
||||
|
||||
Suspend bool `json:"suspend"`
|
||||
Terminated bool `json:"terminated"`
|
||||
Finished bool `json:"finished"`
|
||||
|
||||
ContextBackend *corev1.ObjectReference `json:"contextBackend,omitempty"`
|
||||
Steps []workflowv1alpha1.WorkflowStepStatus `json:"steps,omitempty"`
|
||||
|
||||
StartTime metav1.Time `json:"startTime,omitempty"`
|
||||
// +nullable
|
||||
EndTime metav1.Time `json:"endTime,omitempty"`
|
||||
ContextBackend *corev1.ObjectReference `json:"contextBackend,omitempty"`
|
||||
Steps []WorkflowStepStatus `json:"steps,omitempty"`
|
||||
}
|
||||
|
||||
// SubStepsStatus record the status of workflow steps.
|
||||
type SubStepsStatus struct {
|
||||
StepIndex int `json:"stepIndex,omitempty"`
|
||||
Mode WorkflowMode `json:"mode,omitempty"`
|
||||
Steps []WorkflowSubStepStatus `json:"steps,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 make the controller stop the workflow and report error in `message`.
|
||||
WorkflowStepPhaseFailed WorkflowStepPhase = "failed"
|
||||
// WorkflowStepPhaseStopped will make the controller stop the workflow.
|
||||
WorkflowStepPhaseStopped WorkflowStepPhase = "stopped"
|
||||
// WorkflowStepPhaseRunning will make the controller continue the workflow.
|
||||
WorkflowStepPhaseRunning WorkflowStepPhase = "running"
|
||||
)
|
||||
|
||||
// DefinitionType describes the type of DefinitionRevision.
|
||||
// +kubebuilder:validation:Enum=Component;Trait;Policy;WorkflowStep
|
||||
type DefinitionType string
|
||||
@@ -296,6 +346,29 @@ const (
|
||||
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"`
|
||||
@@ -312,9 +385,9 @@ type ApplicationComponent struct {
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
|
||||
DependsOn []string `json:"dependsOn,omitempty"`
|
||||
Inputs wfTypesv1alpha1.StepInputs `json:"inputs,omitempty"`
|
||||
Outputs wfTypesv1alpha1.StepOutputs `json:"outputs,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"`
|
||||
@@ -323,10 +396,22 @@ type ApplicationComponent struct {
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// ReplicaKey is not empty means the component is replicated. This field is designed so that it can't be specified in application directly.
|
||||
// So we set the json tag as "-". Instead, this will be filled when using replication policy.
|
||||
ReplicaKey string `json:"-"`
|
||||
// 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.
|
||||
@@ -339,62 +424,39 @@ type ClusterSelector struct {
|
||||
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 string = "policy"
|
||||
PolicyResourceCreator ResourceCreatorRole = "policy"
|
||||
// WorkflowResourceCreator create the resource in workflow.
|
||||
WorkflowResourceCreator string = "workflow"
|
||||
WorkflowResourceCreator ResourceCreatorRole = "workflow"
|
||||
)
|
||||
|
||||
// OAMObjectReference defines the object reference for an oam resource
|
||||
type OAMObjectReference struct {
|
||||
Component string `json:"component,omitempty"`
|
||||
Trait string `json:"trait,omitempty"`
|
||||
}
|
||||
|
||||
// Equal check if two references are equal
|
||||
func (in OAMObjectReference) Equal(r OAMObjectReference) bool {
|
||||
return in.Component == r.Component && in.Trait == r.Trait
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
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],
|
||||
}
|
||||
}
|
||||
return OAMObjectReference{}
|
||||
}
|
||||
|
||||
// ClusterObjectReference defines the object reference with cluster.
|
||||
type ClusterObjectReference struct {
|
||||
Cluster string `json:"cluster,omitempty"`
|
||||
Creator string `json:"creator,omitempty"`
|
||||
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
|
||||
@@ -420,85 +482,3 @@ func (re RawExtensionPointer) MarshalJSON() ([]byte, error) {
|
||||
// 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
|
||||
// ReadyCondition indicates whether whole application processing is successful.
|
||||
ReadyCondition
|
||||
)
|
||||
|
||||
var conditions = map[ApplicationConditionType]string{
|
||||
ParsedCondition: "Parsed",
|
||||
RevisionCondition: "Revision",
|
||||
PolicyCondition: "Policy",
|
||||
RenderCondition: "Render",
|
||||
WorkflowCondition: "Workflow",
|
||||
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"`
|
||||
}
|
||||
|
||||
// ContainerState defines the state of a container
|
||||
type ContainerState string
|
||||
|
||||
const (
|
||||
// ContainerRunning indicates the container is running
|
||||
ContainerRunning ContainerState = "Running"
|
||||
// ContainerWaiting indicates the container is waiting
|
||||
ContainerWaiting ContainerState = "Waiting"
|
||||
// ContainerTerminated indicates the container is terminated
|
||||
ContainerTerminated ContainerState = "Terminated"
|
||||
)
|
||||
|
||||
// ContainerStateToString convert the container state to string
|
||||
func ContainerStateToString(state corev1.ContainerState) string {
|
||||
switch {
|
||||
case state.Running != nil:
|
||||
return "Running"
|
||||
case state.Waiting != nil:
|
||||
return "Waiting"
|
||||
case state.Terminated != nil:
|
||||
return "Terminated"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 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",
|
||||
}
|
||||
obj := &unstructured.Unstructured{}
|
||||
o2 := NewOAMObjectReferenceFromObject(obj)
|
||||
r.False(o2.Equal(o1))
|
||||
o1.AddLabelsToObject(obj)
|
||||
r.Equal(2, 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))
|
||||
}
|
||||
|
||||
func TestContainerStateToString(t *testing.T) {
|
||||
r := require.New(t)
|
||||
r.Equal("Waiting", ContainerStateToString(v1.ContainerState{
|
||||
Waiting: &v1.ContainerStateWaiting{},
|
||||
}))
|
||||
r.Equal("Running", ContainerStateToString(v1.ContainerState{
|
||||
Running: &v1.ContainerStateRunning{},
|
||||
}))
|
||||
r.Equal("Terminated", ContainerStateToString(v1.ContainerState{
|
||||
Terminated: &v1.ContainerStateTerminated{},
|
||||
}))
|
||||
r.Equal("Unknown", ContainerStateToString(v1.ContainerState{}))
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2023 The KubeVela Authors.
|
||||
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.
|
||||
@@ -21,17 +21,31 @@ limitations under the License.
|
||||
package common
|
||||
|
||||
import (
|
||||
oamv1alpha1 "github.com/kubevela/pkg/apis/oam/v1alpha1"
|
||||
"github.com/kubevela/workflow/api/v1alpha1"
|
||||
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)
|
||||
in.Rollout.DeepCopyInto(&out.Rollout)
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]v1.ObjectReference, len(*in))
|
||||
@@ -44,15 +58,16 @@ func (in *AppStatus) DeepCopyInto(out *AppStatus) {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.ResourceTracker != nil {
|
||||
in, out := &in.ResourceTracker, &out.ResourceTracker
|
||||
*out = new(v1.ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
if in.Workflow != nil {
|
||||
in, out := &in.Workflow, &out.Workflow
|
||||
*out = new(WorkflowStatus)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.WorkflowRestartScheduledAt != nil {
|
||||
in, out := &in.WorkflowRestartScheduledAt, &out.WorkflowRestartScheduledAt
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
if in.LatestRevision != nil {
|
||||
in, out := &in.LatestRevision, &out.LatestRevision
|
||||
*out = new(Revision)
|
||||
@@ -63,13 +78,6 @@ func (in *AppStatus) DeepCopyInto(out *AppStatus) {
|
||||
*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.
|
||||
@@ -97,12 +105,12 @@ func (in *ApplicationComponent) DeepCopyInto(out *ApplicationComponent) {
|
||||
}
|
||||
if in.Inputs != nil {
|
||||
in, out := &in.Inputs, &out.Inputs
|
||||
*out = make(oamv1alpha1.StepInputs, len(*in))
|
||||
*out = make(StepInputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Outputs != nil {
|
||||
in, out := &in.Outputs, &out.Outputs
|
||||
*out = make(oamv1alpha1.StepOutputs, len(*in))
|
||||
*out = make(StepOutputs, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Traits != nil {
|
||||
@@ -135,19 +143,10 @@ func (in *ApplicationComponent) DeepCopy() *ApplicationComponent {
|
||||
func (in *ApplicationComponentStatus) DeepCopyInto(out *ApplicationComponentStatus) {
|
||||
*out = *in
|
||||
out.WorkloadDefinition = in.WorkloadDefinition
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*out = make(map[string]string, len(*in))
|
||||
for key, val := range *in {
|
||||
(*out)[key] = val
|
||||
}
|
||||
}
|
||||
if in.Traits != nil {
|
||||
in, out := &in.Traits, &out.Traits
|
||||
*out = make([]ApplicationTraitStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.Scopes != nil {
|
||||
in, out := &in.Scopes, &out.Scopes
|
||||
@@ -189,13 +188,6 @@ func (in *ApplicationTrait) DeepCopy() *ApplicationTrait {
|
||||
// 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
|
||||
if in.Details != nil {
|
||||
in, out := &in.Details, &out.Details
|
||||
*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 ApplicationTraitStatus.
|
||||
@@ -261,6 +253,27 @@ func (in *ClusterObjectReference) DeepCopy() *ClusterObjectReference {
|
||||
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
|
||||
@@ -299,36 +312,102 @@ func (in *DefinitionReference) DeepCopy() *DefinitionReference {
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *OAMObjectReference) DeepCopyInto(out *OAMObjectReference) {
|
||||
func (in *Distribution) DeepCopyInto(out *Distribution) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OAMObjectReference.
|
||||
func (in *OAMObjectReference) DeepCopy() *OAMObjectReference {
|
||||
// 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(OAMObjectReference)
|
||||
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 *PolicyStatus) DeepCopyInto(out *PolicyStatus) {
|
||||
func (in *Helm) DeepCopyInto(out *Helm) {
|
||||
*out = *in
|
||||
if in.Status != nil {
|
||||
in, out := &in.Status, &out.Status
|
||||
*out = new(runtime.RawExtension)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.Release.DeepCopyInto(&out.Release)
|
||||
in.Repository.DeepCopyInto(&out.Repository)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyStatus.
|
||||
func (in *PolicyStatus) DeepCopy() *PolicyStatus {
|
||||
// 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(PolicyStatus)
|
||||
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 *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
|
||||
}
|
||||
@@ -353,44 +432,6 @@ func (in *RawExtensionPointer) DeepCopy() *RawExtensionPointer {
|
||||
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
|
||||
@@ -409,11 +450,21 @@ func (in *Revision) DeepCopy() *Revision {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Schematic) DeepCopyInto(out *Schematic) {
|
||||
*out = *in
|
||||
if in.KUBE != nil {
|
||||
in, out := &in.KUBE, &out.KUBE
|
||||
*out = new(Kube)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.CUE != nil {
|
||||
in, out := &in.CUE, &out.CUE
|
||||
*out = new(CUE)
|
||||
**out = **in
|
||||
}
|
||||
if in.HELM != nil {
|
||||
in, out := &in.HELM, &out.HELM
|
||||
*out = new(Helm)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
if in.Terraform != nil {
|
||||
in, out := &in.Terraform, &out.Terraform
|
||||
*out = new(Terraform)
|
||||
@@ -446,24 +497,68 @@ func (in *Status) DeepCopy() *Status {
|
||||
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 *SubStepsStatus) DeepCopyInto(out *SubStepsStatus) {
|
||||
*out = *in
|
||||
if in.Steps != nil {
|
||||
in, out := &in.Steps, &out.Steps
|
||||
*out = make([]WorkflowSubStepStatus, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubStepsStatus.
|
||||
func (in *SubStepsStatus) DeepCopy() *SubStepsStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(SubStepsStatus)
|
||||
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
|
||||
}
|
||||
if in.GitCredentialsSecretReference != nil {
|
||||
in, out := &in.GitCredentialsSecretReference, &out.GitCredentialsSecretReference
|
||||
*out = new(v1.SecretReference)
|
||||
**out = **in
|
||||
}
|
||||
in.BaseConfigurationSpec.DeepCopyInto(&out.BaseConfigurationSpec)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Terraform.
|
||||
@@ -486,13 +581,11 @@ func (in *WorkflowStatus) DeepCopyInto(out *WorkflowStatus) {
|
||||
}
|
||||
if in.Steps != nil {
|
||||
in, out := &in.Steps, &out.Steps
|
||||
*out = make([]v1alpha1.WorkflowStepStatus, len(*in))
|
||||
*out = make([]WorkflowStepStatus, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
in.StartTime.DeepCopyInto(&out.StartTime)
|
||||
in.EndTime.DeepCopyInto(&out.EndTime)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkflowStatus.
|
||||
@@ -505,6 +598,41 @@ func (in *WorkflowStatus) DeepCopy() *WorkflowStatus {
|
||||
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
|
||||
if in.SubSteps != nil {
|
||||
in, out := &in.SubSteps, &out.SubSteps
|
||||
*out = new(SubStepsStatus)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
}
|
||||
|
||||
// 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 *WorkflowSubStepStatus) DeepCopyInto(out *WorkflowSubStepStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
@@ -31,7 +31,7 @@ import (
|
||||
)
|
||||
|
||||
// A ConditionType represents a condition a resource could be in.
|
||||
// nolint
|
||||
// nolint:golint
|
||||
type ConditionType string
|
||||
|
||||
// Condition types.
|
||||
@@ -45,7 +45,7 @@ const (
|
||||
)
|
||||
|
||||
// A ConditionReason represents the reason a resource is in a condition.
|
||||
// nolint
|
||||
// nolint:golint
|
||||
type ConditionReason string
|
||||
|
||||
// Reasons a resource is or is not ready.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2023 The KubeVela Authors.
|
||||
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.
|
||||
|
||||
@@ -21,12 +21,13 @@ 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, v1beta1.SchemeBuilder.AddToScheme)
|
||||
AddToSchemes = append(AddToSchemes, v1alpha1.SchemeBuilder.AddToScheme, v1alpha2.SchemeBuilder.AddToScheme, v1beta1.SchemeBuilder.AddToScheme)
|
||||
}
|
||||
|
||||
// AddToSchemes may be used to add all resources defined in the project to a Scheme
|
||||
|
||||
@@ -1,78 +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"
|
||||
// ApplyOnceStrategyOnAppUpdate policy takes effect on application updating
|
||||
ApplyOnceStrategyOnAppUpdate ApplyOnceAffectStrategy = "onUpdate"
|
||||
// ApplyOnceStrategyOnAppStateKeep policy takes effect on application state keep
|
||||
ApplyOnceStrategyOnAppStateKeep ApplyOnceAffectStrategy = "onStateKeep"
|
||||
// ApplyOnceStrategyAlways policy takes effect always
|
||||
ApplyOnceStrategyAlways ApplyOnceAffectStrategy = "always"
|
||||
)
|
||||
|
||||
// ApplyOnceAffectStrategy is a string that mark the policy effective stage
|
||||
type ApplyOnceAffectStrategy string
|
||||
|
||||
// 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"`
|
||||
// ApplyOnceAffectStrategy Decide when the strategy will take effect
|
||||
// like affect:onUpdate/onStateKeep/always
|
||||
ApplyOnceAffectStrategy ApplyOnceAffectStrategy `json:"affect"`
|
||||
}
|
||||
|
||||
// Type the type name of the policy
|
||||
func (in *ApplyOncePolicySpec) Type() string {
|
||||
return ApplyOncePolicyType
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
@@ -17,63 +17,48 @@
|
||||
package v1alpha1
|
||||
|
||||
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/core.oam.dev/condition"
|
||||
)
|
||||
|
||||
// ClusterManagementEngine represents a multi-cluster management solution
|
||||
type ClusterManagementEngine string
|
||||
|
||||
const (
|
||||
// EnvBindingPolicyType refers to the type of EnvBinding
|
||||
EnvBindingPolicyType = "env-binding"
|
||||
// OCMEngine represents Open-Cluster-Management multi-cluster management solution
|
||||
OCMEngine ClusterManagementEngine = "ocm"
|
||||
|
||||
// SingleClusterEngine represents single cluster ClusterManagerEngine
|
||||
SingleClusterEngine ClusterManagementEngine = "single-cluster"
|
||||
|
||||
// ClusterGatewayEngine represents multi-cluster management solution with cluster-gateway
|
||||
ClusterGatewayEngine ClusterManagementEngine = "cluster-gateway"
|
||||
)
|
||||
|
||||
// EnvTraitPatch is the patch to trait
|
||||
type EnvTraitPatch struct {
|
||||
Type string `json:"type"`
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
Disable bool `json:"disable,omitempty"`
|
||||
}
|
||||
// EnvBindingPhase is a label for the condition of a EnvBinding at the current time
|
||||
type EnvBindingPhase string
|
||||
|
||||
// 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
|
||||
}
|
||||
const (
|
||||
// EnvBindingPrepare means EnvBinding is preparing the pre-work for cluster scheduling
|
||||
EnvBindingPrepare EnvBindingPhase = "preparing"
|
||||
|
||||
// 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"`
|
||||
}
|
||||
// EnvBindingRendering means EnvBinding is rendering the apps in different envs
|
||||
EnvBindingRendering EnvBindingPhase = "rendering"
|
||||
|
||||
// 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
|
||||
}
|
||||
// EnvBindingScheduling means EnvBinding is deciding which cluster the apps is scheduled to.
|
||||
EnvBindingScheduling EnvBindingPhase = "scheduling"
|
||||
|
||||
// EnvBindingFinished means EnvBinding finished env binding
|
||||
EnvBindingFinished EnvBindingPhase = "finished"
|
||||
)
|
||||
|
||||
// EnvPatch specify the parameter configuration for different environments
|
||||
type EnvPatch struct {
|
||||
Components []EnvComponentPatch `json:"components,omitempty"`
|
||||
Components []common.ApplicationComponent `json:"components"`
|
||||
}
|
||||
|
||||
// NamespaceSelector defines the rules to select a Namespace resource.
|
||||
@@ -97,51 +82,94 @@ type EnvSelector struct {
|
||||
}
|
||||
|
||||
// EnvConfig is the configuration for different environments.
|
||||
// Deprecated
|
||||
type EnvConfig struct {
|
||||
Name string `json:"name"`
|
||||
Placement EnvPlacement `json:"placement,omitempty"`
|
||||
Selector *EnvSelector `json:"selector,omitempty"`
|
||||
Patch EnvPatch `json:"patch,omitempty"`
|
||||
Patch EnvPatch `json:"patch"`
|
||||
}
|
||||
|
||||
// EnvBindingSpec defines a list of envs
|
||||
// Deprecated This spec is deprecated and replaced by Topology/Override Policy
|
||||
// AppTemplate represents a application to be configured.
|
||||
type AppTemplate struct {
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
runtime.RawExtension `json:",inline"`
|
||||
}
|
||||
|
||||
// ClusterDecision recorded the mapping of environment and cluster
|
||||
type ClusterDecision struct {
|
||||
Env string `json:"env"`
|
||||
Cluster string `json:"cluster,omitempty"`
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// A ConfigMapReference is a reference to a configMap in an arbitrary namespace.
|
||||
type ConfigMapReference struct {
|
||||
// Name of the secret.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Namespace of the secret.
|
||||
Namespace string `json:"namespace,omitempty"`
|
||||
}
|
||||
|
||||
// A EnvBindingSpec defines the desired state of a EnvBinding.
|
||||
type EnvBindingSpec struct {
|
||||
Engine ClusterManagementEngine `json:"engine,omitempty"`
|
||||
|
||||
// AppTemplate indicates the application template.
|
||||
AppTemplate AppTemplate `json:"appTemplate"`
|
||||
|
||||
Envs []EnvConfig `json:"envs"`
|
||||
|
||||
// OutputResourcesTo specifies the namespace and name of a ConfigMap
|
||||
// which store the resources rendered after differentiated configuration
|
||||
// +optional
|
||||
OutputResourcesTo *ConfigMapReference `json:"outputResourcesTo,omitempty"`
|
||||
}
|
||||
|
||||
// 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
|
||||
// Deprecated
|
||||
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)
|
||||
// Deprecated
|
||||
type ClusterConnection struct {
|
||||
ClusterName string `json:"clusterName"`
|
||||
LastActiveRevision string `json:"lastActiveRevision"`
|
||||
}
|
||||
|
||||
// EnvBindingStatus records the status of all env
|
||||
// Deprecated
|
||||
// A EnvBindingStatus is the status of EnvBinding
|
||||
type EnvBindingStatus struct {
|
||||
Envs []EnvStatus `json:"envs"`
|
||||
ClusterConnections []ClusterConnection `json:"clusterConnections"`
|
||||
// ConditionedStatus reflects the observed status of a resource
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
Phase EnvBindingPhase `json:"phase,omitempty"`
|
||||
|
||||
ClusterDecisions []ClusterDecision `json:"clusterDecisions,omitempty"`
|
||||
|
||||
// ResourceTracker record the status of the ResourceTracker
|
||||
ResourceTracker *corev1.ObjectReference `json:"resourceTracker,omitempty"`
|
||||
}
|
||||
|
||||
// EnvBinding is the Schema for the EnvBinding API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:resource:scope=Namespaced,categories={oam},shortName=envbind
|
||||
// +kubebuilder:printcolumn:name="ENGINE",type=string,JSONPath=`.spec.engine`
|
||||
// +kubebuilder:printcolumn:name="PHASE",type=string,JSONPath=`.status.phase`
|
||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
||||
type EnvBinding struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec EnvBindingSpec `json:"spec,omitempty"`
|
||||
Status EnvBindingStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// EnvBindingList contains a list of EnvBinding.
|
||||
type EnvBindingList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []EnvBinding `json:"items"`
|
||||
}
|
||||
|
||||
// SetConditions set condition for EnvBinding
|
||||
func (e *EnvBinding) SetConditions(c ...condition.Condition) {
|
||||
e.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition gets condition from EnvBinding
|
||||
func (e *EnvBinding) GetCondition(conditionType condition.ConditionType) condition.Condition {
|
||||
return e.Status.GetCondition(conditionType)
|
||||
}
|
||||
|
||||
@@ -1,49 +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"
|
||||
)
|
||||
|
||||
// +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"`
|
||||
}
|
||||
@@ -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 v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
const (
|
||||
// GarbageCollectPolicyType refers to the type of garbage-collect
|
||||
GarbageCollectPolicyType = "garbage-collect"
|
||||
)
|
||||
|
||||
// GarbageCollectPolicySpec defines the spec of configuration drift
|
||||
type GarbageCollectPolicySpec struct {
|
||||
// ApplicationRevisionLimit if set, this application will use this number for application revision instead of
|
||||
// the global configuration
|
||||
ApplicationRevisionLimit *int `json:"applicationRevisionLimit,omitempty"`
|
||||
|
||||
// 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"`
|
||||
|
||||
// ContinueOnFailure if is set, continue to execute gc when the workflow fails, by default gc will be executed only after the workflow succeeds
|
||||
ContinueOnFailure bool `json:"continueOnFailure,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"`
|
||||
Propagation *GarbageCollectPropagation `json:"propagation"`
|
||||
}
|
||||
|
||||
// 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"
|
||||
)
|
||||
|
||||
// GarbageCollectPropagation the deletion propagation setting similar to metav1.DeletionPropagation
|
||||
type GarbageCollectPropagation string
|
||||
|
||||
const (
|
||||
// GarbageCollectPropagationOrphan orphan child resources while deleting target resources
|
||||
GarbageCollectPropagationOrphan = "orphan"
|
||||
// GarbageCollectPropagationCascading delete child resources in background while deleting target resources
|
||||
GarbageCollectPropagationCascading = "cascading"
|
||||
)
|
||||
|
||||
// Type the type name of the policy
|
||||
func (in *GarbageCollectPolicySpec) Type() string {
|
||||
return GarbageCollectPolicyType
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
// FindDeleteOption find delete option for target resource
|
||||
func (in *GarbageCollectPolicySpec) FindDeleteOption(manifest *unstructured.Unstructured) (bool, []client.DeleteOption) {
|
||||
for _, rule := range in.Rules {
|
||||
if rule.Selector.Match(manifest) && rule.Propagation != nil {
|
||||
switch *rule.Propagation {
|
||||
case GarbageCollectPropagationOrphan:
|
||||
return true, []client.DeleteOption{client.PropagationPolicy(metav1.DeletePropagationOrphan)}
|
||||
case GarbageCollectPropagationCascading:
|
||||
return false, []client.DeleteOption{client.PropagationPolicy(metav1.DeletePropagationBackground)}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false, 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,69 +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 (
|
||||
// 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"
|
||||
// ReplicationPolicyType refers to the type of replication policy
|
||||
ReplicationPolicyType = "replication"
|
||||
)
|
||||
|
||||
// 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"`
|
||||
|
||||
// AllowEmpty ignore empty cluster error when no cluster returned for label
|
||||
// selector
|
||||
AllowEmpty bool `json:"allowEmpty,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"`
|
||||
}
|
||||
|
||||
// ReplicationPolicySpec defines the spec of replication policy
|
||||
// Override policy should be used together with replication policy to select the deployment target components
|
||||
type ReplicationPolicySpec struct {
|
||||
Keys []string `json:"keys,omitempty"`
|
||||
// Selector is the subset of selected components which will be replicated.
|
||||
Selector []string `json:"selector,omitempty"`
|
||||
}
|
||||
@@ -1,49 +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 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
const (
|
||||
// ReadOnlyPolicyType refers to the type of read-only policy
|
||||
ReadOnlyPolicyType = "read-only"
|
||||
)
|
||||
|
||||
// ReadOnlyPolicySpec defines the spec of read-only policy
|
||||
type ReadOnlyPolicySpec struct {
|
||||
Rules []ReadOnlyPolicyRule `json:"rules"`
|
||||
}
|
||||
|
||||
// Type the type name of the policy
|
||||
func (in *ReadOnlyPolicySpec) Type() string {
|
||||
return ReadOnlyPolicyType
|
||||
}
|
||||
|
||||
// ReadOnlyPolicyRule defines the rule for read-only resources
|
||||
type ReadOnlyPolicyRule struct {
|
||||
Selector ResourcePolicyRuleSelector `json:"selector"`
|
||||
}
|
||||
|
||||
// FindStrategy return if the target resource is read-only
|
||||
func (in *ReadOnlyPolicySpec) FindStrategy(manifest *unstructured.Unstructured) bool {
|
||||
for _, rule := range in.Rules {
|
||||
if rule.Selector.Match(manifest) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -17,18 +17,15 @@
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
k8sscheme "k8s.io/client-go/kubernetes/scheme"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
|
||||
wfTypesv1alpha1 "github.com/kubevela/pkg/apis/oam/v1alpha1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
)
|
||||
|
||||
// Package type metadata.
|
||||
const (
|
||||
Group = common.Group
|
||||
Group = "core.oam.dev"
|
||||
Version = "v1alpha1"
|
||||
)
|
||||
|
||||
@@ -38,30 +35,16 @@ var (
|
||||
|
||||
// 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
|
||||
// EnvBinding type metadata.
|
||||
var (
|
||||
PolicyKind = "Policy"
|
||||
PolicyGroupVersionKind = SchemeGroupVersion.WithKind(PolicyKind)
|
||||
)
|
||||
|
||||
// Workflow meta
|
||||
var (
|
||||
WorkflowKind = "Workflow"
|
||||
WorkflowGroupVersionKind = SchemeGroupVersion.WithKind(WorkflowKind)
|
||||
EnvBindingKind = reflect.TypeOf(EnvBinding{}).Name()
|
||||
EnvBindingGroupKind = schema.GroupKind{Group: Group, Kind: EnvBindingKind}.String()
|
||||
EnvBindingKindAPIVersion = EnvBindingKind + "." + SchemeGroupVersion.String()
|
||||
EnvBindingKindVersionKind = SchemeGroupVersion.WithKind(EnvBindingKind)
|
||||
)
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&Policy{}, &PolicyList{})
|
||||
SchemeBuilder.Register(&wfTypesv1alpha1.Workflow{}, &wfTypesv1alpha1.WorkflowList{})
|
||||
_ = SchemeBuilder.AddToScheme(k8sscheme.Scheme)
|
||||
}
|
||||
|
||||
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||
func Resource(resource string) schema.GroupResource {
|
||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||
SchemeBuilder.Register(&EnvBinding{}, &EnvBindingList{})
|
||||
}
|
||||
|
||||
@@ -1,78 +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 (
|
||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
"k8s.io/utils/ptr"
|
||||
stringslices "k8s.io/utils/strings/slices"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// 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 ptr.To(val != "" && stringslices.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
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
Copyright 2023 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 (
|
||||
// ResourceUpdatePolicyType refers to the type of resource-update policy
|
||||
ResourceUpdatePolicyType = "resource-update"
|
||||
)
|
||||
|
||||
// ResourceUpdatePolicySpec defines the spec of resource-update policy
|
||||
type ResourceUpdatePolicySpec struct {
|
||||
Rules []ResourceUpdatePolicyRule `json:"rules"`
|
||||
}
|
||||
|
||||
// Type the type name of the policy
|
||||
func (in *ResourceUpdatePolicySpec) Type() string {
|
||||
return ResourceUpdatePolicyType
|
||||
}
|
||||
|
||||
// ResourceUpdatePolicyRule defines the rule for resource-update resources
|
||||
type ResourceUpdatePolicyRule struct {
|
||||
// Selector picks which resources should be affected
|
||||
Selector ResourcePolicyRuleSelector `json:"selector"`
|
||||
// Strategy the strategy for updating resources
|
||||
Strategy ResourceUpdateStrategy `json:"strategy,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceUpdateStrategy the update strategy for resource
|
||||
type ResourceUpdateStrategy struct {
|
||||
// Op the update op for selected resources
|
||||
Op ResourceUpdateOp `json:"op,omitempty"`
|
||||
// RecreateFields the field path which will trigger recreate if changed
|
||||
RecreateFields []string `json:"recreateFields,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceUpdateOp update op for resource
|
||||
type ResourceUpdateOp string
|
||||
|
||||
const (
|
||||
// ResourceUpdateStrategyPatch patch the target resource (three-way patch)
|
||||
ResourceUpdateStrategyPatch ResourceUpdateOp = "patch"
|
||||
// ResourceUpdateStrategyReplace update the target resource
|
||||
ResourceUpdateStrategyReplace ResourceUpdateOp = "replace"
|
||||
)
|
||||
|
||||
// FindStrategy return if the target resource is read-only
|
||||
func (in *ResourceUpdatePolicySpec) FindStrategy(manifest *unstructured.Unstructured) *ResourceUpdateStrategy {
|
||||
for _, rule := range in.Rules {
|
||||
if rule.Selector.Match(manifest) {
|
||||
return &rule.Strategy
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,49 +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 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
const (
|
||||
// SharedResourcePolicyType refers to the type of shared resource policy
|
||||
SharedResourcePolicyType = "shared-resource"
|
||||
)
|
||||
|
||||
// SharedResourcePolicySpec defines the spec of shared-resource policy
|
||||
type SharedResourcePolicySpec struct {
|
||||
Rules []SharedResourcePolicyRule `json:"rules"`
|
||||
}
|
||||
|
||||
// Type the type name of the policy
|
||||
func (in *SharedResourcePolicySpec) Type() string {
|
||||
return SharedResourcePolicyType
|
||||
}
|
||||
|
||||
// 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,49 +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 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||
|
||||
const (
|
||||
// TakeOverPolicyType refers to the type of take-over policy
|
||||
TakeOverPolicyType = "take-over"
|
||||
)
|
||||
|
||||
// TakeOverPolicySpec defines the spec of take-over policy
|
||||
type TakeOverPolicySpec struct {
|
||||
Rules []TakeOverPolicyRule `json:"rules"`
|
||||
}
|
||||
|
||||
// Type the type name of the policy
|
||||
func (in *TakeOverPolicySpec) Type() string {
|
||||
return TakeOverPolicyType
|
||||
}
|
||||
|
||||
// TakeOverPolicyRule defines the rule for taking over resources
|
||||
type TakeOverPolicyRule struct {
|
||||
Selector ResourcePolicyRuleSelector `json:"selector"`
|
||||
}
|
||||
|
||||
// FindStrategy return if the target resource should be taken over
|
||||
func (in *TakeOverPolicySpec) FindStrategy(manifest *unstructured.Unstructured) bool {
|
||||
for _, rule := range in.Rules {
|
||||
if rule.Selector.Match(manifest) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
//go:build !ignore_autogenerated
|
||||
// +build !ignore_autogenerated
|
||||
|
||||
/*
|
||||
Copyright 2023 The KubeVela Authors.
|
||||
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.
|
||||
@@ -21,92 +21,121 @@ limitations under the License.
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"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) {
|
||||
func (in *AppTemplate) DeepCopyInto(out *AppTemplate) {
|
||||
*out = *in
|
||||
in.Selector.DeepCopyInto(&out.Selector)
|
||||
if in.Strategy != nil {
|
||||
in, out := &in.Strategy, &out.Strategy
|
||||
*out = new(ApplyOnceStrategy)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.RawExtension.DeepCopyInto(&out.RawExtension)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ApplyOncePolicyRule.
|
||||
func (in *ApplyOncePolicyRule) DeepCopy() *ApplyOncePolicyRule {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppTemplate.
|
||||
func (in *AppTemplate) DeepCopy() *AppTemplate {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplyOncePolicyRule)
|
||||
out := new(AppTemplate)
|
||||
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) {
|
||||
func (in *ClusterDecision) DeepCopyInto(out *ClusterDecision) {
|
||||
*out = *in
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]ApplyOncePolicyRule, len(*in))
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterDecision.
|
||||
func (in *ClusterDecision) DeepCopy() *ClusterDecision {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ClusterDecision)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ConfigMapReference) DeepCopyInto(out *ConfigMapReference) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapReference.
|
||||
func (in *ConfigMapReference) DeepCopy() *ConfigMapReference {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ConfigMapReference)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *EnvBinding) DeepCopyInto(out *EnvBinding) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvBinding.
|
||||
func (in *EnvBinding) DeepCopy() *EnvBinding {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(EnvBinding)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *EnvBinding) 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 *EnvBindingList) DeepCopyInto(out *EnvBindingList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]EnvBinding, 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 {
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvBindingList.
|
||||
func (in *EnvBindingList) DeepCopy() *EnvBindingList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ApplyOncePolicySpec)
|
||||
out := new(EnvBindingList)
|
||||
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)
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *EnvBindingList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
return nil
|
||||
}
|
||||
|
||||
// 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
|
||||
in.AppTemplate.DeepCopyInto(&out.AppTemplate)
|
||||
if in.Envs != nil {
|
||||
in, out := &in.Envs, &out.Envs
|
||||
*out = make([]EnvConfig, len(*in))
|
||||
@@ -114,6 +143,11 @@ func (in *EnvBindingSpec) DeepCopyInto(out *EnvBindingSpec) {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
if in.OutputResourcesTo != nil {
|
||||
in, out := &in.OutputResourcesTo, &out.OutputResourcesTo
|
||||
*out = new(ConfigMapReference)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvBindingSpec.
|
||||
@@ -129,18 +163,17 @@ func (in *EnvBindingSpec) DeepCopy() *EnvBindingSpec {
|
||||
// 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))
|
||||
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
|
||||
if in.ClusterDecisions != nil {
|
||||
in, out := &in.ClusterDecisions, &out.ClusterDecisions
|
||||
*out = make([]ClusterDecision, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
if in.ResourceTracker != nil {
|
||||
in, out := &in.ResourceTracker, &out.ResourceTracker
|
||||
*out = new(v1.ObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvBindingStatus.
|
||||
@@ -153,33 +186,6 @@ func (in *EnvBindingStatus) DeepCopy() *EnvBindingStatus {
|
||||
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
|
||||
@@ -207,7 +213,7 @@ func (in *EnvPatch) DeepCopyInto(out *EnvPatch) {
|
||||
*out = *in
|
||||
if in.Components != nil {
|
||||
in, out := &in.Components, &out.Components
|
||||
*out = make([]EnvComponentPatch, len(*in))
|
||||
*out = make([]common.ApplicationComponent, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
@@ -269,109 +275,6 @@ func (in *EnvSelector) DeepCopy() *EnvSelector {
|
||||
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)
|
||||
if in.Propagation != nil {
|
||||
in, out := &in.Propagation, &out.Propagation
|
||||
*out = new(GarbageCollectPropagation)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
|
||||
// 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.ApplicationRevisionLimit != nil {
|
||||
in, out := &in.ApplicationRevisionLimit, &out.ApplicationRevisionLimit
|
||||
*out = new(int)
|
||||
**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
|
||||
@@ -393,489 +296,3 @@ func (in *NamespaceSelector) DeepCopy() *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 *ReadOnlyPolicyRule) DeepCopyInto(out *ReadOnlyPolicyRule) {
|
||||
*out = *in
|
||||
in.Selector.DeepCopyInto(&out.Selector)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReadOnlyPolicyRule.
|
||||
func (in *ReadOnlyPolicyRule) DeepCopy() *ReadOnlyPolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ReadOnlyPolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ReadOnlyPolicySpec) DeepCopyInto(out *ReadOnlyPolicySpec) {
|
||||
*out = *in
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]ReadOnlyPolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReadOnlyPolicySpec.
|
||||
func (in *ReadOnlyPolicySpec) DeepCopy() *ReadOnlyPolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ReadOnlyPolicySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// 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 *ReplicationPolicySpec) DeepCopyInto(out *ReplicationPolicySpec) {
|
||||
*out = *in
|
||||
if in.Keys != nil {
|
||||
in, out := &in.Keys, &out.Keys
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
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 ReplicationPolicySpec.
|
||||
func (in *ReplicationPolicySpec) DeepCopy() *ReplicationPolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ReplicationPolicySpec)
|
||||
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 *ResourceUpdatePolicyRule) DeepCopyInto(out *ResourceUpdatePolicyRule) {
|
||||
*out = *in
|
||||
in.Selector.DeepCopyInto(&out.Selector)
|
||||
in.Strategy.DeepCopyInto(&out.Strategy)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceUpdatePolicyRule.
|
||||
func (in *ResourceUpdatePolicyRule) DeepCopy() *ResourceUpdatePolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceUpdatePolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceUpdatePolicySpec) DeepCopyInto(out *ResourceUpdatePolicySpec) {
|
||||
*out = *in
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]ResourceUpdatePolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceUpdatePolicySpec.
|
||||
func (in *ResourceUpdatePolicySpec) DeepCopy() *ResourceUpdatePolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceUpdatePolicySpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *ResourceUpdateStrategy) DeepCopyInto(out *ResourceUpdateStrategy) {
|
||||
*out = *in
|
||||
if in.RecreateFields != nil {
|
||||
in, out := &in.RecreateFields, &out.RecreateFields
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceUpdateStrategy.
|
||||
func (in *ResourceUpdateStrategy) DeepCopy() *ResourceUpdateStrategy {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(ResourceUpdateStrategy)
|
||||
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 *TakeOverPolicyRule) DeepCopyInto(out *TakeOverPolicyRule) {
|
||||
*out = *in
|
||||
in.Selector.DeepCopyInto(&out.Selector)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TakeOverPolicyRule.
|
||||
func (in *TakeOverPolicyRule) DeepCopy() *TakeOverPolicyRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TakeOverPolicyRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *TakeOverPolicySpec) DeepCopyInto(out *TakeOverPolicySpec) {
|
||||
*out = *in
|
||||
if in.Rules != nil {
|
||||
in, out := &in.Rules, &out.Rules
|
||||
*out = make([]TakeOverPolicyRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TakeOverPolicySpec.
|
||||
func (in *TakeOverPolicySpec) DeepCopy() *TakeOverPolicySpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(TakeOverPolicySpec)
|
||||
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
|
||||
}
|
||||
|
||||
123
apis/core.oam.dev/v1alpha2/application_types.go
Normal file
123
apis/core.oam.dev/v1alpha2/application_types.go
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
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 (
|
||||
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"
|
||||
)
|
||||
|
||||
// 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.
|
||||
|
||||
// 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"`
|
||||
|
||||
// Components record the related Components created by Application Controller
|
||||
Components []corev1.ObjectReference `json:"components,omitempty"`
|
||||
|
||||
// Services record the status of the application services
|
||||
Services []common.ApplicationComponentStatus `json:"services,omitempty"`
|
||||
|
||||
// ResourceTracker record the status of the ResourceTracker
|
||||
ResourceTracker *corev1.ObjectReference `json:"resourceTracker,omitempty"`
|
||||
|
||||
// LatestRevision of the application configuration it generates
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationTrait defines the trait of application
|
||||
type ApplicationTrait struct {
|
||||
Name string `json:"name"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationComponent describe the component of application
|
||||
type ApplicationComponent struct {
|
||||
Name string `json:"name"`
|
||||
WorkloadType string `json:"type"`
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Settings runtime.RawExtension `json:"settings,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"`
|
||||
}
|
||||
|
||||
// ApplicationSpec is the spec of Application
|
||||
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
|
||||
// +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"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationList contains a list of Application
|
||||
type ApplicationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Application `json:"items"`
|
||||
}
|
||||
|
||||
// GetComponent get the component from the application based on its workload type
|
||||
func (app *Application) GetComponent(workloadType string) *ApplicationComponent {
|
||||
for _, c := range app.Spec.Components {
|
||||
if c.WorkloadType == workloadType {
|
||||
return &c
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
68
apis/core.oam.dev/v1alpha2/application_types_test.go
Normal file
68
apis/core.oam.dev/v1alpha2/application_types_test.go
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
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 (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestApplicationGetComponent(t *testing.T) {
|
||||
ac1 := ApplicationComponent{
|
||||
Name: "ac1",
|
||||
WorkloadType: "type1",
|
||||
}
|
||||
ac2 := ApplicationComponent{
|
||||
Name: "ac2",
|
||||
WorkloadType: "type2",
|
||||
}
|
||||
tests := map[string]struct {
|
||||
app *Application
|
||||
componentName string
|
||||
want *ApplicationComponent
|
||||
}{
|
||||
"test get one": {
|
||||
app: &Application{
|
||||
Spec: ApplicationSpec{
|
||||
Components: []ApplicationComponent{
|
||||
ac1, ac2,
|
||||
},
|
||||
},
|
||||
},
|
||||
componentName: ac1.WorkloadType,
|
||||
want: &ac1,
|
||||
},
|
||||
"test get none": {
|
||||
app: &Application{
|
||||
Spec: ApplicationSpec{
|
||||
Components: []ApplicationComponent{
|
||||
ac2,
|
||||
},
|
||||
},
|
||||
},
|
||||
componentName: ac1.WorkloadType,
|
||||
want: nil,
|
||||
},
|
||||
}
|
||||
for name, tt := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if got := tt.app.GetComponent(tt.componentName); !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("GetComponent() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
73
apis/core.oam.dev/v1alpha2/applicationrevision_types.go
Normal file
73
apis/core.oam.dev/v1alpha2/applicationrevision_types.go
Normal file
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
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"`
|
||||
}
|
||||
86
apis/core.oam.dev/v1alpha2/approllout_types.go
Normal file
86
apis/core.oam.dev/v1alpha2/approllout_types.go
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
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"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
)
|
||||
|
||||
// AppRolloutSpec defines how to describe an upgrade between different apps
|
||||
type AppRolloutSpec struct {
|
||||
// TargetAppRevisionName contains the name of the applicationRevision that we need to upgrade to.
|
||||
TargetAppRevisionName string `json:"targetAppRevisionName"`
|
||||
|
||||
// SourceAppRevisionName contains the name of the applicationRevision that we need to upgrade from.
|
||||
// it can be empty only when the rolling is only a scale event
|
||||
SourceAppRevisionName string `json:"sourceAppRevisionName,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
|
||||
// It will remove the target app from the kubernetes if it's set to true
|
||||
// +optional
|
||||
RevertOnDelete *bool `json:"revertOnDelete,omitempty"`
|
||||
}
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// AppRollout is the Schema for the AppRollout API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam},shortName=approllout
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:name="TARGET",type=string,JSONPath=`.status.rolloutStatus.rolloutTargetSize`
|
||||
// +kubebuilder:printcolumn:name="UPGRADED",type=string,JSONPath=`.status.rolloutStatus.upgradedReplicas`
|
||||
// +kubebuilder:printcolumn:name="READY",type=string,JSONPath=`.status.rolloutStatus.upgradedReadyReplicas`
|
||||
// +kubebuilder:printcolumn:name="BATCH-STATE",type=string,JSONPath=`.status.rolloutStatus.batchRollingState`
|
||||
// +kubebuilder:printcolumn:name="ROLLING-STATE",type=string,JSONPath=`.status.rolloutStatus.rollingState`
|
||||
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=".metadata.creationTimestamp"
|
||||
type AppRollout struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec AppRolloutSpec `json:"spec,omitempty"`
|
||||
Status AppRolloutStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// AppRolloutList contains a list of AppRollout
|
||||
// +kubebuilder:object:root=true
|
||||
type AppRolloutList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []AppRollout `json:"items"`
|
||||
}
|
||||
103
apis/core.oam.dev/v1alpha2/componentdefinition_types.go
Normal file
103
apis/core.oam.dev/v1alpha2/componentdefinition_types.go
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
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"`
|
||||
}
|
||||
143
apis/core.oam.dev/v1alpha2/conversion.go
Normal file
143
apis/core.oam.dev/v1alpha2/conversion.go
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
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,
|
||||
})
|
||||
}
|
||||
// 3.2) convert Spec.RolloutPlan
|
||||
v1b1.Spec.RolloutPlan = v1a2.Spec.RolloutPlan.DeepCopy()
|
||||
|
||||
// 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,
|
||||
})
|
||||
}
|
||||
// 3.2) convert Spec.RolloutPlan
|
||||
app.Spec.RolloutPlan = sourceApp.Spec.RolloutPlan.DeepCopy()
|
||||
|
||||
// 4) convert Status common.AppStatus
|
||||
app.Status = *sourceApp.Status.DeepCopy()
|
||||
return nil
|
||||
default:
|
||||
}
|
||||
return fmt.Errorf("unsupported ConvertFrom object %v", reflect.TypeOf(src))
|
||||
}
|
||||
146
apis/core.oam.dev/v1alpha2/core_scope_types.go
Normal file
146
apis/core.oam.dev/v1alpha2/core_scope_types.go
Normal file
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
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 (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
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"
|
||||
)
|
||||
|
||||
// HealthStatus represents health status strings.
|
||||
type HealthStatus string
|
||||
|
||||
const (
|
||||
// StatusHealthy represents healthy status.
|
||||
StatusHealthy HealthStatus = "HEALTHY"
|
||||
// StatusUnhealthy represents unhealthy status.
|
||||
StatusUnhealthy = "UNHEALTHY"
|
||||
// StatusUnknown represents unknown status.
|
||||
StatusUnknown = "UNKNOWN"
|
||||
)
|
||||
|
||||
var _ oam.Scope = &HealthScope{}
|
||||
|
||||
// A HealthScopeSpec defines the desired state of a HealthScope.
|
||||
type HealthScopeSpec struct {
|
||||
// ProbeTimeout is the amount of time in seconds to wait when receiving a response before marked failure.
|
||||
ProbeTimeout *int32 `json:"probe-timeout,omitempty"`
|
||||
|
||||
// ProbeInterval is the amount of time in seconds between probing tries.
|
||||
ProbeInterval *int32 `json:"probe-interval,omitempty"`
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// A HealthScopeStatus represents the observed state of a HealthScope.
|
||||
type HealthScopeStatus struct {
|
||||
condition.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"`
|
||||
Total int64 `json:"total,omitempty"`
|
||||
HealthyWorkloads int64 `json:"healthyWorkloads,omitempty"`
|
||||
UnhealthyWorkloads int64 `json:"unhealthyWorkloads,omitempty"`
|
||||
UnknownWorkloads int64 `json:"unknownWorkloads,omitempty"`
|
||||
}
|
||||
|
||||
// WorkloadHealthCondition represents informative health condition of a workload.
|
||||
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"`
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A HealthScope determines an aggregate health status based of the health of components.
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:JSONPath=".status.health",name=HEALTH,type=string
|
||||
type HealthScope struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec HealthScopeSpec `json:"spec,omitempty"`
|
||||
Status HealthScopeStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// HealthScopeList contains a list of HealthScope.
|
||||
type HealthScopeList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []HealthScope `json:"items"`
|
||||
}
|
||||
65
apis/core.oam.dev/v1alpha2/core_trait_types.go
Normal file
65
apis/core.oam.dev/v1alpha2/core_trait_types.go
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
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 (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
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"
|
||||
)
|
||||
|
||||
var _ oam.Trait = &ManualScalerTrait{}
|
||||
|
||||
// A ManualScalerTraitSpec defines the desired state of a ManualScalerTrait.
|
||||
type ManualScalerTraitSpec struct {
|
||||
// ReplicaCount of the workload this trait applies to.
|
||||
ReplicaCount int32 `json:"replicaCount"`
|
||||
|
||||
// WorkloadReference to the workload this trait applies to.
|
||||
WorkloadReference corev1.ObjectReference `json:"workloadRef"`
|
||||
}
|
||||
|
||||
// A ManualScalerTraitStatus represents the observed state of a
|
||||
// ManualScalerTrait.
|
||||
type ManualScalerTraitStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A ManualScalerTrait determines how many replicas a workload should have.
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ManualScalerTrait struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ManualScalerTraitSpec `json:"spec,omitempty"`
|
||||
Status ManualScalerTraitStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ManualScalerTraitList contains a list of ManualScalerTrait.
|
||||
type ManualScalerTraitList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ManualScalerTrait `json:"items"`
|
||||
}
|
||||
673
apis/core.oam.dev/v1alpha2/core_types.go
Normal file
673
apis/core.oam.dev/v1alpha2/core_types.go
Normal file
@@ -0,0 +1,673 @@
|
||||
/*
|
||||
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 (
|
||||
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"
|
||||
)
|
||||
|
||||
// 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:printcolumn:name="DEFINITION-NAME",type=string,JSONPath=".spec.definitionRef.name"
|
||||
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.
|
||||
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 kind.group/version format,
|
||||
// e.g. server.core.oam.dev/v1alpha2. Traits that omit this field apply to
|
||||
// all workload kinds.
|
||||
// +optional
|
||||
AppliesToWorkloads []string `json:"appliesToWorkloads,omitempty"`
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// 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"
|
||||
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
|
||||
|
||||
// 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
|
||||
type ScopeDefinition struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ScopeDefinitionSpec `json:"spec,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ScopeDefinitionList contains a list of ScopeDefinition.
|
||||
type ScopeDefinitionList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ScopeDefinition `json:"items"`
|
||||
}
|
||||
|
||||
// A ComponentParameter defines a configurable parameter of a component.
|
||||
type ComponentParameter struct {
|
||||
// Name of this parameter. OAM ApplicationConfigurations will specify
|
||||
// parameter values using this name.
|
||||
Name string `json:"name"`
|
||||
|
||||
// FieldPaths specifies an array of fields within this Component's workload
|
||||
// that will be overwritten by the value of this parameter. The type of the
|
||||
// parameter (e.g. int, string) is inferred from the type of these fields;
|
||||
// All fields must be of the same type. Fields are specified as JSON field
|
||||
// paths without a leading dot, for example 'spec.replicas'.
|
||||
FieldPaths []string `json:"fieldPaths"`
|
||||
|
||||
// +kubebuilder:default:=false
|
||||
// Required specifies whether or not a value for this parameter must be
|
||||
// supplied when authoring an ApplicationConfiguration.
|
||||
// +optional
|
||||
Required *bool `json:"required,omitempty"`
|
||||
|
||||
// Description of this parameter.
|
||||
// +optional
|
||||
Description *string `json:"description,omitempty"`
|
||||
}
|
||||
|
||||
// A ComponentSpec defines the desired state of a Component.
|
||||
type ComponentSpec struct {
|
||||
// A Workload that will be created for each ApplicationConfiguration that
|
||||
// includes this Component. Workload is an instance of a workloadDefinition.
|
||||
// We either use the GVK info or a special "type" field in the workload to associate
|
||||
// the content of the workload with its workloadDefinition
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Workload runtime.RawExtension `json:"workload"`
|
||||
|
||||
// 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.
|
||||
// +optional
|
||||
Parameters []ComponentParameter `json:"parameters,omitempty"`
|
||||
}
|
||||
|
||||
// A ComponentStatus represents the observed state of a Component.
|
||||
type ComponentStatus struct {
|
||||
// The generation observed by the component controller.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration"`
|
||||
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
// LatestRevision of component
|
||||
// +optional
|
||||
LatestRevision *common.Revision `json:"latestRevision,omitempty"`
|
||||
|
||||
// One Component should only be used by one AppConfig
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A Component describes how an OAM workload kind may be instantiated.
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:printcolumn:JSONPath=".spec.workload.kind",name=WORKLOAD-KIND,type=string
|
||||
// +kubebuilder:printcolumn:name="age",type="date",JSONPath=".metadata.creationTimestamp"
|
||||
type Component struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ComponentSpec `json:"spec,omitempty"`
|
||||
Status ComponentStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ComponentList contains a list of Component.
|
||||
type ComponentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []Component `json:"items"`
|
||||
}
|
||||
|
||||
// A ComponentParameterValue specifies a value for a named parameter. The
|
||||
// associated component must publish a parameter with this name.
|
||||
type ComponentParameterValue struct {
|
||||
// Name of the component parameter to set.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Value to set.
|
||||
Value intstr.IntOrString `json:"value"`
|
||||
}
|
||||
|
||||
// A ComponentTrait specifies a trait that should be applied to a component.
|
||||
type ComponentTrait struct {
|
||||
// A Trait that will be created for the component
|
||||
// +kubebuilder:validation:EmbeddedResource
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Trait runtime.RawExtension `json:"trait"`
|
||||
|
||||
// DataOutputs specify the data output sources from this trait.
|
||||
// +optional
|
||||
DataOutputs []DataOutput `json:"dataOutputs,omitempty"`
|
||||
|
||||
// DataInputs specify the data input sinks into this trait.
|
||||
// +optional
|
||||
DataInputs []DataInput `json:"dataInputs,omitempty"`
|
||||
}
|
||||
|
||||
// A ComponentScope specifies a scope in which a component should exist.
|
||||
type ComponentScope struct {
|
||||
// A ScopeReference must refer to an OAM scope resource.
|
||||
ScopeReference corev1.ObjectReference `json:"scopeRef"`
|
||||
}
|
||||
|
||||
// An ApplicationConfigurationComponent specifies a component of an
|
||||
// ApplicationConfiguration. Each component is used to instantiate a workload.
|
||||
type ApplicationConfigurationComponent struct {
|
||||
// ComponentName specifies a component whose latest revision will be bind
|
||||
// with ApplicationConfiguration. When the spec of the referenced component
|
||||
// changes, ApplicationConfiguration will automatically migrate all trait
|
||||
// affect from the prior revision to the new one. This is mutually exclusive
|
||||
// with RevisionName.
|
||||
// +optional
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
|
||||
// RevisionName of a specific component revision to which to bind
|
||||
// ApplicationConfiguration. This is mutually exclusive with componentName.
|
||||
// +optional
|
||||
RevisionName string `json:"revisionName,omitempty"`
|
||||
|
||||
// DataOutputs specify the data output sources from this component.
|
||||
DataOutputs []DataOutput `json:"dataOutputs,omitempty"`
|
||||
|
||||
// DataInputs specify the data input sinks into this component.
|
||||
DataInputs []DataInput `json:"dataInputs,omitempty"`
|
||||
|
||||
// ParameterValues specify values for the the specified component's
|
||||
// parameters. Any parameter required by the component must be specified.
|
||||
// +optional
|
||||
ParameterValues []ComponentParameterValue `json:"parameterValues,omitempty"`
|
||||
|
||||
// Traits of the specified component.
|
||||
// +optional
|
||||
Traits []ComponentTrait `json:"traits,omitempty"`
|
||||
|
||||
// Scopes in which the specified component should exist.
|
||||
// +optional
|
||||
Scopes []ComponentScope `json:"scopes,omitempty"`
|
||||
}
|
||||
|
||||
// An ApplicationConfigurationSpec defines the desired state of a
|
||||
// ApplicationConfiguration.
|
||||
type ApplicationConfigurationSpec struct {
|
||||
// Components of which this ApplicationConfiguration consists. Each
|
||||
// component will be used to instantiate a workload.
|
||||
Components []ApplicationConfigurationComponent `json:"components"`
|
||||
}
|
||||
|
||||
// A TraitStatus represents the state of a trait.
|
||||
type TraitStatus string
|
||||
|
||||
// A WorkloadTrait represents a trait associated with a workload and its status
|
||||
type WorkloadTrait struct {
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the status of the trait
|
||||
Status TraitStatus `json:"status,omitempty"`
|
||||
|
||||
// Reference to a trait created by an ApplicationConfiguration.
|
||||
Reference corev1.ObjectReference `json:"traitRef"`
|
||||
|
||||
// Message will allow controller to leave some additional information for this trait
|
||||
Message string `json:"message,omitempty"`
|
||||
|
||||
// AppliedGeneration indicates the generation observed by the appConfig controller.
|
||||
// The same field is also recorded in the annotations of traits.
|
||||
// A trait is possible to be deleted from cluster after created.
|
||||
// This field is useful to track the observed generation of traits after they are
|
||||
// deleted.
|
||||
AppliedGeneration int64 `json:"appliedGeneration,omitempty"`
|
||||
|
||||
// DependencyUnsatisfied notify does the trait has dependency unsatisfied
|
||||
DependencyUnsatisfied bool `json:"dependencyUnsatisfied,omitempty"`
|
||||
}
|
||||
|
||||
// A ScopeStatus represents the state of a scope.
|
||||
type ScopeStatus string
|
||||
|
||||
// A WorkloadScope represents a scope associated with a workload and its status
|
||||
type WorkloadScope struct {
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the status of the scope
|
||||
Status ScopeStatus `json:"status,omitempty"`
|
||||
|
||||
// Reference to a scope created by an ApplicationConfiguration.
|
||||
Reference corev1.ObjectReference `json:"scopeRef"`
|
||||
}
|
||||
|
||||
// A WorkloadStatus represents the status of a workload.
|
||||
type WorkloadStatus struct {
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the entire status of the workload
|
||||
Status string `json:"status,omitempty"`
|
||||
|
||||
// ComponentName that produced this workload.
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
|
||||
// ComponentRevisionName of current component
|
||||
ComponentRevisionName string `json:"componentRevisionName,omitempty"`
|
||||
|
||||
// DependencyUnsatisfied notify does the workload has dependency unsatisfied
|
||||
DependencyUnsatisfied bool `json:"dependencyUnsatisfied,omitempty"`
|
||||
|
||||
// AppliedComponentRevision indicates the applied component revision name of this workload
|
||||
AppliedComponentRevision string `json:"appliedComponentRevision,omitempty"`
|
||||
|
||||
// Reference to a workload created by an ApplicationConfiguration.
|
||||
Reference corev1.ObjectReference `json:"workloadRef,omitempty"`
|
||||
|
||||
// Traits associated with this workload.
|
||||
Traits []WorkloadTrait `json:"traits,omitempty"`
|
||||
|
||||
// Scopes associated with this workload.
|
||||
Scopes []WorkloadScope `json:"scopes,omitempty"`
|
||||
}
|
||||
|
||||
// HistoryWorkload contain the old component revision that are still running
|
||||
type HistoryWorkload struct {
|
||||
// Revision of this workload
|
||||
Revision string `json:"revision,omitempty"`
|
||||
|
||||
// Reference to running workload.
|
||||
Reference corev1.ObjectReference `json:"workloadRef,omitempty"`
|
||||
}
|
||||
|
||||
// A ApplicationStatus represents the state of the entire application.
|
||||
type ApplicationStatus string
|
||||
|
||||
// An ApplicationConfigurationStatus represents the observed state of a
|
||||
// ApplicationConfiguration.
|
||||
type ApplicationConfigurationStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
// Status is a place holder for a customized controller to fill
|
||||
// if it needs a single place to summarize the status of the entire application
|
||||
Status ApplicationStatus `json:"status,omitempty"`
|
||||
|
||||
Dependency DependencyStatus `json:"dependency,omitempty"`
|
||||
|
||||
// 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"`
|
||||
|
||||
// The generation observed by the appConfig controller.
|
||||
// +optional
|
||||
ObservedGeneration int64 `json:"observedGeneration"`
|
||||
|
||||
// HistoryWorkloads will record history but still working revision workloads.
|
||||
HistoryWorkloads []HistoryWorkload `json:"historyWorkloads,omitempty"`
|
||||
}
|
||||
|
||||
// DependencyStatus represents the observed state of the dependency of
|
||||
// an ApplicationConfiguration.
|
||||
type DependencyStatus struct {
|
||||
Unsatisfied []UnstaifiedDependency `json:"unsatisfied,omitempty"`
|
||||
}
|
||||
|
||||
// UnstaifiedDependency describes unsatisfied dependency flow between
|
||||
// one pair of objects.
|
||||
type UnstaifiedDependency struct {
|
||||
Reason string `json:"reason"`
|
||||
From DependencyFromObject `json:"from"`
|
||||
To DependencyToObject `json:"to"`
|
||||
}
|
||||
|
||||
// DependencyFromObject represents the object that dependency data comes from.
|
||||
type DependencyFromObject struct {
|
||||
corev1.ObjectReference `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"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// An ApplicationConfiguration represents an OAM application.
|
||||
// +kubebuilder:resource:shortName=appconfig,categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ApplicationConfiguration struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ApplicationConfigurationSpec `json:"spec,omitempty"`
|
||||
Status ApplicationConfigurationStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ApplicationConfigurationList contains a list of ApplicationConfiguration.
|
||||
type ApplicationConfigurationList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ApplicationConfiguration `json:"items"`
|
||||
}
|
||||
|
||||
// DataOutput specifies a data output source from an object.
|
||||
type DataOutput struct {
|
||||
// Name is the unique name of a DataOutput in an ApplicationConfiguration.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// FieldPath refers to the value of an object's field.
|
||||
FieldPath string `json:"fieldPath,omitempty"`
|
||||
|
||||
// Conditions specify the conditions that should be satisfied before emitting a data output.
|
||||
// Different conditions are AND-ed together.
|
||||
// If no conditions is specified, it is by default to check output value not empty.
|
||||
// +optional
|
||||
Conditions []ConditionRequirement `json:"conditions,omitempty"`
|
||||
// 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 {
|
||||
// ValueFrom specifies the value source.
|
||||
ValueFrom DataInputValueFrom `json:"valueFrom,omitempty"`
|
||||
|
||||
// ToFieldPaths specifies the field paths of an object to fill passed value.
|
||||
ToFieldPaths []string `json:"toFieldPaths,omitempty"`
|
||||
|
||||
// StrategyMergeKeys specifies the merge key if the toFieldPaths target is an array.
|
||||
// The StrategyMergeKeys is optional, by default, if the toFieldPaths target is an array, we will append.
|
||||
// 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.
|
||||
type DataInputValueFrom struct {
|
||||
// DataOutputName matches a name of a DataOutput in the same AppConfig.
|
||||
DataOutputName string `json:"dataOutputName"`
|
||||
}
|
||||
|
||||
// ConditionRequirement specifies the requirement to match a value.
|
||||
type ConditionRequirement struct {
|
||||
Operator ConditionOperator `json:"op"`
|
||||
|
||||
// +optional
|
||||
// Value specifies an expected value
|
||||
// This is mutually exclusive with ValueFrom
|
||||
Value string `json:"value,omitempty"`
|
||||
// +optional
|
||||
// ValueFrom specifies expected value from AppConfig
|
||||
// This is mutually exclusive with Value
|
||||
ValueFrom ValueFrom `json:"valueFrom,omitempty"`
|
||||
|
||||
// +optional
|
||||
// FieldPath specifies got value from workload/trait object
|
||||
FieldPath string `json:"fieldPath,omitempty"`
|
||||
}
|
||||
|
||||
// ValueFrom gets value from AppConfig object by specifying a path
|
||||
type ValueFrom struct {
|
||||
FieldPath string `json:"fieldPath"`
|
||||
}
|
||||
|
||||
// ConditionOperator specifies the operator to match a value.
|
||||
type ConditionOperator string
|
||||
|
||||
const (
|
||||
// ConditionEqual indicates equal to given value
|
||||
ConditionEqual ConditionOperator = "eq"
|
||||
// ConditionNotEqual indicates not equal to given value
|
||||
ConditionNotEqual ConditionOperator = "notEq"
|
||||
// ConditionNotEmpty indicates given value not empty
|
||||
ConditionNotEmpty ConditionOperator = "notEmpty"
|
||||
)
|
||||
411
apis/core.oam.dev/v1alpha2/core_workload_types.go
Normal file
411
apis/core.oam.dev/v1alpha2/core_workload_types.go
Normal file
@@ -0,0 +1,411 @@
|
||||
/*
|
||||
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
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"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/apis/core.oam.dev/condition"
|
||||
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
|
||||
// An OperatingSystem required by a containerised workload.
|
||||
type OperatingSystem string
|
||||
|
||||
// Supported operating system types.
|
||||
const (
|
||||
OperatingSystemLinux OperatingSystem = "linux"
|
||||
OperatingSystemWindows OperatingSystem = "windows"
|
||||
)
|
||||
|
||||
// A CPUArchitecture required by a containerised workload.
|
||||
type CPUArchitecture string
|
||||
|
||||
// Supported architectures
|
||||
const (
|
||||
CPUArchitectureI386 CPUArchitecture = "i386"
|
||||
CPUArchitectureAMD64 CPUArchitecture = "amd64"
|
||||
CPUArchitectureARM CPUArchitecture = "arm"
|
||||
CPUArchitectureARM64 CPUArchitecture = "arm64"
|
||||
)
|
||||
|
||||
// A SecretKeySelector is a reference to a secret key in an arbitrary namespace.
|
||||
type SecretKeySelector struct {
|
||||
// The name of the secret.
|
||||
Name string `json:"name"`
|
||||
|
||||
// The key to select.
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
// TODO(negz): The OAM spec calls for float64 quantities in some cases, but this
|
||||
// is incompatible with controller-gen and Kubernetes API conventions. We should
|
||||
// reassess whether resource.Quantity is appropriate after resolving
|
||||
// https://github.com/oam-dev/spec/issues/313
|
||||
|
||||
// CPUResources required by a container.
|
||||
type CPUResources struct {
|
||||
// Required CPU count. 1.0 represents one CPU core.
|
||||
Required resource.Quantity `json:"required"`
|
||||
}
|
||||
|
||||
// MemoryResources required by a container.
|
||||
type MemoryResources struct {
|
||||
// Required memory.
|
||||
Required resource.Quantity `json:"required"`
|
||||
}
|
||||
|
||||
// GPUResources required by a container.
|
||||
type GPUResources struct {
|
||||
// Required GPU count.
|
||||
Required resource.Quantity `json:"required"`
|
||||
}
|
||||
|
||||
// DiskResource required by a container.
|
||||
type DiskResource struct {
|
||||
// Required disk space.
|
||||
Required resource.Quantity `json:"required"`
|
||||
|
||||
// Ephemeral specifies whether an external disk needs to be mounted.
|
||||
// +optional
|
||||
Ephemeral *bool `json:"ephemeral,omitempty"`
|
||||
}
|
||||
|
||||
// A VolumeAccessMode determines how a volume may be accessed.
|
||||
type VolumeAccessMode string
|
||||
|
||||
// Volume access modes.
|
||||
const (
|
||||
VolumeAccessModeRO VolumeAccessMode = "RO"
|
||||
VolumeAccessModeRW VolumeAccessMode = "RW"
|
||||
)
|
||||
|
||||
// A VolumeSharingPolicy determines how a volume may be shared.
|
||||
type VolumeSharingPolicy string
|
||||
|
||||
// Volume sharing policies.
|
||||
const (
|
||||
VolumeSharingPolicyExclusive VolumeSharingPolicy = "Exclusive"
|
||||
VolumeSharingPolicyShared VolumeSharingPolicy = "Shared"
|
||||
)
|
||||
|
||||
// VolumeResource required by a container.
|
||||
type VolumeResource struct {
|
||||
// Name of this volume. Must be unique within its container.
|
||||
Name string `json:"name"`
|
||||
|
||||
// MountPath at which this volume will be mounted within its container.
|
||||
MountPath string `json:"mountPath"`
|
||||
|
||||
// TODO(negz): Use +kubebuilder:default marker to default AccessMode to RW
|
||||
// and SharingPolicy to Exclusive once we're generating v1 CRDs.
|
||||
|
||||
// AccessMode of this volume; RO (read only) or RW (read and write).
|
||||
// +optional
|
||||
// +kubebuilder:validation:Enum=RO;RW
|
||||
AccessMode *VolumeAccessMode `json:"accessMode,omitempty"`
|
||||
|
||||
// SharingPolicy of this volume; Exclusive or Shared.
|
||||
// +optional
|
||||
// +kubebuilder:validation:Enum=Exclusive;Shared
|
||||
SharingPolicy *VolumeSharingPolicy `json:"sharingPolicy,omitempty"`
|
||||
|
||||
// Disk requirements of this volume.
|
||||
// +optional
|
||||
Disk *DiskResource `json:"disk,omitempty"`
|
||||
}
|
||||
|
||||
// ExtendedResource required by a container.
|
||||
type ExtendedResource struct {
|
||||
// Name of the external resource. Resource names are specified in
|
||||
// kind.group/version format, e.g. motionsensor.ext.example.com/v1.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Required extended resource(s), e.g. 8 or "very-cool-widget"
|
||||
Required intstr.IntOrString `json:"required"`
|
||||
}
|
||||
|
||||
// ContainerResources specifies a container's required compute resources.
|
||||
type ContainerResources struct {
|
||||
// CPU required by this container.
|
||||
CPU CPUResources `json:"cpu"`
|
||||
|
||||
// Memory required by this container.
|
||||
Memory MemoryResources `json:"memory"`
|
||||
|
||||
// GPU required by this container.
|
||||
// +optional
|
||||
GPU *GPUResources `json:"gpu,omitempty"`
|
||||
|
||||
// Volumes required by this container.
|
||||
// +optional
|
||||
Volumes []VolumeResource `json:"volumes,omitempty"`
|
||||
|
||||
// Extended resources required by this container.
|
||||
// +optional
|
||||
Extended []ExtendedResource `json:"extended,omitempty"`
|
||||
}
|
||||
|
||||
// A ContainerEnvVar specifies an environment variable that should be set within
|
||||
// a container.
|
||||
type ContainerEnvVar struct {
|
||||
// Name of the environment variable. Must be composed of valid Unicode
|
||||
// letter and number characters, as well as _ and -.
|
||||
// +kubebuilder:validation:Pattern=^[-_a-zA-Z0-9]+$
|
||||
Name string `json:"name"`
|
||||
|
||||
// Value of the environment variable.
|
||||
// +optional
|
||||
Value *string `json:"value,omitempty"`
|
||||
|
||||
// FromSecret is a secret key reference which can be used to assign a value
|
||||
// to the environment variable.
|
||||
// +optional
|
||||
FromSecret *SecretKeySelector `json:"fromSecret,omitempty"`
|
||||
}
|
||||
|
||||
// A ContainerConfigFile specifies a configuration file that should be written
|
||||
// within a container.
|
||||
type ContainerConfigFile struct {
|
||||
// Path within the container at which the configuration file should be
|
||||
// written.
|
||||
Path string `json:"path"`
|
||||
|
||||
// Value that should be written to the configuration file.
|
||||
// +optional
|
||||
Value *string `json:"value,omitempty"`
|
||||
|
||||
// FromSecret is a secret key reference which can be used to assign a value
|
||||
// to be written to the configuration file at the given path in the
|
||||
// container.
|
||||
// +optional
|
||||
FromSecret *SecretKeySelector `json:"fromSecret,omitempty"`
|
||||
}
|
||||
|
||||
// A TransportProtocol represents a transport layer protocol.
|
||||
type TransportProtocol string
|
||||
|
||||
// Transport protocols.
|
||||
const (
|
||||
TransportProtocolTCP TransportProtocol = "TCP"
|
||||
TransportProtocolUDP TransportProtocol = "UDP"
|
||||
)
|
||||
|
||||
// A ContainerPort specifies a port that is exposed by a container.
|
||||
type ContainerPort struct {
|
||||
// Name of this port. Must be unique within its container. Must be lowercase
|
||||
// alphabetical characters.
|
||||
// +kubebuilder:validation:Pattern=^[a-z]+$
|
||||
Name string `json:"name"`
|
||||
|
||||
// Port number. Must be unique within its container.
|
||||
Port int32 `json:"containerPort"`
|
||||
|
||||
// TODO(negz): Use +kubebuilder:default marker to default Protocol to TCP
|
||||
// once we're generating v1 CRDs.
|
||||
|
||||
// Protocol used by the server listening on this port.
|
||||
// +kubebuilder:validation:Enum=TCP;UDP
|
||||
// +optional
|
||||
Protocol *TransportProtocol `json:"protocol,omitempty"`
|
||||
}
|
||||
|
||||
// An ExecProbe probes a container's health by executing a command.
|
||||
type ExecProbe struct {
|
||||
// Command to be run by this probe.
|
||||
Command []string `json:"command"`
|
||||
}
|
||||
|
||||
// A HTTPHeader to be passed when probing a container.
|
||||
type HTTPHeader struct {
|
||||
// Name of this HTTP header. Must be unique per probe.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Value of this HTTP header.
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// A HTTPGetProbe probes a container's health by sending an HTTP GET request.
|
||||
type HTTPGetProbe struct {
|
||||
// Path to probe, e.g. '/healthz'.
|
||||
Path string `json:"path"`
|
||||
|
||||
// Port to probe.
|
||||
Port int32 `json:"port"`
|
||||
|
||||
// HTTPHeaders to send with the GET request.
|
||||
// +optional
|
||||
HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"`
|
||||
}
|
||||
|
||||
// A TCPSocketProbe probes a container's health by connecting to a TCP socket.
|
||||
type TCPSocketProbe struct {
|
||||
// Port this probe should connect to.
|
||||
Port int32 `json:"port"`
|
||||
}
|
||||
|
||||
// A ContainerHealthProbe specifies how to probe the health of a container.
|
||||
// Exactly one of Exec, HTTPGet, or TCPSocket must be specified.
|
||||
type ContainerHealthProbe struct {
|
||||
// Exec probes a container's health by executing a command.
|
||||
// +optional
|
||||
Exec *ExecProbe `json:"exec,omitempty"`
|
||||
|
||||
// HTTPGet probes a container's health by sending an HTTP GET request.
|
||||
// +optional
|
||||
HTTPGet *HTTPGetProbe `json:"httpGet,omitempty"`
|
||||
|
||||
// TCPSocketProbe probes a container's health by connecting to a TCP socket.
|
||||
// +optional
|
||||
TCPSocket *TCPSocketProbe `json:"tcpSocket,omitempty"`
|
||||
|
||||
// InitialDelaySeconds after a container starts before the first probe.
|
||||
// +optional
|
||||
InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"`
|
||||
|
||||
// TODO(negz): Use +kubebuilder:default marker to default PeriodSeconds,
|
||||
// TimeoutSeconds, SuccessThreshold, and FailureThreshold to 10, 1, 1, and 3
|
||||
// respectively once we're generating v1 CRDs.
|
||||
|
||||
// PeriodSeconds between probes.
|
||||
// +optional
|
||||
PeriodSeconds *int32 `json:"periodSeconds,omitempty"`
|
||||
|
||||
// TimeoutSeconds after which the probe times out.
|
||||
// +optional
|
||||
TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
|
||||
|
||||
// SuccessThreshold specifies how many consecutive probes must success in
|
||||
// order for the container to be considered healthy.
|
||||
// +optional
|
||||
SuccessThreshold *int32 `json:"successThreshold,omitempty"`
|
||||
|
||||
// FailureThreshold specifies how many consecutive probes must fail in order
|
||||
// for the container to be considered healthy.
|
||||
// +optional
|
||||
FailureThreshold *int32 `json:"failureThreshold,omitempty"`
|
||||
}
|
||||
|
||||
// A Container represents an Open Containers Initiative (OCI) container.
|
||||
type Container struct {
|
||||
// Name of this container. Must be unique within its workload.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Image this container should run. Must be a path-like or URI-like
|
||||
// representation of an OCI image. May be prefixed with a registry address
|
||||
// and should be suffixed with a tag.
|
||||
Image string `json:"image"`
|
||||
|
||||
// Resources required by this container
|
||||
// +optional
|
||||
Resources *ContainerResources `json:"resources,omitempty"`
|
||||
|
||||
// Command to be run by this container.
|
||||
// +optional
|
||||
Command []string `json:"command,omitempty"`
|
||||
|
||||
// Arguments to be passed to the command run by this container.
|
||||
// +optional
|
||||
Arguments []string `json:"args,omitempty"`
|
||||
|
||||
// Environment variables that should be set within this container.
|
||||
// +optional
|
||||
Environment []ContainerEnvVar `json:"env,omitempty"`
|
||||
|
||||
// ConfigFiles that should be written within this container.
|
||||
// +optional
|
||||
ConfigFiles []ContainerConfigFile `json:"config,omitempty"`
|
||||
|
||||
// Ports exposed by this container.
|
||||
// +optional
|
||||
Ports []ContainerPort `json:"ports,omitempty"`
|
||||
|
||||
// A LivenessProbe assesses whether this container is alive. Containers that
|
||||
// fail liveness probes will be restarted.
|
||||
// +optional
|
||||
LivenessProbe *ContainerHealthProbe `json:"livenessProbe,omitempty"`
|
||||
|
||||
// A ReadinessProbe assesses whether this container is ready to serve
|
||||
// requests. Containers that fail readiness probes will be withdrawn from
|
||||
// service.
|
||||
// +optional
|
||||
ReadinessProbe *ContainerHealthProbe `json:"readinessProbe,omitempty"`
|
||||
|
||||
// TODO(negz): Ideally the key within this secret would be configurable, but
|
||||
// the current OAM spec allows only a secret name.
|
||||
|
||||
// ImagePullSecret specifies the name of a Secret from which the
|
||||
// credentials required to pull this container's image can be loaded.
|
||||
// +optional
|
||||
ImagePullSecret *string `json:"imagePullSecret,omitempty"`
|
||||
}
|
||||
|
||||
// A ContainerizedWorkloadSpec defines the desired state of a
|
||||
// ContainerizedWorkload.
|
||||
type ContainerizedWorkloadSpec struct {
|
||||
// OperatingSystem required by this workload.
|
||||
// +kubebuilder:validation:Enum=linux;windows
|
||||
// +optional
|
||||
OperatingSystem *OperatingSystem `json:"osType,omitempty"`
|
||||
|
||||
// CPUArchitecture required by this workload.
|
||||
// +kubebuilder:validation:Enum=i386;amd64;arm;arm64
|
||||
// +optional
|
||||
CPUArchitecture *CPUArchitecture `json:"arch,omitempty"`
|
||||
|
||||
// Containers of which this workload consists.
|
||||
Containers []Container `json:"containers"`
|
||||
}
|
||||
|
||||
// A ContainerizedWorkloadStatus represents the observed state of a
|
||||
// ContainerizedWorkload.
|
||||
type ContainerizedWorkloadStatus struct {
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
// Resources managed by this containerised workload.
|
||||
Resources []corev1.ObjectReference `json:"resources,omitempty"`
|
||||
}
|
||||
|
||||
var _ oam.Workload = &ContainerizedWorkload{}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// A ContainerizedWorkload is a workload that runs OCI containers.
|
||||
// +kubebuilder:resource:categories={oam}
|
||||
// +kubebuilder:subresource:status
|
||||
type ContainerizedWorkload struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec ContainerizedWorkloadSpec `json:"spec,omitempty"`
|
||||
Status ContainerizedWorkloadStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// ContainerizedWorkloadList contains a list of ContainerizedWorkload.
|
||||
type ContainerizedWorkloadList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []ContainerizedWorkload `json:"items"`
|
||||
}
|
||||
22
apis/core.oam.dev/v1alpha2/doc.go
Normal file
22
apis/core.oam.dev/v1alpha2/doc.go
Normal file
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
Copyright 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 contains resources relating to the Open Application Model.
|
||||
// See https://github.com/oam-dev/spec for more details.
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=core.oam.dev
|
||||
// +versionName=v1alpha2
|
||||
package v1alpha2
|
||||
95
apis/core.oam.dev/v1alpha2/methods.go
Normal file
95
apis/core.oam.dev/v1alpha2/methods.go
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
// This code is manually implemented, but should be generated in the future.
|
||||
|
||||
package v1alpha2
|
||||
|
||||
import (
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
)
|
||||
|
||||
// GetCondition of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
return tr.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) SetConditions(c ...condition.Condition) {
|
||||
tr.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetWorkloadReference of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) GetWorkloadReference() corev1.ObjectReference {
|
||||
return tr.Spec.WorkloadReference
|
||||
}
|
||||
|
||||
// SetWorkloadReference of this ManualScalerTrait.
|
||||
func (tr *ManualScalerTrait) SetWorkloadReference(r corev1.ObjectReference) {
|
||||
tr.Spec.WorkloadReference = r
|
||||
}
|
||||
|
||||
// GetCondition of this ApplicationConfiguration.
|
||||
func (ac *ApplicationConfiguration) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
return ac.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ApplicationConfiguration.
|
||||
func (ac *ApplicationConfiguration) SetConditions(c ...condition.Condition) {
|
||||
ac.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this Component.
|
||||
func (cm *Component) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
return cm.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this Component.
|
||||
func (cm *Component) SetConditions(c ...condition.Condition) {
|
||||
cm.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this ContainerizedWorkload.
|
||||
func (wl *ContainerizedWorkload) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
return wl.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this ContainerizedWorkload.
|
||||
func (wl *ContainerizedWorkload) SetConditions(c ...condition.Condition) {
|
||||
wl.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetCondition of this HealthScope.
|
||||
func (hs *HealthScope) GetCondition(ct condition.ConditionType) condition.Condition {
|
||||
return hs.Status.GetCondition(ct)
|
||||
}
|
||||
|
||||
// SetConditions of this HealthScope.
|
||||
func (hs *HealthScope) SetConditions(c ...condition.Condition) {
|
||||
hs.Status.SetConditions(c...)
|
||||
}
|
||||
|
||||
// GetWorkloadReferences to get all workload references for scope.
|
||||
func (hs *HealthScope) GetWorkloadReferences() []corev1.ObjectReference {
|
||||
return hs.Spec.WorkloadReferences
|
||||
}
|
||||
|
||||
// AddWorkloadReference to add a workload reference to this scope.
|
||||
func (hs *HealthScope) AddWorkloadReference(r corev1.ObjectReference) {
|
||||
hs.Spec.WorkloadReferences = append(hs.Spec.WorkloadReferences, r)
|
||||
}
|
||||
149
apis/core.oam.dev/v1alpha2/register.go
Normal file
149
apis/core.oam.dev/v1alpha2/register.go
Normal file
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
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 (
|
||||
"reflect"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"sigs.k8s.io/controller-runtime/pkg/scheme"
|
||||
)
|
||||
|
||||
// Package type metadata.
|
||||
const (
|
||||
Group = "core.oam.dev"
|
||||
Version = "v1alpha2"
|
||||
)
|
||||
|
||||
var (
|
||||
// SchemeGroupVersion is group version used to register these objects
|
||||
SchemeGroupVersion = schema.GroupVersion{Group: Group, Version: Version}
|
||||
|
||||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
|
||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||
)
|
||||
|
||||
// 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)
|
||||
)
|
||||
|
||||
// ScopeDefinition type metadata.
|
||||
var (
|
||||
ScopeDefinitionKind = reflect.TypeOf(ScopeDefinition{}).Name()
|
||||
ScopeDefinitionGroupKind = schema.GroupKind{Group: Group, Kind: ScopeDefinitionKind}.String()
|
||||
ScopeDefinitionKindAPIVersion = ScopeDefinitionKind + "." + SchemeGroupVersion.String()
|
||||
ScopeDefinitionGroupVersionKind = SchemeGroupVersion.WithKind(ScopeDefinitionKind)
|
||||
)
|
||||
|
||||
// Component type metadata.
|
||||
var (
|
||||
ComponentKind = reflect.TypeOf(Component{}).Name()
|
||||
ComponentGroupKind = schema.GroupKind{Group: Group, Kind: ComponentKind}.String()
|
||||
ComponentKindAPIVersion = ComponentKind + "." + SchemeGroupVersion.String()
|
||||
ComponentGroupVersionKind = SchemeGroupVersion.WithKind(ComponentKind)
|
||||
)
|
||||
|
||||
// ApplicationConfiguration type metadata.
|
||||
var (
|
||||
ApplicationConfigurationKind = reflect.TypeOf(ApplicationConfiguration{}).Name()
|
||||
ApplicationConfigurationGroupKind = schema.GroupKind{Group: Group, Kind: ApplicationConfigurationKind}.String()
|
||||
ApplicationConfigurationKindAPIVersion = ApplicationConfigurationKind + "." + SchemeGroupVersion.String()
|
||||
ApplicationConfigurationGroupVersionKind = SchemeGroupVersion.WithKind(ApplicationConfigurationKind)
|
||||
)
|
||||
|
||||
// ContainerizedWorkload type metadata.
|
||||
var (
|
||||
ContainerizedWorkloadKind = reflect.TypeOf(ContainerizedWorkload{}).Name()
|
||||
ContainerizedWorkloadGroupKind = schema.GroupKind{Group: Group, Kind: ContainerizedWorkloadKind}.String()
|
||||
ContainerizedWorkloadKindAPIVersion = ContainerizedWorkloadKind + "." + SchemeGroupVersion.String()
|
||||
ContainerizedWorkloadGroupVersionKind = SchemeGroupVersion.WithKind(ContainerizedWorkloadKind)
|
||||
)
|
||||
|
||||
// ManualScalerTrait type metadata.
|
||||
var (
|
||||
ManualScalerTraitKind = reflect.TypeOf(ManualScalerTrait{}).Name()
|
||||
ManualScalerTraitGroupKind = schema.GroupKind{Group: Group, Kind: ManualScalerTraitKind}.String()
|
||||
ManualScalerTraitKindAPIVersion = ManualScalerTraitKind + "." + SchemeGroupVersion.String()
|
||||
ManualScalerTraitGroupVersionKind = SchemeGroupVersion.WithKind(ManualScalerTraitKind)
|
||||
)
|
||||
|
||||
// HealthScope type metadata.
|
||||
var (
|
||||
HealthScopeKind = reflect.TypeOf(HealthScope{}).Name()
|
||||
HealthScopeGroupKind = schema.GroupKind{Group: Group, Kind: HealthScopeKind}.String()
|
||||
HealthScopeKindAPIVersion = HealthScopeKind + "." + SchemeGroupVersion.String()
|
||||
HealthScopeGroupVersionKind = SchemeGroupVersion.WithKind(HealthScopeKind)
|
||||
)
|
||||
|
||||
// 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)
|
||||
)
|
||||
|
||||
// AppRollout type metadata.
|
||||
var (
|
||||
AppRolloutKind = reflect.TypeOf(AppRollout{}).Name()
|
||||
AppRolloutGroupKind = schema.GroupKind{Group: Group, Kind: AppRolloutKind}.String()
|
||||
AppRolloutKindAPIVersion = ApplicationKind + "." + SchemeGroupVersion.String()
|
||||
AppRolloutKindVersionKind = SchemeGroupVersion.WithKind(AppRolloutKind)
|
||||
)
|
||||
|
||||
// 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)
|
||||
)
|
||||
|
||||
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(&AppRollout{}, &AppRolloutList{})
|
||||
SchemeBuilder.Register(&ApplicationRevision{}, &ApplicationRevisionList{})
|
||||
}
|
||||
2383
apis/core.oam.dev/v1alpha2/zz_generated.deepcopy.go
Normal file
2383
apis/core.oam.dev/v1alpha2/zz_generated.deepcopy.go
Normal file
File diff suppressed because it is too large
Load Diff
176
apis/core.oam.dev/v1beta1/appdeployment_types.go
Normal file
176
apis/core.oam.dev/v1beta1/appdeployment_types.go
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
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/condition"
|
||||
)
|
||||
|
||||
// AppDeploymentPhase defines the phase that the AppDeployment is undergoing.
|
||||
type AppDeploymentPhase string
|
||||
|
||||
const (
|
||||
// PhaseRolling is the phase when the AppDeployment is rolling live instances from old revisions to new ones.
|
||||
PhaseRolling AppDeploymentPhase = "Rolling"
|
||||
|
||||
// PhaseCompleted is the phase when the AppDeployment is done with reconciliation.
|
||||
PhaseCompleted AppDeploymentPhase = "Completed"
|
||||
|
||||
// PhaseFailed is the phase when the AppDeployment has failed in reconciliation due to unexpected conditions.
|
||||
PhaseFailed AppDeploymentPhase = "Failed"
|
||||
)
|
||||
|
||||
// HTTPMatchRequest specifies a set of criterion to be met in order for the
|
||||
// rule to be applied to the HTTP request. For example, the following
|
||||
// restricts the rule to match only requests where the URL path
|
||||
// starts with /ratings/v2/ and the request contains a custom `end-user` header
|
||||
// with value `jason`.
|
||||
type HTTPMatchRequest struct {
|
||||
// URI defines how to match with an URI.
|
||||
URI *URIMatch `json:"uri,omitempty"`
|
||||
}
|
||||
|
||||
// URIMatch defines the rules to match with an URI.
|
||||
type URIMatch struct {
|
||||
Prefix string `json:"prefix,omitempty"`
|
||||
}
|
||||
|
||||
// HTTPRule defines the rules to match and split http traffic across revisions.
|
||||
type HTTPRule struct {
|
||||
|
||||
// Match defines the conditions to be satisfied for the rule to be
|
||||
// activated. All conditions inside a single match block have AND
|
||||
// semantics, while the list of match blocks have OR semantics. The rule
|
||||
// is matched if any one of the match blocks succeed.
|
||||
Match []*HTTPMatchRequest `json:"match,omitempty"`
|
||||
|
||||
// WeightedTargets defines the revision targets to select and route traffic to.
|
||||
WeightedTargets []WeightedTarget `json:"weightedTargets,omitempty"`
|
||||
}
|
||||
|
||||
// WeightedTarget defines the revision target to select and route traffic to.
|
||||
type WeightedTarget struct {
|
||||
|
||||
// RevisionName is the name of the app revision.
|
||||
RevisionName string `json:"revisionName,omitempty"`
|
||||
|
||||
// ComponentName is the name of the component.
|
||||
// Note that it is the original component name in the Application. No need to append revision.
|
||||
ComponentName string `json:"componentName,omitempty"`
|
||||
|
||||
// Port is the port to route traffic towards.
|
||||
Port int `json:"port,omitempty"`
|
||||
|
||||
// Weight defines the proportion of traffic to be forwarded to the service
|
||||
// version. (0-100). Sum of weights across destinations SHOULD BE == 100.
|
||||
// If there is only one destination in a rule, the weight value is assumed to
|
||||
// be 100.
|
||||
Weight int `json:"weight,omitempty"`
|
||||
}
|
||||
|
||||
// Traffic defines the traffic rules to apply across revisions.
|
||||
type Traffic struct {
|
||||
// Hosts are the destination hosts to which traffic is being sent. Could
|
||||
// be a DNS name with wildcard prefix or an IP address.
|
||||
Hosts []string `json:"hosts,omitempty"`
|
||||
|
||||
// Gateways specifies the names of gateways that should apply these rules.
|
||||
// Gateways in other namespaces may be referred to by
|
||||
// `<gateway namespace>/<gateway name>`; specifying a gateway with no
|
||||
// namespace qualifier is the same as specifying the AppDeployment's namespace.
|
||||
Gateways []string `json:"gateways,omitempty"`
|
||||
|
||||
// HTTP defines the rules to match and split http traffoc across revisions.
|
||||
HTTP []HTTPRule `json:"http,omitempty"`
|
||||
}
|
||||
|
||||
// AppRevision specifies an AppRevision resource to and the rules to apply to it.
|
||||
type AppRevision struct {
|
||||
// RevisionName is the name of the AppRevision.
|
||||
RevisionName string `json:"revisionName,omitempty"`
|
||||
|
||||
// Placement defines the cluster placement rules for an app revision.
|
||||
Placement []common.ClusterPlacement `json:"placement,omitempty"`
|
||||
}
|
||||
|
||||
// ClusterPlacementStatus shows the placement results of a cluster.
|
||||
type ClusterPlacementStatus struct {
|
||||
// ClusterName indicates the name of the cluster to deploy apps to.
|
||||
// If empty, it indicates the host cluster per se.
|
||||
ClusterName string `json:"clusterName,omitempty"`
|
||||
|
||||
// Replicas indicates the replica number of an app revision to deploy to a cluster.
|
||||
Replicas int `json:"replicas,omitempty"`
|
||||
}
|
||||
|
||||
// PlacementStatus shows the cluster placement results of an app revision.
|
||||
type PlacementStatus struct {
|
||||
// RevisionName is the name of the AppRevision.
|
||||
RevisionName string `json:"revisionName,omitempty"`
|
||||
|
||||
// Clusters shows cluster placement results.
|
||||
Clusters []ClusterPlacementStatus `json:"clusters,omitempty"`
|
||||
}
|
||||
|
||||
// AppDeploymentSpec defines how to describe an upgrade between different apps
|
||||
type AppDeploymentSpec struct {
|
||||
|
||||
// Traffic defines the traffic rules to apply across revisions.
|
||||
Traffic *Traffic `json:"traffic,omitempty"`
|
||||
|
||||
// AppRevision specifies AppRevision resources to and the rules to apply to them.
|
||||
AppRevisions []AppRevision `json:"appRevisions,omitempty"`
|
||||
}
|
||||
|
||||
// AppDeploymentStatus defines the observed state of AppDeployment
|
||||
type AppDeploymentStatus struct {
|
||||
// Conditions represents the latest available observations of a CloneSet's current state.
|
||||
condition.ConditionedStatus `json:",inline"`
|
||||
|
||||
// Phase shows the phase that the AppDeployment is undergoing.
|
||||
// If Phase is Rolling, no update should be made to the spec.
|
||||
Phase AppDeploymentPhase `json:"phase,omitempty"`
|
||||
|
||||
// Placement shows the cluster placement results of the app revisions.
|
||||
Placement []PlacementStatus `json:"placement,omitempty"`
|
||||
}
|
||||
|
||||
// AppDeployment is the Schema for the AppDeployment API
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:resource:categories={oam},shortName=appdeploy
|
||||
// +kubebuilder:subresource:status
|
||||
// +genclient
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type AppDeployment struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec AppDeploymentSpec `json:"spec,omitempty"`
|
||||
Status AppDeploymentStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// AppDeploymentList contains a list of AppDeployment
|
||||
// +kubebuilder:object:root=true
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
type AppDeploymentList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []AppDeployment `json:"items"`
|
||||
}
|
||||
@@ -17,34 +17,56 @@
|
||||
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"
|
||||
|
||||
wfTypesv1alpha1 "github.com/kubevela/pkg/apis/oam/v1alpha1"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/condition"
|
||||
"github.com/oam-dev/kubevela/apis/standard.oam.dev/v1alpha1"
|
||||
)
|
||||
|
||||
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.
|
||||
// +optional
|
||||
Name string `json:"name,omitempty"`
|
||||
// Type is the type 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 struct {
|
||||
// Name is the unique name of the workflow step.
|
||||
Name string `json:"name"`
|
||||
|
||||
Type string `json:"type"`
|
||||
|
||||
// +kubebuilder:pruning:PreserveUnknownFields
|
||||
Properties *runtime.RawExtension `json:"properties,omitempty"`
|
||||
|
||||
DependsOn []string `json:"dependsOn,omitempty"`
|
||||
|
||||
Inputs common.StepInputs `json:"inputs,omitempty"`
|
||||
|
||||
Outputs common.StepOutputs `json:"outputs,omitempty"`
|
||||
}
|
||||
|
||||
// Workflow defines workflow steps and other attributes
|
||||
type Workflow struct {
|
||||
Ref string `json:"ref,omitempty"`
|
||||
Mode *wfTypesv1alpha1.WorkflowExecuteMode `json:"mode,omitempty"`
|
||||
Steps []wfTypesv1alpha1.WorkflowStep `json:"steps,omitempty"`
|
||||
Steps []WorkflowStep `json:"steps,omitempty"`
|
||||
}
|
||||
|
||||
// ApplicationSpec is the spec of Application
|
||||
@@ -62,6 +84,13 @@ type ApplicationSpec struct {
|
||||
// - 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
|
||||
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
@@ -69,7 +98,7 @@ type ApplicationSpec struct {
|
||||
// Application is the Schema for the applications API
|
||||
// +kubebuilder:storageversion
|
||||
// +kubebuilder:subresource:status
|
||||
// +kubebuilder:resource:categories={oam},shortName={app,velaapp}
|
||||
// +kubebuilder:resource:categories={oam},shortName=app
|
||||
// +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`
|
||||
@@ -115,36 +144,3 @@ func (app *Application) GetComponent(workloadType string) *common.ApplicationCom
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user