Compare commits

..

No commits in common. "main" and "v1.8.0-alpha.2" have entirely different histories.

579 changed files with 18199 additions and 70588 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1 +1 @@
**/node_modules/ node_modules

View File

@ -1,10 +0,0 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
[*.{js,json,yml}]
charset = utf-8
indent_style = space
indent_size = 2

View File

@ -9,8 +9,4 @@ packages/velaux-ui/src/assets/
.DS_Store .DS_Store
public public
*.d.ts *.d.ts
dist
pkg/

View File

@ -39,7 +39,7 @@ module.exports = {
}, },
], ],
'no-duplicate-imports': 'off', 'no-duplicate-imports': 'off',
"import/no-duplicates": "warn", '@typescript-eslint/no-duplicate-imports': 'warn',
'react/no-deprecated': 'off', 'react/no-deprecated': 'off',
'react/no-unknown-property': 'off', 'react/no-unknown-property': 'off',
'@typescript-eslint/explicit-member-accessibility': 'off', '@typescript-eslint/explicit-member-accessibility': 'off',

4
.gitattributes vendored
View File

@ -1,4 +0,0 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated

6
.github/CODEOWNERS vendored
View File

@ -1,7 +1,7 @@
# 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 # 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 @chivalryq * @barnettZQG @wonderflow
pkg @barnettZQG @chivalryq @wangyikewxgm @yangsoon @FogDong pkg @barnettZQG @yangsoon @FogDong
packages @barnettZQG @chivalryq packages @barnettZQG

View File

@ -1,11 +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: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

View File

@ -1,64 +0,0 @@
name: Arm64 Build Test
on:
push:
branches:
- main
- release-*
tags:
- v*
workflow_dispatch: { }
pull_request:
branches:
- main
- release-*
env:
# Common versions
GO_VERSION: '1.22.0'
permissions:
contents: read
jobs:
detect-noop:
runs-on: ubuntu-22.04
outputs:
noop: ${{ steps.noop.outputs.should_skip }}
steps:
- name: Detect No-op Changes
id: noop
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
continue-on-error: true
arm64-build-test:
runs-on: ubuntu-22.04
needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true'
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@5927c834f5b4fdf503fca6f4c7eccda82949e1ee
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4
- name: Build linux/arm64 image
id: docker_build_2
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c
with:
context: ./
build-args: |
GOPROXY=https://proxy.golang.org
file: ./Dockerfile
platforms: linux/arm64
push: false
tags: oamdev/velaux:latest

View File

@ -7,16 +7,16 @@ on:
jobs: jobs:
# align with crossplane's choice https://github.com/crossplane/crossplane/blob/master/.github/workflows/backport.yml # align with crossplane's choice https://github.com/crossplane/crossplane/blob/master/.github/workflows/backport.yml
open-pr: open-pr:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
if: github.event.pull_request.merged if: github.event.pull_request.merged
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Open Backport PR - name: Open Backport PR
uses: zeebe-io/backport-action@v0.0.9 uses: zeebe-io/backport-action@v0.0.6
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
github_workspace: ${{ github.workspace }} github_workspace: ${{ github.workspace }}

View File

@ -1,4 +1,4 @@
name: Static Check name: staticcheck
on: on:
push: push:
@ -12,43 +12,38 @@ on:
- release-* - release-*
env: env:
# Common versions # Common versions
GO_VERSION: '1.22.0' GO_VERSION: '1.19'
jobs: jobs:
detect-noop: detect-noop:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
outputs: outputs:
noop: ${{ steps.noop.outputs.should_skip }} noop: ${{ steps.noop.outputs.should_skip }}
steps: steps:
- name: Detect No-op Changes - name: Detect No-op Changes
id: noop id: noop
uses: fkirc/skip-duplicate-actions@v5.3.1 uses: fkirc/skip-duplicate-actions@v3.3.0
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]' paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]' do_not_skip: '["workflow_dispatch", "schedule", "push"]'
concurrent_skipping: false concurrent_skipping: false
check: build:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 - uses: actions/checkout@v2
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b - uses: actions/setup-node@v2
with: with:
node-version: '16' node-version: '16'
cache: 'yarn'
- name: Set up Go - name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
id: go id: go
- name: Install Yarn
run: npm install --global yarn
- name: upgrade yarn
run: yarn set version 3.6.0
- run: yarn install - run: yarn install
- run: yarn lint - run: yarn lint
name: Check Frontend Code Style name: Check Frontend Code Style
- run: yarn test - run: yarn test
- run: make check-diff - run: make check-diff
name: Check Server Code Style name: Check Server Code Style

View File

@ -24,18 +24,18 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 uses: actions/checkout@v3
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@v2
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
queries: +security-and-quality queries: +security-and-quality
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v3 uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v2
with: with:
category: "/language:${{ matrix.language }}" category: "/language:${{ matrix.language }}"

View File

@ -11,11 +11,9 @@ on:
jobs: jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
pull-requests: write
steps: steps:
- uses: thehanimo/pr-title-checker@v1.4.2 - uses: thehanimo/pr-title-checker@v1.3.1
with: with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
pass_on_octokit_error: true pass_on_octokit_error: true
configuration_path: '.github/pr-title-checker-config.json' configuration_path: ".github/pr-title-checker-config.json"

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout code - name: Checkout code
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 uses: actions/checkout@v2
- name: Build Vela Core image from Dockerfile - name: Build Vela Core image from Dockerfile
run: | run: |
@ -23,7 +23,7 @@ jobs:
output: 'trivy-results.sarif' output: 'trivy-results.sarif'
- name: Upload Trivy scan results to GitHub Security tab - name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3 uses: github/codeql-action/upload-sarif@v1
if: always() if: always()
with: with:
sarif_file: 'trivy-results.sarif' sarif_file: 'trivy-results.sarif'

View File

@ -5,53 +5,23 @@ on:
issue_comment: issue_comment:
types: [created] types: [created]
permissions:
contents: read
jobs: jobs:
bot:
runs-on: ubuntu-22.04
steps:
- name: Checkout Actions
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6
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: '16'
cache: 'npm'
cache-dependency-path: ./actions/package-lock.json
- name: Install Dependencies
run: npm ci --production --prefix ./actions
- name: Run Commands
uses: ./actions/commands
with:
token: ${{secrets.VELA_BOT_TOKEN}}
configPath: issue-commands
backport: backport:
runs-on: ubuntu-22.04 runs-on: ubuntu-18.04
if: github.event.issue.pull_request && contains(github.event.comment.body, '/backport') if: github.event.issue.pull_request && contains(github.event.comment.body, '/backport')
permissions:
contents: write
pull-requests: write
issues: write
steps: steps:
- name: Extract Command - name: Extract Command
id: command id: command
uses: xt0rted/slash-command-action@bf51f8f5f4ea3d58abc7eca58f77104182b23e88 uses: xt0rted/slash-command-action@v1
with: with:
repo-token: ${{ secrets.VELA_BOT_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
command: backport command: backport
reaction: "true" reaction: "true"
reaction-type: "eyes" reaction-type: "eyes"
allow-edits: "false" allow-edits: "false"
permission-level: read permission-level: read
- name: Handle Command - name: Handle Command
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea uses: actions/github-script@v4
env: env:
VERSION: ${{ steps.command.outputs.command-arguments }} VERSION: ${{ steps.command.outputs.command-arguments }}
with: with:
@ -63,7 +33,7 @@ jobs:
label = "backport " + version label = "backport " + version
} }
// Add our backport label. // Add our backport label.
github.rest.issues.addLabels({ github.issues.addLabels({
// Every pull request is an issue, but not every issue is a pull request. // Every pull request is an issue, but not every issue is a pull request.
issue_number: context.issue.number, issue_number: context.issue.number,
owner: context.repo.owner, owner: context.repo.owner,
@ -72,70 +42,11 @@ jobs:
}) })
console.log("Added '" + label + "' label.") console.log("Added '" + label + "' label.")
- name: Checkout - name: Checkout
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Open Backport PR - name: Open Backport PR
uses: zeebe-io/backport-action@v0.0.9 uses: zeebe-io/backport-action@v0.0.6
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
github_workspace: ${{ github.workspace }} 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
contents: 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 = ["staticcheck.yml", "server-test.yml", "arm64-build-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",
});

View File

@ -10,7 +10,7 @@ jobs:
build: build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 - uses: actions/checkout@v2
- name: Get the version - name: Get the version
id: get_version id: get_version
run: | run: |
@ -19,24 +19,25 @@ jobs:
VERSION=latest VERSION=latest
fi fi
echo ::set-output name=VERSION::${VERSION} 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 DockerHub - name: Login to DockerHub
uses: docker/login-action@v3.2.0 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-qemu-action@v3.1.0 - name: Login to Aliyun Container Registry (ACR)
- uses: docker/setup-buildx-action@v3.4.0 uses: docker/login-action@v1
with:
registry: acr.kubevela.net
username: "${{ secrets.ACR_USERNAME }}"
password: "${{ secrets.ACR_PASSWORD }}"
- uses: docker/setup-qemu-action@v1
- uses: docker/setup-buildx-action@v1
with: with:
driver-opts: image=moby/buildkit:master driver-opts: image=moby/buildkit:master
- name: Build docker image - name: Build docker image
id: acr_build id: acr_build
uses: docker/build-push-action@v6.3.0 uses: docker/build-push-action@v2
with: with:
context: ./ context: ./
file: ./Dockerfile file: ./Dockerfile
@ -45,6 +46,6 @@ jobs:
build-args: | build-args: |
GITVERSION=git-${{ steps.vars.outputs.git_revision }} GITVERSION=git-${{ steps.vars.outputs.git_revision }}
VERSION=${{ steps.get_version.outputs.VERSION }} VERSION=${{ steps.get_version.outputs.VERSION }}
GOPROXY=https://proxy.golang.org
tags: |- tags: |-
acr.kubevela.net/oamdev/velaux:${{ steps.get_version.outputs.VERSION }}
oamdev/velaux:${{ steps.get_version.outputs.VERSION }} oamdev/velaux:${{ steps.get_version.outputs.VERSION }}

View File

@ -15,7 +15,7 @@ on:
env: env:
# Common versions # Common versions
GO_VERSION: '1.22.0' GO_VERSION: '1.19'
permissions: permissions:
contents: read contents: read
@ -23,13 +23,13 @@ permissions:
jobs: jobs:
detect-noop: detect-noop:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
outputs: outputs:
noop: ${{ steps.noop.outputs.should_skip }} noop: ${{ steps.noop.outputs.should_skip }}
steps: steps:
- name: Detect No-op Changes - name: Detect No-op Changes
id: noop id: noop
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf uses: fkirc/skip-duplicate-actions@12aca0a884f6137d619d6a8a09fcc3406ced5281
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]' paths_ignore: '["**.md", "**.mdx", "**.png", "**.jpg"]'
@ -37,24 +37,24 @@ jobs:
continue-on-error: true continue-on-error: true
server-unit-tests: server-unit-tests:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
needs: detect-noop needs: detect-noop
if: needs.detect-noop.outputs.noop != 'true' if: needs.detect-noop.outputs.noop != 'true'
steps: steps:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
submodules: true submodules: true
- name: Cache Go Dependencies - name: Cache Go Dependencies
uses: actions/cache@v4 uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812
with: with:
path: .work/pkg path: .work/pkg
key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-pkg-${{ hashFiles('**/go.sum') }}
@ -66,32 +66,18 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install -y golang-ginkgo-dev sudo apt-get install -y golang-ginkgo-dev
- name : Set up MySQL
uses: mirromutth/mysql-action@v1.1
with:
mysql database: 'kubevela'
mysql root password: 'kubevelaSQL123'
- name: Set up Postgres
uses: Harmon758/postgresql-action@v1
with:
postgresql version: '11'
postgresql db: 'kubevela'
postgresql user: 'kubevela'
postgresql password: 'Kubevela-123'
- name: Start MongoDB - name: Start MongoDB
uses: supercharge/mongodb-github-action@5a87bd81f88e2a8b195f8b7b656f5cda1350815a # 1.11.0 uses: supercharge/mongodb-github-action@d26215f71b2ce60420a2a3776a25893d11a65f85 # 1.9.0
with: with:
mongodb-version: '5.0' mongodb-version: '5.0'
# TODO need update action version to resolve node 12 deprecated. # TODO need update action version to resolve node 12 deprecated.
- name: install Kubebuilder - name: install Kubebuilder
uses: RyanSiu1995/kubebuilder-action@e7e4de1c1eaf1d089b9a186f7526239acadf0b40 uses: RyanSiu1995/kubebuilder-action@ff52bff1bae252239223476e5ab0d71d6ba02343
with: with:
version: 3.1.0 version: 3.1.0
kubebuilderOnly: false kubebuilderOnly: false
kubernetesVersion: v1.26.0 kubernetesVersion: v1.21.2
- name: Run api server unit test - name: Run api server unit test
run: make unit-test-server run: make unit-test-server
@ -105,35 +91,33 @@ jobs:
name: codecov-umbrella name: codecov-umbrella
server-e2e-tests: server-e2e-tests:
runs-on: ubuntu-22.04 runs-on: ubuntu-20.04
needs: [ detect-noop ] needs: [ detect-noop ]
if: needs.detect-noop.outputs.noop != 'true' if: needs.detect-noop.outputs.noop != 'true'
strategy: strategy:
matrix: matrix:
k8s-version: ["v1.26"] k8s-version: ["v1.20","v1.24"]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }} group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.k8s-version }}
cancel-in-progress: true cancel-in-progress: true
steps: steps:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568
with: with:
go-version: ${{ env.GO_VERSION }} go-version: ${{ env.GO_VERSION }}
id: go id: go
- name: Check out code into the Go module directory - name: Check out code into the Go module directory
uses: actions/checkout@6ccd57f4c5d15bdc2fef309bd9fb6cc9db2ef1c6 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
submodules: true submodules: true
- name: Build docker image - name: Build docker image
id: docker_build id: docker_build
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c uses: docker/build-push-action@v2
with: with:
context: ./ context: ./
build-args: | file: ./Dockerfile
GOPROXY=https://proxy.golang.org
file: ./Dockerfile.e2e
platforms: linux/amd64 platforms: linux/amd64
push: false push: false
tags: oamdev/velaux:latest tags: oamdev/velaux:latest
@ -146,7 +130,7 @@ jobs:
- name: Calculate K3d args - name: Calculate K3d args
run: | run: |
EGRESS_ARG="" EGRESS_ARG=""
if [[ "${{ matrix.k8s-version }}" == v1.26 ]]; then if [[ "${{ matrix.k8s-version }}" == v1.24 ]]; then
EGRESS_ARG="--k3s-arg --egress-selector-mode=disabled@server:0" EGRESS_ARG="--k3s-arg --egress-selector-mode=disabled@server:0"
fi fi
echo "EGRESS_ARG=${EGRESS_ARG}" >> $GITHUB_ENV echo "EGRESS_ARG=${EGRESS_ARG}" >> $GITHUB_ENV
@ -178,22 +162,17 @@ jobs:
make e2e-setup-core make e2e-setup-core
make start-addon-mock-server make start-addon-mock-server
make load-image make load-image
make enable-addon-no-replicas make enable-addon
- name: Run server e2e test - name: Run server e2e test
run: | run: |
export ALIYUN_ACCESS_KEY_ID=${{ secrets.ALIYUN_ACCESS_KEY_ID }} export ALIYUN_ACCESS_KEY_ID=${{ secrets.ALIYUN_ACCESS_KEY_ID }}
export ALIYUN_ACCESS_KEY_SECRET=${{ secrets.ALIYUN_ACCESS_KEY_SECRET }} export ALIYUN_ACCESS_KEY_SECRET=${{ secrets.ALIYUN_ACCESS_KEY_SECRET }}
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
docker run --rm -v `pwd`/e2e-plugins:/plugins oamdev/velaux:latest cp -r -a /app/velaux/plugins/ /plugins/
make e2e-server-test make e2e-server-test
- name: Test addon enable
run: |
make enable-addon
- name: Upload coverage report - name: Upload coverage report
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with: with:
token: ${{ secrets.CODECOV_TOKEN }} token: ${{ secrets.CODECOV_TOKEN }}
files: /tmp/e2e_apiserver_test.out files: /tmp/e2e_apiserver_test.out
@ -202,3 +181,16 @@ jobs:
- name: Clean e2e profile - name: Clean e2e profile
run: rm /tmp/e2e_apiserver_test.out run: rm /tmp/e2e_apiserver_test.out
- uses: docker/setup-buildx-action@v1
with:
driver-opts: image=moby/buildkit:master
- name: Build linux/arm64 image
id: docker_build_2
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
platforms: linux/arm64
push: false
tags: oamdev/velaux:latest

17
.gitignore vendored
View File

@ -28,19 +28,4 @@ package-lock.json
yarn-error.log yarn-error.log
.DS_Store .DS_Store
dist dist
/packages/**/compiled
.yarn/.cache/
.yarn/cache/
.yarn/unplugged
.yarn/install-state.gz
.pnp.*
tsconfig.tsbuildinfo
e2e-plugins
npm-artifacts
bin

View File

@ -1,226 +0,0 @@
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)`;
# default is false: such cases aren't reported by default.
check-type-assertions: false
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
# 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
revive:
# minimal confidence for issues, default is 0.8
min-confidence: 0.8
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
goimports:
# put imports beginning with prefix after 3rd-party packages;
# it's a comma-separated list of prefixes
local-prefixes: github.com/kubevela/velaux
gocyclo:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
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
threshold: 100
goconst:
# minimal length of string constant, 3 by default
min-len: 3
# minimal occurrences count to trigger, 3 by default
min-occurrences: 5
lll:
# 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:
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
# with golangci-lint call it on a directory with the changed file.
check-exported: false
nakedret:
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
max-func-lines: 30
gocritic:
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
enabled-tags:
- performance
settings: # settings passed to gocritic
captLocal: # must be valid enabled check name
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
makezero:
# Allow only slices initialized with a length of zero. Default is false.
always: false
linters:
enable:
- megacheck
- govet
- gocyclo
- gocritic
- goconst
- goimports
- gofmt # We enable this as well as goimports for its simplify mode.
- revive
- unconvert
- misspell
- nakedret
- exportloopref
disable:
- deadcode
- scopelint
- structcheck
- varcheck
- rowserrcheck
- sqlclosecheck
- errchkjson
- contextcheck
presets:
- bugs
- unused
fast: false
issues:
# Excluding configuration per-path and per-linter
exclude-rules:
# Exclude some linters from running on tests files.
- path: _test(ing)?\.go
linters:
- gocyclo
- errcheck
- dupl
- gosec
- exportloopref
- unparam
# Ease some gocritic warnings on test files.
- path: _test\.go
text: "(unnamedResult|exitAfterDefer)"
linters:
- gocritic
# 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.
- text: "(hugeParam|rangeValCopy):"
linters:
- gocritic
# This "TestMain should call os.Exit to set exit code" warning is not clever
# enough to notice that we call a helper method that calls os.Exit.
- text: "SA3000:"
linters:
- staticcheck
- text: "k8s.io/api/core/v1"
linters:
- goimports
# This is a "potential hardcoded credentials" warning. It's triggered by
# any variable with 'secret' in the same, and thus hits a lot of false
# positives in Kubernetes land where a Secret is an object type.
- text: "G101:"
linters:
- gosec
- gas
# This is an 'errors unhandled' warning that duplicates errcheck.
- text: "G104:"
linters:
- gosec
- gas
# The Azure AddToUserAgent method appends to the existing user agent string.
# It returns an error if you pass it an empty string lettinga you know the
# user agent did not change, making it more of a warning.
- text: \.AddToUserAgent
linters:
- errcheck
- 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
# Independently from option `exclude` we use default exclude patterns,
# it can be disabled by this option. To list all
# excluded by default patterns execute `golangci-lint run --help`.
# Default value for this option is true.
exclude-use-default: false
# Show only new issues: if there are unstaged changes or untracked files,
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
# It's a super-useful option for integration of golangci-lint into existing
# large codebase. It's not practical to fix all existing issues at the moment
# of integration: much better don't allow issues in new code.
# Default is false.
new: false
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-per-linter: 0
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

File diff suppressed because one or more lines are too long

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint
require(absPnpApiPath).setup();
}
}
// Defer to the real eslint your application uses
module.exports = absRequire(`eslint`);

View File

@ -1,6 +0,0 @@
{
"name": "eslint",
"version": "8.34.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
}

View File

@ -1,5 +0,0 @@
# This file is automatically generated by @yarnpkg/sdks.
# Manual changes might be lost!
integrations:
- vscode

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require prettier/index.js
require(absPnpApiPath).setup();
}
}
// Defer to the real prettier/index.js your application uses
module.exports = absRequire(`prettier/index.js`);

View File

@ -1,6 +0,0 @@
{
"name": "prettier",
"version": "2.8.7-sdk",
"main": "./index.js",
"type": "commonjs"
}

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsc
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/bin/tsc your application uses
module.exports = absRequire(`typescript/bin/tsc`);

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/bin/tsserver
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/bin/tsserver your application uses
module.exports = absRequire(`typescript/bin/tsserver`);

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsc.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsc.js your application uses
module.exports = absRequire(`typescript/lib/tsc.js`);

View File

@ -1,225 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const moduleWrapper = tsserver => {
if (!process.versions.pnp) {
return tsserver;
}
const {isAbsolute} = require(`path`);
const pnpApi = require(`pnpapi`);
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
const isPortal = str => str.startsWith("portal:/");
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
return `${locator.name}@${locator.reference}`;
}));
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
// doesn't understand. This layer makes sure to remove the protocol
// before forwarding it to TS, and to add it back on all returned paths.
function toEditorPath(str) {
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
// We also take the opportunity to turn virtual paths into physical ones;
// this makes it much easier to work with workspaces that list peer
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
// file instances instead of the real ones.
//
// We only do this to modules owned by the the dependency tree roots.
// This avoids breaking the resolution when jumping inside a vendor
// with peer dep (otherwise jumping into react-dom would show resolution
// errors on react).
//
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
if (resolved) {
const locator = pnpApi.findPackageLocator(resolved);
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
str = resolved;
}
}
str = normalize(str);
if (str.match(/\.zip\//)) {
switch (hostInfo) {
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
// VSCode only adds it automatically for supported schemes,
// so we have to do it manually for the `zip` scheme.
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
//
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
//
// 2021-10-08: VSCode changed the format in 1.61.
// Before | ^zip:/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
// 2022-04-06: VSCode changed the format in 1.66.
// Before | ^/zip//c:/foo/bar.zip/package.json
// After | ^/zip/c:/foo/bar.zip/package.json
//
// 2022-05-06: VSCode changed the format in 1.68
// Before | ^/zip/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
case `vscode <1.61`: {
str = `^zip:${str}`;
} break;
case `vscode <1.66`: {
str = `^/zip/${str}`;
} break;
case `vscode <1.68`: {
str = `^/zip${str}`;
} break;
case `vscode`: {
str = `^/zip/${str}`;
} break;
// To make "go to definition" work,
// We have to resolve the actual file system path from virtual path
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
case `coc-nvim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = resolve(`zipfile:${str}`);
} break;
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
// We have to resolve the actual file system path from virtual path,
// everything else is up to neovim
case `neovim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = `zipfile://${str}`;
} break;
default: {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}
return str;
}
function fromEditorPath(str) {
switch (hostInfo) {
case `coc-nvim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
// So in order to convert it back, we use .* to match all the thing
// before `zipfile:`
return process.platform === `win32`
? str.replace(/^.*zipfile:\//, ``)
: str.replace(/^.*zipfile:/, ``);
} break;
case `neovim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
return str.replace(/^zipfile:\/\//, ``);
} break;
case `vscode`:
default: {
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
} break;
}
}
// Force enable 'allowLocalPluginLoads'
// TypeScript tries to resolve plugins using a path relative to itself
// which doesn't work when using the global cache
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
// TypeScript already does local loads and if this code is running the user trusts the workspace
// https://github.com/microsoft/vscode/issues/45856
const ConfiguredProject = tsserver.server.ConfiguredProject;
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
this.projectService.allowLocalPluginLoads = true;
return originalEnablePluginsWithOptions.apply(this, arguments);
};
// And here is the point where we hijack the VSCode <-> TS communications
// by adding ourselves in the middle. We locate everything that looks
// like an absolute path of ours and normalize it.
const Session = tsserver.server.Session;
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
let hostInfo = `unknown`;
Object.assign(Session.prototype, {
onMessage(/** @type {string | object} */ message) {
const isStringMessage = typeof message === 'string';
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
if (
parsedMessage != null &&
typeof parsedMessage === `object` &&
parsedMessage.arguments &&
typeof parsedMessage.arguments.hostInfo === `string`
) {
hostInfo = parsedMessage.arguments.hostInfo;
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
// The RegExp from https://semver.org/ but without the caret at the start
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
) ?? []).map(Number)
if (major === 1) {
if (minor < 61) {
hostInfo += ` <1.61`;
} else if (minor < 66) {
hostInfo += ` <1.66`;
} else if (minor < 68) {
hostInfo += ` <1.68`;
}
}
}
}
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
return typeof value === 'string' ? fromEditorPath(value) : value;
});
return originalOnMessage.call(
this,
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
);
},
send(/** @type {any} */ msg) {
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
return typeof value === `string` ? toEditorPath(value) : value;
})));
}
});
return tsserver;
};
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserver.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsserver.js your application uses
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserver.js`));

View File

@ -1,225 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
const moduleWrapper = tsserver => {
if (!process.versions.pnp) {
return tsserver;
}
const {isAbsolute} = require(`path`);
const pnpApi = require(`pnpapi`);
const isVirtual = str => str.match(/\/(\$\$virtual|__virtual__)\//);
const isPortal = str => str.startsWith("portal:/");
const normalize = str => str.replace(/\\/g, `/`).replace(/^\/?/, `/`);
const dependencyTreeRoots = new Set(pnpApi.getDependencyTreeRoots().map(locator => {
return `${locator.name}@${locator.reference}`;
}));
// VSCode sends the zip paths to TS using the "zip://" prefix, that TS
// doesn't understand. This layer makes sure to remove the protocol
// before forwarding it to TS, and to add it back on all returned paths.
function toEditorPath(str) {
// We add the `zip:` prefix to both `.zip/` paths and virtual paths
if (isAbsolute(str) && !str.match(/^\^?(zip:|\/zip\/)/) && (str.match(/\.zip\//) || isVirtual(str))) {
// We also take the opportunity to turn virtual paths into physical ones;
// this makes it much easier to work with workspaces that list peer
// dependencies, since otherwise Ctrl+Click would bring us to the virtual
// file instances instead of the real ones.
//
// We only do this to modules owned by the the dependency tree roots.
// This avoids breaking the resolution when jumping inside a vendor
// with peer dep (otherwise jumping into react-dom would show resolution
// errors on react).
//
const resolved = isVirtual(str) ? pnpApi.resolveVirtual(str) : str;
if (resolved) {
const locator = pnpApi.findPackageLocator(resolved);
if (locator && (dependencyTreeRoots.has(`${locator.name}@${locator.reference}`) || isPortal(locator.reference))) {
str = resolved;
}
}
str = normalize(str);
if (str.match(/\.zip\//)) {
switch (hostInfo) {
// Absolute VSCode `Uri.fsPath`s need to start with a slash.
// VSCode only adds it automatically for supported schemes,
// so we have to do it manually for the `zip` scheme.
// The path needs to start with a caret otherwise VSCode doesn't handle the protocol
//
// Ref: https://github.com/microsoft/vscode/issues/105014#issuecomment-686760910
//
// 2021-10-08: VSCode changed the format in 1.61.
// Before | ^zip:/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
// 2022-04-06: VSCode changed the format in 1.66.
// Before | ^/zip//c:/foo/bar.zip/package.json
// After | ^/zip/c:/foo/bar.zip/package.json
//
// 2022-05-06: VSCode changed the format in 1.68
// Before | ^/zip/c:/foo/bar.zip/package.json
// After | ^/zip//c:/foo/bar.zip/package.json
//
case `vscode <1.61`: {
str = `^zip:${str}`;
} break;
case `vscode <1.66`: {
str = `^/zip/${str}`;
} break;
case `vscode <1.68`: {
str = `^/zip${str}`;
} break;
case `vscode`: {
str = `^/zip/${str}`;
} break;
// To make "go to definition" work,
// We have to resolve the actual file system path from virtual path
// and convert scheme to supported by [vim-rzip](https://github.com/lbrayner/vim-rzip)
case `coc-nvim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = resolve(`zipfile:${str}`);
} break;
// Support neovim native LSP and [typescript-language-server](https://github.com/theia-ide/typescript-language-server)
// We have to resolve the actual file system path from virtual path,
// everything else is up to neovim
case `neovim`: {
str = normalize(resolved).replace(/\.zip\//, `.zip::`);
str = `zipfile://${str}`;
} break;
default: {
str = `zip:${str}`;
} break;
}
} else {
str = str.replace(/^\/?/, process.platform === `win32` ? `` : `/`);
}
}
return str;
}
function fromEditorPath(str) {
switch (hostInfo) {
case `coc-nvim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for coc-nvim is in format of /<pwd>/zipfile:/<pwd>/.yarn/...
// So in order to convert it back, we use .* to match all the thing
// before `zipfile:`
return process.platform === `win32`
? str.replace(/^.*zipfile:\//, ``)
: str.replace(/^.*zipfile:/, ``);
} break;
case `neovim`: {
str = str.replace(/\.zip::/, `.zip/`);
// The path for neovim is in format of zipfile:///<pwd>/.yarn/...
return str.replace(/^zipfile:\/\//, ``);
} break;
case `vscode`:
default: {
return str.replace(/^\^?(zip:|\/zip(\/ts-nul-authority)?)\/+/, process.platform === `win32` ? `` : `/`)
} break;
}
}
// Force enable 'allowLocalPluginLoads'
// TypeScript tries to resolve plugins using a path relative to itself
// which doesn't work when using the global cache
// https://github.com/microsoft/TypeScript/blob/1b57a0395e0bff191581c9606aab92832001de62/src/server/project.ts#L2238
// VSCode doesn't want to enable 'allowLocalPluginLoads' due to security concerns but
// TypeScript already does local loads and if this code is running the user trusts the workspace
// https://github.com/microsoft/vscode/issues/45856
const ConfiguredProject = tsserver.server.ConfiguredProject;
const {enablePluginsWithOptions: originalEnablePluginsWithOptions} = ConfiguredProject.prototype;
ConfiguredProject.prototype.enablePluginsWithOptions = function() {
this.projectService.allowLocalPluginLoads = true;
return originalEnablePluginsWithOptions.apply(this, arguments);
};
// And here is the point where we hijack the VSCode <-> TS communications
// by adding ourselves in the middle. We locate everything that looks
// like an absolute path of ours and normalize it.
const Session = tsserver.server.Session;
const {onMessage: originalOnMessage, send: originalSend} = Session.prototype;
let hostInfo = `unknown`;
Object.assign(Session.prototype, {
onMessage(/** @type {string | object} */ message) {
const isStringMessage = typeof message === 'string';
const parsedMessage = isStringMessage ? JSON.parse(message) : message;
if (
parsedMessage != null &&
typeof parsedMessage === `object` &&
parsedMessage.arguments &&
typeof parsedMessage.arguments.hostInfo === `string`
) {
hostInfo = parsedMessage.arguments.hostInfo;
if (hostInfo === `vscode` && process.env.VSCODE_IPC_HOOK) {
const [, major, minor] = (process.env.VSCODE_IPC_HOOK.match(
// The RegExp from https://semver.org/ but without the caret at the start
/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
) ?? []).map(Number)
if (major === 1) {
if (minor < 61) {
hostInfo += ` <1.61`;
} else if (minor < 66) {
hostInfo += ` <1.66`;
} else if (minor < 68) {
hostInfo += ` <1.68`;
}
}
}
}
const processedMessageJSON = JSON.stringify(parsedMessage, (key, value) => {
return typeof value === 'string' ? fromEditorPath(value) : value;
});
return originalOnMessage.call(
this,
isStringMessage ? processedMessageJSON : JSON.parse(processedMessageJSON)
);
},
send(/** @type {any} */ msg) {
return originalSend.call(this, JSON.parse(JSON.stringify(msg, (key, value) => {
return typeof value === `string` ? toEditorPath(value) : value;
})));
}
});
return tsserver;
};
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/tsserverlibrary.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/tsserverlibrary.js your application uses
module.exports = moduleWrapper(absRequire(`typescript/lib/tsserverlibrary.js`));

View File

@ -1,20 +0,0 @@
#!/usr/bin/env node
const {existsSync} = require(`fs`);
const {createRequire} = require(`module`);
const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = createRequire(absPnpApiPath);
if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require typescript/lib/typescript.js
require(absPnpApiPath).setup();
}
}
// Defer to the real typescript/lib/typescript.js your application uses
module.exports = absRequire(`typescript/lib/typescript.js`);

View File

@ -1,6 +0,0 @@
{
"name": "typescript",
"version": "4.4.4-sdk",
"main": "./lib/typescript.js",
"type": "commonjs"
}

View File

@ -1,3 +0,0 @@
nodeLinker: pnp
yarnPath: .yarn/releases/yarn-3.6.0.cjs

View File

@ -5,8 +5,7 @@ ARG VERSION
WORKDIR /app/velaux WORKDIR /app/velaux
ADD . . ADD . .
ENV VERSION=${VERSION} ENV VERSION=${VERSION}
RUN apk add --no-cache git make clang build-base python3 RUN apk add --no-cache git && yarn install && yarn build
RUN yarn install && yarn build
# Build the manager binary # Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as server-builder FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as server-builder
@ -33,15 +32,17 @@ 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}" \ 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/server/main.go -o apiserver-${TARGETARCH} cmd/server/main.go
FROM ${BASE_IMAGE:-alpine@sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501} FROM ${BASE_IMAGE:-alpine:3.15@sha256:cf34c62ee8eb3fe8aa24c1fab45d7e9d12768d945c3f5a6fd6a63d901e898479}
# This is required by daemon connecting with cri # This is required by daemon connecting with cri
RUN apk add --no-cache ca-certificates bash expat RUN apk add --no-cache ca-certificates bash expat openssl-dev
WORKDIR /app/velaux WORKDIR /
ARG TARGETARCH ARG TARGETARCH
ENV PATH=$PATH:/app/velaux COPY --from=server-builder /workspace/apiserver-${TARGETARCH} /velaux/server
COPY --from=server-builder /workspace/apiserver-${TARGETARCH} /app/velaux/server COPY --from=ui-builder /app/velaux/public /velaux/public
COPY --from=ui-builder /app/velaux/public /app/velaux/public COPY entrypoint.sh /usr/local/bin/
ENTRYPOINT ["entrypoint.sh"]
CMD ["server"] CMD ["server"]

View File

@ -1,49 +0,0 @@
ARG BASE_IMAGE
FROM node:16-alpine as ui-builder
ARG VERSION
WORKDIR /app/velaux
ADD . .
ENV VERSION=${VERSION}
RUN apk add --no-cache git
RUN yarn install && yarn build && yarn packages:plugins
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as server-builder
ARG GOPROXY
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source for building server
COPY cmd/server/ cmd/server/
COPY pkg/ pkg/
# Build
ARG TARGETARCH
ARG VERSION
ARG GITVERSION
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
-o apiserver-${TARGETARCH} cmd/server/main.go
FROM ${BASE_IMAGE:-alpine@sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501}
# This is required by daemon connecting with cri
RUN apk add --no-cache ca-certificates bash expat
WORKDIR /app/velaux
ARG TARGETARCH
ENV PATH=$PATH:/app/velaux
COPY --from=server-builder /workspace/apiserver-${TARGETARCH} /app/velaux/server
COPY --from=ui-builder /app/velaux/public /app/velaux/public
COPY --from=ui-builder /app/velaux/plugins/app-demo/dist /app/velaux/plugins/app-demo
COPY --from=ui-builder /app/velaux/plugins/node-dashboard/dist /app/velaux/plugins/node-dashboard
CMD ["server"]

View File

@ -1,38 +1,9 @@
ARG BASE_IMAG FROM nginx:1.23
# Build the manager binary
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.19-alpine@sha256:2381c1e5f8350a901597d633b2e517775eeac7a6682be39225a93b22cfd0f8bb as server-builder
ARG GOPROXY
ENV GOPROXY=${GOPROXY:-https://goproxy.cn}
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
COPY vendor vendor
# Copy the go source for building server COPY build /usr/share/nginx/html
COPY cmd/server/ cmd/server/ COPY web.conf /etc/nginx/nginx.conf
COPY pkg/ pkg/ COPY entrypoint.sh /entrypoint.sh
ENV KUBEVELA_API_URL="127.0.0.1:8000"
# Build ENV DEX_URL="127.0.0.1:5556"
ARG TARGETARCH ENTRYPOINT ["/entrypoint.sh"]
ARG VERSION CMD ["nginx", "-g", "daemon off;"]
ARG GITVERSION
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} \
go build -a -ldflags "-s -w -X github.com/oam-dev/kubevela/version.VelaVersion=${VERSION:-undefined} -X github.com/oam-dev/kubevela/version.GitRevision=${GITVERSION:-undefined}" \
-o apiserver-${TARGETARCH} cmd/server/main.go
FROM ${BASE_IMAGE:-alpine@sha256:e2e16842c9b54d985bf1ef9242a313f36b856181f188de21313820e177002501}
# This is required by daemon connecting with cri
RUN apk add --no-cache ca-certificates bash expat
WORKDIR /app/velaux
ARG TARGETARCH
ENV PATH=$PATH:/app/velaux
COPY --from=server-builder /workspace/apiserver-${TARGETARCH} /app/velaux/server
COPY ./public /app/velaux/public
CMD ["server"]

View File

@ -1,7 +1,30 @@
include makefiles/const.mk GOLANGCILINT_VERSION ?= 1.49.0
include makefiles/build.mk
all: docker-build # 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
GLOBAL_GOLANGCILINT := $(shell which golangci-lint)
GOBIN_GOLANGCILINT:= $(shell which $(GOBIN)/golangci-lint)
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}[INFO]${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)
.PHONY: golangci .PHONY: golangci
golangci: golangci:
@ -27,7 +50,7 @@ ifeq (, $(shell which staticcheck))
@{ \ @{ \
set -e ;\ set -e ;\
echo 'installing honnef.co/go/tools/cmd/staticcheck ' ;\ echo 'installing honnef.co/go/tools/cmd/staticcheck ' ;\
go install honnef.co/go/tools/cmd/staticcheck@v0.4.7 ;\ go install honnef.co/go/tools/cmd/staticcheck@d7e217c1ff411395475b2971c0824e1e7cc1af98 ;\
} }
STATICCHECK=$(GOBIN)/staticcheck STATICCHECK=$(GOBIN)/staticcheck
else else
@ -51,9 +74,9 @@ e2e-setup-core: install-vela install-core install-addon
.PHONY: install-vela .PHONY: install-vela
install-vela: install-vela:
curl -fsSl https://kubevela.io/script/install.sh | bash -s v1.9.0-alpha.3 curl -fsSl https://kubevela.io/script/install.sh | bash
install-core: install-core:
vela install -v v1.9.0-alpha.2 -y vela install -y
install-addon: install-addon:
vela addon enable fluxcd vela addon enable fluxcd
vela addon enable vela-workflow --override-definitions vela addon enable vela-workflow --override-definitions
@ -67,11 +90,8 @@ start-addon-mock-server:
load-image: load-image:
k3d image import oamdev/velaux:latest || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; } k3d image import oamdev/velaux:latest || { echo >&2 "kind not installed or error loading image: $(VELA_CORE_TEST_IMAGE)"; exit 1; }
enable-addon-no-replicas:
vela addon enable ./addon replicas=0
enable-addon: enable-addon:
vela addon enable ./addon vela addon enable ./addon
.PHONY: e2e-server-test .PHONY: e2e-server-test
e2e-server-test: e2e-server-test:
@ -81,16 +101,6 @@ e2e-server-test:
unit-test-server: unit-test-server:
go test -gcflags=all=-l -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/...) go test -gcflags=all=-l -coverprofile=coverage.txt $(shell go list ./pkg/... ./cmd/...)
setup-test-server:
curl -L -o kubebuilder https://go.kubebuilder.io/dl/latest/$(shell go env GOOS)/$(shell go env GOARCH)
chmod +x kubebuilder
sudo mv kubebuilder /usr/local/bin/
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
${eval OUTPUT = $(shell ${GOBIN}/setup-envtest --bin-dir /tmp use)}
${eval BIN_PATH=$(lastword $(subst Path:, ,${OUTPUT}))}
sudo mkdir -p /usr/local/kubebuilder/bin
sudo mv ${BIN_PATH}/* /usr/local/kubebuilder/bin
build-swagger: build-swagger:
go run ./cmd/server/main.go build-swagger ./docs/apidoc/swagger.json go run ./cmd/server/main.go build-swagger ./docs/apidoc/swagger.json
@ -120,12 +130,4 @@ check-diff: reviewable
@$(OK) branch is clean @$(OK) branch is clean
run-server: run-server:
go run ./cmd/server/main.go go run ./cmd/server/main.go
build-ui:
@$(INFO) Building UI
yarn build
build-test-image: build-ui
@$(INFO) Building image
docker build -t velaux:latest -f Dockerfile.local .

View File

@ -5,27 +5,19 @@
## Overview ## Overview
[VelaUX](https://github.com/kubevela/velaux) is a web portal for KubeVela end users, and also functions as an opinionated application delivery platform. Additionally, it operates as a highly adaptable plugin framework, empowering developers to create bespoke plugins and smoothly integrate them into the KubeVela platform. This approach delivers unparalleled flexibility and customization options for scaling up the platform's capabilities. The [KubeVela](https://github.com/oam-dev/kubevela) User Experience (UX) Dashboard. Designed as an extensible, application-oriented delivery platform.
### Highlights
*Customizable User Interface*: With VelaUX, enterprises can tailor the user interface to their specific needs for managing applications and infrastructure. This feature leads to a more intuitive and efficient user experience, resulting in increased productivity and better resource utilization.
*Easy Integration*: VelaUX is designed for seamless integration with the KubeVela platform, simplifying the deployment and management of cloud-native atomic capabilities within the platform. This makes it easier for enterprises to build platforms that meet their needs for continuous application delivery, observability, security, and other requirements based on these cloud-native atomic capabilities.
*Out-of-Box Platform*: VelaUX provides a comprehensive set of features that empower enterprises to deploy and monitor their applications effectively. These features include multi-cluster and multi-environment support, pipeline management, observability, and more. Additionally, VelaUX streamlines the complexities of Kubernetes, making it simpler for users to manage their deployments.
## Quick Start ## Quick Start
### Users ### Users
Please refer to this guide to install: [https://kubevela.net/docs/install](https://kubevela.net/docs/install) Please refer to: [https://kubevela.net/docs/install](https://kubevela.net/docs/install)
### Developers ### Developers
#### Build the frontend #### Build the frontend
Make sure you have installed [yarn 2.0](https://yarnpkg.com/getting-started/install), This is required. Make sure you have installed [yarn](https://classic.yarnpkg.com/en/docs/install).
Install frontend dependencies and build the frontend. Install frontend dependencies and build the frontend.

View File

@ -1,7 +1,7 @@
info: """ info: """
To open the dashboard directly by port-forward: To open the dashboard directly by port-forward:
vela port-forward -n vela-system addon-velaux 8000:8000 vela port-forward -n vela-system addon-velaux 9082:80
Please refer to https://kubevela.io/docs/reference/addons/velaux for more VelaUX addon installation and visiting method. Please refer to https://kubevela.io/docs/reference/addons/velaux for more VelaUX addon installation and visiting method.
""" """

View File

@ -2,7 +2,6 @@ import (
"encoding/base64" "encoding/base64"
"encoding/json" "encoding/json"
"strconv" "strconv"
"vela/config"
) )
metadata: { metadata: {
@ -53,10 +52,6 @@ template: {
} }
} }
validation: config.#ImageRegistry & {
$params: parameter
}
parameter: { parameter: {
// +usage=Image registry FQDN, such as: index.docker.io // +usage=Image registry FQDN, such as: index.docker.io
registry: *"index.docker.io" | string registry: *"index.docker.io" | string

View File

@ -1,5 +1,5 @@
name: velaux name: velaux
version: v1.8.0-rc.3 version: latest
description: KubeVela User Experience (UX). An extensible, application-oriented delivery and management Platform. description: KubeVela User Experience (UX). An extensible, application-oriented delivery and management Platform.
icon: https://static.kubevela.net/images/logos/KubeVela%20-03.png icon: https://static.kubevela.net/images/logos/KubeVela%20-03.png
url: https://kubevela.io url: https://kubevela.io

View File

@ -45,22 +45,22 @@ _httpsTrait: *[ if parameter["secretName"] != _|_ && parameter["domain"] != _|_
type: "https-route" type: "https-route"
properties: { properties: {
domains: [ parameter["domain"]] domains: [ parameter["domain"]]
rules: [{port: 8000}] rules: [{port: 80}]
secrets: [{ secrets: [{
name: parameter["secretName"] name: parameter["secretName"]
}] }]
}}] | [] }}] | []
server: { server: {
name: "velaux-server" name: "apiserver"
type: "webservice" type: "webservice"
properties: { properties: {
if parameter["repo"] == _|_ { if parameter["repo"] == _|_ {
image: "oamdev/velaux:" + _version image: "oamdev/vela-apiserver:" + _version
} }
if parameter["repo"] != _|_ { if parameter["repo"] != _|_ {
image: parameter["repo"] + "/" + "oamdev/velaux:" + _version image: parameter["repo"] + "/" + "oamdev/vela-apiserver:" + _version
} }
if parameter["imagePullSecrets"] != _|_ { if parameter["imagePullSecrets"] != _|_ {
@ -71,7 +71,7 @@ server: {
exposeType: parameter["serviceType"] exposeType: parameter["serviceType"]
} }
cmd: ["server", "--datastore-type=" + parameter["dbType"], "--feature-gates=EnableCacheJSFile=true"] + database + dbURL + enableImpersonation cmd: ["apiserver", "--datastore-type=" + parameter["dbType"]] + database + dbURL + enableImpersonation
ports: [ ports: [
{ {
port: 8000 port: 8000

View File

@ -24,8 +24,6 @@ import (
"os/signal" "os/signal"
"syscall" "syscall"
"github.com/kubevela/pkg/util/profiling"
restfulspec "github.com/emicklei/go-restful-openapi/v2" restfulspec "github.com/emicklei/go-restful-openapi/v2"
"github.com/fatih/color" "github.com/fatih/color"
"github.com/go-openapi/spec" "github.com/go-openapi/spec"
@ -35,6 +33,7 @@ import (
"github.com/kubevela/velaux/cmd/server/app/options" "github.com/kubevela/velaux/cmd/server/app/options"
"github.com/kubevela/velaux/pkg/server" "github.com/kubevela/velaux/pkg/server"
"github.com/oam-dev/kubevela/pkg/utils"
"github.com/oam-dev/kubevela/version" "github.com/oam-dev/kubevela/version"
) )
@ -46,7 +45,7 @@ func NewAPIServerCommand() *cobra.Command {
Long: `The KubeVela API server validates and configures data for the API objects. Long: `The KubeVela API server validates and configures data for the API objects.
The API Server services REST operations and provides the frontend to the The API Server services REST operations and provides the frontend to the
cluster's shared state through which all other components interact.`, cluster's shared state through which all other components interact.`,
RunE: func(cmd *cobra.Command, args []string) error { //nolint:revive,unused RunE: func(cmd *cobra.Command, args []string) error {
if err := s.Validate(); err != nil { if err := s.Validate(); err != nil {
return err return err
} }
@ -64,7 +63,7 @@ cluster's shared state through which all other components interact.`,
buildSwaggerCmd := &cobra.Command{ buildSwaggerCmd := &cobra.Command{
Use: "build-swagger", Use: "build-swagger",
Short: "Build swagger documentation of KubeVela apiserver", Short: "Build swagger documentation of KubeVela apiserver",
RunE: func(cmd *cobra.Command, args []string) error { //nolint:revive,unused RunE: func(cmd *cobra.Command, args []string) error {
name := "docs/apidoc/latest-swagger.json" name := "docs/apidoc/latest-swagger.json"
if len(args) > 0 { if len(args) > 0 {
name = args[0] name = args[0]
@ -112,7 +111,9 @@ func Run(s *options.ServerRunOptions) error {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
go profiling.StartProfilingServer(errChan) if s.GenericServerRunOptions.PprofAddr != "" {
go utils.EnablePprof(s.GenericServerRunOptions.PprofAddr, errChan)
}
go func() { go func() {
if err := run(ctx, s, errChan); err != nil { if err := run(ctx, s, errChan); err != nil {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,107 +0,0 @@
# How to build a plugin
VelUX plugin could help you customs any page applications. Most default and extensional runtime APIs make you develop the application easies.
## 1. Build the local server environment.
Refer [contributing](./docs/contributing/velaux.md) guide.
## 2. Initialize the plugin project.
```bash
mkdir custom-plugins
$pluginName=<your_plugin_name>
git clone https://github.com/kubevela-contrib/velaux-plugin-template custom-plugins/$pluginName
cd custom-plugins/$pluginName
```
## 3. Edit the plugin metadata.
* src/plugin.json: Plugin metadata, you should change it.
* package.json: Project metadata, you should change the project name, version, and description etc.
Plugin metadata spec:
```cue
{
"type": "page-app",
"name": string,
"id": string,
"info": {
"keywords": []string,
"description": string,
"author": {
"name": string
},
"logos": {
"small": string,
"large": string
},
"screenshots": [],
"version": string,
"updated": string
},
"backend"?: bool,
"proxy"?: bool,
"backendType?": "kube-api" | "kube-service",
"routes"?: [
{
"path": string,
"permission": {
"resource": string,
"action": string
}
}
],
"backendService"?: {
"name": string
"namespace"?: string
},
"kubePermissions"?: [
{
"apiGroups": string[],
"resources": string[],
"verbs": string[],
}
]
}
```
There are some example plugin configs. https://github.com/kubevela/velaux/tree/main/docs/plugins
## 4. Develop the plugin
```bash
yarn install
yarn dev
```
### Request the backend API
```js
import { getBackendSrv } from '@velaux/ui';
// Request the core APIs
getBackendSrv().get('/api/v1/clusters').then(res=>{console.log(res)})
// Request the plugin proxy APIs
getBackendSrv().get(`/proxy/plugins/${pluginID}/${realPath}`).then(res=>{console.log(res)})
```
Core API Reference: https://kubevela.net/docs/platform-engineers/openapi/overview
### UI Components
```js
import { Table, Form } from '@velaux/ui';
```
UI Component Reference: https://fusion.design/pc/component/box?themeid=2
## 5. Start the server to debug the plugin
```bash
go run ./cmd/server/main.go --plugin-path <custom-plugins-path>
```

View File

@ -38,13 +38,11 @@
## Start the server on local ## Start the server on local
Make sure you have installed [yarn 2.0](https://yarnpkg.com/getting-started/install), This is required. Make sure you have installed [yarn](https://classic.yarnpkg.com/en/docs/install).
```shell ```shell
yarn install yarn install
yarn build-packages
## Build the frontend and watch the code changes ## Build the frontend and watch the code changes
yarn dev yarn dev
``` ```
@ -78,12 +76,6 @@ make reviewable
### Test the code ### Test the code
For testing server kubebuilder and its dependency tools are required. To install them you can use:
```shell
make setup-test-server
```
Frontend: Frontend:
```shell ```shell
@ -103,25 +95,7 @@ make e2e-server-test
make build-swagger make build-swagger
``` ```
### Config yarn2 in vscode
Add following config in `settings.json`
```json
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true
}
```
## Develop the plugin
Reference: [How to build a plugin](./how-to-build-plugin)
## References ## References
* UI framework: [@alifd/next](https://fusion.design/) * UI framework: [@alifd/next](https://fusion.design/)
* Icons: [react-icons](https://react-icons.github.io/react-icons) * Icons: [react-icons](https://react-icons.github.io/react-icons)

View File

@ -1,52 +0,0 @@
{
"type": "page-app",
"name": "Backend Kube API Allow Route",
"id": "backend-kube-api-allow-route",
"info": {
"keywords": [
"app"
],
"description": "The app demo plugin",
"author": {
"name": "KubeVela"
},
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
},
"screenshots": [],
"version": "0.0.1",
"updated": "2023-03-30"
},
"backend": true,
"proxy": true,
"backendType": "kube-api",
"kubePermissions": [
{
"apiGroups": [
""
],
"resources": [
"nodes",
"nodes/status"
],
"verbs": [
"get",
"list"
]
}
],
"routes": [
{
"path": "/api/v1/nodes",
"permission": {
"resource": "node",
"action": "detail"
}
}
],
"dependencies": {
"velauxDependency": ">=1.8.0",
"plugins": []
}
}

View File

@ -1,55 +0,0 @@
{
"type": "page-app",
"name": "Backend Kube API",
"id": "backend-kube-api-node",
"info": {
"keywords": [
"app"
],
"description": "The app demo plugin",
"author": {
"name": "KubeVela"
},
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
},
"screenshots": [],
"version": "0.0.1",
"updated": "2023-03-30"
},
"backend": true,
"proxy": true,
"backendType": "kube-api",
"routes": [
{
"path": "/nodes/:node",
"method": "GET",
"proxyHeaders": [
{
"name": "Authorization",
"value": "Bearer test"
}
]
}
],
"kubePermissions": [
{
"apiGroups": [
""
],
"resources": [
"nodes",
"nodes/status"
],
"verbs": [
"get",
"list"
]
}
],
"dependencies": {
"velauxDependency": ">=1.8.0",
"plugins": []
}
}

View File

@ -1,43 +0,0 @@
{
"type": "page-app",
"name": "Backend Kube API",
"id": "backend-kube-api",
"info": {
"keywords": [
"app"
],
"description": "The app demo plugin",
"author": {
"name": "KubeVela"
},
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
},
"screenshots": [],
"version": "0.0.1",
"updated": "2023-03-30"
},
"backend": true,
"proxy": true,
"backendType": "kube-api",
"kubePermissions": [
{
"apiGroups": [
""
],
"resources": [
"nodes",
"nodes/status"
],
"verbs": [
"get",
"list"
]
}
],
"dependencies": {
"velauxDependency": ">=1.8.0",
"plugins": []
}
}

View File

@ -1,31 +0,0 @@
{
"type": "page-app",
"name": "Backend Kube Service",
"id": "backend-kube-service",
"info": {
"keywords": [
"app"
],
"description": "The app demo plugin",
"author": {
"name": "KubeVela"
},
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
},
"screenshots": [],
"version": "0.0.1",
"updated": "2023-03-30"
},
"backend": true,
"proxy": true,
"backendType": "kube-service",
"backendService": {
"name": "test"
},
"dependencies": {
"velauxDependency": ">=1.8.0",
"plugins": []
}
}

View File

@ -1,41 +0,0 @@
{
"type": "page-app",
"name": "Frontend",
"id": "frontend",
"info": {
"keywords": [
"app"
],
"description": "The app demo plugin",
"author": {
"name": "KubeVela"
},
"logos": {
"small": "img/logo.svg",
"large": "img/logo.svg"
},
"screenshots": [],
"version": "0.0.1",
"updated": "2023-03-30"
},
"includes": [
{
"workspace": {
"name": "continuous-delivery"
},
"type": "Workspace",
"label": "Custom App",
"name": "custom-app",
"to": "/plugins/frontend",
"relatedRoute": [
"/plugins/frontend"
],
"icon": "",
"catalog": "Continuous Delivery"
}
],
"dependencies": {
"velauxDependency": ">=1.8.0",
"plugins": []
}
}

View File

@ -1,7 +0,0 @@
name: bar
version: 1.0.0
description: Vela test addon named bar
icon: https://www.nar.com/icon
url: https://www.bar.com

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -114,26 +114,44 @@ var helmHandler http.HandlerFunc = func(rw http.ResponseWriter, req *http.Reques
_, _ = rw.Write([]byte(err.Error())) _, _ = rw.Write([]byte(err.Error()))
} }
_, _ = rw.Write(file) _, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "foo-1.0.0.tgz"): case strings.Contains(req.URL.Path, "fluxcd-test-version-1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/foo-1.0.0.tgz") file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/fluxcd-test-version-1.0.0.tgz")
if err != nil { if err != nil {
_, _ = rw.Write([]byte(err.Error())) _, _ = rw.Write([]byte(err.Error()))
} }
_, _ = rw.Write(file) _, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "bar-1.0.0.tgz"): case strings.Contains(req.URL.Path, "fluxcd-test-version-2.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-1.0.0.tgz") file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/fluxcd-test-version-2.0.0.tgz")
if err != nil { if err != nil {
_, _ = rw.Write([]byte(err.Error())) _, _ = rw.Write([]byte(err.Error()))
} }
_, _ = rw.Write(file) _, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "bar-2.0.0.tgz"): case strings.Contains(req.URL.Path, "vela-workflow-v0.3.5.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-2.0.0.tgz") file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/vela-workflow-v0.3.5.tgz")
if err != nil { if err != nil {
_, _ = rw.Write([]byte(err.Error())) _, _ = rw.Write([]byte(err.Error()))
} }
_, _ = rw.Write(file) _, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "mock-be-dep-addon-1.0.0.tgz"): case strings.Contains(req.URL.Path, "foo-v1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/mock-be-dep-addon-1.0.0.tgz") file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/foo-v1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "bar-v1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-v1.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "bar-v2.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/bar-v2.0.0.tgz")
if err != nil {
_, _ = rw.Write([]byte(err.Error()))
}
_, _ = rw.Write(file)
case strings.Contains(req.URL.Path, "mock-be-dep-addon-v1.0.0.tgz"):
file, err := os.ReadFile("./e2e-test/addon/testrepo/helm-repo/mock-be-dep-addon-v1.0.0.tgz")
if err != nil { if err != nil {
_, _ = rw.Write([]byte(err.Error())) _, _ = rw.Write([]byte(err.Error()))
} }

View File

@ -23,7 +23,7 @@ import (
"strings" "strings"
"time" "time"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/pkg/addon" "github.com/oam-dev/kubevela/pkg/addon"
@ -229,7 +229,7 @@ var _ = Describe("Test addon rest api", func() {
var newaddonStatus apisv1.AddonStatusResponse var newaddonStatus apisv1.AddonStatusResponse
g.Expect(decodeResponseBody(status, &newaddonStatus)).Should(Succeed()) g.Expect(decodeResponseBody(status, &newaddonStatus)).Should(Succeed())
g.Expect(newaddonStatus.Name).Should(BeEquivalentTo("bar")) g.Expect(newaddonStatus.Name).Should(BeEquivalentTo("bar"))
g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("1.0.0")) g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("v1.0.0"))
}, 30*time.Second, 300*time.Millisecond).Should(Succeed()) }, 30*time.Second, 300*time.Millisecond).Should(Succeed())
}) })
}) })
@ -248,7 +248,7 @@ var _ = Describe("Test addon rest api", func() {
var newaddonStatus apisv1.AddonStatusResponse var newaddonStatus apisv1.AddonStatusResponse
g.Expect(decodeResponseBody(status, &newaddonStatus)).Should(Succeed()) g.Expect(decodeResponseBody(status, &newaddonStatus)).Should(Succeed())
g.Expect(newaddonStatus.Name).Should(BeEquivalentTo("mock-dep-addon")) g.Expect(newaddonStatus.Name).Should(BeEquivalentTo("mock-dep-addon"))
g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("1.0.0")) g.Expect(newaddonStatus.InstalledVersion).Should(BeEquivalentTo("v1.0.0"))
g.Expect(newaddonStatus.Phase).Should(BeEquivalentTo(apisv1.AddonPhaseEnabled)) g.Expect(newaddonStatus.Phase).Should(BeEquivalentTo(apisv1.AddonPhaseEnabled))
}, 30*time.Second, 300*time.Millisecond).Should(Succeed()) }, 30*time.Second, 300*time.Millisecond).Should(Succeed())
}) })

View File

@ -22,7 +22,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/apis/core.oam.dev/common" "github.com/oam-dev/kubevela/apis/core.oam.dev/common"

View File

@ -22,7 +22,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@ -114,7 +114,9 @@ var _ = Describe("Test the application synchronizing", func() {
Expect(lrr.Records[1].Name).Should(Equal("test-v2")) Expect(lrr.Records[1].Name).Should(Equal("test-v2"))
// The workflow includes a suspend step. // The workflow includes a suspend step.
Expect(lrr.Records[1].Status).Should(Equal("suspending")) if lrr.Records[1].Status != "suspending" {
return fmt.Errorf("the record status is %s, not suspending", lrr.Records[1].Status)
}
return nil return nil
}).WithTimeout(time.Minute * 1).WithPolling(3 * time.Second).Should(BeNil()) }).WithTimeout(time.Minute * 1).WithPolling(3 * time.Second).Should(BeNil())
}) })

View File

@ -22,7 +22,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@ -33,7 +33,6 @@ import (
) )
var appName = "app-e2e" var appName = "app-e2e"
var appName2 = "app-e2e-2"
var appProject = "test-app-project" var appProject = "test-app-project"
func prepareEnv(envName string) { func prepareEnv(envName string) {
@ -84,55 +83,6 @@ var _ = Describe("Test application rest api", func() {
Expect(cmp.Diff(appBase.Labels["test"], req.Labels["test"])).Should(BeEmpty()) Expect(cmp.Diff(appBase.Labels["test"], req.Labels["test"])).Should(BeEmpty())
}) })
It("Test create second app", func() {
defer GinkgoRecover()
var req = apisv1.CreateApplicationRequest{
Name: appName2,
Project: appProject,
Description: "this is another test app",
Icon: "",
Labels: map[string]string{"test": "true", "labelselector": "true"},
EnvBinding: []*apisv1.EnvBinding{{Name: "dev-env"}},
Component: &apisv1.CreateComponentRequest{
Name: "webservice",
ComponentType: "webservice",
Properties: "{\"image\":\"nginx\"}",
},
}
res := post("/applications", req)
var appBase apisv1.ApplicationBase
Expect(decodeResponseBody(res, &appBase)).Should(Succeed())
Expect(cmp.Diff(appBase.Name, req.Name)).Should(BeEmpty())
Expect(cmp.Diff(appBase.Description, req.Description)).Should(BeEmpty())
Expect(cmp.Diff(appBase.Labels["test"], req.Labels["test"])).Should(BeEmpty())
})
It("Test update app", func() {
defer GinkgoRecover()
var req = apisv1.UpdateApplicationRequest{
Alias: "test-app",
Description: "this is a test app",
Icon: "",
Labels: map[string]string{"test": "true"},
Annotations: map[string]string{"test": "true"},
}
res := put("/applications/"+appName, req)
var appBase apisv1.ApplicationBase
Expect(decodeResponseBody(res, &appBase)).Should(Succeed())
Expect(cmp.Diff(appBase.Alias, req.Alias)).Should(BeEmpty())
Expect(cmp.Diff(appBase.Description, req.Description)).Should(BeEmpty())
Expect(cmp.Diff(appBase.Labels["test"], req.Labels["test"])).Should(BeEmpty())
Expect(cmp.Diff(appBase.Annotations["test"], req.Annotations["test"])).Should(BeEmpty())
})
It("Test listing applications by label", func() {
defer GinkgoRecover()
res := get("/applications?env=dev-env&labels=labelselector=true")
var apps apisv1.ListApplicationResponse
Expect(decodeResponseBody(res, &apps)).Should(Succeed())
Expect(cmp.Diff(len(apps.Applications), 1)).Should(BeEmpty())
})
It("Test listing components", func() { It("Test listing components", func() {
defer GinkgoRecover() defer GinkgoRecover()
res := get("/applications/" + appName + "/components") res := get("/applications/" + appName + "/components")

View File

@ -21,7 +21,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/kubevela/workflow/api/v1alpha1" "github.com/kubevela/workflow/api/v1alpha1"
@ -150,14 +150,6 @@ var _ = Describe("Test application workflow rest api", func() {
Expect(adr.WorkflowRecord.Name).ShouldNot(BeEmpty()) Expect(adr.WorkflowRecord.Name).ShouldNot(BeEmpty())
}) })
It("Get the workflow records from an env", func() {
res := get(fmt.Sprintf("/applications/%s/envs/%s/records", appName, envName))
var lrr apisv1.ListWorkflowRecordsResponse
Expect(decodeResponseBody(res, &lrr)).Should(Succeed())
Expect(lrr.Total).Should(Equal(int64(1)))
Expect(len(lrr.Records)).Should(Equal(1))
})
It("Detail the record", func() { It("Detail the record", func() {
res := get(fmt.Sprintf("/applications/%s/workflows/%s/records", appName, repository.ConvertWorkflowName(envName))) res := get(fmt.Sprintf("/applications/%s/workflows/%s/records", appName, repository.ConvertWorkflowName(envName)))
var lrr apisv1.ListWorkflowRecordsResponse var lrr apisv1.ListWorkflowRecordsResponse

View File

@ -21,7 +21,7 @@ import (
"os" "os"
"time" "time"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/kubevela/pkg/util/rand" "github.com/kubevela/pkg/util/rand"

View File

@ -20,7 +20,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/apis/types" "github.com/oam-dev/kubevela/apis/types"

View File

@ -20,7 +20,7 @@ import (
"context" "context"
"fmt" "fmt"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"

View File

@ -21,7 +21,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/pkg/multicluster" "github.com/oam-dev/kubevela/pkg/multicluster"

View File

@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"

View File

@ -24,7 +24,7 @@ import (
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"github.com/kubevela/workflow/api/v1alpha1" "github.com/kubevela/workflow/api/v1alpha1"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1" "github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"

View File

@ -1,150 +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 e2e_test
import (
"fmt"
"cuelang.org/go/pkg/strings"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"
"github.com/kubevela/velaux/pkg/server/utils/bcode"
)
func enablePlugin(id string) {
res := post(fmt.Sprintf("/manage/plugins/%s/enable", id), nil)
var dto apisv1.PluginDTO
Expect(decodeResponseBody(res, &dto)).Should(Succeed())
Expect(dto.ID).Should(Equal(id))
}
var _ = Describe("Test the plugin rest api", func() {
Context("Test manage plugin API. Request to /manage/plugins", func() {
It("Test list installed plugins", func() {
defer GinkgoRecover()
res := get("/manage/plugins")
var lpr apisv1.ListManagedPluginResponse
Expect(decodeResponseBody(res, &lpr)).Should(Succeed())
Expect(len(lpr.Plugins)).Should(Equal(2))
Expect(lpr.Plugins[0].Enabled).Should(BeFalse())
})
It("Test detail a installed plugin", func() {
defer GinkgoRecover()
res := get("/manage/plugins/app-demo")
var dto apisv1.ManagedPluginDTO
Expect(decodeResponseBody(res, &dto)).Should(Succeed())
Expect(dto.Module).Should(Equal("plugins/app-demo/module"))
})
It("Test enable/set/disable plugin", func() {
By("before enable")
res := get("/manage/plugins/app-demo")
var dto apisv1.ManagedPluginDTO
Expect(decodeResponseBody(res, &dto)).Should(Succeed())
Expect(dto.Enabled).Should(BeFalse())
By("enable")
enableReq := apisv1.PluginEnableRequest{
JSONData: map[string]interface{}{
"arg1": "value1",
},
SecureJSONData: map[string]interface{}{
"arg2": "value2",
},
}
res = post("/manage/plugins/app-demo/enable", enableReq)
Expect(decodeResponseBody(res, &dto)).Should(Succeed())
Expect(dto.Enabled).Should(BeTrue())
Expect(dto.JSONSetting["arg1"]).Should(Equal("value1"))
Expect(dto.SecureJSONFields["arg2"]).Should(Equal(true))
By("after enable, get")
res = get("/manage/plugins/app-demo")
Expect(decodeResponseBody(res, &dto)).Should(Succeed())
Expect(dto.Enabled).Should(BeTrue())
Expect(dto.JSONSetting["arg1"]).Should(Equal("value1"))
Expect(dto.SecureJSONFields["arg2"]).Should(Equal(true))
By("change the setting")
setReq := apisv1.PluginSetRequest{
JSONData: map[string]interface{}{
"arg1": "changedValue1",
},
SecureJSONData: map[string]interface{}{
"arg2": "changedValue2",
"addArg": "addValue",
},
}
res = post("/manage/plugins/app-demo/setting", setReq)
Expect(decodeResponseBody(res, &dto)).Should(Succeed())
Expect(dto.Enabled).Should(BeTrue())
Expect(dto.JSONSetting["arg1"]).Should(Equal("changedValue1"))
Expect(dto.SecureJSONFields["arg2"]).Should(Equal(true))
Expect(dto.SecureJSONFields["addArg"]).Should(Equal(true))
By("disable the plugin")
res = post("/manage/plugins/app-demo/disable", nil)
Expect(decodeResponseBody(res, &dto)).Should(Succeed())
Expect(dto.Enabled).Should(BeFalse())
})
})
Context("Test plugin API. Request to /proxy/plugins", func() {
It("Test to request the kube API", func() {
defer GinkgoRecover()
By("Before enable the plugin, request the plugin API should return 400")
res := get(baseDomain + "/proxy/plugins/node-dashboard/api/v1/nodes")
var nodeList corev1.NodeList
err := decodeResponseBody(res, &nodeList)
Expect(err).Should(HaveOccurred())
Expect(strings.Contains(err.Error(), "the plugin is not enabled")).Should(BeTrue())
By("After enable the plugin, request the plugin API should return 200")
enablePlugin("node-dashboard")
res = get(baseDomain + "/proxy/plugins/node-dashboard/api/v1/nodes")
Expect(decodeResponseBody(res, &nodeList)).Should(Succeed())
Expect(len(nodeList.Items)).Should(Equal(1))
})
})
Context("Test to request the plugin static files. Request to /public/plugins", func() {
It("Test to get the module file", func() {
defer GinkgoRecover()
res := get(baseDomain + "/public/plugins/app-demo/module.js")
defer func() { _ = res.Body.Close() }()
Expect(res.StatusCode).Should(Equal(200))
})
})
})
var _ = Describe("Test to request the dex plugin", func() {
It("Test to request the dex", func() {
defer GinkgoRecover()
res := get(baseDomain + "/dex/a")
var bcode bcode.Bcode
err := decodeResponseBody(res, &bcode)
Expect(strings.HasPrefix(err.Error(), "response code is not 200")).Should(BeTrue())
Expect(bcode.BusinessCode).Should(Equal(int32(404)))
})
})

View File

@ -21,7 +21,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1" apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"

View File

@ -19,7 +19,7 @@ package e2e_test
import ( import (
"io" "io"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
) )

View File

@ -29,13 +29,14 @@ import (
"time" "time"
"github.com/google/uuid" "github.com/google/uuid"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
v1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1"
"sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client"
"github.com/kubevela/velaux/pkg/server" "github.com/kubevela/velaux/pkg/server"
"github.com/kubevela/velaux/pkg/server/config" "github.com/kubevela/velaux/pkg/server/config"
"github.com/kubevela/velaux/pkg/server/domain/service"
"github.com/kubevela/velaux/pkg/server/infrastructure/clients" "github.com/kubevela/velaux/pkg/server/infrastructure/clients"
"github.com/kubevela/velaux/pkg/server/infrastructure/datastore" "github.com/kubevela/velaux/pkg/server/infrastructure/datastore"
apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1" apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"
@ -46,10 +47,9 @@ var k8sClient client.Client
var token string var token string
const ( const (
baseDomain = "http://127.0.0.1:8001" baseDomain = "http://127.0.0.1:8001"
baseURL = "http://127.0.0.1:8001/api/v1" baseURL = "http://127.0.0.1:8001/api/v1"
testNSprefix = "api-test-" testNSprefix = "api-test-"
fakeAdminName = "admin"
) )
func TestE2eApiserverTest(t *testing.T) { func TestE2eApiserverTest(t *testing.T) {
@ -72,9 +72,6 @@ var _ = BeforeSuite(func() {
AddonCacheTime: 10 * time.Minute, AddonCacheTime: 10 * time.Minute,
KubeQPS: 100, KubeQPS: 100,
KubeBurst: 300, KubeBurst: 300,
PluginConfig: config.PluginConfig{
CustomPluginPath: []string{"../e2e-plugins"},
},
} }
cfg.LeaderConfig.ID = uuid.New().String() cfg.LeaderConfig.ID = uuid.New().String()
cfg.LeaderConfig.LockName = "apiserver-lock" cfg.LeaderConfig.LockName = "apiserver-lock"
@ -83,50 +80,22 @@ var _ = BeforeSuite(func() {
server := server.New(cfg) server := server.New(cfg)
Expect(server).ShouldNot(BeNil()) Expect(server).ShouldNot(BeNil())
go func() { go func() {
defer GinkgoRecover()
err := server.Run(ctx, make(chan error)) err := server.Run(ctx, make(chan error))
Expect(err).ShouldNot(HaveOccurred()) Expect(err).ShouldNot(HaveOccurred())
}() }()
By("wait for api server to start") By("wait for api server to start")
defaultAdminPassword := "VelaUX12345"
Eventually( Eventually(
func() error { func() error {
password := os.Getenv("VELA_UX_PASSWORD") password := os.Getenv("VELA_UX_PASSWORD")
if password == "" { if password == "" {
password = defaultAdminPassword password = service.InitAdminPassword
} }
// init admin user
var initReq = apisv1.InitAdminRequest{
Name: fakeAdminName,
Password: password,
Email: "fake@email.com",
}
bodyByte, err := json.Marshal(initReq)
Expect(err).Should(BeNil())
initHtpReq, err := http.NewRequest("PUT", baseURL+"/auth/init_admin", bytes.NewBuffer(bodyByte))
Expect(err).Should(BeNil())
initHtpReq.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(initHtpReq)
if err != nil {
return err
}
// either 200 or "admin user is already configured"
if res.StatusCode != 200 {
body, err := io.ReadAll(res.Body)
Expect(err).Should(BeNil())
if !strings.Contains(string(body), "admin user is already configured") {
return fmt.Errorf("init admin failed: %s", string(body))
}
}
// login
var req = apisv1.LoginRequest{ var req = apisv1.LoginRequest{
Username: fakeAdminName, Username: "admin",
Password: password, Password: password,
} }
bodyByte, err = json.Marshal(req) bodyByte, err := json.Marshal(req)
Expect(err).Should(BeNil()) Expect(err).Should(BeNil())
resp, err := http.Post(baseURL+"/auth/login", "application/json", bytes.NewBuffer(bodyByte)) resp, err := http.Post(baseURL+"/auth/login", "application/json", bytes.NewBuffer(bodyByte))
if err != nil { if err != nil {
return err return err
@ -147,7 +116,7 @@ var _ = BeforeSuite(func() {
err = json.NewDecoder(resp.Body).Decode(code) err = json.NewDecoder(resp.Body).Decode(code)
Expect(err).Should(BeNil()) Expect(err).Should(BeNil())
return fmt.Errorf("rest service not ready code:%d message:%s", resp.StatusCode, code.Message) return fmt.Errorf("rest service not ready code:%d message:%s", resp.StatusCode, code.Message)
}).WithTimeout(time.Second * 60).WithPolling(time.Millisecond * 200).Should(Succeed()) }, time.Second*20, time.Millisecond*200).Should(BeNil())
var err error var err error
k8sClient, err = clients.GetKubeClient() k8sClient, err = clients.GetKubeClient()
Expect(err).ShouldNot(HaveOccurred()) Expect(err).ShouldNot(HaveOccurred())
@ -208,12 +177,10 @@ func put(path string, body interface{}) *http.Response {
func get(path string) *http.Response { func get(path string) *http.Response {
client := &http.Client{} client := &http.Client{}
if !strings.HasPrefix(path, "http") { if !strings.HasPrefix(path, "/v1") {
if !strings.HasPrefix(path, "/v1") { path = baseURL + path
path = baseURL + path } else {
} else { path = baseDomain + path
path = baseDomain + path
}
} }
req, err := http.NewRequest(http.MethodGet, path, nil) req, err := http.NewRequest(http.MethodGet, path, nil)
Expect(err).Should(BeNil()) Expect(err).Should(BeNil())
@ -268,14 +235,15 @@ func decodeResponseBody(resp *http.Response, dst interface{}) error {
if err != nil { if err != nil {
return err return err
} }
if resp.StatusCode != 200 {
return fmt.Errorf("response code is not 200: %d body: %s", resp.StatusCode, string(body))
}
if dst != nil { if dst != nil {
err = json.Unmarshal(body, dst) err = json.Unmarshal(body, dst)
if err != nil { if err != nil {
return err return err
} }
} return nil
if resp.StatusCode != 200 {
return fmt.Errorf("response code is not 200: %d body: %s", resp.StatusCode, string(body))
} }
return nil return nil
} }

View File

@ -17,7 +17,7 @@ limitations under the License.
package e2e_test package e2e_test
import ( import (
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1" apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"

View File

@ -19,7 +19,7 @@ package e2e_test
import ( import (
"fmt" "fmt"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1" apisv1 "github.com/kubevela/velaux/pkg/server/interfaces/api/dto/v1"

View File

@ -24,10 +24,10 @@ import (
types2 "github.com/oam-dev/kubevela/pkg/velaql/providers/query/types" types2 "github.com/oam-dev/kubevela/pkg/velaql/providers/query/types"
. "github.com/onsi/ginkgo/v2" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"github.com/pkg/errors" "github.com/pkg/errors"
batchv1 "k8s.io/api/batch/v1" batchv1beta1 "k8s.io/api/batch/v1beta1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@ -227,7 +227,7 @@ var _ = Describe("Test velaQL rest api", func() {
return nil return nil
}, 3*time.Second).WithTimeout(time.Minute).Should(BeNil()) }, 3*time.Second).WithTimeout(time.Minute).Should(BeNil())
newWorkload := new(batchv1.CronJob) newWorkload := new(batchv1beta1.CronJob)
Eventually(func() error { Eventually(func() error {
return k8sClient.Get(context.Background(), client.ObjectKey{Name: component2Name, Namespace: namespace}, newWorkload) return k8sClient.Get(context.Background(), client.ObjectKey{Name: component2Name, Namespace: namespace}, newWorkload)
}, 3*time.Second).WithTimeout(time.Minute).Should(BeNil()) }, 3*time.Second).WithTimeout(time.Minute).Should(BeNil())
@ -499,7 +499,7 @@ spec:
cue: cue:
template: | template: |
output: { output: {
apiVersion: "batch/v1" apiVersion: "batch/v1beta1"
kind: "CronJob" kind: "CronJob"
metadata: name: context.name metadata: name: context.name
spec: { spec: {

8
entrypoint.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
if [ "$1" = "server" ]; then
shift # "apiserver"
set -- /velaux/server "$@"
fi
exec "$@"

368
go.mod
View File

@ -1,195 +1,187 @@
module github.com/kubevela/velaux module github.com/kubevela/velaux
go 1.22 go 1.19
require ( require (
cuelang.org/go v0.5.0 cuelang.org/go v0.5.0-beta.5
github.com/AlecAivazis/survey/v2 v2.1.1 // indirect github.com/AlecAivazis/survey/v2 v2.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/agiledragon/gomonkey/v2 v2.4.0 github.com/agiledragon/gomonkey/v2 v2.4.0
github.com/alibabacloud-go/cs-20151215/v3 v3.0.32 // indirect
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.4 // indirect
github.com/alibabacloud-go/tea v1.1.19 // indirect
github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b // indirect github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b // indirect
github.com/barnettZQG/inject v0.0.1 github.com/barnettZQG/inject v0.0.1
github.com/briandowns/spinner v1.23.0 // indirect github.com/briandowns/spinner v1.11.1 // indirect
github.com/chartmuseum/helm-push v0.10.4 // indirect github.com/chartmuseum/helm-push v0.10.2 // indirect
github.com/cloudtty/cloudtty v0.5.0 github.com/cloudtty/cloudtty v0.2.0
github.com/containerd/containerd v1.7.2 // indirect github.com/containerd/containerd v1.6.18 // indirect
github.com/coreos/go-oidc v2.2.1+incompatible github.com/coreos/go-oidc v2.2.1+incompatible
github.com/crossplane/crossplane-runtime v0.19.2 // indirect github.com/crossplane/crossplane-runtime v0.14.1-0.20210722005935-0b469fcc77cd // indirect
github.com/cue-exp/kubevelafix v0.0.0-20220922150317-aead819d979d // indirect github.com/cue-exp/kubevelafix v0.0.0-20220922150317-aead819d979d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/emicklei/go-restful-openapi/v2 v2.9.1 github.com/emicklei/go-restful-openapi/v2 v2.9.1
github.com/emicklei/go-restful/v3 v3.10.2 github.com/emicklei/go-restful/v3 v3.8.0
github.com/evanphx/json-patch v5.6.0+incompatible // indirect github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/facebookgo/structtag v0.0.0-20150214074306-217e25fb9691 // indirect github.com/facebookgo/structtag v0.0.0-20150214074306-217e25fb9691 // indirect
github.com/fatih/color v1.15.0 github.com/fatih/color v1.13.0
github.com/felixge/httpsnoop v1.0.3 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fluxcd/helm-controller/api v0.32.2 // indirect github.com/fluxcd/helm-controller/api v0.21.0 // indirect
github.com/fluxcd/source-controller/api v0.24.4 // indirect github.com/fluxcd/source-controller/api v0.24.4 // indirect
github.com/form3tech-oss/jwt-go v3.2.5+incompatible github.com/form3tech-oss/jwt-go v3.2.3+incompatible
github.com/getkin/kin-openapi v0.118.0 github.com/getkin/kin-openapi v0.94.0
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/ghodss/yaml v1.0.0
github.com/go-git/go-git/v5 v5.7.0 // indirect github.com/go-git/go-git/v5 v5.5.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/spec v0.20.7 github.com/go-openapi/spec v0.20.4
github.com/go-playground/validator/v10 v10.9.0 github.com/go-playground/validator/v10 v10.9.0
github.com/go-resty/resty/v2 v2.7.0 // indirect github.com/go-resty/resty/v2 v2.7.0 // indirect
github.com/golang/mock v1.6.0 // indirect github.com/golang/mock v1.6.0 // indirect
github.com/google/go-cmp v0.5.9 github.com/google/go-cmp v0.5.9
github.com/google/go-containerregistry v0.15.2 github.com/google/go-containerregistry v0.13.0
github.com/google/go-github/v32 v32.1.0 // indirect github.com/google/go-github/v32 v32.1.0 // indirect
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0 github.com/gorilla/websocket v1.5.0
github.com/gosuri/uitable v0.0.4 // indirect github.com/gosuri/uitable v0.0.4 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hcl/v2 v2.17.0 // indirect github.com/hashicorp/hcl/v2 v2.12.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect github.com/imdario/mergo v0.3.13 // indirect
github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c github.com/koding/websocketproxy v0.0.0-20181220232114-7ed82d81a28c
github.com/kubevela/pkg v1.8.1-0.20230613075152-2cef0c31b14e github.com/kubevela/pkg v0.0.0-20230224072506-9ff31b249aa8
github.com/kubevela/prism v1.7.0-alpha.1.0.20230403030519-b7e45f7f842e github.com/kubevela/prism v1.7.0-alpha.1
github.com/kubevela/workflow v0.4.1-0.20230227023118-8eae143050d4
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
github.com/oam-dev/cluster-gateway v1.9.0-alpha.2 github.com/oam-dev/cluster-gateway v1.7.0-alpha.1
github.com/oam-dev/cluster-register v1.0.4-0.20230424040021-147f7c1fefe5 // indirect github.com/oam-dev/cluster-register v1.0.4-0.20220928064144-5f76a9d7ca8c // indirect
github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28 // indirect github.com/oam-dev/terraform-config-inspect v0.0.0-20210418082552-fc72d929aa28 // indirect
github.com/oam-dev/terraform-controller v0.7.11 github.com/oam-dev/terraform-controller v0.7.10
github.com/onsi/gomega v1.27.8 github.com/onsi/ginkgo v1.16.5
github.com/openkruise/kruise-api v1.4.0 // indirect github.com/onsi/gomega v1.27.0
github.com/openkruise/kruise-api v1.3.0 // indirect
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.16.0 // indirect github.com/prometheus/client_golang v1.12.2 // indirect
github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect
github.com/robfig/cron/v3 v3.0.1 github.com/robfig/cron/v3 v3.0.1
github.com/sirupsen/logrus v1.9.3 // indirect github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/cobra v1.7.0 github.com/spf13/cobra v1.6.0
github.com/spf13/pflag v1.0.5 github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4 github.com/stretchr/testify v1.8.1
github.com/tidwall/gjson v1.14.4 github.com/tidwall/gjson v1.14.4
github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f // indirect github.com/wercker/stern v0.0.0-20190705090245-4fa46dd6987f // indirect
github.com/xanzy/go-gitlab v0.86.0 // indirect github.com/wonderflow/cert-manager-api v1.0.4-0.20210304051430-e08aa76f6c5f // indirect
github.com/xlab/treeprint v1.2.0 // indirect github.com/xanzy/go-gitlab v0.80.0 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.mongodb.org/mongo-driver v1.11.2 go.mongodb.org/mongo-driver v1.11.2
go.uber.org/zap v1.24.0 // indirect go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.11.0 golang.org/x/crypto v0.6.0
golang.org/x/oauth2 v0.10.0 golang.org/x/oauth2 v0.3.0
golang.org/x/term v0.10.0 // indirect golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.11.0 // indirect golang.org/x/text v0.7.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools v2.2.0+incompatible gotest.tools v2.2.0+incompatible
helm.sh/helm/v3 v3.11.2 helm.sh/helm/v3 v3.10.3
k8s.io/api v0.26.3 istio.io/client-go v1.13.4 // indirect
k8s.io/apiextensions-apiserver v0.26.3 k8s.io/api v0.25.3
k8s.io/apimachinery v0.26.3 k8s.io/apiextensions-apiserver v0.25.2
k8s.io/apiserver v0.26.3 k8s.io/apimachinery v0.25.3
k8s.io/cli-runtime v0.26.3 // indirect k8s.io/apiserver v0.25.3
k8s.io/client-go v0.26.3 k8s.io/cli-runtime v0.25.3 // indirect
k8s.io/component-base v0.26.3 k8s.io/client-go v0.25.3
k8s.io/component-base v0.25.3
k8s.io/helm v2.17.0+incompatible // indirect k8s.io/helm v2.17.0+incompatible // indirect
k8s.io/klog/v2 v2.100.1 k8s.io/klog/v2 v2.90.0
k8s.io/kube-aggregator v0.26.3 // indirect k8s.io/kube-aggregator v0.25.3 // indirect
k8s.io/kubectl v0.26.3 // indirect k8s.io/kubectl v0.25.3 // indirect
k8s.io/metrics v0.26.3 // indirect k8s.io/metrics v0.25.3 // indirect
k8s.io/utils v0.0.0-20230220204549-a5ecb0141aa5 k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed
open-cluster-management.io/api v0.10.1 // indirect open-cluster-management.io/api v0.10.0 // indirect
sigs.k8s.io/controller-runtime v0.14.6 sigs.k8s.io/controller-runtime v0.12.3
sigs.k8s.io/gateway-api v0.7.1 // indirect sigs.k8s.io/gateway-api v0.4.3 // indirect
sigs.k8s.io/kind v0.20.0 // indirect sigs.k8s.io/kind v0.17.0 // indirect
sigs.k8s.io/yaml v1.3.0 sigs.k8s.io/yaml v1.3.0
) )
require ( require github.com/oam-dev/kubevela v1.8.0-alpha.2.0.20230307081937-79f1d5cb0386
github.com/alibabacloud-go/cs-20151215/v3 v3.0.35
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.4
github.com/alibabacloud-go/tea v1.2.0
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
github.com/grafana/grafana v1.9.2-0.20230216173926-a0bea04a0274
github.com/julienschmidt/httprouter v1.3.0
github.com/kubevela/workflow v0.6.0
github.com/oam-dev/kubevela v1.9.4
github.com/onsi/ginkgo/v2 v2.11.0
gorm.io/driver/postgres v1.5.2
)
require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
github.com/alibabacloud-go/tea-utils v1.3.1 // indirect
github.com/alibabacloud-go/tea-utils/v2 v2.0.1 // indirect
github.com/alibabacloud-go/tea-xml v1.1.2 // indirect
github.com/aliyun/credentials-go v1.1.2 // indirect
github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgx/v5 v5.4.2 // indirect
github.com/jellydator/ttlcache/v3 v3.0.1 // indirect
github.com/perimeterx/marshmallow v1.1.4 // indirect
github.com/tjfoc/gmsm v1.3.2 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
)
require ( require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/BurntSushi/toml v1.2.1 // indirect github.com/BurntSushi/toml v1.2.1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/Masterminds/squirrel v1.5.3 // indirect github.com/Masterminds/squirrel v1.5.3 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230518184743-7afd39499903 // indirect github.com/ProtonMail/go-crypto v0.0.0-20221026131551-cf6655e29de4 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/agext/levenshtein v1.2.3 // indirect github.com/agext/levenshtein v1.2.3 // indirect
github.com/alessio/shellescape v1.4.1 // indirect github.com/alessio/shellescape v1.4.1 // indirect
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/endpoint-util v1.1.1 // indirect
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect
github.com/alibabacloud-go/tea-utils v1.4.5 // indirect
github.com/alibabacloud-go/tea-utils/v2 v2.0.1 // indirect
github.com/alibabacloud-go/tea-xml v1.1.2 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 // indirect
github.com/aliyun/credentials-go v1.1.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect github.com/blang/semver/v4 v4.0.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/cloudflare/circl v1.3.3 // indirect github.com/clbanning/mxj/v2 v2.5.5 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/cyphar/filepath-securejoin v0.2.3 // indirect github.com/cyphar/filepath-securejoin v0.2.3 // indirect
github.com/docker/cli v23.0.5+incompatible // indirect github.com/docker/cli v20.10.20+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v23.0.5+incompatible // indirect github.com/docker/docker v20.10.20+incompatible // indirect
github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect
github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-metrics v0.0.1 // indirect github.com/docker/go-metrics v0.0.1 // indirect
github.com/docker/go-units v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect github.com/emirpasic/gods v1.18.1 // indirect
github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect
github.com/fluxcd/pkg/apis/kustomize v1.0.0 // indirect github.com/fluxcd/pkg/apis/kustomize v0.3.3 // indirect
github.com/fluxcd/pkg/apis/meta v1.0.0 // indirect github.com/fluxcd/pkg/apis/meta v0.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-errors/errors v1.0.1 // indirect github.com/go-errors/errors v1.0.1 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.4.1 // indirect github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect github.com/go-gorp/gorp/v3 v3.0.2 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/swag v0.22.3 // indirect github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect github.com/go-stack/stack v1.8.1 // indirect
github.com/gobwas/glob v0.2.3 // indirect github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/snappy v0.0.4 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/btree v1.1.2 // indirect github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-querystring v1.1.0 // indirect github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect github.com/google/gofuzz v1.2.0 // indirect
@ -197,28 +189,28 @@ require (
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/mux v1.8.0 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20191002090509-6af20e3a5340 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/hashicorp/go-hclog v0.12.2 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.4.0 // indirect github.com/huandu/xstrings v1.3.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmoiron/sqlx v1.3.5 // indirect github.com/jmoiron/sqlx v1.3.5 // indirect
github.com/josharian/intern v1.0.0 // indirect github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/klauspost/compress v1.16.5 // indirect github.com/klauspost/compress v1.15.12 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect github.com/leodido/go-urn v1.2.1 // indirect
github.com/lib/pq v1.10.7 // indirect github.com/lib/pq v1.10.6 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect
@ -227,7 +219,7 @@ require (
github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/locker v1.0.1 // indirect github.com/moby/locker v1.0.1 // indirect
github.com/moby/spdystream v0.2.0 // indirect github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
@ -235,66 +227,76 @@ require (
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
github.com/openshift/library-go v0.0.0-20230327085348-8477ec72b725 // indirect github.com/openshift/library-go v0.0.0-20221111030555-73ed40c0a938 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect github.com/pjbgf/sha1cd v0.2.3 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect github.com/pquerna/cachecontrol v0.1.0 // indirect
github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.10.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect
github.com/rivo/uniseg v0.4.3 // indirect github.com/rivo/uniseg v0.4.3 // indirect
github.com/rubenv/sql-migrate v1.3.1 // indirect github.com/rubenv/sql-migrate v1.1.2 // indirect
github.com/sergi/go-diff v1.2.0 // indirect github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect github.com/sergi/go-diff v1.1.0 // indirect
github.com/skeema/knownhosts v1.1.1 // indirect github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.5.0 github.com/skeema/knownhosts v1.1.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect github.com/tidwall/pretty v1.2.0 // indirect
github.com/tjfoc/gmsm v1.3.2 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.1 // indirect github.com/xdg-go/scram v1.1.1 // indirect
github.com/xdg-go/stringprep v1.0.3 // indirect github.com/xdg-go/stringprep v1.0.3 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/zclconf/go-cty v1.13.0 // indirect github.com/zclconf/go-cty v1.10.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.5 // indirect go.etcd.io/etcd/api/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.5 // indirect go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 // indirect go.opentelemetry.io/contrib v0.20.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0 // indirect
go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.20.0 // indirect
go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/otel v1.3.0 // indirect
go.opentelemetry.io/otel/sdk v1.14.0 // indirect go.opentelemetry.io/otel/exporters/otlp v0.20.0 // indirect
go.opentelemetry.io/otel/trace v1.14.0 // indirect go.opentelemetry.io/otel/metric v0.20.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect go.opentelemetry.io/otel/sdk v1.3.0 // indirect
go.starlark.net v0.0.0-20221020143700-22309ac47eac // indirect go.opentelemetry.io/otel/sdk/export/metric v0.20.0 // indirect
go.uber.org/multierr v1.11.0 // indirect go.opentelemetry.io/otel/sdk/metric v0.20.0 // indirect
golang.org/x/mod v0.12.0 // indirect go.opentelemetry.io/otel/trace v1.3.0 // indirect
golang.org/x/net v0.12.0 // indirect go.opentelemetry.io/proto/otlp v0.11.0 // indirect
golang.org/x/sync v0.3.0 // indirect go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect
golang.org/x/sys v0.10.0 // indirect go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.7.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.11.0 // indirect golang.org/x/tools v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc v1.53.0 // indirect google.golang.org/grpc v1.48.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/square/go-jose.v2 v2.5.1 // indirect gopkg.in/square/go-jose.v2 v2.5.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect
gorm.io/gorm v1.25.2 istio.io/api v0.0.0-20220512212136-561ffec82582 // indirect
istio.io/gogo-genproto v0.0.0-20211208193508-5ab4acc9eb1e // indirect
k8s.io/klog v1.0.0 // indirect k8s.io/klog v1.0.0 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect k8s.io/kube-openapi v0.0.0-20220803162953-67bda5d908f1 // indirect
oras.land/oras-go v1.2.2 // indirect oras.land/oras-go v1.2.0 // indirect
sigs.k8s.io/apiserver-network-proxy v0.0.30 // indirect sigs.k8s.io/apiserver-network-proxy v0.0.30 // indirect
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 // indirect sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.33 // indirect
sigs.k8s.io/apiserver-runtime v1.1.2-0.20221118041430-0a6394f6dda3 // indirect sigs.k8s.io/apiserver-runtime v1.1.2-0.20221102045245-fb656940062f // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect sigs.k8s.io/kustomize/api v0.12.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect
@ -302,43 +304,29 @@ require (
) )
require ( require (
github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 // indirect cloud.google.com/go/compute v1.10.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/cel-go v0.12.6 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.2 // indirect
github.com/invopop/yaml v0.1.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect github.com/magiconair/properties v1.8.6 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect github.com/nacos-group/nacos-sdk-go/v2 v2.1.0 // indirect
github.com/nacos-group/nacos-sdk-go/v2 v2.2.2 // indirect github.com/openkruise/rollouts v0.1.1-0.20220622054609-149e5a48da5e // indirect
github.com/openkruise/rollouts v0.3.0 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml v1.9.5 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 // indirect google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gorm.io/driver/mysql v1.5.1
k8s.io/kms v0.26.3 // indirect
) )
replace ( replace (
cloud.google.com/go => cloud.google.com/go v0.100.2 cloud.google.com/go => cloud.google.com/go v0.100.2
github.com/docker/cli => github.com/docker/cli v20.10.9+incompatible github.com/docker/cli => github.com/docker/cli v20.10.9+incompatible
github.com/docker/docker => github.com/moby/moby v20.10.20+incompatible github.com/docker/docker => github.com/moby/moby v20.10.20+incompatible
github.com/emicklei/go-restful/v3 => github.com/emicklei/go-restful/v3 v3.8.0
github.com/wercker/stern => github.com/oam-dev/stern v1.13.2 github.com/wercker/stern => github.com/oam-dev/stern v1.13.2
go.uber.org/atomic => go.uber.org/atomic v1.9.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc => go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0
sigs.k8s.io/apiserver-network-proxy/konnectivity-client => sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.36 go.opentelemetry.io/otel => go.opentelemetry.io/otel v0.20.0
go.opentelemetry.io/otel/metric => go.opentelemetry.io/otel/metric v0.20.0
go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v0.20.0
go.opentelemetry.io/otel/trace => go.opentelemetry.io/otel/trace v0.20.0
go.opentelemetry.io/proto/otlp => go.opentelemetry.io/proto/otlp v0.7.0
sigs.k8s.io/apiserver-network-proxy/konnectivity-client => sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.31-0.20220502234555-5308cea56b78
) )

1239
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
{
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [
"packages/*"
],
"version": "9.4.0-pre"
}

View File

@ -1,4 +0,0 @@
# Build the docker image
.PHONY: docker-build
docker-build:
docker build --build-arg=VERSION=$(VELAUX_VERSION) --build-arg=GITVERSION=$(GIT_COMMIT) -t $(VELAUX_IMAGE) .

View File

@ -1,39 +0,0 @@
SHELL := /bin/bash
GOLANGCILINT_VERSION ?= 1.59.1
# 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
GLOBAL_GOLANGCILINT := $(shell which golangci-lint)
GOBIN_GOLANGCILINT:= $(shell which $(GOBIN)/golangci-lint)
# VelaUX version
VELAUX_VERSION ?= main
# Repo info
GIT_COMMIT ?= git-$(shell git rev-parse --short HEAD)
GIT_COMMIT_LONG ?= $(shell git rev-parse HEAD)
VELAUX_IMAGE ?= velaux:$(VELAUX_VERSION)
VELAUX_VERSION_KEY := github.com/kubevela/velaux/version.VelaVersion
VELAUX_GITVERSION_KEY := github.com/kubevela/velaux/version.GitRevision
LDFLAGS ?= "-s -w -X $(VELAUX_VERSION_KEY)=$(VELAUX_VERSION) -X $(VELAUX_GITVERSION_KEY)=$(GIT_COMMIT)"
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}[INFO]${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)

View File

@ -7,38 +7,23 @@
"repository": "github:kubevela/velaux", "repository": "github:kubevela/velaux",
"scripts": { "scripts": {
"dev": "NODE_ENV=dev webpack --progress --color --config scripts/webpack/webpack.dev.js --watch", "dev": "NODE_ENV=dev webpack --progress --color --config scripts/webpack/webpack.dev.js --watch",
"build": "yarn run build-packages && yarn run build-ui", "build": "yarn run build-theme && NODE_ENV=production webpack --progress --config scripts/webpack/webpack.prod.js",
"build-ui": "NODE_ENV=production webpack --progress --config scripts/webpack/webpack.prod.js",
"lint": "yarn run lint:ts", "lint": "yarn run lint:ts",
"lint:ts": "eslint . --ext .js,.tsx,.ts --cache", "lint:ts": "eslint . --ext .js,.tsx,.ts --cache",
"lint:fix": "yarn lint:ts --fix", "lint:fix": "yarn lint:ts --fix",
"test": "yarn test:ui", "test": "yarn test:ui",
"test:ui": "yarn workspace @velaux/ui run test", "test:ui": "yarn workspace @velaux/ui run test",
"build-packages": "yarn packages:theme && yarn packages:data && yarn packages:ui", "build-theme": "yarn workspace @velaux/theme run build-theme"
"packages:theme": "yarn workspace @velaux/theme build",
"packages:ui": "yarn workspace @velaux/ui build",
"packages:data": "yarn workspace @velaux/data build",
"packages:plugins": "yarn workspace @velaux-plugins/app-demo build && yarn workspace @velaux-plugins/node-dashboard build",
"packages:pack": "rm -rf ./npm-artifacts && mkdir -p ./npm-artifacts && lerna exec --no-private -- yarn pack --out \"../../npm-artifacts/%s-%v.tgz\""
}, },
"workspaces": { "workspaces": {
"packages": [ "packages": [
"packages/*", "packages/*",
"plugins/*" "plugins-bundled/internal/*"
] ]
}, },
"dependencies": { "dependencies": {},
"@alifd/next": "^1.26.15",
"history": "4.10.1",
"react": "^17.0.2",
"react-dom": "^17.0.0",
"tslib": "2.4.1"
},
"resolutions": {
"@types/react": "17.0.14",
"@types/react-dom": "17.0.14"
},
"devDependencies": { "devDependencies": {
"browserslist": "^4.21.4",
"@babel/core": "7.20.5", "@babel/core": "7.20.5",
"@babel/plugin-proposal-class-properties": "7.18.6", "@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6", "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
@ -53,20 +38,6 @@
"@babel/preset-typescript": "7.18.6", "@babel/preset-typescript": "7.18.6",
"@babel/runtime": "7.20.1", "@babel/runtime": "7.20.1",
"@emotion/eslint-plugin": "11.10.0", "@emotion/eslint-plugin": "11.10.0",
"@grafana/eslint-config": "5.1.0",
"@grafana/tsconfig": "^1.2.0-rc1",
"@types/react": "^17.0.2",
"@types/react-cookies": "^0.1.0",
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-dom": "^17.0.2",
"@types/webpack-env": "1.18.0",
"@typescript-eslint/eslint-plugin": "5.42.0",
"@typescript-eslint/parser": "5.42.0",
"browserslist": "^4.21.4",
"copy-webpack-plugin": "11.0.0",
"css-loader": "6.7.1",
"css-minimizer-webpack-plugin": "4.2.2",
"cypress": "9.5.1",
"esbuild": "0.16.17", "esbuild": "0.16.17",
"esbuild-loader": "2.21.0", "esbuild-loader": "2.21.0",
"esbuild-plugin-browserslist": "^0.6.0", "esbuild-plugin-browserslist": "^0.6.0",
@ -77,35 +48,38 @@
"eslint-plugin-jsdoc": "39.8.0", "eslint-plugin-jsdoc": "39.8.0",
"eslint-plugin-jsx-a11y": "6.7.1", "eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-lodash": "7.4.0", "eslint-plugin-lodash": "7.4.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "7.32.1", "eslint-plugin-react": "7.32.1",
"eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-react-hooks": "4.6.0",
"eslint-webpack-plugin": "3.2.0", "eslint-webpack-plugin": "3.2.0",
"fork-ts-checker-webpack-plugin": "7.3.0", "copy-webpack-plugin": "11.0.0",
"html-loader": "4.2.0",
"html-webpack-plugin": "5.5.0",
"lerna": "5.5.4",
"less": "4.1.3",
"less-loader": "11.1.0",
"mini-css-extract-plugin": "2.7.2", "mini-css-extract-plugin": "2.7.2",
"ngtemplate-loader": "2.1.0", "css-loader": "6.7.1",
"pnp-webpack-plugin": "1.7.0", "style-loader": "3.3.1",
"prettier": "^2.8.7", "less-loader": "11.1.0",
"react-dev-utils": "^11.0.4", "less": "4.1.3",
"style-loader": "3.3.2",
"terser-webpack-plugin": "5.3.6",
"ts-loader": "8.1.0", "ts-loader": "8.1.0",
"tsc": "2.0.4", "html-loader": "4.2.0",
"typescript": "4.4.4", "css-minimizer-webpack-plugin": "4.2.2",
"cypress": "9.5.1",
"webpack": "5.74.0", "webpack": "5.74.0",
"webpack-bundle-analyzer": "4.7.0", "webpack-bundle-analyzer": "4.7.0",
"webpack-cli": "4.10.0", "webpack-cli": "4.10.0",
"webpack-dev-server": "4.11.1", "webpack-dev-server": "4.11.1",
"webpack-manifest-plugin": "5.0.0", "webpack-manifest-plugin": "5.0.0",
"webpack-merge": "5.8.0" "webpack-merge": "5.8.0",
"fork-ts-checker-webpack-plugin": "7.3.0",
"html-webpack-plugin": "5.5.0",
"terser-webpack-plugin": "5.3.6",
"ngtemplate-loader": "2.1.0",
"@grafana/tsconfig": "^1.2.0-rc1",
"@grafana/eslint-config": "5.1.0",
"@typescript-eslint/parser": "5.42.0",
"@typescript-eslint/eslint-plugin": "5.42.0",
"react-dev-utils": "^11.0.4",
"typescript": "4.4.4"
}, },
"engines": { "engines": {
"node": ">= 16" "node": ">= 16"
}, },
"packageManager": "yarn@3.6.0" "packageManager": "yarn@3.4.1"
} }

View File

@ -1,64 +0,0 @@
{
"author": "KubeVela",
"license": "Apache-2.0",
"name": "@velaux/data",
"version": "0.0.4",
"description": "VelaUX Data Library",
"keywords": [
"typescript"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "http://github.com/kubevela/velaux.git",
"directory": "packages/velaux-data"
},
"publishConfig": {
"main": "dist/index.js",
"module": "dist/esm/index.js",
"types": "dist/index.d.ts",
"access": "public"
},
"files": [
"dist",
"./README.md",
"./CHANGELOG.md",
"LICENSE_APACHE2"
],
"main": "src/index.ts",
"types": "dist/index.d.ts",
"scripts": {
"build": "tsc -p ./tsconfig.build.json && rollup -c rollup.config.ts",
"clean": "rimraf ./dist ./compiled ./package.tgz",
"typecheck": "tsc --emitDeclarationOnly false --noEmit"
},
"devDependencies": {
"@grafana/tsconfig": "^1.2.0-rc1",
"@rollup/plugin-commonjs": "23.0.2",
"@rollup/plugin-json": "5.0.1",
"@rollup/plugin-node-resolve": "15.0.1",
"@types/jest": "29.2.3",
"@types/jquery": "3.5.14",
"@types/lodash": "4.14.187",
"@types/marked": "4.0.7",
"@types/node": "18.13.0",
"@types/papaparse": "5.3.5",
"@types/react": "17.0.42",
"@types/react-dom": "17.0.2",
"@types/sinon": "10.0.13",
"@types/testing-library__jest-dom": "5.14.5",
"@types/tinycolor2": "1.4.3",
"esbuild": "0.16.17",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-scripts": "^3.4.0",
"react-test-renderer": "17.0.2",
"rimraf": "3.0.2",
"rollup": "2.79.1",
"rollup-plugin-dts": "^5.0.0",
"rollup-plugin-esbuild": "5.0.0",
"rollup-plugin-node-externals": "^5.0.0",
"sinon": "14.0.1",
"typescript": "4.4.4"
}
}

View File

@ -1,37 +0,0 @@
import resolve from '@rollup/plugin-node-resolve';
import dts from 'rollup-plugin-dts';
import esbuild from 'rollup-plugin-esbuild';
import { externals } from 'rollup-plugin-node-externals';
const pkg = require('./package.json');
const config = [
{
input: './compiled/index.d.ts',
plugins: [dts()],
output: {
file: pkg.publishConfig.types,
format: 'es',
},
},
{
input: 'src/index.ts',
plugins: [externals({ deps: true, packagePath: './package.json' }), resolve(), esbuild()],
output: [
{
format: 'cjs',
sourcemap: true,
dir: pkg.publishConfig.main,
},
{
format: 'esm',
sourcemap: true,
dir: pkg.publishConfig.module,
preserveModules: true,
preserveModulesRoot: `packages/velaux-data/src`,
},
],
},
];
export default config;

View File

@ -1,16 +0,0 @@
export * from './addon';
export * from './application';
export * from './cluster';
export * from './component';
export * from './configs';
export * from './definitions';
export * from './env';
export * from './kubernetes';
export * from './observation';
export * from './project';
export * from './pipeline';
export * from './repository';
export * from './roles';
export * from './system';
export * from './target';
export * from './user';

View File

@ -1,3 +0,0 @@
export * from './types';
export * from './plugins';
export * from './api';

View File

@ -1,38 +0,0 @@
import { ComponentType } from 'react';
import { PluginMeta, VelaUXPlugin } from './types';
import { KeyValue } from '../types';
export interface AppPluginMeta<T extends KeyValue = KeyValue> extends PluginMeta<T> {
// TODO anything specific to apps?
}
export interface AppRootProps<T extends KeyValue = KeyValue> {
meta: AppPluginMeta<T>;
/**
* base URL segment for an app, /app/pluginId
*/
basename: string; // The URL path to this page
}
export class AppPagePlugin<T extends KeyValue = KeyValue> extends VelaUXPlugin<AppPluginMeta<T>> {
// Content under: /a/${plugin-id}/*
root?: ComponentType<AppRootProps<T>>;
/**
* Called after the module has loaded, and before the app is used.
* This function may be called multiple times on the same instance.
* The first time, `this.meta` will be undefined
*/
init(meta: AppPluginMeta) {}
/**
* Set the component displayed under:
* /a/${plugin-id}/*
*
* If the NavModel is configured, the page will have a managed frame, otheriwse it has full control.
*/
setRootPage(root: ComponentType<AppRootProps<T>>) {
this.root = root;
return this;
}
}

View File

@ -1,2 +0,0 @@
export * from './app';
export * from './types';

View File

@ -1,150 +0,0 @@
import { ComponentType } from 'react';
import { KeyValue, MenuType, ResourceAction, Workspace } from '..';
import { Addon } from '../api'
export enum PluginType {
PageApp = 'page-app',
Definition = 'definition',
}
interface PluginMetaInfoLink {
name: string;
url: string;
}
export interface PluginMetaInfo {
author: {
name: string;
url?: string;
};
description: string;
links: PluginMetaInfoLink[];
logos: {
large: string;
small: string;
};
updated: string;
version: string;
}
interface PluginDependencyInfo {
id: string;
name: string;
version: string;
type: PluginType;
}
export interface PluginDependencies {
velauxDependency?: string;
velauxVersion: string;
plugins: PluginDependencyInfo[];
}
export interface PluginInclude {
workspace: Workspace;
type: MenuType;
label: string;
name: string;
to: string;
relatedRoute: string[];
icon: string;
permission?: ResourceAction;
catalog?: string;
}
export interface PluginMeta<T extends KeyValue = {}> extends PluginLink, SourceAddon {
id: string;
name: string;
type: PluginType;
info: PluginMetaInfo;
// System.load & relative URLS
module: string;
baseUrl: string;
// Define plugin requirements
dependencies?: PluginDependencies;
// Define the menus
includes?: PluginInclude[];
// Filled in by the backend
jsonSetting?: T;
secureJsonData?: KeyValue;
secureJsonFields?: KeyValue<boolean>;
enabled?: boolean;
defaultNavUrl?: string;
hasUpdate?: boolean;
enterprise?: boolean;
latestVersion?: string;
live?: boolean;
}
/**
* Represents a plugin and link to get plugin tarball
*/
export interface PluginLink {
name: string
url: string
}
/**
* Represents a plugin linked to
*/
export interface SourceAddon {
addon: Addon
}
export interface PluginConfigPageProps<T extends PluginMeta> {
plugin: VelaUXPlugin<T>;
query: KeyValue; // The URL query parameters
onJSONDataChange: (key: string, value: any) => void;
onSecureJSONDataChange: (key: string, value: any) => void;
}
export interface PluginConfigPage<T extends PluginMeta> {
title: string; // Display
icon?: string;
id: string; // Unique, in URL
body: ComponentType<PluginConfigPageProps<T>>;
}
// The design was inspired by Grafana. So the field is consistent with Grafana;
export class VelaUXPlugin<T extends PluginMeta = PluginMeta> {
// Meta is filled in by the plugin loading system
meta: T;
// This is set if the plugin system had errors loading the plugin
loadError?: boolean;
// Show configuration tabs on the plugin page
configPages?: PluginConfigPage<T>;
// Tabs on the plugin page
addConfigPage(tab: PluginConfigPage<T>) {
this.configPages = tab;
return this;
}
constructor() {
this.meta = {} as T;
}
}
export type PluginEnableRequest = {
id: string
jsonData: KeyValue
secureJsonData: KeyValue
}
export type PluginInstallRequest = {
id: string
url: string
}
export type UXPlugin = {
id: string
url: string
}

View File

@ -1,6 +0,0 @@
export enum DeployModes {
Deploy = 'deploy',
CanaryDeploy = 'canary-deploy',
}
export type DeployMode = DeployModes.CanaryDeploy | DeployModes.Deploy;

View File

@ -1,9 +0,0 @@
export type KeyValue<T = any> = Record<string, T>;
export function unmarshal<T>(kv: KeyValue): T {
return kv as T;
}
export function marshal<T>(obj: T): KeyValue {
return obj as KeyValue;
}

View File

@ -1,5 +0,0 @@
export * from './layout';
export * from './menus';
export * from './permission';
export * from './data';
export * from './application';

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