├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ ├── documentation.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── assets │ └── images │ │ └── welcome │ │ ├── Meshery-celebration-Dark.svg │ │ └── Meshery-celebration-Light.svg ├── config.yml ├── dependabot.yml ├── install │ └── deploy.yaml ├── label-commenter-config.yml ├── release-drafter.yml └── workflows │ ├── build-and-release.yml │ ├── ci.yml │ ├── components-to-doc.yml │ ├── e2etest.yaml │ ├── error-ref-publisher.yaml │ ├── label-commenter.yml │ ├── multi-platform.yml │ ├── release-drafter.yml │ ├── slack.yml │ └── update_components.yaml ├── .gitignore ├── .golangci.yml ├── CODEOWNERS ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── build ├── Makefile.core.mk ├── Makefile.show-help.mk ├── config.go └── meshmodel_metadata.json ├── go.mod ├── go.sum ├── helpers └── component_info.json ├── img ├── .DS_Store └── readme │ ├── community.svg │ ├── meshery-logo-dark-text-side.svg │ ├── meshery-logo-light-text-side.svg │ ├── meshery-logo-light-text.svg │ ├── slack-128.png │ ├── slack-dark-128.png │ └── traefik.svg ├── internal └── config │ ├── config.go │ ├── error.go │ ├── operations.go │ └── releases.go ├── main.go ├── templates └── meshmodel │ └── components │ ├── v1.4.5 │ ├── httproutegroup.meshery.layer5.io_meshmodel.json │ ├── tcproute.meshery.layer5.io_meshmodel.json │ ├── traefikmesh_meshmodel.json │ ├── trafficsplit.meshery.layer5.io_meshmodel.json │ └── traffictarget.meshery.layer5.io_meshmodel.json │ ├── v1.4.7 │ ├── httproutegroup.meshery.layer5.io_meshmodel.json │ ├── tcproute.meshery.layer5.io_meshmodel.json │ ├── traefikmesh_meshmodel.json │ ├── trafficsplit.meshery.layer5.io_meshmodel.json │ └── traffictarget.meshery.layer5.io_meshmodel.json │ └── v1.4.8 │ ├── httproutegroup.meshery.layer5.io_meshmodel.json │ ├── tcproute.meshery.layer5.io_meshmodel.json │ ├── traefikmesh_meshmodel.json │ ├── trafficsplit.meshery.layer5.io_meshmodel.json │ └── traffictarget.meshery.layer5.io_meshmodel.json └── traefik ├── custom-operations.go ├── error.go ├── install.go ├── oam.go ├── oam ├── doc.go ├── parser.go └── register.go ├── sample-apps.go └── traefik.go /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 General Bug Report 3 | about: Report an issue to help improve the project. 4 | title: "" 5 | labels: "kind/bug" 6 | assignees: "" 7 | --- 8 | 9 | #### Current Behavior 10 | 11 | 12 | 13 | #### Expected Behavior 14 | 15 | 16 | 17 | #### Screenshots/Logs 18 | 19 | 20 | 21 | #### Environment 22 | 23 | - **Host OS:** Mac Linux Windows 24 | - **Platform:** Docker or Kubernetes 25 | - **Meshery Server Version:** stable-v 26 | - **Meshery Client Version:** stable-v 27 | - **Meshery Adapter Version:** stable-v 28 | 29 | 36 | 37 | --- 38 | 39 | #### Contributor [Guides](https://docs.meshery.io/project/contributing) and Resources 40 | 41 | - 📝 [Meshery Adapters Spreadsheet](https://docs.google.com/spreadsheets/d/1rGGpSXC68iDJzNRU-qZIRQsZUwkt1qLFg7JCs4pfvbU/edit?usp=sharing) 42 | - 🛠 [Meshery Build & Release Strategy](https://docs.meshery.io/project/build-and-release) 43 | - 📚 [Instructions for contributing to documentation](https://github.com/meshery/meshery/blob/master/CONTRIBUTING.md#documentation-contribution-flow) 44 | - Meshery documentation [site](https://docs.meshery.io/) and [source](https://github.com/meshery/meshery/tree/master/docs) 45 | - 🎨 Wireframes and [designs for Meshery UI](https://www.figma.com/file/SMP3zxOjZztdOLtgN4dS2W/Meshery-UI) in Figma [(open invite)](https://www.figma.com/team_invite/redeem/qJy1c95qirjgWQODApilR9) 46 | - 🙋🏾🙋🏼 Questions: [Layer5 Discussion Forum](https://discuss.layer5.io) and [Layer5 Community Slack](http://slack.layer5.io) 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: 🙋🏾🙋🏼‍Question 4 | url: https://github.com/layer5io/meshery/discussions/new 5 | about: Submit your question using GitHub Discussions. 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 📄 Documentation issue 3 | about: Issues related to documentation. 4 | title: '[Docs]' 5 | labels: 'area/docs' 6 | assignees: '' 7 | --- 8 | **Current State:** 9 | 10 | **Desired State:** 11 | 12 | --- 13 | **Contributor Resources** 14 | - 📝 [Meshery Adapters Spreadsheet](https://docs.google.com/spreadsheets/d/1rGGpSXC68iDJzNRU-qZIRQsZUwkt1qLFg7JCs4pfvbU/edit?usp=sharing) 15 | - [Meshery documentation site](https://docs.meshery.io/) 16 | - [Meshery documentation source](https://github.com/meshery/meshery/tree/master/docs) 17 | - [Instructions for contributing to documentation](https://github.com/meshery/meshery/blob/master/CONTRIBUTING.md#documentation-contribution-flow) 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 💡 General Feature Request 3 | about: Suggest an enhancement to Meshery. 4 | title: "" 5 | labels: "kind/enhancement" 6 | assignees: "" 7 | --- 8 | 9 | #### Current Behavior 10 | 11 | 12 | 13 | #### Desired Behavior 14 | 15 | 16 | 17 | #### Implementation 18 | 19 | 20 | 21 | #### Acceptance Tests 22 | 23 | 24 | 25 | #### Mockups 26 | 27 | 28 | 29 | --- 30 | 31 | #### Contributor [Guides](https://docs.meshery.io/project/contributing) and Resources 32 | 33 | - 📝 [Meshery Adapters Spreadsheet](https://docs.google.com/spreadsheets/d/1rGGpSXC68iDJzNRU-qZIRQsZUwkt1qLFg7JCs4pfvbU/edit?usp=sharing) 34 | - 🛠 [Meshery Build & Release Strategy](https://docs.meshery.io/project/build-and-release) 35 | - 📚 [Instructions for contributing to documentation](https://github.com/meshery/meshery/blob/master/CONTRIBUTING.md#documentation-contribution-flow) 36 | - Meshery documentation [site](https://docs.meshery.io/) and [source](https://github.com/meshery/meshery/tree/master/docs) 37 | - 🎨 Wireframes and [designs for Meshery UI](https://www.figma.com/file/SMP3zxOjZztdOLtgN4dS2W/Meshery-UI) in Figma [(open invite)](https://www.figma.com/team_invite/redeem/qJy1c95qirjgWQODApilR9) 38 | - 🙋🏾🙋🏼 Questions: [Layer5 Discussion Forum](https://discuss.layer5.io) and [Layer5 Community Slack](http://slack.layer5.io) 39 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Description** 2 | 3 | This PR fixes # 4 | 5 | **Notes for Reviewers** 6 | 7 | 8 | **[Signed commits](../CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)** 9 | - [ ] Yes, I signed my commits. 10 | 11 | 12 | 24 | -------------------------------------------------------------------------------- /.github/config.yml: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------- 2 | # Configuration for new-issue-welcome - https://github.com/behaviorbot/new-issue-welcome 3 | # Comment to be posted to on first time issues 4 | newIssueWelcomeComment: > 5 | Thanks for opening this issue. A contributor will be by to give feedback soon. In the meantime, please review the [Contributors' Welcome Guide](https://docs.meshery.io/project/community), engage in the [discussion forum](https://meshery.io/community#discussion-forums), and be sure to join the [community Slack](http://slack.meshery.io/). 6 | # Configuration for new-pr-welcome - https://github.com/behaviorbot/new-pr-welcome 7 | # Comment to be posted to on PRs from first time contributors in your repository 8 | newPRWelcomeComment: > 9 | Yay, your first pull request! :thumbsup: A contributor will be by to give feedback soon. In the meantime, you can find updates in the [#github-notifications](https://layer5io.slack.com/archives/CLVT4TSG4) channel in the [community Slack](https://slack.meshery.io). 10 | 11 | Be sure to double-check that you have signed your commits. Here are instructions for [making signing an implicit activity while performing a commit](https://github.com/layer5io/layer5/blob/master/CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin). 12 | 13 | #------------------------------------------------------------------------------- 14 | # Configuration for first-pr-merge - https://github.com/behaviorbot/first-pr-merge 15 | # Comment to be posted to on pull requests merged by a first time user 16 | firstPRMergeComment: > 17 | Thanks for your contribution to Meshery! :tada: 18 | 19 | 20 | 21 | 22 | Meshery Logo 23 | 24 | 25 |         [Join the community](http://slack.meshery.io), if you haven't yet and please leave a :star: [star on the project](../stargazers). :smile: 26 | 27 | #------------------------------------------------------------------------------- 28 | # Configuration for request-info - https://github.com/behaviorbot/request-info 29 | # Comment to reply with 30 | requestInfoReplyComment: > 31 | Thanks for opening this issue. We welcome all input! If you could provide a little more information, this will greatly aide in its resolution. :thumbsup: 32 | # *OPTIONAL* Add a list of people whose Issues/PRs will not be commented on 33 | # keys must be GitHub usernames 34 | #requestInfoUserstoExclude: 35 | # - layer5io/maintainers 36 | 37 | #------------------------------------------------------------------------------- 38 | # Configuration for sentiment-bot - https://github.com/behaviorbot/sentiment-bot 39 | # *Required* toxicity threshold between 0 and .99 with the higher numbers being the most toxic 40 | # Anything higher than this threshold will be marked as toxic and commented on 41 | sentimentBotToxicityThreshold: .9 42 | 43 | # *Required* Comment to reply with 44 | sentimentBotReplyComment: > 45 | Please be sure to review the code of conduct and be respectful of other users. // @meshery/maintainers 46 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gomod 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | open-pull-requests-limit: 5 8 | labels: 9 | - "dependencies" 10 | reviewers: 11 | - meshery/maintainers -------------------------------------------------------------------------------- /.github/install/deploy.yaml: -------------------------------------------------------------------------------- 1 | name: TraefikMesh 2 | services: 3 | traefik: 4 | type: TraefikMesh 5 | model: TRAEFIK_MESH 6 | apiVersion: core.meshmodel.dev/v1alpha1 7 | namespace: traefik 8 | version: #will be inserted dynamically 9 | 10 | -------------------------------------------------------------------------------- /.github/label-commenter-config.yml: -------------------------------------------------------------------------------- 1 | comment: 2 | footer: "\ 3 | ---\n\n 4 | >         Be sure to [join the community](http://slack.layer5.io), if you haven't yet and please leave a :star: [star on the project](../stargazers) :smile: 5 | " 6 | 7 | labels: 8 | - name: issue/design required 9 | labeled: 10 | issue: 11 | body: This issue has been labeled with 'design-required'. Note that prior to commencing on implementation, a design specification needs to be created and reviewed for approval. See [Creating a Functional Specification](https://docs.google.com/document/d/1RP3IWLc-MiQS-QYasqCoVuCH7--G87p5ezE5f_nOzB8/edit?usp=sharing) to create a design spec. 12 | action: open 13 | - name: issue/remind 14 | labeled: 15 | issue: 16 | body: Checking in... it has been awhile since we've heard from you on this issue. Are you still working on it? Please let us know and please don't hesitate to contact a [MeshMate](https://layer5.io/community/meshmates/) or any other [community member](https://layer5.io/community/members) for assistance. 17 | action: open 18 | pr: 19 | body: Checking in... it has been awhile since we've heard from you on this issue. Are you still working on it? Please let us know and please don't hesitate to contact a [MeshMate](https://layer5.io/community/meshmates/) or any other [community member](https://layer5.io/community/members) for assistance. 20 | action: open 21 | - name: issue/dco 22 | labeled: 23 | issue: 24 | body: "🚨 Alert! Git Police! We couldn’t help but notice that one or more of your commits is missing a sign-off. _A what?_ A commit sign-off (your email address).\n\n 25 | To amend the commits in this PR with your signoff using the instructions provided in the DCO check above. \n\n 26 | To configure your dev environment to automatically signoff on your commits in the future, see [these instructions](https://github.com/meshery/meshery/blob/master/CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)." 27 | action: open 28 | pr: 29 | body: "🚨 Alert! Git Police! We couldn’t help but notice that one or more of your commits is missing a sign-off. _A what?_ A commit sign-off (your email address).\n\n 30 | To amend the commits in this PR with your signoff using the instructions provided in the DCO check above. \n\n 31 | To configure your dev environment to automatically signoff on your commits in the future, see [these instructions](https://github.com/meshery/meshery/blob/master/CONTRIBUTING.md#signing-off-on-commits-developer-certificate-of-origin)." 32 | action: open 33 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: "Meshery Adapter for Traefik Mesh v$NEXT_PATCH_VERSION" 2 | tag-template: "v$NEXT_PATCH_VERSION" 3 | categories: 4 | - title: "🚀 Features" 5 | labels: 6 | - "kind/feature" 7 | - "kind/enhancement" 8 | - title: "🐛 Bug Fixes" 9 | labels: 10 | - "kind/fix" 11 | - "kind/bugfix" 12 | - "kind/bug" 13 | - title: "🧰 Maintenance" 14 | labels: 15 | - "kind/chore" 16 | - "area/ci" 17 | - "area/tests" 18 | - title: 📖 Documentation 19 | label: area/docs 20 | change-template: "- $TITLE @$AUTHOR (#$NUMBER)" 21 | template: | 22 | ## What's New 23 | **General** 24 | $CHANGES 25 | 26 | ## Contributors 27 | 28 | Thank you to our contributors for making this release possible: 29 | $CONTRIBUTORS 30 | -------------------------------------------------------------------------------- /.github/workflows/build-and-release.yml: -------------------------------------------------------------------------------- 1 | name: Meshery Traefik Mesh Build and Release 2 | on: 3 | release: 4 | types: [published] 5 | push: 6 | branches: 7 | - "master" 8 | jobs: 9 | build: 10 | name: Build check 11 | runs-on: ubuntu-latest 12 | # needs: [lint, error_check, static_check, vet, sec_check, tests] 13 | steps: 14 | - name: Check out code 15 | uses: actions/checkout@v3 16 | with: 17 | fetch-depth: 1 18 | - name: Setup Go 19 | uses: actions/setup-go@v3 20 | with: 21 | go-version: 1.19 22 | - run: GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go build . 23 | docker: 24 | name: Docker build and push 25 | runs-on: ubuntu-latest 26 | steps: 27 | - name: Check out code 28 | uses: actions/checkout@v3 29 | with: 30 | fetch-depth: 1 31 | - name: Docker login 32 | uses: azure/docker-login@v1 33 | with: 34 | username: ${{ secrets.DOCKER_USERNAME }} 35 | password: ${{ secrets.DOCKER_PASSWORD }} 36 | - name: Docker edge build & tag 37 | if: startsWith(github.ref, 'refs/tags/') != true && success() 38 | run: | 39 | DOCKER_BUILDKIT=1 docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:edge-latest --build-arg TOKEN=${{ secrets.GLOBAL_TOKEN }} --build-arg TOKEN=${{ secrets.GLOBAL_TOKEN }} --build-arg GIT_COMMITSHA=${GITHUB_SHA::7} --build-arg VERSION="edge-latest" . 40 | docker tag ${{ secrets.IMAGE_NAME }}:edge-latest ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::7} 41 | - name: Docker edge push 42 | if: startsWith(github.ref, 'refs/tags/') != true && success() 43 | run: | 44 | docker push ${{ secrets.IMAGE_NAME }}:edge-latest 45 | docker push ${{ secrets.IMAGE_NAME }}:edge-${GITHUB_SHA::7} 46 | - name: Docker stable build & tag 47 | if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() 48 | run: | 49 | DOCKER_BUILDKIT=1 docker build --no-cache -t ${{ secrets.IMAGE_NAME }}:stable-latest --build-arg GIT_COMMITSHA=${GITHUB_SHA::7} --build-arg VERSION=${GITHUB_REF/refs\/tags\//} . 50 | docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//} 51 | docker tag ${{ secrets.IMAGE_NAME }}:stable-latest ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::7} 52 | - name: Docker stable push 53 | if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() 54 | run: | 55 | docker push ${{ secrets.IMAGE_NAME }}:stable-latest 56 | docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_REF/refs\/tags\//} 57 | docker push ${{ secrets.IMAGE_NAME }}:stable-${GITHUB_SHA::7} 58 | - name: Docker Hub Description 59 | if: github.event_name != 'pull_request' && startsWith(github.ref, 'refs/tags/') && success() 60 | uses: peter-evans/dockerhub-description@v2.0.0 61 | env: 62 | DOCKERHUB_USERNAME: ${{ secrets.DOCKER_USERNAME }} 63 | DOCKERHUB_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} 64 | DOCKERHUB_REPOSITORY: ${{ secrets.IMAGE_NAME }} 65 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Default Meshery Traefik Mesh Workflow 2 | on: 3 | push: 4 | branches: 5 | - "*" 6 | tags: 7 | - "v*" 8 | pull_request: 9 | branches: 10 | - master 11 | jobs: 12 | lint: 13 | name: Check & Review code 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/setup-go@v3 17 | with: 18 | go-version: 1.19 19 | - uses: actions/checkout@v3 20 | - name: golangci-lint 21 | uses: golangci/golangci-lint-action@v3 22 | with: 23 | # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. 24 | version: v1.49 25 | 26 | # Optional: working directory, useful for monorepos 27 | # working-directory: somedir 28 | 29 | # Optional: golangci-lint command line arguments. 30 | # args: --issues-exit-code=0 31 | 32 | # Optional: show only new issues if it's a pull request. The default value is `false`. 33 | # only-new-issues: true 34 | error_check: 35 | name: Error check 36 | runs-on: ubuntu-latest 37 | steps: 38 | - name: Check out code 39 | uses: actions/checkout@v3 40 | with: 41 | fetch-depth: 1 42 | - name: Setup Go 43 | uses: actions/setup-go@v3 44 | with: 45 | go-version: 1.19 46 | - run: GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go install github.com/kisielk/errcheck@latest; /home/runner/go/bin/errcheck -tags draft ./... 47 | error_code_check: 48 | name: Error code utility check 49 | runs-on: ubuntu-latest 50 | steps: 51 | - name: Check out code 52 | uses: actions/checkout@v3 53 | with: 54 | fetch-depth: 1 55 | - name: Setup Go 56 | uses: actions/setup-go@v3 57 | with: 58 | go-version: 1.19 59 | - run: | 60 | errWillHave="level=error" 61 | GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go install github.com/layer5io/meshkit/cmd/errorutil; 62 | err=$(/home/runner/go/bin/errorutil -d . update --skip-dirs meshery -i ./helpers -o ./helpers); 63 | echo "ERR: $err"; 64 | if [[ $err == *"$errWillHave"* ]]; 65 | then 66 | echo "$err"; 67 | return 1; 68 | fi 69 | static_check: 70 | name: Static check 71 | runs-on: ubuntu-latest 72 | steps: 73 | - name: Check out code 74 | uses: actions/checkout@v3 75 | with: 76 | fetch-depth: 1 77 | - name: Setup Go 78 | uses: actions/setup-go@v3 79 | with: 80 | go-version: 1.19 81 | - uses: dominikh/staticcheck-action@v1.2.0 82 | with: 83 | install-go: false 84 | version: "2022.1" 85 | vet: 86 | name: Vet 87 | runs-on: ubuntu-latest 88 | steps: 89 | - name: Check out code 90 | uses: actions/checkout@v3 91 | with: 92 | fetch-depth: 1 93 | - name: Setup Go 94 | uses: actions/setup-go@v3 95 | with: 96 | go-version: 1.19 97 | - run: GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go vet -tags draft ./... 98 | sec_check: 99 | name: Security check 100 | runs-on: ubuntu-latest 101 | env: 102 | GO111MODULE: on 103 | steps: 104 | - name: Check out code 105 | uses: actions/checkout@v3 106 | with: 107 | fetch-depth: 1 108 | - name: Run Gosec Security Scanner 109 | uses: securego/gosec@master 110 | with: 111 | args: -exclude=G301,G304,G107,G101,G110 ./... 112 | tests: 113 | # needs: [lint, error_check, static_check, vet, sec_check] 114 | name: Tests 115 | runs-on: ubuntu-latest 116 | env: 117 | ACTIONS_ALLOW_UNSECURE_COMMANDS: true 118 | steps: 119 | - name: Check out code 120 | uses: actions/checkout@v3 121 | with: 122 | fetch-depth: 1 123 | - name: Setup Go 124 | uses: actions/setup-go@v3 125 | with: 126 | go-version: 1.19 127 | - name: Create cluster using KinD 128 | uses: engineerd/setup-kind@v0.5.0 129 | with: 130 | version: "v0.11.0" 131 | - run: | 132 | export CURRENTCONTEXT="$(kubectl config current-context)" 133 | echo "current-context:" ${CURRENTCONTEXT} 134 | export KUBECONFIG="${HOME}/.kube/config" 135 | echo "environment-kubeconfig:" ${KUBECONFIG} 136 | GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go test ./... 137 | -------------------------------------------------------------------------------- /.github/workflows/components-to-doc.yml: -------------------------------------------------------------------------------- 1 | name: Components to Documents 2 | on: 3 | push: 4 | paths: 5 | - templates/oam/workloads** 6 | release: 7 | types: [published] 8 | 9 | jobs: 10 | CopyComponents: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | 15 | - name: Make components to .md files 16 | run: | 17 | 18 | function join_by { 19 | local d=${1-} f=${2-} 20 | if shift 2; then 21 | echo "$f${@/#/$d}" 22 | 23 | fi 24 | } 25 | mkdir output 26 | folder_path=templates/oam/workloads/* 27 | for file in $folder_path; 28 | do 29 | folder_name="$file/*" 30 | onlyfolder=$(basename "$file") 31 | echo "--- 32 | component: $onlyfolder 33 | integrations:" > $onlyfolder.md 34 | for indFile in $folder_name; 35 | do 36 | filename=$(basename "$indFile") 37 | temp_filename=$filename 38 | IFS="." 39 | read -ra newarr <<< "$temp_filename" 40 | IFS="" 41 | if [[ "${newarr[7]}" == "schema" ]] 42 | then 43 | continue 44 | fi 45 | ans=$(join_by . ${newarr[0]} ${newarr[1]}) 46 | echo " - $ans" >> $onlyfolder.md 47 | done 48 | echo "---" >> $onlyfolder.md 49 | mv $onlyfolder.md output 50 | done 51 | 52 | - name: Pushes folder to main repo 53 | uses: crykn/copy_folder_to_another_repo_action@v1.0.6 54 | env: 55 | API_TOKEN_GITHUB: ${{ secrets.GH_ACCESS_TOKEN }} 56 | with: 57 | source_folder: 'output' 58 | destination_repo: 'meshery/meshery' 59 | destination_folder: 'docs/_integrations/traefik-mesh' 60 | destination_branch: 'master' 61 | user_email: 'ci@layer5.io' 62 | user_name: 'l5io' 63 | commit_msg: 'Adapters Component added' -------------------------------------------------------------------------------- /.github/workflows/e2etest.yaml: -------------------------------------------------------------------------------- 1 | name: E2E Test Traefik Mesh 2 | 3 | on: 4 | push: 5 | branches: 6 | - "*" 7 | tags: 8 | - "v*" 9 | pull_request: 10 | branches: 11 | - "*" 12 | release: 13 | types: [published] 14 | jobs: 15 | SetPatterfile: 16 | runs-on: ubuntu-latest 17 | outputs: 18 | sm_version: ${{ steps.gettag.outputs.release }} 19 | adapter_version: ${{ env.version }} 20 | steps: 21 | - name: Checkout Code 22 | uses: actions/checkout@v3 23 | - name: Get version of adapter 24 | run: | 25 | if [ ${{ github.event_name }} == "release" ];then 26 | echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV 27 | else 28 | echo "version=edge" >> $GITHUB_ENV 29 | fi 30 | - name: Get latest release tag 31 | id: gettag 32 | uses: pozetroninc/github-action-get-latest-release@master 33 | with: 34 | repository: traefik/mesh 35 | excludes: prerelease, draft 36 | - name: Change service mesh version in patternfile 37 | run: | 38 | 39 | yq e -i '.services.traefik.version="${{ steps.gettag.outputs.release }}"' ./.github/install/deploy.yaml 40 | cat ./.github/install/deploy.yaml 41 | - name: Uploading file 42 | uses: actions/upload-artifact@v2 43 | with: 44 | name: patternfile 45 | path: ./.github/install/deploy.yaml 46 | 47 | TestTraefik: 48 | needs: SetPatterfile 49 | uses: meshery/meshery/.github/workflows/test_adaptersv2.yaml@master 50 | with: 51 | expected_resources: grafana-core,jaeger,prometheus-core,traefik-mesh-controller,traefik-mesh-proxy 52 | expected_resources_types: pod,pod,pod,pod,pod 53 | expected_resources_namespaces: traefik,traefik,traefik,traefik,traefik 54 | deployment_url: https://raw.githubusercontent.com/meshery/meshery/master/install/deployment_yamls/k8s/meshery-traefik-mesh-deployment.yaml 55 | service_url: https://raw.githubusercontent.com/meshery/meshery/master/install/deployment_yamls/k8s/meshery-traefik-mesh-service.yaml 56 | adapter_name: traefik 57 | patternfile_name: deploy.yaml 58 | provider: Local 59 | k8s_version: v1.20.1 60 | sm_version: ${{ needs.SetPatternfile.outputs.sm_version }} 61 | adapter_version: ${{ needs.SetPatternfile.outputs.adapter_version }} 62 | output_filename: data.json 63 | secrets: 64 | token: ${{ secrets.PROVIDER_TOKEN }} 65 | 66 | UpdateDocs: 67 | needs: TestTraefik 68 | if: "always() && github.event_name != 'pull_request' " 69 | runs-on: ubuntu-latest 70 | steps: 71 | - name: Skip if needed 72 | run: | 73 | echo "this is it ${{ needs.SkipIfNeeded.outputs.skipdocupdate }} " 74 | if [ "${{github.event_name }}" == "push" ];then 75 | echo "version=edge" >> $GITHUB_ENV 76 | fi 77 | if [ "${{github.event_name }}" == "release" ];then 78 | echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV 79 | fi 80 | - uses: actions/checkout@v3 81 | with: 82 | repository: meshery/meshery 83 | token: ${{ secrets.GH_ACCESS_TOKEN }} 84 | - name: DownloadJSON 85 | uses: actions/download-artifact@v2 86 | with: 87 | name: data.json 88 | - name: Add commit SHORT_SHA 89 | run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV 90 | - name: echo results 91 | run: | 92 | pretty=$(jq . data.json) 93 | rm data.json 94 | mkdir -p ./docs/_compatibility/meshery-traefik-mesh 95 | cd ./docs/_compatibility/meshery-traefik-mesh 96 | touch data.json 97 | echo $pretty > data.json 98 | cat data.json 99 | touch test.md 100 | filename=(`date +%m-%d-%Y-%H-%M-%m_${SHORT_SHA}`) 101 | echo $filename 102 | echo "--- 103 | timestamp: $(jq '.metadata.runon| strptime("%a %b %e %X %Z %Y") | strftime("%Y-%m-%d %X %Z %a")' data.json) 104 | meshery-component: meshery-traefik-mesh 105 | meshery-component-version: $version 106 | meshery-server-version: $(jq '.metadata."meshery-server-version"' data.json) 107 | k8s-distro: minikube 108 | k8s-version: $(jq '.metadata.k8s_version' data.json) 109 | service-mesh: traefik-mesh 110 | service-mesh-version: $(jq '.metadata.service_mesh_version' data.json) 111 | tests: 112 | pod/traefik-mesh-controller: $(jq '.resources_status."pod/traefik-mesh-controller"' data.json) 113 | pod/traefik-mesh-proxy: $(jq '.resources_status."pod/traefik-mesh-proxy"' data.json) 114 | pod/grafana-core: $(jq '.resources_status."pod/grafana-core"' data.json) 115 | pod/jaeger: $(jq '.resources_status."pod/jaeger"' data.json) 116 | pod/prometheus-core: $(jq '.resources_status."pod/prometheus-core"' data.json) 117 | overall-status: $(jq '."overall-status"' data.json) 118 | ---" > test.md 119 | mv test.md $filename.md 120 | rm data.json 121 | - name: Commit 122 | uses: stefanzweifel/git-auto-commit-action@v4 123 | with: 124 | file_pattern: docs 125 | commit_user_name: l5io 126 | commit_user_email: ci@layer5.io 127 | commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> 128 | commit_options: '--signoff' 129 | commit_message: '[Docs] Test status of adapter' 130 | -------------------------------------------------------------------------------- /.github/workflows/error-ref-publisher.yaml: -------------------------------------------------------------------------------- 1 | name: Meshkit Error Codes Utility Runner 2 | on: 3 | push: 4 | branches: 5 | - 'master' 6 | paths: 7 | - '**.go' 8 | 9 | jobs: 10 | Update-error-codes: 11 | name: Error codes utility 12 | if: github.repository == 'meshery/meshery-traefik-mesh' 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v3 16 | # token here with write access to meshery-traefik-mesh repo 17 | with: 18 | token: ${{ secrets.GH_ACCESS_TOKEN }} 19 | ref: 'master' 20 | 21 | - name: Setup Go 22 | uses: actions/setup-go@v3 23 | with: 24 | go-version: '1.19' 25 | 26 | - name: Run utility 27 | run: | 28 | go get github.com/layer5io/meshkit/cmd/errorutil 29 | go run github.com/layer5io/meshkit/cmd/errorutil -d . update --skip-dirs meshery -i ./helpers -o ./helpers 30 | # to update errorutil* files in meshery-traefik-mesh repo 31 | - name: Commit changes 32 | uses: stefanzweifel/git-auto-commit-action@v4 33 | with: 34 | commit_user_name: l5io 35 | commit_user_email: ci@layer5.io 36 | commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> 37 | commit_options: '--signoff' 38 | commit_message: "run error codes utility" 39 | file_pattern: helpers/ **error.go 40 | 41 | # to push changes to meshery docs 42 | - name: Checkout meshery 43 | uses: actions/checkout@v3 44 | with: 45 | repository: 'meshery/meshery' 46 | # token with write access to meshery repository 47 | token: ${{ secrets.GH_ACCESS_TOKEN }} 48 | path: 'meshery' 49 | ref: 'master' 50 | 51 | - name: Update docs 52 | run: | 53 | echo '{ "errors_export": "" }' | jq --slurpfile export ./helpers/errorutil_errors_export.json '.errors_export = $export[0]' > ./meshery/docs/_data/errorref/traefik-mesh_errors_export.json 54 | 55 | - name: Commit changes 56 | uses: stefanzweifel/git-auto-commit-action@v4 57 | with: 58 | repository: ./meshery 59 | commit_user_name: l5io 60 | commit_user_email: ci@layer5.io 61 | commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> 62 | commit_options: '--signoff' 63 | commit_message: '[Docs] Error Code Reference: Meshery Adapter for Traefik-mesh updated' 64 | file_pattern: docs/ 65 | -------------------------------------------------------------------------------- /.github/workflows/label-commenter.yml: -------------------------------------------------------------------------------- 1 | name: Label Commenter 2 | 3 | on: 4 | issues: 5 | types: 6 | - labeled 7 | 8 | pull_request_target: 9 | types: 10 | - labeled 11 | 12 | permissions: 13 | contents: read 14 | issues: write 15 | pull-requests: write 16 | 17 | jobs: 18 | comment: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v3 22 | with: 23 | ref: master 24 | env: 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | - name: Label Commenter 27 | uses: peaceiris/actions-label-commenter@v1 28 | -------------------------------------------------------------------------------- /.github/workflows/multi-platform.yml: -------------------------------------------------------------------------------- 1 | name: Multi-Platform Build and Release 2 | on: 3 | release: 4 | types: [published] 5 | push: 6 | tags: 7 | - 'v*' 8 | branches: 9 | - 'master' 10 | paths-ignore: 11 | - 'docs/**' 12 | - '.github/**' 13 | workflow_dispatch: 14 | inputs: 15 | release-ver: 16 | description: 'Stable Release Version' 17 | required: true 18 | default: 'v' 19 | stripped-release-ver: 20 | description: 'Stripped Stable Release Version' 21 | required: true 22 | default: '' 23 | release-channel: 24 | description: 'Release Channel' 25 | required: true 26 | default: 'edge' 27 | 28 | env: 29 | GIT_VERSION: ${{github.event.inputs.release-ver}} 30 | GIT_STRIPPED_VERSION: ${{github.event.inputs.stripped-release-ver}} 31 | RELEASE_CHANNEL: ${{github.event.inputs.release-channel}} 32 | GIT_TAG: ${{ github.event.release.tag_name }} 33 | 34 | jobs: 35 | print-inputs: 36 | runs-on: ubuntu-latest 37 | steps: 38 | 39 | - run: | 40 | echo "Dispatched GIT_VERSION: ${{github.event.inputs.release-ver}}" 41 | echo "Dispatched GIT_STRIPPED_VERSION: ${{github.event.inputs.stripped-release-ver}}" 42 | echo "Env RELEASE_CHANNEL: ${{env.RELEASE_CHANNEL}}" 43 | echo "Env GIT_VERSION: ${{env.GIT_VERSION}}" 44 | echo "Env GIT_STRIPPED_VERSION: ${{env.GIT_STRIPPED_VERSION}}" 45 | echo "Env GIT_TAG: ${{ github.event.release.tag_name }}" 46 | echo "Env GITHUB_REF: $GITHUB_REF" 47 | echo "Env GITHUB_REF:" ${GITHUB_REF} 48 | 49 | docker-build: 50 | runs-on: ubuntu-latest 51 | steps: 52 | - 53 | name: Checkout repo 54 | uses: actions/checkout@v3 55 | - 56 | name: Identify Release Values 57 | if: "${{ github.event.inputs.release-ver}} != 'v' }}" 58 | run: | 59 | if [[ ${GITHUB_REF} = refs/tags* ]] 60 | then 61 | echo RELEASE_CHANNEL=stable >> $GITHUB_ENV 62 | else 63 | echo RELEASE_CHANNEL=edge >> $GITHUB_ENV 64 | fi 65 | LATEST_VERSION=$(git ls-remote --sort='v:refname' --tags | tail -1 | cut -f2 | sed 's/refs\/tags\///g') >> $GITHUB_ENV 66 | GIT_VERSION=$(git ls-remote --sort='v:refname' --tags | tail -1 | cut -f2 | sed 's/refs\/tags\///g') >> $GITHUB_ENV 67 | GIT_STRIPPED_VERSION=$(git ls-remote --sort='v:refname' --tags | tail -1 | cut -f2 | sed 's/refs\/tags\///g' | cut -c2-) 68 | echo "Release channel determined to be $RELEASE_CHANNEL" 69 | echo "GIT_LATEST=$LATEST_VERSION" >> $GITHUB_ENV 70 | echo "GIT_VERSION=$GIT_VERSION" >> $GITHUB_ENV 71 | echo "GIT_STRIPPED_VERSION=$GIT_STRIPPED_VERSION" >> $GITHUB_ENV 72 | shell: bash 73 | 74 | - 75 | name: Set up QEMU 76 | uses: docker/setup-qemu-action@v1 77 | - 78 | name: Set up Docker Buildx 79 | uses: docker/setup-buildx-action@v1 80 | - 81 | name: Docker Meta 82 | id: meta 83 | uses: docker/metadata-action@v3 84 | with: 85 | images: ${{ secrets.IMAGE_NAME }} 86 | flavor: | 87 | latest=false 88 | tags: | 89 | type=raw,value=${{env.RELEASE_CHANNEL}}-{{sha}} 90 | type=semver,pattern={{version}},value=${{env.GIT_STRIPPED_VERSION}} 91 | type=raw,value=${{env.RELEASE_CHANNEL}}-{{tag}},enable=${{ startsWith(github.ref, 'refs/tags/v') }} 92 | type=raw,value=${{env.RELEASE_CHANNEL}}-latest 93 | - 94 | name: Login to DockerHub 95 | uses: docker/login-action@v1 96 | with: 97 | username: ${{ secrets.DOCKER_USERNAME }} 98 | password: ${{ secrets.DOCKER_PASSWORD }} 99 | - 100 | name: Build and Push 101 | uses: docker/build-push-action@v2 102 | with: 103 | context: "{{defaultContext}}" 104 | push: true 105 | build-args: | 106 | VERSION=${{env.GIT_VERSION}} 107 | GIT_COMMITSHA=${GITHUB_SHA::7} 108 | tags: ${{ steps.meta.outputs.tags }} 109 | platforms: linux/amd64,linux/arm64 110 | - 111 | name: Docker Hub Description 112 | uses: peter-evans/dockerhub-description@v3 113 | with: 114 | username: ${{ secrets.DOCKER_USERNAME }} 115 | password: ${{ secrets.DOCKER_PASSWORD }} 116 | repository: ${{ secrets.IMAGE_NAME }} 117 | readme-filepath: README.md 118 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | # our release branch 6 | branches: 7 | - master 8 | 9 | jobs: 10 | update_release_draft: 11 | runs-on: ubuntu-latest 12 | steps: 13 | # Drafts your next Release notes as Pull Requests are merged into "master" 14 | - uses: release-drafter/release-drafter@v5 15 | with: 16 | config-name: release-drafter.yml 17 | env: 18 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 19 | -------------------------------------------------------------------------------- /.github/workflows/slack.yml: -------------------------------------------------------------------------------- 1 | name: Slack Notify 2 | 3 | on: 4 | watch: 5 | types: [started] 6 | issues: 7 | types: [labeled] 8 | 9 | jobs: 10 | star-notify: 11 | if: github.event_name == 'watch' 12 | name: Notify Slack on star 13 | runs-on: ubuntu-latest 14 | steps: 15 | - name: Get current star count 16 | run: | 17 | echo "STARS=$(curl --silent 'https://api.github.com/repos/${{ github.repository }}' -H 'Accept: application/vnd.github.preview' | jq '.stargazers_count')" >> $GITHUB_ENV 18 | - name: Notify Slack 19 | env: 20 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} 21 | uses: pullreminders/slack-action@master 22 | with: 23 | args: '{\"channel\":\"CSK7N9TGX\",\"text\":\"${{ github.actor }} just starred ${{ github.repository }}! (https://github.com/${{ github.repository }}/stargazers) Total ⭐️: ${{ env.STARS }}\"}' 24 | 25 | good-first-issue-notify: 26 | if: github.event_name == 'issues' && (github.event.label.name == 'good first issue' || github.event.label.name == 'first-timers-only') 27 | name: Notify Slack for new good-first-issue 28 | runs-on: ubuntu-latest 29 | steps: 30 | - name: Notify Slack 31 | env: 32 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} 33 | uses: pullreminders/slack-action@master 34 | with: 35 | args: '{\"channel\":\"C019426UBNY\",\"type\":\"section\",\"text\":\":new: Good first issue up for grabs: ${{ github.event.issue.title }} - ${{ github.event.issue.html_url }} \"}' 36 | 37 | -------------------------------------------------------------------------------- /.github/workflows/update_components.yaml: -------------------------------------------------------------------------------- 1 | name: Meshery Traefik Mesh Pattern Components Generator 2 | on: 3 | push: 4 | branches: 5 | - 'master' 6 | schedule: 7 | - cron: "0 0 * * *" 8 | jobs: 9 | GenerateComponents: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Check out code 13 | uses: actions/checkout@v3 14 | with: 15 | fetch-depth: 1 16 | token: ${{ secrets.GH_ACCESS_TOKEN }} 17 | ref: "master" 18 | - name: Setup Go 19 | uses: actions/setup-go@v3 20 | with: 21 | go-version: 1.19 22 | - name: Run adapter to create components 23 | run: | 24 | touch log.txt 25 | mkdir -p ~/.meshery/bin 26 | (FORCE_DYNAMIC_REG=true DEBUG=true go run main.go > log.txt 2>&1) & 27 | end=$((SECONDS+300)) 28 | while [ $SECONDS -lt $end ]; do 29 | if [ "$(cat log.txt | grep "Component Creation completed for version")" != "" ];then 30 | echo "New components created" 31 | break 32 | fi 33 | done 34 | rm log.txt 35 | - name: Commit changes 36 | uses: stefanzweifel/git-auto-commit-action@v4 37 | with: 38 | file_pattern: templates/ 39 | commit_user_name: l5io 40 | commit_user_email: ci@layer5.io 41 | commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> 42 | commit_options: "--signoff" 43 | commit_message: "[Patterns] Pattern components generated from latest Traefik manifests" 44 | branch: master 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, build with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | 15 | .vscode 16 | 17 | meshery-traefik-mesh 18 | 19 | **errorutil_analyze_errors.json 20 | **errorutil_analyze_summary.json 21 | **errorutil_errors_export.json -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | linters-settings: 2 | depguard: 3 | list-type: blacklist 4 | packages: 5 | # logging is allowed only by logutils.Log, logrus 6 | # is allowed to use only in logutils package 7 | - github.com/sirupsen/logrus 8 | packages-with-error-message: 9 | - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log" 10 | dupl: 11 | threshold: 100 12 | exhaustive: 13 | default-signifies-exhaustive: false 14 | funlen: 15 | lines: 100 16 | statements: 50 17 | gci: 18 | local-prefixes: github.com/golangci/golangci-lint 19 | goconst: 20 | min-len: 2 21 | min-occurrences: 2 22 | gocritic: 23 | enabled-tags: 24 | - diagnostic 25 | - experimental 26 | - opinionated 27 | - performance 28 | - style 29 | disabled-checks: 30 | - dupImport # https://github.com/go-critic/go-critic/issues/845 31 | - ifElseChain 32 | - octalLiteral 33 | - whyNoLint 34 | - wrapperFunc 35 | gocyclo: 36 | min-complexity: 15 37 | goimports: 38 | local-prefixes: github.com/golangci/golangci-lint 39 | golint: 40 | min-confidence: 0 41 | gomnd: 42 | settings: 43 | mnd: 44 | # don't include the "operation" and "assign" 45 | checks: argument,case,condition,return 46 | gosec: 47 | settings: 48 | exclude: -G204 49 | govet: 50 | check-shadowing: false 51 | settings: 52 | printf: 53 | funcs: 54 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof 55 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf 56 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf 57 | - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf 58 | lll: 59 | line-length: 950 60 | maligned: 61 | suggest-new: true 62 | misspell: 63 | locale: US 64 | nolintlint: 65 | allow-leading-space: true # don't require machine-readable nolint directives (i.e. with no leading space) 66 | allow-unused: false # report any unused nolint directives 67 | require-explanation: false # don't require an explanation for nolint directives 68 | require-specific: false # don't require nolint directives to be specific about which linter is being skipped 69 | 70 | linters: 71 | # please, do not use `enable-all`: it's deprecated and will be removed soon. 72 | # inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint 73 | # https://golangci-lint.run/usage/linters/ 74 | disable-all: true 75 | enable: 76 | # TODO: consider continuously if more should be enabled. 77 | # Can also be useful to run with more strict settings before commit locally, i.e. to test for TODOs (godox) 78 | # - bodyclose 79 | # - deadcode 80 | - dogsled 81 | # - dupl 82 | # - errcheck 83 | # - exhaustive 84 | # - funlen 85 | # - goconst 86 | # - gocritic 87 | # - gocyclo 88 | - gofmt 89 | - goimports 90 | # - golint 91 | - gomodguard 92 | - gosec 93 | # - gomnd 94 | # - goprintffuncname 95 | - gosimple 96 | - govet 97 | - ineffassign 98 | # - interfacer 99 | - lll 100 | - misspell 101 | # - nakedret 102 | # - nolintlint 103 | # - rowserrcheck 104 | # - scopelint 105 | - staticcheck 106 | # - structcheck 107 | - stylecheck 108 | - typecheck 109 | # - unconvert 110 | # - unparam 111 | - unused 112 | # - varcheck 113 | - whitespace 114 | - asciicheck 115 | # - gochecknoglobals 116 | # - gocognit 117 | # - godot 118 | # - godox 119 | # - goerr113 120 | # - maligned 121 | # - nestif 122 | # - prealloc 123 | # - testpackage 124 | # - wsl 125 | 126 | issues: 127 | # Excluding configuration per-path, per-linter, per-text and per-source 128 | exclude-rules: 129 | - path: _test\.go 130 | linters: 131 | - gomnd 132 | 133 | # https://github.com/go-critic/go-critic/issues/926 134 | - linters: 135 | - gocritic 136 | text: "unnecessaryDefer:" 137 | 138 | run: 139 | skip-dirs: 140 | - test/testdata_etc 141 | - internal/cache 142 | - internal/renameio 143 | - internal/robustio 144 | timeout: 5m 145 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | @girishranganathan 2 | @leecalcote 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | You want to contribute to the project? Yay! We want you to! Visit our centralized instructions for [contributing](https://github.com/layer5io/meshery/blob/master/CONTRIBUTING.md#contributing). 4 | 5 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.19 as builder 2 | 3 | ARG VERSION 4 | ARG GIT_COMMITSHA 5 | WORKDIR /build 6 | # Copy the Go Modules manifests 7 | COPY go.mod go.mod 8 | COPY go.sum go.sum 9 | # cache deps before building and copying source so that we don't need to re-download as much 10 | # and so that source changes don't invalidate our downloaded layer 11 | RUN GOPROXY=https://proxy.golang.org,direct go mod download 12 | # Copy the go source 13 | COPY main.go main.go 14 | COPY internal/ internal/ 15 | COPY traefik/ traefik/ 16 | COPY build/ build/ 17 | # Build 18 | RUN GOPROXY=https://proxy.golang.org,direct CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -ldflags="-w -s -X main.version=$VERSION -X main.gitsha=$GIT_COMMITSHA" -a -o meshery-traefik-mesh main.go 19 | 20 | # Use distroless as minimal base image to package the manager binary 21 | # Refer to https://github.com/GoogleContainerTools/distroless for more details 22 | FROM gcr.io/distroless/static:nonroot 23 | ENV DISTRO="debian" 24 | ENV SERVICE_ADDR="meshery-traefik-mesh" 25 | ENV MESHERY_SERVER="http://meshery:9081" 26 | WORKDIR $HOME/.meshery 27 | COPY templates/ ./templates 28 | COPY --from=builder /build/meshery-traefik-mesh . 29 | USER nonroot:nonroot 30 | 31 | ENTRYPOINT ["./meshery-traefik-mesh"] 32 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright Meshery Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include build/Makefile.core.mk 16 | include build/Makefile.show-help.mk 17 | 18 | #----------------------------------------------------------------------------- 19 | # Environment Setup 20 | #----------------------------------------------------------------------------- 21 | BUILDER=buildx-multi-arch 22 | ADAPTER=traefik-mesh 23 | 24 | #----------------------------------------------------------------------------- 25 | # Docker-based Builds 26 | #----------------------------------------------------------------------------- 27 | .PHONY: docker docker-run lint error test run run-force-dynamic-reg 28 | 29 | ## Lint check Golang 30 | lint: 31 | golangci-lint run 32 | 33 | ## Build and run Adapter locally 34 | run: dep-check 35 | go mod tidy; \ 36 | DEBUG=true GOPROXY=direct GOSUMDB=off go run main.go 37 | 38 | ## Build and run Adapter locally; force component registration 39 | run-force-dynamic-reg: dep-check 40 | FORCE_DYNAMIC_REG=true DEBUG=true GOPROXY=direct GOSUMDB=off go run main.go 41 | 42 | ## Run Meshery Error utility 43 | error: dep-check 44 | go run github.com/layer5io/meshkit/cmd/errorutil -d . analyze -i ./helpers -o ./helpers 45 | 46 | ## Run Golang tests 47 | test: dep-check 48 | export CURRENTCONTEXT="$(kubectl config current-context)" 49 | echo "current-context:" ${CURRENTCONTEXT} 50 | export KUBECONFIG="${HOME}/.kube/config" 51 | echo "environment-kubeconfig:" ${KUBECONFIG} 52 | GOPROXY=direct GOSUMDB=off GO111MODULE=on go test -v ./... 53 | 54 | #----------------------------------------------------------------------------- 55 | # Dependencies 56 | #----------------------------------------------------------------------------- 57 | .PHONY: dep-check 58 | #.SILENT: dep-check 59 | 60 | INSTALLED_GO_VERSION=$(shell go version) 61 | 62 | dep-check: 63 | 64 | ifeq (,$(findstring $(GOVERSION), $(INSTALLED_GO_VERSION))) 65 | # Only send a warning. 66 | # @echo "Dependency missing: go$(GOVERSION). Ensure 'go$(GOVERSION).x' is installed and available in your 'PATH'" 67 | @echo "GOVERSION: " $(GOVERSION) 68 | @echo "INSTALLED_GO_VERSION: " $(INSTALLED_GO_VERSION) 69 | # Force error and stop. 70 | $(error Found $(INSTALLED_GO_VERSION). \ 71 | Required golang version is: 'go$(GOVERSION).x'. \ 72 | Ensure go '$(GOVERSION).x' is installed and available in your 'PATH'.) 73 | endif 74 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 4 | Shows an illustrated light mode meshery logo in light color mode and a dark mode meshery logo dark color mode. 5 |

6 | 7 | # Meshery Adapter for Traefik Mesh 8 | 9 | [![Docker Pulls](https://img.shields.io/docker/pulls/layer5/meshery.svg)](https://hub.docker.com/r/layer5/meshery-maesh) 10 | [![Go Report Card](https://goreportcard.com/badge/github.com/layer5io/meshery-traefik-mesh)](https://goreportcard.com/report/github.com/layer5io/meshery-traefik-mesh) 11 | [![Build Status](https://img.shields.io/github/actions/workflow/status/meshery/meshery-traefik-mesh/release-drafter.yml)](https://github.com/layer5io/meshery-traefik-mesh/actions) 12 | [![GitHub](https://img.shields.io/github/license/meshery/meshery-traefik-mesh.svg)](LICENSE) 13 | [![GitHub issues by-label](https://img.shields.io/github/issues/meshery/meshery-traefik-mesh/help%20wanted.svg)](https://github.com/layer5io/meshery-traefik-mesh/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) 14 | [![Website](https://img.shields.io/website/https/layer5.io/meshery.svg)](https://layer5.io/meshery/) 15 | [![Twitter Follow](https://img.shields.io/twitter/follow/layer5.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=mesheryio) 16 | [![Slack](https://img.shields.io/badge/Slack-@layer5.svg?logo=slack)](http://slack.meshery.io) 17 | [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3564/badge)](https://bestpractices.coreinfrastructure.org/projects/3564) 18 | 19 |

20 |

Meshery

21 | Meshery - the Cloud Native Manager 24 | A self-service engineering platform, Meshery, is the open source, cloud native manager that enables the design and management of all Kubernetes-based infrastructure and applications (multi-cloud). Among other features, As an extensible platform, Meshery offers visual and collaborative GitOps, freeing you from the chains of YAML while managing Kubernetes multi-cluster deployments. 25 | 26 | 27 |

If you’re using Meshery or if you like the project, please star this repository to show your support! 🤩

28 |

29 | 30 |

31 |

Traefik Mesh

32 | Traefik Mesh - Simpler Service Mesh 35 |

36 | Traefik Mesh is a straight-forward, easy to configure, and non-invasive service mesh that allows visibility and management of the traffic flows inside any Kubernetes cluster.

37 |

38 |

39 | 40 |

41 |

Community and Contributing

42 | Our projects are community-built and welcome collaboration. 👍 Be sure to see the Meshery Community Welcome Guide for a tour of resources available to you and jump into our Slack! Contributors are expected to adhere to the CNCF Code of Conduct. 43 | 44 | 45 | 46 | 47 | 48 | 49 | Shows an illustrated light mode meshery logo in light color mode and a dark mode meshery logo dark color mode. 50 | 51 | 52 | 53 | Layer5 Cloud Native Community 54 | 55 |

56 | ✔️ Join any or all of the weekly meetings on community calendar.
57 | ✔️ Watch community meeting recordings.
58 | ✔️ Fill-in a community member form to gain access to community resources.
59 | ✔️ Discuss in the Community Forum.
60 |

61 |

62 | Not sure where to start? Grab an open issue with the help-wanted label. 63 |

64 | 65 | **License** 66 | 67 | This repository and site are available as open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0). 68 | -------------------------------------------------------------------------------- /build/Makefile.core.mk: -------------------------------------------------------------------------------- 1 | # Copyright Meshery Authors 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #----------------------------------------------------------------------------- 16 | # Global Variables 17 | #----------------------------------------------------------------------------- 18 | GIT_VERSION = $(shell git describe --tags `git rev-list --tags --max-count=1`) 19 | GIT_COMMITSHA = $(shell git rev-list -1 HEAD) 20 | GIT_STRIPPED_VERSION=$(shell git describe --tags `git rev-list --tags --max-count=1` | cut -c 2-) 21 | 22 | GOVERSION = 1.19 23 | GOPATH = $(shell go env GOPATH) 24 | GOBIN = $(GOPATH)/bin 25 | 26 | SHELL :=/bin/bash -o pipefail 27 | 28 | #----------------------------------------------------------------------------- 29 | # Components 30 | #----------------------------------------------------------------------------- 31 | ADAPTER_URLS := "localhost:10000 localhost:10001 localhost:10002 localhost:10004 localhost:10005 localhost:10006 localhost:10007 localhost:10009 localhost:10010 localhost:10012" 32 | 33 | #----------------------------------------------------------------------------- 34 | # Providers 35 | #----------------------------------------------------------------------------- 36 | REMOTE_PROVIDER_LOCAL="http://localhost:9876" 37 | MESHERY_CLOUD_DEV="http://localhost:9876" 38 | MESHERY_CLOUD_PROD="https://meshery.layer5.io" 39 | MESHERY_CLOUD_STAGING="https://staging-meshery.layer5.io" 40 | 41 | #----------------------------------------------------------------------------- 42 | # Server 43 | #----------------------------------------------------------------------------- 44 | MESHERY_K8S_SKIP_COMP_GEN ?= TRUE 45 | APPLICATIONCONFIGPATH="../install/apps.json" 46 | 47 | #----------------------------------------------------------------------------- 48 | # Build 49 | #----------------------------------------------------------------------------- 50 | RELEASE_CHANNEL=edge 51 | -------------------------------------------------------------------------------- /build/Makefile.show-help.mk: -------------------------------------------------------------------------------- 1 | .DEFAULT_GOAL := show-help 2 | # See for explanation. 3 | .PHONY: show-help 4 | show-help: 5 | @echo "$$(tput bold)Please specify a build target. The choices are:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|LC_ALL='C' sort -f|awk -F --- -v n=$$(tput cols) -v i=19 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'|more $(shell test $(shell uname) == Darwin && echo '-Xr') -------------------------------------------------------------------------------- /build/config.go: -------------------------------------------------------------------------------- 1 | package build 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io" 7 | "os" 8 | "path/filepath" 9 | "strings" 10 | 11 | "github.com/layer5io/meshery-adapter-library/adapter" 12 | "github.com/layer5io/meshkit/utils" 13 | "github.com/layer5io/meshkit/utils/manifests" 14 | walker "github.com/layer5io/meshkit/utils/walker" 15 | smp "github.com/layer5io/service-mesh-performance/spec" 16 | ) 17 | 18 | var DefaultVersion string 19 | var DefaultURL string 20 | var DefaultGenerationMethod string 21 | var WorkloadPath string 22 | var MeshModelPath string 23 | var AllVersions []string 24 | var CRDNames []string 25 | 26 | var meshmodelmetadata = make(map[string]interface{}) 27 | 28 | var MeshModelConfig = adapter.MeshModelConfig{ //Move to build/config.go 29 | Category: "Cloud Native Network", 30 | Metadata: meshmodelmetadata, 31 | } 32 | 33 | // NewConfig creates the configuration for creating components 34 | func NewConfig(version string) manifests.Config { 35 | return manifests.Config{ 36 | Name: smp.ServiceMesh_Type_name[int32(smp.ServiceMesh_TRAEFIK_MESH)], 37 | MeshVersion: version, 38 | CrdFilter: manifests.NewCueCrdFilter(manifests.ExtractorPaths{ 39 | NamePath: "spec.names.kind", 40 | IdPath: "spec.names.kind", 41 | VersionPath: "spec.versions[0].name", 42 | GroupPath: "spec.group", 43 | SpecPath: "spec.versions[0].schema.openAPIV3Schema.properties.spec"}, false), 44 | ExtractCrds: func(manifest string) []string { 45 | crds := strings.Split(manifest, "---") 46 | return crds 47 | }, 48 | } 49 | } 50 | 51 | func init() { 52 | wd, _ := os.Getwd() 53 | f, _ := os.Open("./build/meshmodel_metadata.json") 54 | defer func() { 55 | err := f.Close() 56 | if err != nil { 57 | fmt.Println(err.Error()) 58 | } 59 | }() 60 | byt, _ := io.ReadAll(f) 61 | 62 | _ = json.Unmarshal(byt, &meshmodelmetadata) 63 | WorkloadPath = filepath.Join(wd, "templates", "oam", "workloads") 64 | MeshModelPath = filepath.Join(wd, "templates", "meshmodel", "components") 65 | AllVersions, _ = utils.GetLatestReleaseTagsSorted("traefik", "mesh") 66 | if len(AllVersions) == 0 { 67 | return 68 | } 69 | DefaultVersion = AllVersions[len(AllVersions)-1] 70 | DefaultGenerationMethod = adapter.Manifests 71 | 72 | //Get all the crd names 73 | w := walker.NewGit() 74 | err := w.Owner("traefik"). 75 | Repo("mesh-helm-chart"). 76 | Branch("master"). 77 | Root("mesh/crds/**"). 78 | RegisterFileInterceptor(func(file walker.File) error { 79 | if file.Content != "" { 80 | CRDNames = append(CRDNames, file.Name) 81 | } 82 | return nil 83 | }).Walk() 84 | if err != nil { 85 | fmt.Println("Could not find CRD names. Will fail component creation...", err.Error()) 86 | } 87 | DefaultURL = "https://raw.githubusercontent.com/traefik/mesh-helm-chart/" + "master" + "/mesh/crds/" 88 | } 89 | -------------------------------------------------------------------------------- /build/meshmodel_metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "primaryColor": "#9D0FB0", 3 | "secondaryColor": "#e281f0", 4 | "shape": "circle", 5 | "logoURL": "", 6 | "svgColor": "", 7 | "svgWhite": "" 8 | } -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/layer5io/meshery-traefik-mesh 2 | 3 | go 1.19 4 | 5 | replace ( 6 | github.com/kudobuilder/kuttl => github.com/layer5io/kuttl v0.4.1-0.20200723152044-916f10574334 7 | github.com/spf13/afero => github.com/spf13/afero v1.5.1 // Until viper bug is resolved #1161 8 | go.opentelemetry.io/otel => go.opentelemetry.io/otel v0.11.0 9 | go.opentelemetry.io/otel/sdk => go.opentelemetry.io/otel/sdk v0.11.0 10 | gopkg.in/ini.v1 => github.com/go-ini/ini v1.62.0 11 | ) 12 | 13 | require ( 14 | github.com/google/uuid v1.3.1 15 | github.com/layer5io/meshery-adapter-library v0.6.7 16 | github.com/layer5io/meshkit v0.6.49 17 | github.com/layer5io/service-mesh-performance v0.6.1 18 | gopkg.in/yaml.v2 v2.4.0 19 | ) 20 | 21 | require ( 22 | cuelang.org/go v0.5.0 // indirect 23 | github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect 24 | github.com/BurntSushi/toml v1.2.1 // indirect 25 | github.com/MakeNowJust/heredoc v1.0.0 // indirect 26 | github.com/Masterminds/goutils v1.1.1 // indirect 27 | github.com/Masterminds/semver/v3 v3.2.0 // indirect 28 | github.com/Masterminds/sprig/v3 v3.2.3 // indirect 29 | github.com/Masterminds/squirrel v1.5.3 // indirect 30 | github.com/Microsoft/go-winio v0.6.0 // indirect 31 | github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect 32 | github.com/acomagu/bufpipe v1.0.3 // indirect 33 | github.com/apache/thrift v0.13.0 // indirect 34 | github.com/asaskevich/govalidator v0.0.0-20200428143746-21a406dcc535 // indirect 35 | github.com/beorn7/perks v1.0.1 // indirect 36 | github.com/cenkalti/backoff/v4 v4.1.3 // indirect 37 | github.com/cespare/xxhash/v2 v2.2.0 // indirect 38 | github.com/chai2010/gettext-go v1.0.2 // indirect 39 | github.com/cockroachdb/apd/v2 v2.0.2 // indirect 40 | github.com/containerd/containerd v1.6.19 // indirect 41 | github.com/cyphar/filepath-securejoin v0.2.3 // indirect 42 | github.com/davecgh/go-spew v1.1.1 // indirect 43 | github.com/docker/cli v20.10.21+incompatible // indirect 44 | github.com/docker/distribution v2.8.2+incompatible // indirect 45 | github.com/docker/docker v20.10.21+incompatible // indirect 46 | github.com/docker/docker-credential-helpers v0.7.0 // indirect 47 | github.com/docker/go-connections v0.4.0 // indirect 48 | github.com/docker/go-metrics v0.0.1 // indirect 49 | github.com/docker/go-units v0.5.0 // indirect 50 | github.com/emicklei/go-restful/v3 v3.9.0 // indirect 51 | github.com/emirpasic/gods v1.12.0 // indirect 52 | github.com/evanphx/json-patch v5.6.0+incompatible // indirect 53 | github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect 54 | github.com/fatih/color v1.13.0 // indirect 55 | github.com/fsnotify/fsnotify v1.6.0 // indirect 56 | github.com/go-errors/errors v1.0.1 // indirect 57 | github.com/go-git/gcfg v1.5.0 // indirect 58 | github.com/go-git/go-billy/v5 v5.3.1 // indirect 59 | github.com/go-git/go-git/v5 v5.4.2 // indirect 60 | github.com/go-gorp/gorp/v3 v3.0.2 // indirect 61 | github.com/go-logr/logr v1.2.4 // indirect 62 | github.com/go-openapi/jsonpointer v0.19.5 // indirect 63 | github.com/go-openapi/jsonreference v0.20.0 // indirect 64 | github.com/go-openapi/swag v0.19.14 // indirect 65 | github.com/gobwas/glob v0.2.3 // indirect 66 | github.com/gogo/protobuf v1.3.2 // indirect 67 | github.com/golang/protobuf v1.5.3 // indirect 68 | github.com/google/btree v1.0.1 // indirect 69 | github.com/google/gnostic v0.5.7-v3refs // indirect 70 | github.com/google/go-cmp v0.5.9 // indirect 71 | github.com/google/gofuzz v1.2.0 // indirect 72 | github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect 73 | github.com/gorilla/mux v1.8.0 // indirect 74 | github.com/gosuri/uitable v0.0.4 // indirect 75 | github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect 76 | github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect 77 | github.com/hashicorp/hcl v1.0.0 // indirect 78 | github.com/huandu/xstrings v1.3.3 // indirect 79 | github.com/imdario/mergo v0.3.15 // indirect 80 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 81 | github.com/jackc/chunkreader/v2 v2.0.1 // indirect 82 | github.com/jackc/pgconn v1.13.0 // indirect 83 | github.com/jackc/pgio v1.0.0 // indirect 84 | github.com/jackc/pgpassfile v1.0.0 // indirect 85 | github.com/jackc/pgproto3/v2 v2.3.1 // indirect 86 | github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect 87 | github.com/jackc/pgtype v1.12.0 // indirect 88 | github.com/jackc/pgx/v4 v4.17.2 // indirect 89 | github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect 90 | github.com/jinzhu/inflection v1.0.0 // indirect 91 | github.com/jinzhu/now v1.1.4 // indirect 92 | github.com/jmoiron/sqlx v1.3.5 // indirect 93 | github.com/josharian/intern v1.0.0 // indirect 94 | github.com/json-iterator/go v1.1.12 // indirect 95 | github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect 96 | github.com/klauspost/compress v1.14.4 // indirect 97 | github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect 98 | github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect 99 | github.com/layer5io/learn-layer5/smi-conformance v0.0.0-20210317075357-06b4f88b3e34 // indirect 100 | github.com/lib/pq v1.10.7 // indirect 101 | github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect 102 | github.com/magiconair/properties v1.8.7 // indirect 103 | github.com/mailru/easyjson v0.7.6 // indirect 104 | github.com/mattn/go-colorable v0.1.12 // indirect 105 | github.com/mattn/go-isatty v0.0.14 // indirect 106 | github.com/mattn/go-runewidth v0.0.9 // indirect 107 | github.com/mattn/go-sqlite3 v1.14.15 // indirect 108 | github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect 109 | github.com/mitchellh/copystructure v1.2.0 // indirect 110 | github.com/mitchellh/go-homedir v1.1.0 // indirect 111 | github.com/mitchellh/go-wordwrap v1.0.1 // indirect 112 | github.com/mitchellh/mapstructure v1.5.0 // indirect 113 | github.com/mitchellh/reflectwalk v1.0.2 // indirect 114 | github.com/moby/locker v1.0.1 // indirect 115 | github.com/moby/spdystream v0.2.0 // indirect 116 | github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect 117 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 118 | github.com/modern-go/reflect2 v1.0.2 // indirect 119 | github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect 120 | github.com/morikuni/aec v1.0.0 // indirect 121 | github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect 122 | github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect 123 | github.com/opencontainers/go-digest v1.0.0 // indirect 124 | github.com/opencontainers/image-spec v1.1.0-rc2 // indirect 125 | github.com/pelletier/go-toml/v2 v2.0.6 // indirect 126 | github.com/peterbourgon/diskv v2.0.1+incompatible // indirect 127 | github.com/pkg/errors v0.9.1 // indirect 128 | github.com/prometheus/client_golang v1.15.0 // indirect 129 | github.com/prometheus/client_model v0.3.0 // indirect 130 | github.com/prometheus/common v0.42.0 // indirect 131 | github.com/prometheus/procfs v0.9.0 // indirect 132 | github.com/rubenv/sql-migrate v1.2.0 // indirect 133 | github.com/russross/blackfriday/v2 v2.1.0 // indirect 134 | github.com/sergi/go-diff v1.1.0 // indirect 135 | github.com/shopspring/decimal v1.2.0 // indirect 136 | github.com/sirupsen/logrus v1.9.0 // indirect 137 | github.com/spf13/afero v1.9.3 // indirect 138 | github.com/spf13/cast v1.5.0 // indirect 139 | github.com/spf13/cobra v1.7.0 // indirect 140 | github.com/spf13/jwalterweatherman v1.1.0 // indirect 141 | github.com/spf13/pflag v1.0.5 // indirect 142 | github.com/spf13/viper v1.15.0 // indirect 143 | github.com/subosito/gotenv v1.4.2 // indirect 144 | github.com/xanzy/ssh-agent v0.3.0 // indirect 145 | github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect 146 | github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect 147 | github.com/xeipuuv/gojsonschema v1.2.0 // indirect 148 | github.com/xlab/treeprint v1.1.0 // indirect 149 | go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc v0.11.0 // indirect 150 | go.opentelemetry.io/otel v1.10.0 // indirect 151 | go.opentelemetry.io/otel/exporters/trace/jaeger v0.11.0 // indirect 152 | go.opentelemetry.io/otel/sdk v1.10.0 // indirect 153 | go.starlark.net v0.0.0-20200306205701-8dd3e2ee1dd5 // indirect 154 | golang.org/x/crypto v0.14.0 // indirect 155 | golang.org/x/mod v0.8.0 // indirect 156 | golang.org/x/net v0.17.0 // indirect 157 | golang.org/x/oauth2 v0.7.0 // indirect 158 | golang.org/x/sync v0.1.0 // indirect 159 | golang.org/x/sys v0.13.0 // indirect 160 | golang.org/x/term v0.13.0 // indirect 161 | golang.org/x/text v0.13.0 // indirect 162 | golang.org/x/time v0.3.0 // indirect 163 | golang.org/x/tools v0.6.0 // indirect 164 | google.golang.org/api v0.107.0 // indirect 165 | google.golang.org/appengine v1.6.7 // indirect 166 | google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect 167 | google.golang.org/grpc v1.56.3 // indirect 168 | google.golang.org/protobuf v1.30.0 // indirect 169 | gopkg.in/inf.v0 v0.9.1 // indirect 170 | gopkg.in/ini.v1 v1.67.0 // indirect 171 | gopkg.in/warnings.v0 v0.1.2 // indirect 172 | gopkg.in/yaml.v3 v3.0.1 // indirect 173 | gorm.io/driver/postgres v1.3.10 // indirect 174 | gorm.io/driver/sqlite v1.3.1 // indirect 175 | gorm.io/gorm v1.23.7 // indirect 176 | helm.sh/helm/v3 v3.11.1 // indirect 177 | k8s.io/api v0.26.0 // indirect 178 | k8s.io/apiextensions-apiserver v0.26.0 // indirect 179 | k8s.io/apimachinery v0.26.1 // indirect 180 | k8s.io/apiserver v0.26.0 // indirect 181 | k8s.io/cli-runtime v0.26.0 // indirect 182 | k8s.io/client-go v0.26.0 // indirect 183 | k8s.io/component-base v0.26.0 // indirect 184 | k8s.io/klog/v2 v2.80.1 // indirect 185 | k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect 186 | k8s.io/kubectl v0.26.0 // indirect 187 | k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect 188 | oras.land/oras-go v1.2.2 // indirect 189 | sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect 190 | sigs.k8s.io/kustomize/api v0.12.1 // indirect 191 | sigs.k8s.io/kustomize/kyaml v0.13.9 // indirect 192 | sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect 193 | sigs.k8s.io/yaml v1.3.0 // indirect 194 | ) 195 | -------------------------------------------------------------------------------- /helpers/component_info.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "meshery-traefik-mesh", 3 | "type": "adapter", 4 | "next_error_code": 1043 5 | } -------------------------------------------------------------------------------- /img/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meshery-extensions/meshery-traefik-mesh/720552a7d1684c1928f72260fd8ac897491bbeb4/img/.DS_Store -------------------------------------------------------------------------------- /img/readme/community.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/readme/meshery-logo-dark-text-side.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/readme/meshery-logo-light-text-side.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /img/readme/meshery-logo-light-text.svg: -------------------------------------------------------------------------------- 1 | meshery-logo-light-text -------------------------------------------------------------------------------- /img/readme/slack-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meshery-extensions/meshery-traefik-mesh/720552a7d1684c1928f72260fd8ac897491bbeb4/img/readme/slack-128.png -------------------------------------------------------------------------------- /img/readme/slack-dark-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meshery-extensions/meshery-traefik-mesh/720552a7d1684c1928f72260fd8ac897491bbeb4/img/readme/slack-dark-128.png -------------------------------------------------------------------------------- /img/readme/traefik.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /internal/config/config.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "path" 5 | "strings" 6 | 7 | "github.com/layer5io/meshery-adapter-library/adapter" 8 | "github.com/layer5io/meshery-adapter-library/common" 9 | "github.com/layer5io/meshery-adapter-library/config" 10 | "github.com/layer5io/meshery-adapter-library/status" 11 | configprovider "github.com/layer5io/meshkit/config/provider" 12 | "github.com/layer5io/meshkit/utils" 13 | smp "github.com/layer5io/service-mesh-performance/spec" 14 | ) 15 | 16 | const ( 17 | // OAM metadata constants 18 | OAMAdapterNameMetadataKey = "adapter.meshery.io/name" 19 | OAMComponentCategoryMetadataKey = "ui.meshery.io/category" 20 | ) 21 | 22 | var ( 23 | // TraefikMeshOperation is the default name for the install 24 | // and uninstall commands on the traefik mesh 25 | TraefikMeshOperation = strings.ToLower(smp.ServiceMesh_TRAEFIK_MESH.Enum().String()) 26 | 27 | configRootPath = path.Join(utils.GetHome(), ".meshery") 28 | 29 | // ServerConfig is the configuration for the gRPC server 30 | ServerConfig = map[string]string{ 31 | "name": smp.ServiceMesh_TRAEFIK_MESH.Enum().String(), 32 | "port": "10006", 33 | "type": "adapter", 34 | "traceurl": status.None, 35 | } 36 | 37 | // MeshSpec is the spec for the service mesh associated with this adapter 38 | MeshSpec = map[string]string{ 39 | "name": smp.ServiceMesh_TRAEFIK_MESH.Enum().String(), 40 | "status": status.None, 41 | "version": status.None, 42 | } 43 | 44 | // ProviderConfig is the config for the configuration provider 45 | ProviderConfig = map[string]string{ 46 | configprovider.FilePath: configRootPath, 47 | configprovider.FileType: "yaml", 48 | configprovider.FileName: "traefik-mesh", 49 | } 50 | 51 | // KubeConfig - Controlling the kubeconfig lifecycle with viper 52 | KubeConfig = map[string]string{ 53 | configprovider.FilePath: configRootPath, 54 | configprovider.FileType: "yaml", 55 | configprovider.FileName: "kubeconfig", 56 | } 57 | 58 | // Operations represents the set of valid operations that are available 59 | // to the adapter 60 | Operations = getOperations(common.Operations) 61 | ) 62 | 63 | // New creates a new config instance 64 | func New(provider string) (h config.Handler, err error) { 65 | opts := configprovider.Options{ 66 | FilePath: configRootPath, 67 | FileName: "traefik", 68 | FileType: "yaml", 69 | } 70 | // Config provider 71 | switch provider { 72 | case configprovider.ViperKey: 73 | h, err = configprovider.NewViper(opts) 74 | if err != nil { 75 | return nil, err 76 | } 77 | case configprovider.InMemKey: 78 | h, err = configprovider.NewInMem(opts) 79 | if err != nil { 80 | return nil, err 81 | } 82 | default: 83 | return nil, ErrEmptyConfig 84 | } 85 | 86 | // Setup Server config 87 | if err := h.SetObject(adapter.ServerKey, ServerConfig); err != nil { 88 | return nil, err 89 | } 90 | 91 | // setup Mesh config 92 | if err := h.SetObject(adapter.MeshSpecKey, MeshSpec); err != nil { 93 | return nil, err 94 | } 95 | 96 | // setup Operation Config 97 | if err := h.SetObject(adapter.OperationsKey, Operations); err != nil { 98 | return nil, err 99 | } 100 | 101 | return h, nil 102 | } 103 | 104 | // NewKubeconfigBuilder returns a config handler based on the provider 105 | // 106 | // Valid prividers are "viper" and "in-mem" 107 | func NewKubeconfigBuilder(provider string) (config.Handler, error) { 108 | opts := configprovider.Options{ 109 | FilePath: configRootPath, 110 | FileType: "yaml", 111 | FileName: "kubeconfig", 112 | } 113 | 114 | // Config provider 115 | switch provider { 116 | case configprovider.ViperKey: 117 | return configprovider.NewViper(opts) 118 | case configprovider.InMemKey: 119 | return configprovider.NewInMem(opts) 120 | } 121 | return nil, ErrEmptyConfig 122 | } 123 | 124 | // RootPath returns the config root path for the adapter 125 | func RootPath() string { 126 | return configRootPath 127 | } 128 | -------------------------------------------------------------------------------- /internal/config/error.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Layer5, Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package config 16 | 17 | import ( 18 | "github.com/layer5io/meshkit/errors" 19 | ) 20 | 21 | const ( 22 | // ErrEmptyConfigCode represents the error when the configuration is either empty 23 | // or is invalid 24 | ErrEmptyConfigCode = "1029" 25 | 26 | // ErrGetLatestReleasesCode represents the error which occurs during the process of getting 27 | // latest releases 28 | ErrGetLatestReleasesCode = "1030" 29 | 30 | // ErrGetLatestReleaseNamesCode represents the error which occurs during the process of extracting 31 | // release names 32 | ErrGetLatestReleaseNamesCode = "1031" 33 | ) 34 | 35 | var ( 36 | // ErrEmptyConfig error is the error when config is invalid 37 | ErrEmptyConfig = errors.New(ErrEmptyConfigCode, errors.Alert, []string{"Config is empty"}, []string{}, []string{}, []string{}) 38 | ) 39 | 40 | // ErrGetLatestReleases is the error for fetching nsm-mesh releases 41 | func ErrGetLatestReleases(err error) error { 42 | return errors.New(ErrGetLatestReleasesCode, errors.Alert, []string{"Unable to fetch release info"}, []string{err.Error()}, []string{}, []string{}) 43 | } 44 | 45 | // ErrGetLatestReleaseNames is the error for fetching nsm-mesh releases 46 | func ErrGetLatestReleaseNames(err error) error { 47 | return errors.New(ErrGetLatestReleaseNamesCode, errors.Alert, []string{"Failed to extract release names"}, []string{err.Error()}, []string{}, []string{}) 48 | } 49 | -------------------------------------------------------------------------------- /internal/config/operations.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/layer5io/meshery-adapter-library/adapter" 7 | "github.com/layer5io/meshery-adapter-library/meshes" 8 | smp "github.com/layer5io/service-mesh-performance/spec" 9 | ) 10 | 11 | var ( 12 | TraefikOperation = strings.ToLower(smp.ServiceMesh_TRAEFIK_MESH.Enum().String()) 13 | TraefikBookStoreOperation = "traefik_bookstore_app" 14 | ServiceName = "service_name" 15 | ) 16 | 17 | func getOperations(dev adapter.Operations) adapter.Operations { 18 | versions, _ := getLatestReleaseNames(3) 19 | 20 | dev[TraefikMeshOperation] = &adapter.Operation{ 21 | Type: int32(meshes.OpCategory_INSTALL), 22 | Description: "Traefik Mesh", 23 | Versions: versions, 24 | Templates: []adapter.Template{ 25 | "templates/traefik-mesh.yaml", 26 | }, 27 | AdditionalProperties: map[string]string{}, 28 | } 29 | 30 | return dev 31 | } 32 | -------------------------------------------------------------------------------- /internal/config/releases.go: -------------------------------------------------------------------------------- 1 | package config 2 | 3 | import ( 4 | "encoding/json" 5 | "fmt" 6 | "io" 7 | "net/http" 8 | "regexp" 9 | "sort" 10 | 11 | "github.com/layer5io/meshery-adapter-library/adapter" 12 | ) 13 | 14 | // Release is used to save the release informations 15 | type Release struct { 16 | ID int `json:"id,omitempty"` 17 | TagName string `json:"tag_name,omitempty"` 18 | Name adapter.Version `json:"name,omitempty"` 19 | Draft bool `json:"draft,omitempty"` 20 | Assets []*Asset `json:"assets,omitempty"` 21 | } 22 | 23 | // Asset describes the github release asset object 24 | type Asset struct { 25 | Name string `json:"name,omitempty"` 26 | State string `json:"state,omitempty"` 27 | DownloadURL string `json:"browser_download_url,omitempty"` 28 | } 29 | 30 | // getLatestReleaseNames returns the names of the latest releases 31 | // limited by the "limit" parameter. It filters out all the rc 32 | // releases and sorts the result lexographically (descending) 33 | func getLatestReleaseNames(limit int) ([]adapter.Version, error) { 34 | releases, err := GetLatestReleases(10) 35 | if err != nil { 36 | return []adapter.Version{}, ErrGetLatestReleaseNames(err) 37 | } 38 | 39 | // Filter out the rc releases 40 | result := make([]adapter.Version, limit) 41 | r, err := regexp.Compile(`\d+(\.\d+){2,}$`) 42 | if err != nil { 43 | return []adapter.Version{}, ErrGetLatestReleaseNames(err) 44 | } 45 | 46 | for _, release := range releases { 47 | versionStr := string(release.Name) 48 | if r.MatchString(versionStr) { 49 | result = append(result, adapter.Version(versionStr)) 50 | } 51 | } 52 | 53 | // Sort the result 54 | sort.Slice(result, func(i, j int) bool { 55 | return result[i] > result[j] 56 | }) 57 | 58 | if limit > len(result) { 59 | limit = len(result) 60 | } 61 | 62 | return result[:limit], nil 63 | } 64 | 65 | // GetLatestReleases fetches the latest releases from the traefik mesh repository 66 | func GetLatestReleases(releases uint) ([]*Release, error) { 67 | releaseAPIURL := "https://api.github.com/repos/traefik/mesh/releases?per_page=" + fmt.Sprint(releases) 68 | // We need a variable url here hence using nosec 69 | // #nosec 70 | resp, err := http.Get(releaseAPIURL) 71 | if err != nil { 72 | return []*Release{}, ErrGetLatestReleases(err) 73 | } 74 | 75 | if resp.StatusCode != http.StatusOK { 76 | return []*Release{}, ErrGetLatestReleases(fmt.Errorf("unexpected status code: %d", resp.StatusCode)) 77 | } 78 | 79 | body, err := io.ReadAll(resp.Body) 80 | if err != nil { 81 | return []*Release{}, ErrGetLatestReleases(err) 82 | } 83 | 84 | var releaseList []*Release 85 | 86 | if err = json.Unmarshal(body, &releaseList); err != nil { 87 | return []*Release{}, ErrGetLatestReleases(err) 88 | } 89 | 90 | if err = resp.Body.Close(); err != nil { 91 | return []*Release{}, ErrGetLatestReleases(err) 92 | } 93 | 94 | return releaseList, nil 95 | } 96 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Layer5.io 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package main 16 | 17 | import ( 18 | "fmt" 19 | "os" 20 | "path" 21 | "strings" 22 | "time" 23 | 24 | "github.com/google/uuid" 25 | "github.com/layer5io/meshery-traefik-mesh/traefik" 26 | "github.com/layer5io/meshery-traefik-mesh/traefik/oam" 27 | "github.com/layer5io/meshkit/logger" 28 | "github.com/layer5io/meshkit/utils/events" 29 | 30 | // "github.com/layer5io/meshkit/tracing" 31 | "github.com/layer5io/meshery-adapter-library/adapter" 32 | "github.com/layer5io/meshery-adapter-library/api/grpc" 33 | "github.com/layer5io/meshery-traefik-mesh/build" 34 | "github.com/layer5io/meshery-traefik-mesh/internal/config" 35 | configprovider "github.com/layer5io/meshkit/config/provider" 36 | ) 37 | 38 | var ( 39 | serviceName = "traefik-mesh-adapter" 40 | version = "edge" 41 | gitsha = "none" 42 | instanceID = uuid.NewString() 43 | ) 44 | 45 | func init() { 46 | // Create the config path if it doesn't exists as the entire adapter 47 | // expects that directory to exists, which may or may not be true 48 | if err := os.MkdirAll(path.Join(config.RootPath(), "bin"), 0750); err != nil { 49 | fmt.Println(err) 50 | os.Exit(1) 51 | } 52 | } 53 | 54 | // main is the entrypoint of the adapter 55 | func main() { 56 | // Initialize Logger instance 57 | log, err := logger.New(serviceName, logger.Options{ 58 | Format: logger.SyslogLogFormat, 59 | DebugLevel: isDebug(), 60 | }) 61 | if err != nil { 62 | fmt.Println(err) 63 | os.Exit(1) 64 | } 65 | 66 | err = os.Setenv("KUBECONFIG", path.Join( 67 | config.KubeConfig[configprovider.FilePath], 68 | fmt.Sprintf("%s.%s", config.KubeConfig[configprovider.FileName], config.KubeConfig[configprovider.FileType])), 69 | ) 70 | 71 | if err != nil { 72 | // Fail silently 73 | log.Warn(err) 74 | } 75 | 76 | // Initialize application specific configs and dependencies 77 | // App and request config 78 | cfg, err := config.New(configprovider.ViperKey) 79 | if err != nil { 80 | log.Error(err) 81 | os.Exit(1) 82 | } 83 | 84 | service := &grpc.Service{} 85 | err = cfg.GetObject(adapter.ServerKey, service) 86 | if err != nil { 87 | log.Error(err) 88 | os.Exit(1) 89 | } 90 | 91 | kubeconfigHandler, err := config.NewKubeconfigBuilder(configprovider.ViperKey) 92 | if err != nil { 93 | log.Error(err) 94 | os.Exit(1) 95 | } 96 | 97 | // // Initialize Tracing instance 98 | // tracer, err := tracing.New(service.Name, service.TraceURL) 99 | // if err != nil { 100 | // log.Err("Tracing Init Failed", err.Error()) 101 | // os.Exit(1) 102 | // } 103 | e := events.NewEventStreamer() 104 | // Initialize Handler intance 105 | handler := traefik.New(cfg, log, kubeconfigHandler, e) 106 | handler = adapter.AddLogger(log, handler) 107 | 108 | service.Handler = handler 109 | service.EventStreamer = e 110 | service.StartedAt = time.Now() 111 | service.Version = version 112 | service.GitSHA = gitsha 113 | 114 | go registerCapabilities(service.Port, log) //Registering static capabilities 115 | go registerDynamicCapabilities(service.Port, log) //Registering latest capabilities periodically 116 | 117 | // Server Initialization 118 | log.Info("Adaptor Listening at port: ", service.Port) 119 | err = grpc.Start(service, nil) 120 | if err != nil { 121 | log.Error(err) 122 | os.Exit(1) 123 | } 124 | } 125 | 126 | func isDebug() bool { 127 | return os.Getenv("DEBUG") == "true" 128 | } 129 | 130 | func mesheryServerAddress() string { 131 | meshReg := os.Getenv("MESHERY_SERVER") 132 | 133 | if meshReg != "" { 134 | if strings.HasPrefix(meshReg, "http") { 135 | return meshReg 136 | } 137 | 138 | return "http://" + meshReg 139 | } 140 | 141 | return "http://localhost:9081" 142 | } 143 | 144 | func serviceAddress() string { 145 | svcAddr := os.Getenv("SERVICE_ADDR") 146 | 147 | if svcAddr != "" { 148 | return svcAddr 149 | } 150 | 151 | return "mesherylocal.layer5.io" 152 | } 153 | 154 | func registerCapabilities(port string, log logger.Handler) { 155 | // Register meshmodel components 156 | if err := oam.RegisterMeshModelComponents(instanceID, mesheryServerAddress(), serviceAddress(), port); err != nil { 157 | log.Error(err) 158 | } 159 | } 160 | func registerDynamicCapabilities(port string, log logger.Handler) { 161 | registerWorkloads(port, log) 162 | //Start the ticker 163 | const reRegisterAfter = 24 164 | ticker := time.NewTicker(reRegisterAfter * time.Hour) 165 | for { 166 | <-ticker.C 167 | registerWorkloads(port, log) 168 | } 169 | } 170 | 171 | func registerWorkloads(port string, log logger.Handler) { 172 | version := build.DefaultVersion 173 | url := build.DefaultURL 174 | gm := build.DefaultGenerationMethod 175 | // Prechecking to skip comp gen 176 | if os.Getenv("FORCE_DYNAMIC_REG") != "true" && oam.AvailableVersions[version] { 177 | log.Info("Components available statically for version ", version, ". Skipping dynamic component registeration") 178 | return 179 | } 180 | log.Info("Registering latest workload components for version ", version) 181 | // Register workloads 182 | for _, crd := range build.CRDNames { 183 | crdurl := url + crd 184 | log.Info("Registering ", crdurl) 185 | if err := adapter.CreateComponents(adapter.StaticCompConfig{ 186 | URL: crdurl, 187 | Method: gm, 188 | MeshModelPath: build.MeshModelPath, 189 | MeshModelConfig: build.MeshModelConfig, 190 | DirName: version, 191 | Config: build.NewConfig(version), 192 | }); err != nil { 193 | log.Info(err.Error()) 194 | return 195 | } 196 | } 197 | 198 | //The below log is checked in the workflows. If you change this log, reflect that change in the workflow where components are generated 199 | log.Info("Component creation completed for version ", version) 200 | 201 | //Now we will register in case 202 | log.Info("Registering workloads with Meshery Server for version ", version) 203 | if err := oam.RegisterMeshModelComponents(instanceID, mesheryServerAddress(), serviceAddress(), port); err != nil { 204 | log.Info(err.Error()) 205 | return 206 | } 207 | log.Info("Latest workload components successfully registered.") 208 | } 209 | -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.5/httproutegroup.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "HTTPRouteGroup", 3 | "apiVersion": "specs.smi-spec.io/v1alpha4", 4 | "displayName": "HTTP Route Group", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.5", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"matches\": {\n \"description\": \"Match conditions of this route group.\",\n \"items\": {\n \"properties\": {\n \"headers\": {\n \"description\": \"Header match conditions of this route.\",\n \"items\": {\n \"additionalProperties\": {\n \"type\": \"string\"\n },\n \"description\": \"Header match condition of this route.\",\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"methods\": {\n \"description\": \"The HTTP methods of this HTTP route.\",\n \"items\": {\n \"description\": \"The HTTP method of this HTTP route.\",\n \"enum\": [\n \"*\",\n \"GET\",\n \"HEAD\",\n \"PUT\",\n \"POST\",\n \"DELETE\",\n \"CONNECT\",\n \"OPTIONS\",\n \"TRACE\",\n \"PATCH\"\n ],\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"name\": {\n \"description\": \"Name of the HTTP route.\",\n \"type\": \"string\"\n },\n \"pathRegex\": {\n \"description\": \"URI path regex of the HTTP route.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"matches\"\n ],\n \"title\": \"HTTP Route Group\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.5/tcproute.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TCPRoute", 3 | "apiVersion": "specs.smi-spec.io/v1alpha4", 4 | "displayName": "TCP Route", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.5", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"matches\": {\n \"description\": \"Match conditions of this route.\",\n \"properties\": {\n \"ports\": {\n \"description\": \"Port numbers to match TCP traffic.\",\n \"items\": {\n \"type\": \"integer\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"ports\"\n ],\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"matches\"\n ],\n \"title\": \"TCP Route\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.5/traefikmesh_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TraefikMesh", 3 | "apiVersion": "core.meshmodel.dev/v1alpha1", 4 | "displayName": "Traefik Mesh", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.5", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\"$id\":\"http://meshery.layer5.io/definition/Workload/TraefikMesh\",\"$schema\":\"http://json-schema.org/draft-07/schema\",\"title\":\"TraefikMesh\",\"type\":\"object\",\"properties\":{}}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.5/trafficsplit.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TrafficSplit", 3 | "apiVersion": "split.smi-spec.io/v1alpha4", 4 | "displayName": "Traffic Split", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.5", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"backends\": {\n \"description\": \"The backend services of this split.\",\n \"items\": {\n \"properties\": {\n \"service\": {\n \"description\": \"Name of the Kubernetes service.\",\n \"type\": \"string\"\n },\n \"weight\": {\n \"description\": \"Traffic weight value of this backend.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"service\",\n \"weight\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"matches\": {\n \"description\": \"The HTTP route groups that this traffic split should match.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of the matching group.\",\n \"enum\": [\n \"HTTPRouteGroup\"\n ],\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of the matching group.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"kind\",\n \"name\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"service\": {\n \"description\": \"The apex service of this split.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"service\",\n \"backends\"\n ],\n \"title\": \"Traffic Split\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.5/traffictarget.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TrafficTarget", 3 | "apiVersion": "access.smi-spec.io/v1alpha3", 4 | "displayName": "Traffic Target", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.5", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"destination\": {\n \"description\": \"The destination of this traffic target.\",\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of the destination.\",\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of the destination.\",\n \"type\": \"string\"\n },\n \"namespace\": {\n \"description\": \"Namespace of the destination.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"rules\": {\n \"description\": \"Specifications of this traffic target.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of this spec.\",\n \"enum\": [\n \"HTTPRouteGroup\",\n \"TCPRoute\",\n \"UDPRoute\"\n ],\n \"type\": \"string\"\n },\n \"matches\": {\n \"description\": \"Match conditions of this spec.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"name\": {\n \"description\": \"Name of this spec.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"sources\": {\n \"description\": \"Sources of this traffic target.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of this source.\",\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of this source.\",\n \"type\": \"string\"\n },\n \"namespace\": {\n \"description\": \"Namespace of this source.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"destination\",\n \"rules\",\n \"sources\"\n ],\n \"title\": \"Traffic Target\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.7/httproutegroup.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "HTTPRouteGroup", 3 | "apiVersion": "specs.smi-spec.io/v1alpha4", 4 | "displayName": "HTTP Route Group", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.7", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"matches\": {\n \"description\": \"Match conditions of this route group.\",\n \"items\": {\n \"properties\": {\n \"headers\": {\n \"description\": \"Header match conditions of this route.\",\n \"items\": {\n \"additionalProperties\": {\n \"type\": \"string\"\n },\n \"description\": \"Header match condition of this route.\",\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"methods\": {\n \"description\": \"The HTTP methods of this HTTP route.\",\n \"items\": {\n \"description\": \"The HTTP method of this HTTP route.\",\n \"enum\": [\n \"*\",\n \"GET\",\n \"HEAD\",\n \"PUT\",\n \"POST\",\n \"DELETE\",\n \"CONNECT\",\n \"OPTIONS\",\n \"TRACE\",\n \"PATCH\"\n ],\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"name\": {\n \"description\": \"Name of the HTTP route.\",\n \"type\": \"string\"\n },\n \"pathRegex\": {\n \"description\": \"URI path regex of the HTTP route.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"matches\"\n ],\n \"title\": \"HTTP Route Group\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.7/tcproute.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TCPRoute", 3 | "apiVersion": "specs.smi-spec.io/v1alpha4", 4 | "displayName": "TCP Route", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.7", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"matches\": {\n \"description\": \"Match conditions of this route.\",\n \"properties\": {\n \"ports\": {\n \"description\": \"Port numbers to match TCP traffic.\",\n \"items\": {\n \"type\": \"integer\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"ports\"\n ],\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"matches\"\n ],\n \"title\": \"TCP Route\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.7/traefikmesh_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TraefikMesh", 3 | "apiVersion": "core.meshmodel.dev/v1alpha1", 4 | "displayName": "Traefik Mesh", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.7", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "subCategory": "Service Mesh", 23 | "metadata":{ 24 | "primaryColor": "#9D0FB0", 25 | "secondaryColor": "#e281f0", 26 | "shape": "circle", 27 | "logoURL": "", 28 | "svgColor": "", 29 | "svgWhite": "" 30 | } 31 | }, 32 | "schema": "{\"$id\":\"http://meshery.layer5.io/definition/Workload/TraefikMesh\",\"$schema\":\"http://json-schema.org/draft-07/schema\",\"title\":\"TraefikMesh\",\"type\":\"object\",\"properties\":{}}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.7/trafficsplit.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TrafficSplit", 3 | "apiVersion": "split.smi-spec.io/v1alpha4", 4 | "displayName": "Traffic Split", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.7", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"backends\": {\n \"description\": \"The backend services of this split.\",\n \"items\": {\n \"properties\": {\n \"service\": {\n \"description\": \"Name of the Kubernetes service.\",\n \"type\": \"string\"\n },\n \"weight\": {\n \"description\": \"Traffic weight value of this backend.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"service\",\n \"weight\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"matches\": {\n \"description\": \"The HTTP route groups that this traffic split should match.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of the matching group.\",\n \"enum\": [\n \"HTTPRouteGroup\"\n ],\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of the matching group.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"kind\",\n \"name\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"service\": {\n \"description\": \"The apex service of this split.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"service\",\n \"backends\"\n ],\n \"title\": \"Traffic Split\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.7/traffictarget.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TrafficTarget", 3 | "apiVersion": "access.smi-spec.io/v1alpha3", 4 | "displayName": "Traffic Target", 5 | "format": "JSON", 6 | "metadata": { 7 | "logoURL": "", 8 | "primaryColor": "#9D0FB0", 9 | "svgColor": "", 10 | "svgWhite": "\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e", 11 | "secondaryColor": "#e281f0", 12 | "shape": "circle" 13 | }, 14 | "model": { 15 | "name": "TRAEFIK_MESH", 16 | "version": "v1.4.7", 17 | "displayName": "Traefik Mesh", 18 | "category": { 19 | "name": "Cloud Native Network", 20 | "metadata": null 21 | }, 22 | "metadata":{ 23 | "primaryColor": "#9D0FB0", 24 | "secondaryColor": "#e281f0", 25 | "shape": "circle", 26 | "logoURL": "", 27 | "svgColor": "", 28 | "svgWhite": "" 29 | }, 30 | "subCategory": "Service Mesh" 31 | }, 32 | "schema": "{\n \"properties\": {\n \"destination\": {\n \"description\": \"The destination of this traffic target.\",\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of the destination.\",\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of the destination.\",\n \"type\": \"string\"\n },\n \"namespace\": {\n \"description\": \"Namespace of the destination.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"rules\": {\n \"description\": \"Specifications of this traffic target.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of this spec.\",\n \"enum\": [\n \"HTTPRouteGroup\",\n \"TCPRoute\",\n \"UDPRoute\"\n ],\n \"type\": \"string\"\n },\n \"matches\": {\n \"description\": \"Match conditions of this spec.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"name\": {\n \"description\": \"Name of this spec.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"sources\": {\n \"description\": \"Sources of this traffic target.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of this source.\",\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of this source.\",\n \"type\": \"string\"\n },\n \"namespace\": {\n \"description\": \"Namespace of this source.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"destination\",\n \"rules\",\n \"sources\"\n ],\n \"title\": \"Traffic Target\",\n \"type\": \"object\"\n}" 33 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.8/httproutegroup.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | {"kind":"HTTPRouteGroup","apiVersion":"specs.smi-spec.io/v1alpha4","displayName":"HTTP Route Group","format":"JSON","metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"},"model":{"name":"traefik_mesh","version":"v1.4.8","displayName":"TRAEFIK_MESH","category":{"name":"Cloud Native Network","metadata":null},"metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"}},"schema":"{\n \"properties\": {\n \"matches\": {\n \"description\": \"Match conditions of this route group.\",\n \"items\": {\n \"properties\": {\n \"headers\": {\n \"description\": \"Header match conditions of this route.\",\n \"items\": {\n \"additionalProperties\": {\n \"type\": \"string\"\n },\n \"description\": \"Header match condition of this route.\",\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"methods\": {\n \"description\": \"The HTTP methods of this HTTP route.\",\n \"items\": {\n \"description\": \"The HTTP method of this HTTP route.\",\n \"enum\": [\n \"*\",\n \"GET\",\n \"HEAD\",\n \"PUT\",\n \"POST\",\n \"DELETE\",\n \"CONNECT\",\n \"OPTIONS\",\n \"TRACE\",\n \"PATCH\"\n ],\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"name\": {\n \"description\": \"Name of the HTTP route.\",\n \"type\": \"string\"\n },\n \"pathRegex\": {\n \"description\": \"URI path regex of the HTTP route.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"matches\"\n ],\n \"title\": \"HTTP Route Group\",\n \"type\": \"object\"\n}"} -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.8/tcproute.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | {"kind":"TCPRoute","apiVersion":"specs.smi-spec.io/v1alpha4","displayName":"TCP Route","format":"JSON","metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"},"model":{"name":"traefik_mesh","version":"v1.4.8","displayName":"TRAEFIK_MESH","category":{"name":"Cloud Native Network","metadata":null},"metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"}},"schema":"{\n \"properties\": {\n \"matches\": {\n \"description\": \"Match conditions of this route.\",\n \"properties\": {\n \"ports\": {\n \"description\": \"Port numbers to match TCP traffic.\",\n \"items\": {\n \"type\": \"integer\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"ports\"\n ],\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"matches\"\n ],\n \"title\": \"TCP Route\",\n \"type\": \"object\"\n}"} -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.8/traefikmesh_meshmodel.json: -------------------------------------------------------------------------------- 1 | { 2 | "kind": "TraefikMesh", 3 | "apiVersion": "core.meshmodel.dev/v1alpha1", 4 | "displayName": "Traefik Mesh", 5 | "format": "JSON", 6 | "metadata": 7 | { 8 | "logoURL": "", 9 | "primaryColor": "#9D0FB0", 10 | "svgColor": "", 11 | "svgWhite": "", 12 | "secondaryColor": "#e281f0", 13 | "shape": "circle" 14 | }, 15 | "model": 16 | { 17 | "name": "TRAEFIK_MESH", 18 | "version": "v1.4.8", 19 | "displayName": "Traefik Mesh", 20 | "category": { 21 | "name": "Cloud Native Network", 22 | "metadata": null 23 | }, 24 | "subCategory": "Service Mesh", 25 | "metadata":{ 26 | "primaryColor": "#9D0FB0", 27 | "secondaryColor": "#e281f0", 28 | "shape": "circle", 29 | "logoURL": "", 30 | "svgColor": "", 31 | "svgWhite": "" 32 | } 33 | }, 34 | "schema": "{\"$id\":\"http://meshery.layer5.io/definition/Workload/TraefikMesh\",\"$schema\":\"http://json-schema.org/draft-07/schema\",\"title\":\"TraefikMesh\",\"type\":\"object\",\"properties\":{}}" 35 | } -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.8/trafficsplit.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | {"kind":"TrafficSplit","apiVersion":"split.smi-spec.io/v1alpha4","displayName":"Traffic Split","format":"JSON","metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"},"model":{"name":"traefik_mesh","version":"v1.4.8","displayName":"TRAEFIK_MESH","category":{"name":"Cloud Native Network","metadata":null},"metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"}},"schema":"{\n \"properties\": {\n \"backends\": {\n \"description\": \"The backend services of this split.\",\n \"items\": {\n \"properties\": {\n \"service\": {\n \"description\": \"Name of the Kubernetes service.\",\n \"type\": \"string\"\n },\n \"weight\": {\n \"description\": \"Traffic weight value of this backend.\",\n \"type\": \"number\"\n }\n },\n \"required\": [\n \"service\",\n \"weight\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"matches\": {\n \"description\": \"The HTTP route groups that this traffic split should match.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of the matching group.\",\n \"enum\": [\n \"HTTPRouteGroup\"\n ],\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of the matching group.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"kind\",\n \"name\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"service\": {\n \"description\": \"The apex service of this split.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"service\",\n \"backends\"\n ],\n \"title\": \"Traffic Split\",\n \"type\": \"object\"\n}"} -------------------------------------------------------------------------------- /templates/meshmodel/components/v1.4.8/traffictarget.meshery.layer5.io_meshmodel.json: -------------------------------------------------------------------------------- 1 | {"kind":"TrafficTarget","apiVersion":"access.smi-spec.io/v1alpha3","displayName":"Traffic Target","format":"JSON","metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"},"model":{"name":"traefik_mesh","version":"v1.4.8","displayName":"TRAEFIK_MESH","category":{"name":"Cloud Native Network","metadata":null},"metadata":{"logoURL":"","primaryColor":"#9D0FB0","secondaryColor":"#e281f0","shape":"circle","svgColor":"","svgWhite":"\u003csvg width=\"20\" height=\"20\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cg clip-path=\"url(#a)\"\u003e\u003cpath d=\"m11.54 6.143.046.025 3.928 2.226a.878.878 0 0 0 .865 0l3.896-2.202a1.315 1.315 0 0 1 1.792.482 1.336 1.336 0 0 1-.45 1.808l-.045.027-2.249 1.273a.442.442 0 0 0-.224.386.446.446 0 0 0 .224.386l6.072 3.442a.875.875 0 0 0 .865 0l3.756-2.129a1.315 1.315 0 0 1 1.796.478 1.335 1.335 0 0 1-.453 1.812l-.045.027-2.115 1.196a.442.442 0 0 0-.164.61c.04.067.096.123.164.162l2.125 1.204a1.329 1.329 0 0 1 .518 1.79 1.316 1.316 0 0 1-1.771.551l-.046-.025-3.766-2.135a.877.877 0 0 0-.865 0l-6.14 3.48a.441.441 0 0 0-.164.61.44.44 0 0 0 .164.161l2.537 1.438a1.336 1.336 0 0 1 .51 1.785 1.318 1.318 0 0 1-1.763.556l-.046-.025-4.177-2.369a.878.878 0 0 0-.865 0l-4.215 2.392a1.315 1.315 0 0 1-1.79-.48 1.335 1.335 0 0 1 .447-1.81l.045-.026 2.572-1.46a.44.44 0 0 0 .167-.604.432.432 0 0 0-.167-.168l-6.084-3.448a.878.878 0 0 0-.866 0l-3.582 2.027a1.316 1.316 0 0 1-1.794-.48 1.336 1.336 0 0 1 .453-1.81l.045-.027 1.937-1.096a.44.44 0 0 0 .225-.386.444.444 0 0 0-.225-.386L.684 14.314a1.336 1.336 0 0 1-.51-1.785 1.315 1.315 0 0 1 1.762-.556l.047.025 3.579 2.029a.876.876 0 0 0 .864 0l6.143-3.476a.442.442 0 0 0 .225-.386.444.444 0 0 0-.225-.386l-2.281-1.295a1.336 1.336 0 0 1-.51-1.785c.164-.305.44-.534.769-.638.329-.104.685-.074.993.083v-.001Zm3.973 5.793-6.144 3.476a.442.442 0 0 0-.165.61c.04.068.096.124.165.163l6.08 3.446a.876.876 0 0 0 .866 0l6.138-3.48a.442.442 0 0 0 .164-.609.443.443 0 0 0-.164-.162l-6.076-3.444a.877.877 0 0 0-.865 0Z\" fill=\"#fff\"/\u003e\u003c/g\u003e\u003cdefs\u003e\u003cclipPath id=\"a\"\u003e\u003cpath fill=\"#fff\" d=\"M0 0h32v32H0z\"/\u003e\u003c/clipPath\u003e\u003c/defs\u003e\u003c/svg\u003e"}},"schema":"{\n \"properties\": {\n \"destination\": {\n \"description\": \"The destination of this traffic target.\",\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of the destination.\",\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of the destination.\",\n \"type\": \"string\"\n },\n \"namespace\": {\n \"description\": \"Namespace of the destination.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"rules\": {\n \"description\": \"Specifications of this traffic target.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of this spec.\",\n \"enum\": [\n \"HTTPRouteGroup\",\n \"TCPRoute\",\n \"UDPRoute\"\n ],\n \"type\": \"string\"\n },\n \"matches\": {\n \"description\": \"Match conditions of this spec.\",\n \"items\": {\n \"type\": \"string\"\n },\n \"type\": \"array\"\n },\n \"name\": {\n \"description\": \"Name of this spec.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n },\n \"sources\": {\n \"description\": \"Sources of this traffic target.\",\n \"items\": {\n \"properties\": {\n \"kind\": {\n \"description\": \"Kind of this source.\",\n \"type\": \"string\"\n },\n \"name\": {\n \"description\": \"Name of this source.\",\n \"type\": \"string\"\n },\n \"namespace\": {\n \"description\": \"Namespace of this source.\",\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"kind\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"array\"\n }\n },\n \"required\": [\n \"destination\",\n \"rules\",\n \"sources\"\n ],\n \"title\": \"Traffic Target\",\n \"type\": \"object\"\n}"} -------------------------------------------------------------------------------- /traefik/custom-operations.go: -------------------------------------------------------------------------------- 1 | package traefik 2 | 3 | import ( 4 | "github.com/layer5io/meshery-adapter-library/status" 5 | ) 6 | 7 | func (mesh *Mesh) applyCustomOperation(namespace string, manifest string, isDel bool, kubeconfigs []string) (string, error) { 8 | st := status.Starting 9 | 10 | err := mesh.applyManifest([]byte(manifest), isDel, namespace, kubeconfigs) 11 | if err != nil { 12 | return st, ErrCustomOperation(err) 13 | } 14 | 15 | return status.Completed, nil 16 | } 17 | -------------------------------------------------------------------------------- /traefik/error.go: -------------------------------------------------------------------------------- 1 | package traefik 2 | 3 | import ( 4 | "fmt" 5 | 6 | "github.com/layer5io/meshkit/errors" 7 | ) 8 | 9 | var ( 10 | // Error code for failed service mesh installation 11 | 12 | // ErrInstallTraefikCode represents the errors which are generated 13 | // during traefik mesh install process 14 | ErrInstallTraefikCode = "1032" 15 | 16 | // ErrCreatingHelmIndexCode represents the errors which are generated 17 | // during creation of helm index 18 | ErrCreatingHelmIndexCode = "1033" 19 | 20 | // ErrEntryWithAppVersionNotExistsCode represents the error which is generated 21 | // when no entry is found with specified name and app version 22 | ErrEntryWithAppVersionNotExistsCode = "1034" 23 | 24 | // ErrHelmRepositoryNotFoundCode represents the error which is generated when 25 | // no valid helm repository is found 26 | ErrHelmRepositoryNotFoundCode = "1035" 27 | 28 | // ErrDecodeYamlCode represents the error which is generated when yaml 29 | // decode process fails 30 | ErrDecodeYamlCode = "1036" 31 | 32 | // ErrMeshConfigCode represents the errors which are generated 33 | // when an invalid mesh config is found 34 | ErrMeshConfigCode = "1037" 35 | 36 | // ErrApplyHelmChartCode represents the error which are generated 37 | // during the process of applying helm chart 38 | ErrApplyHelmChartCode = "1012" 39 | 40 | // ErrConvertingAppVersionToChartVersionCode represents the errors which are generated 41 | // during the process of converting app version to chart version 42 | ErrConvertingAppVersionToChartVersionCode = "1038" 43 | 44 | // ErrCreatingTraefikMeshClientCode represents the errors which are generated 45 | // during creating traefik client process 46 | ErrCreatingTraefikMeshClientCode = "1039" 47 | 48 | // ErrSampleAppCode represents the errors which are generated 49 | // duing sample app installation 50 | ErrSampleAppCode = "1040" 51 | 52 | // ErrCustomOperationCode represents the errors which are generated 53 | // when an invalid addon operation is requested 54 | ErrCustomOperationCode = "1041" 55 | 56 | // ErrOpInvalidCode represents the error code which are generated 57 | // when an invalid operation is requested 58 | ErrOpInvalidCode = "1042" 59 | 60 | // ErrOpInvalid is an error when an invalid operation is requested 61 | ErrOpInvalid = errors.New(ErrOpInvalidCode, errors.Alert, []string{"Invalid operation"}, []string{}, []string{}, []string{}) 62 | 63 | // ErrNilClientCode represents the error code which is 64 | // generated when kubernetes client is nil 65 | ErrNilClientCode = "1013" 66 | 67 | // ErrInvalidOAMComponentTypeCode represents the error code which is 68 | // generated when an invalid oam component is requested 69 | ErrInvalidOAMComponentTypeCode = "1014" 70 | 71 | // ErrTraefikCoreComponentFailCode represents the error code which is 72 | // generated when an Traefik core operations fails 73 | ErrTraefikCoreComponentFailCode = "1015" 74 | // ErrProcessOAMCode represents the error code which is 75 | // generated when an OAM operations fails 76 | ErrProcessOAMCode = "1016" 77 | // ErrParseTraefikCoreComponentCode represents the error code which is 78 | // generated when Traefik core component manifest parsing fails 79 | ErrParseTraefikCoreComponentCode = "1017" 80 | // ErrParseOAMComponentCode represents the error code which is 81 | // generated during the OAM component parsing 82 | ErrParseOAMComponentCode = "1018" 83 | // ErrParseOAMConfigCode represents the error code which is 84 | // generated during the OAM configuration parsing 85 | ErrParseOAMConfigCode = "1019" 86 | 87 | // ErrNilClient represents the error which is 88 | // generated when kubernetes client is nil 89 | ErrNilClient = errors.New(ErrNilClientCode, errors.Alert, []string{"kubernetes client not initialized"}, []string{"Kubernetes client is nil"}, []string{"kubernetes client not initialized"}, []string{"Reconnect the adapter to Meshery server"}) 90 | 91 | // ErrParseOAMComponent represents the error which is 92 | // generated during the OAM component parsing 93 | ErrParseOAMComponent = errors.New(ErrParseOAMComponentCode, errors.Alert, []string{"error parsing the component"}, []string{"Error occurred while parsing application component in the OAM request made by Meshery Server"}, []string{"Could not unmarshall configuration component received via ProcessOAM gRPC call into a valid Component struct"}, []string{"Check if Meshery Server is creating valid component for ProcessOAM gRPC call. This error should never happen and can be reported as a bug in Meshery Server. Also, check if Meshery Server and adapters are referring to same component struct provided in MeshKit."}) 94 | 95 | // ErrParseOAMConfig represents the error which is 96 | // generated during the OAM configuration parsing 97 | ErrParseOAMConfig = errors.New(ErrParseOAMConfigCode, errors.Alert, []string{"error parsing the configuration"}, []string{"Error occurred while parsing configuration in the request made by Meshery Server"}, []string{"Could not unmarshall OAM config received via ProcessOAM gRPC call into a valid Config struct"}, []string{"Check if Meshery Server is creating valid config for ProcessOAM gRPC call. This error should never happen and can be reported as a bug in Meshery Server. Also, confirm that Meshery Server and Adapters are referring to same config struct provided in MeshKit"}) 98 | 99 | // ErrGetLatestReleaseCode represents the error which is 100 | // generated when the latest stable version could not 101 | // be fetched during runtime component registeration 102 | ErrGetLatestReleaseCode = "1020" 103 | ) 104 | 105 | // ErrInstallTraefik is the error for install mesh 106 | func ErrInstallTraefik(err error) error { 107 | return errors.New(ErrInstallTraefikCode, errors.Alert, []string{"Error with traefik operation"}, []string{err.Error()}, []string{}, []string{}) 108 | } 109 | 110 | // ErrDecodeYaml is the error when the yaml unmarshal fails 111 | func ErrDecodeYaml(err error) error { 112 | return errors.New(ErrDecodeYamlCode, errors.Alert, []string{"Error occurred while decoding YAML"}, []string{err.Error()}, []string{}, []string{}) 113 | } 114 | 115 | // ErrCreatingHelmIndex is the error for creating helm index 116 | func ErrCreatingHelmIndex(err error) error { 117 | return errors.New(ErrCreatingHelmIndexCode, errors.Alert, []string{"Error while creating Helm Index"}, []string{err.Error()}, []string{}, []string{}) 118 | } 119 | 120 | // ErrEntryWithAppVersionNotExists is the error when an entry with the given app version is not found 121 | func ErrEntryWithAppVersionNotExists(entry, appVersion string) error { 122 | return errors.New(ErrEntryWithAppVersionNotExistsCode, errors.Alert, []string{"Entry for the app version does not exist"}, []string{fmt.Sprintf("entry %s with app version %s does not exists", entry, appVersion)}, []string{}, []string{}) 123 | } 124 | 125 | // ErrHelmRepositoryNotFound is the error when no valid remote helm repository is found 126 | func ErrHelmRepositoryNotFound(repo string, err error) error { 127 | return errors.New(ErrHelmRepositoryNotFoundCode, errors.Alert, []string{"Helm repo not found"}, []string{fmt.Sprintf("either the repo %s does not exists or is corrupt: %v", repo, err)}, []string{}, []string{}) 128 | } 129 | 130 | // ErrMeshConfig is the error for mesh config 131 | func ErrMeshConfig(err error) error { 132 | return errors.New(ErrMeshConfigCode, errors.Alert, []string{"Error configuration mesh"}, []string{err.Error()}, []string{}, []string{}) 133 | } 134 | 135 | // ErrApplyHelmChart is the error for applying helm chart 136 | func ErrApplyHelmChart(err error) error { 137 | return errors.New(ErrApplyHelmChartCode, errors.Alert, []string{"Error occurred while applying Helm Chart"}, []string{err.Error()}, []string{}, []string{}) 138 | } 139 | 140 | // ErrConvertingAppVersionToChartVersion is the error for converting app version to chart version 141 | func ErrConvertingAppVersionToChartVersion(err error) error { 142 | return errors.New(ErrConvertingAppVersionToChartVersionCode, errors.Alert, []string{"Error occurred while converting app version to chart version"}, []string{err.Error()}, []string{}, []string{}) 143 | } 144 | 145 | // ErrCreatingTraefikMeshClient is the error for streaming event 146 | func ErrCreatingTraefikMeshClient(err error) error { 147 | return errors.New(ErrCreatingTraefikMeshClientCode, errors.Alert, []string{"Unable to create a new NSM client"}, []string{err.Error()}, []string{}, []string{}) 148 | } 149 | 150 | // ErrSampleApp is the error for streaming event 151 | func ErrSampleApp(err error) error { 152 | return errors.New(ErrSampleAppCode, errors.Alert, []string{"Error with sample app operation"}, []string{err.Error()}, []string{}, []string{}) 153 | } 154 | 155 | // ErrCustomOperation is the error for streaming event 156 | func ErrCustomOperation(err error) error { 157 | return errors.New(ErrCustomOperationCode, errors.Alert, []string{"Error with custom operation"}, []string{err.Error()}, []string{}, []string{}) 158 | } 159 | 160 | // ErrParseTraefikCoreComponent is the error when traefik core component manifest parsing fails 161 | func ErrParseTraefikCoreComponent(err error) error { 162 | return errors.New(ErrParseTraefikCoreComponentCode, errors.Alert, []string{"Traefik core component manifest parsing failing"}, []string{err.Error()}, []string{}, []string{}) 163 | } 164 | 165 | // ErrInvalidOAMComponentType is the error when the OAM component name is not valid 166 | func ErrInvalidOAMComponentType(compName string) error { 167 | return errors.New(ErrInvalidOAMComponentTypeCode, errors.Alert, []string{"invalid OAM component name: ", compName}, []string{}, []string{}, []string{}) 168 | } 169 | 170 | // ErrTraefikCoreComponentFail is the error when core Traefik component processing fails 171 | func ErrTraefikCoreComponentFail(err error) error { 172 | return errors.New(ErrTraefikCoreComponentFailCode, errors.Alert, []string{"error in Traefik core component"}, []string{err.Error()}, []string{}, []string{}) 173 | } 174 | 175 | // ErrProcessOAM is a generic error which is thrown when an OAM operations fails 176 | func ErrProcessOAM(err error) error { 177 | return errors.New(ErrProcessOAMCode, errors.Alert, []string{"error performing OAM operations"}, []string{err.Error()}, []string{}, []string{}) 178 | } 179 | 180 | // ErrGetLatestRelease is the error for get latest versions 181 | func ErrGetLatestRelease(err error) error { 182 | return errors.New(ErrGetLatestReleaseCode, errors.Alert, []string{"Could not get latest version"}, []string{err.Error()}, []string{"Latest version could not be found at the specified url"}, []string{}) 183 | } 184 | -------------------------------------------------------------------------------- /traefik/install.go: -------------------------------------------------------------------------------- 1 | package traefik 2 | 3 | import ( 4 | "fmt" 5 | "sync" 6 | 7 | "github.com/layer5io/meshery-adapter-library/adapter" 8 | "github.com/layer5io/meshery-adapter-library/status" 9 | mesherykube "github.com/layer5io/meshkit/utils/kubernetes" 10 | ) 11 | 12 | func (mesh *Mesh) installTraefikMesh(del bool, version, namespace string, kubeconfigs []string) (string, error) { 13 | mesh.Log.Debug(fmt.Sprintf("Requested install of version: %s", version)) 14 | mesh.Log.Debug(fmt.Sprintf("Requested action is delete: %v", del)) 15 | mesh.Log.Debug(fmt.Sprintf("Requested action is in namespace: %s", namespace)) 16 | 17 | st := status.Installing 18 | if del { 19 | st = status.Removing 20 | } 21 | 22 | err := mesh.Config.GetObject(adapter.MeshSpecKey, mesh) 23 | if err != nil { 24 | return st, ErrMeshConfig(err) 25 | } 26 | 27 | err = mesh.applyHelmChart(del, version, namespace, kubeconfigs) 28 | if err != nil { 29 | return st, ErrApplyHelmChart(err) 30 | } 31 | 32 | st = status.Installed 33 | if del { 34 | st = status.Removed 35 | } 36 | 37 | return st, nil 38 | } 39 | 40 | func (mesh *Mesh) applyHelmChart(del bool, version, namespace string, kubeconfigs []string) error { 41 | var wg sync.WaitGroup 42 | var errs []error 43 | var errMx sync.Mutex 44 | for _, k8sconfig := range kubeconfigs { 45 | wg.Add(1) 46 | go func(k8sconfig string) { 47 | defer wg.Done() 48 | kClient, err := mesherykube.New([]byte(k8sconfig)) 49 | if err != nil { 50 | errMx.Lock() 51 | errs = append(errs, err) 52 | errMx.Unlock() 53 | return 54 | } 55 | repo := "https://helm.traefik.io/mesh" 56 | chart := "traefik-mesh" 57 | var act mesherykube.HelmChartAction 58 | if del { 59 | act = mesherykube.UNINSTALL 60 | } else { 61 | act = mesherykube.INSTALL 62 | } 63 | err = kClient.ApplyHelmChart(mesherykube.ApplyHelmChartConfig{ 64 | ChartLocation: mesherykube.HelmChartLocation{ 65 | Repository: repo, 66 | Chart: chart, 67 | AppVersion: version, 68 | }, 69 | Namespace: namespace, 70 | Action: act, 71 | CreateNamespace: true, 72 | }) 73 | if err != nil { 74 | errMx.Lock() 75 | errs = append(errs, err) 76 | errMx.Unlock() 77 | return 78 | } 79 | }(k8sconfig) 80 | } 81 | wg.Wait() 82 | if len(errs) != 0 { 83 | return mergeErrors(errs) 84 | } 85 | return nil 86 | } 87 | -------------------------------------------------------------------------------- /traefik/oam.go: -------------------------------------------------------------------------------- 1 | package traefik 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | 7 | "github.com/google/uuid" 8 | "github.com/layer5io/meshery-adapter-library/meshes" 9 | "github.com/layer5io/meshery-traefik-mesh/internal/config" 10 | "github.com/layer5io/meshkit/models/oam/core/v1alpha1" 11 | "gopkg.in/yaml.v2" 12 | ) 13 | 14 | // CompHandler is the type for functions which can handle OAM components 15 | type CompHandler func(*Mesh, v1alpha1.Component, bool, []string) (string, error) 16 | 17 | // HandleComponents handles the processing of OAM components 18 | func (mesh *Mesh) HandleComponents(comps []v1alpha1.Component, isDel bool, kubeconfigs []string) (string, error) { 19 | var errs []error 20 | var msgs []string 21 | stat1 := "deploying" 22 | stat2 := "deployed" 23 | if isDel { 24 | stat1 = "removing" 25 | stat2 = "removed" 26 | } 27 | compFuncMap := map[string]CompHandler{ 28 | "TraefikMesh": handleComponentTraefikMesh, 29 | } 30 | 31 | for _, comp := range comps { 32 | ee := &meshes.EventsResponse{ 33 | OperationId: uuid.New().String(), 34 | Component: config.ServerConfig["type"], 35 | ComponentName: config.ServerConfig["name"], 36 | } 37 | fnc, ok := compFuncMap[comp.Spec.Type] 38 | if !ok { 39 | msg, err := handleTraefikCoreComponent(mesh, comp, isDel, "", "", kubeconfigs) 40 | if err != nil { 41 | ee.Summary = fmt.Sprintf("Error while %s %s", stat1, comp.Spec.Type) 42 | mesh.streamErr(ee.Summary, ee, err) 43 | errs = append(errs, err) 44 | continue 45 | } 46 | ee.Summary = fmt.Sprintf("%s %s successfully", comp.Spec.Type, stat2) 47 | ee.Details = fmt.Sprintf("The %s is now %s.", comp.Spec.Type, stat2) 48 | mesh.StreamInfo(ee) 49 | msgs = append(msgs, msg) 50 | continue 51 | } 52 | 53 | msg, err := fnc(mesh, comp, isDel, kubeconfigs) 54 | if err != nil { 55 | ee.Summary = fmt.Sprintf("Error while %s %s", stat1, comp.Spec.Type) 56 | mesh.streamErr(ee.Summary, ee, err) 57 | errs = append(errs, err) 58 | continue 59 | } 60 | ee.Summary = fmt.Sprintf("%s %s %s successfully", comp.Name, comp.Spec.Type, stat2) 61 | ee.Details = fmt.Sprintf("The %s %s is now %s.", comp.Name, comp.Spec.Type, stat2) 62 | mesh.StreamInfo(ee) 63 | msgs = append(msgs, msg) 64 | } 65 | 66 | if err := mergeErrors(errs); err != nil { 67 | return mergeMsgs(msgs), err 68 | } 69 | 70 | return mergeMsgs(msgs), nil 71 | } 72 | 73 | // HandleApplicationConfiguration handles the processing of OAM application configuration 74 | func (mesh *Mesh) HandleApplicationConfiguration(config v1alpha1.Configuration, isDel bool, kubeconfigs []string) (string, error) { 75 | var errs []error 76 | var msgs []string 77 | for _, comp := range config.Spec.Components { 78 | for _, trait := range comp.Traits { 79 | msgs = append(msgs, fmt.Sprintf("applied trait \"%s\" on service \"%s\"", trait.Name, comp.ComponentName)) 80 | } 81 | } 82 | 83 | if err := mergeErrors(errs); err != nil { 84 | return mergeMsgs(msgs), err 85 | } 86 | 87 | return mergeMsgs(msgs), nil 88 | } 89 | 90 | func handleComponentTraefikMesh(mesh *Mesh, comp v1alpha1.Component, isDel bool, kubeconfigs []string) (string, error) { 91 | version := comp.Spec.Version 92 | msg, err := mesh.installTraefikMesh(isDel, version, comp.Namespace, kubeconfigs) 93 | if err != nil { 94 | return fmt.Sprintf("%s: %s", comp.Name, msg), err 95 | } 96 | 97 | return fmt.Sprintf("%s: %s", comp.Name, msg), nil 98 | } 99 | 100 | func handleTraefikCoreComponent( 101 | mesh *Mesh, 102 | comp v1alpha1.Component, 103 | isDel bool, 104 | apiVersion, 105 | kind string, 106 | kubeconfigs []string) (string, error) { 107 | if apiVersion == "" { 108 | apiVersion = getAPIVersionFromComponent(comp) 109 | if apiVersion == "" { 110 | return "", ErrTraefikCoreComponentFail(fmt.Errorf("failed to get API Version for: %s", comp.Name)) 111 | } 112 | } 113 | 114 | if kind == "" { 115 | kind = getKindFromComponent(comp) 116 | if kind == "" { 117 | return "", ErrTraefikCoreComponentFail(fmt.Errorf("failed to get kind for: %s", comp.Name)) 118 | } 119 | } 120 | 121 | component := map[string]interface{}{ 122 | "apiVersion": apiVersion, 123 | "kind": kind, 124 | "metadata": map[string]interface{}{ 125 | "name": comp.Name, 126 | "annotations": comp.Annotations, 127 | "labels": comp.Labels, 128 | }, 129 | "spec": comp.Spec.Settings, 130 | } 131 | 132 | // Convert to yaml 133 | yamlByt, err := yaml.Marshal(component) 134 | if err != nil { 135 | err = ErrParseTraefikCoreComponent(err) 136 | mesh.Log.Error(err) 137 | return "", err 138 | } 139 | 140 | msg := fmt.Sprintf("created %s \"%s\" in namespace \"%s\"", kind, comp.Name, comp.Namespace) 141 | if isDel { 142 | msg = fmt.Sprintf("deleted %s config \"%s\" in namespace \"%s\"", kind, comp.Name, comp.Namespace) 143 | } 144 | 145 | return msg, mesh.applyManifest(yamlByt, isDel, comp.Namespace, kubeconfigs) 146 | } 147 | 148 | func getAPIVersionFromComponent(comp v1alpha1.Component) string { 149 | return comp.Annotations["pattern.meshery.io.mesh.workload.k8sAPIVersion"] 150 | } 151 | 152 | func getKindFromComponent(comp v1alpha1.Component) string { 153 | return comp.Annotations["pattern.meshery.io.mesh.workload.k8sKind"] 154 | } 155 | 156 | func mergeErrors(errs []error) error { 157 | if len(errs) == 0 { 158 | return nil 159 | } 160 | 161 | var errMsgs []string 162 | 163 | for _, err := range errs { 164 | errMsgs = append(errMsgs, err.Error()) 165 | } 166 | 167 | return fmt.Errorf(strings.Join(errMsgs, "\n")) 168 | } 169 | 170 | func mergeMsgs(strs []string) string { 171 | return strings.Join(strs, "\n") 172 | } 173 | -------------------------------------------------------------------------------- /traefik/oam/doc.go: -------------------------------------------------------------------------------- 1 | // Package oam contains the definitions for OAM objects 2 | // as well as the parsers and register functions associated 3 | // with it 4 | package oam 5 | -------------------------------------------------------------------------------- /traefik/oam/parser.go: -------------------------------------------------------------------------------- 1 | package oam 2 | 3 | import ( 4 | "encoding/json" 5 | 6 | "github.com/layer5io/meshkit/models/oam/core/v1alpha1" 7 | ) 8 | 9 | // ParseApplicationComponent converts json application component to go struct 10 | func ParseApplicationComponent(jsn string) (acomp v1alpha1.Component, err error) { 11 | err = json.Unmarshal([]byte(jsn), &acomp) 12 | return 13 | } 14 | 15 | // ParseApplicationConfiguration converts json application configuration to go struct 16 | func ParseApplicationConfiguration(jsn string) (acomp v1alpha1.Configuration, err error) { 17 | err = json.Unmarshal([]byte(jsn), &acomp) 18 | return 19 | } 20 | -------------------------------------------------------------------------------- /traefik/oam/register.go: -------------------------------------------------------------------------------- 1 | package oam 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "strconv" 8 | "sync" 9 | 10 | "github.com/layer5io/meshery-adapter-library/adapter" 11 | "github.com/layer5io/meshkit/models/meshmodel/core/types" 12 | ) 13 | 14 | var ( 15 | basePath, _ = os.Getwd() 16 | MeshmodelComponents = filepath.Join(basePath, "templates", "meshmodel", "components") 17 | ) 18 | 19 | // AvailableVersions denote the component versions available statically 20 | var AvailableVersions = map[string]bool{} 21 | var availableVersionGlobalMutex sync.Mutex 22 | 23 | type meshmodelDefinitionPathSet struct { 24 | meshmodelDefinitionPath string 25 | } 26 | 27 | func RegisterMeshModelComponents(uuid, runtime, host, port string) error { 28 | meshmodelRDP := []adapter.MeshModelRegistrantDefinitionPath{} 29 | pathSets, err := loadMeshmodelComponents(MeshmodelComponents) 30 | if err != nil { 31 | return err 32 | } 33 | portint, _ := strconv.Atoi(port) 34 | for _, pathSet := range pathSets { 35 | meshmodelRDP = append(meshmodelRDP, adapter.MeshModelRegistrantDefinitionPath{ 36 | EntityDefintionPath: pathSet.meshmodelDefinitionPath, 37 | Host: host, 38 | Port: portint, 39 | Type: types.ComponentDefinition, 40 | }) 41 | } 42 | 43 | return adapter. 44 | NewMeshModelRegistrant(meshmodelRDP, fmt.Sprintf("%s/api/meshmodel/components/register", runtime)). 45 | Register(uuid) 46 | } 47 | 48 | func loadMeshmodelComponents(basepath string) ([]meshmodelDefinitionPathSet, error) { 49 | res := []meshmodelDefinitionPathSet{} 50 | if err := filepath.Walk(basepath, func(path string, info os.FileInfo, err error) error { 51 | if err != nil { 52 | return err 53 | } 54 | 55 | if info.IsDir() { 56 | return nil 57 | } 58 | 59 | res = append(res, meshmodelDefinitionPathSet{ 60 | meshmodelDefinitionPath: path, 61 | }) 62 | availableVersionGlobalMutex.Lock() 63 | AvailableVersions[filepath.Base(filepath.Dir(path))] = true // Getting available versions already existing on file system 64 | availableVersionGlobalMutex.Unlock() 65 | return nil 66 | }); err != nil { 67 | return nil, err 68 | } 69 | 70 | return res, nil 71 | } 72 | -------------------------------------------------------------------------------- /traefik/sample-apps.go: -------------------------------------------------------------------------------- 1 | package traefik 2 | 3 | import ( 4 | "sync" 5 | 6 | "github.com/layer5io/meshery-adapter-library/adapter" 7 | "github.com/layer5io/meshery-adapter-library/status" 8 | mesherykube "github.com/layer5io/meshkit/utils/kubernetes" 9 | ) 10 | 11 | func (mesh *Mesh) installSampleApp(namespace string, del bool, templates []adapter.Template, kubeconfigs []string) (string, error) { 12 | st := status.Installing 13 | 14 | if del { 15 | st = status.Removing 16 | } 17 | 18 | for _, template := range templates { 19 | err := mesh.applyManifest([]byte(template.String()), del, namespace, kubeconfigs) 20 | if err != nil { 21 | return st, ErrSampleApp(err) 22 | } 23 | } 24 | 25 | return status.Installed, nil 26 | } 27 | 28 | func (mesh *Mesh) applyManifest(contents []byte, isDel bool, namespace string, kubeconfigs []string) error { 29 | var wg sync.WaitGroup 30 | var errs []error 31 | var errMx sync.Mutex 32 | for _, k8sconfig := range kubeconfigs { 33 | wg.Add(1) 34 | go func(k8sconfig string) { 35 | defer wg.Done() 36 | kClient, err := mesherykube.New([]byte(k8sconfig)) 37 | if err != nil { 38 | errMx.Lock() 39 | errs = append(errs, err) 40 | errMx.Unlock() 41 | return 42 | } 43 | err = kClient.ApplyManifest(contents, mesherykube.ApplyOptions{ 44 | Namespace: namespace, 45 | Update: true, 46 | Delete: isDel, 47 | }) 48 | if err != nil { 49 | errMx.Lock() 50 | errs = append(errs, err) 51 | errMx.Unlock() 52 | return 53 | } 54 | }(k8sconfig) 55 | } 56 | wg.Wait() 57 | if len(errs) != 0 { 58 | return mergeErrors(errs) 59 | } 60 | return nil 61 | } 62 | -------------------------------------------------------------------------------- /traefik/traefik.go: -------------------------------------------------------------------------------- 1 | // Package traefik - Common operations for the adapter 2 | package traefik 3 | 4 | import ( 5 | "context" 6 | "fmt" 7 | 8 | "github.com/layer5io/meshery-adapter-library/adapter" 9 | "github.com/layer5io/meshery-adapter-library/common" 10 | "github.com/layer5io/meshery-adapter-library/meshes" 11 | "github.com/layer5io/meshery-adapter-library/status" 12 | internalconfig "github.com/layer5io/meshery-traefik-mesh/internal/config" 13 | "github.com/layer5io/meshery-traefik-mesh/traefik/oam" 14 | meshkitCfg "github.com/layer5io/meshkit/config" 15 | "github.com/layer5io/meshkit/errors" 16 | "github.com/layer5io/meshkit/logger" 17 | "github.com/layer5io/meshkit/models" 18 | "github.com/layer5io/meshkit/models/oam/core/v1alpha1" 19 | "github.com/layer5io/meshkit/utils/events" 20 | "gopkg.in/yaml.v2" 21 | ) 22 | 23 | const ( 24 | // SMIManifest is the manifest.yaml file for smi conformance tool 25 | SMIManifest = "https://raw.githubusercontent.com/layer5io/learn-layer5/master/smi-conformance/manifest.yml" 26 | ) 27 | 28 | // Mesh represents the traefik-mesh adapter and embeds adapter.Adapter 29 | type Mesh struct { 30 | adapter.Adapter // Type Embedded 31 | } 32 | 33 | // New initializes treafik-mesh handler. 34 | func New(c meshkitCfg.Handler, l logger.Handler, kc meshkitCfg.Handler, e *events.EventStreamer) adapter.Handler { 35 | return &Mesh{ 36 | Adapter: adapter.Adapter{ 37 | Config: c, 38 | Log: l, 39 | KubeconfigHandler: kc, 40 | EventStreamer: e, 41 | }, 42 | } 43 | } 44 | 45 | // CreateKubeconfigs creates and writes passed kubeconfig onto the filesystem 46 | func (mesh *Mesh) CreateKubeconfigs(kubeconfigs []string) error { 47 | var errs = make([]error, 0) 48 | for _, kubeconfig := range kubeconfigs { 49 | kconfig := models.Kubeconfig{} 50 | err := yaml.Unmarshal([]byte(kubeconfig), &kconfig) 51 | if err != nil { 52 | errs = append(errs, err) 53 | continue 54 | } 55 | 56 | // To have control over what exactly to take in on kubeconfig 57 | mesh.KubeconfigHandler.SetKey("kind", kconfig.Kind) 58 | mesh.KubeconfigHandler.SetKey("apiVersion", kconfig.APIVersion) 59 | mesh.KubeconfigHandler.SetKey("current-context", kconfig.CurrentContext) 60 | err = mesh.KubeconfigHandler.SetObject("preferences", kconfig.Preferences) 61 | if err != nil { 62 | errs = append(errs, err) 63 | continue 64 | } 65 | 66 | err = mesh.KubeconfigHandler.SetObject("clusters", kconfig.Clusters) 67 | if err != nil { 68 | errs = append(errs, err) 69 | continue 70 | } 71 | 72 | err = mesh.KubeconfigHandler.SetObject("users", kconfig.Users) 73 | if err != nil { 74 | errs = append(errs, err) 75 | continue 76 | } 77 | 78 | err = mesh.KubeconfigHandler.SetObject("contexts", kconfig.Contexts) 79 | if err != nil { 80 | errs = append(errs, err) 81 | continue 82 | } 83 | } 84 | if len(errs) == 0 { 85 | return nil 86 | } 87 | return mergeErrors(errs) 88 | } 89 | 90 | // ApplyOperation applies the operation on traefik mesh 91 | func (mesh *Mesh) ApplyOperation(ctx context.Context, opReq adapter.OperationRequest) error { 92 | err := mesh.CreateKubeconfigs(opReq.K8sConfigs) 93 | if err != nil { 94 | return err 95 | } 96 | kubeconfigs := opReq.K8sConfigs 97 | operations := make(adapter.Operations) 98 | err = mesh.Config.GetObject(adapter.OperationsKey, &operations) 99 | if err != nil { 100 | return err 101 | } 102 | 103 | e := &meshes.EventsResponse{ 104 | OperationId: opReq.OperationID, 105 | Summary: status.Deploying, 106 | Details: "Operation is not supported", 107 | Component: internalconfig.ServerConfig["type"], 108 | ComponentName: internalconfig.ServerConfig["name"], 109 | } 110 | 111 | switch opReq.OperationName { 112 | case internalconfig.TraefikMeshOperation: 113 | go func(hh *Mesh, ee *meshes.EventsResponse) { 114 | version := string(operations[opReq.OperationName].Versions[0]) 115 | stat, err := hh.installTraefikMesh(opReq.IsDeleteOperation, version, opReq.Namespace, kubeconfigs) 116 | if err != nil { 117 | summary := fmt.Sprintf("Error while %s Traefik service mesh", stat) 118 | hh.streamErr(summary, ee, err) 119 | return 120 | } 121 | ee.Summary = fmt.Sprintf("Traefik service mesh %s successfully", stat) 122 | ee.Details = fmt.Sprintf("The Traefik service mesh is now %s.", stat) 123 | hh.StreamInfo(ee) 124 | }(mesh, e) 125 | case common.BookInfoOperation, common.HTTPBinOperation, common.ImageHubOperation, common.EmojiVotoOperation: 126 | go func(hh *Mesh, ee *meshes.EventsResponse) { 127 | appName := operations[opReq.OperationName].AdditionalProperties[common.ServiceName] 128 | stat, err := hh.installSampleApp(opReq.Namespace, opReq.IsDeleteOperation, operations[opReq.OperationName].Templates, kubeconfigs) 129 | if err != nil { 130 | summary := fmt.Sprintf("Error while %s %s application", stat, appName) 131 | hh.streamErr(summary, ee, err) 132 | return 133 | } 134 | ee.Summary = fmt.Sprintf("%s application %s successfully", appName, stat) 135 | ee.Details = fmt.Sprintf("The %s application is now %s.", appName, stat) 136 | hh.StreamInfo(ee) 137 | }(mesh, e) 138 | case common.CustomOperation: 139 | go func(hh *Mesh, ee *meshes.EventsResponse) { 140 | stat, err := hh.applyCustomOperation(opReq.Namespace, opReq.CustomBody, opReq.IsDeleteOperation, kubeconfigs) 141 | if err != nil { 142 | summary := fmt.Sprintf("Error while %s custom operation", stat) 143 | hh.streamErr(summary, ee, err) 144 | return 145 | } 146 | ee.Summary = fmt.Sprintf("Manifest %s successfully", status.Deployed) 147 | ee.Details = "" 148 | hh.StreamInfo(ee) 149 | }(mesh, e) 150 | case common.SmiConformanceOperation: 151 | go func(hh *Mesh, ee *meshes.EventsResponse) { 152 | name := operations[opReq.OperationName].Description 153 | _, err := hh.RunSMITest(adapter.SMITestOptions{ 154 | Ctx: context.TODO(), 155 | OperationID: ee.OperationId, 156 | Manifest: SMIManifest, 157 | Namespace: "meshery", 158 | Labels: make(map[string]string), 159 | Annotations: make(map[string]string), 160 | Kubeconfigs: kubeconfigs, 161 | }) 162 | if err != nil { 163 | summary := fmt.Sprintf("Error while %s %s test", status.Running, name) 164 | hh.streamErr(summary, ee, err) 165 | return 166 | } 167 | ee.Summary = fmt.Sprintf("%s test %s successfully", name, status.Completed) 168 | ee.Details = "" 169 | hh.StreamInfo(ee) 170 | }(mesh, e) 171 | default: 172 | mesh.streamErr("Invalid operation", e, ErrOpInvalid) 173 | } 174 | 175 | return nil 176 | } 177 | 178 | // ProcessOAM will handles the grpc invocation for handling OAM objects 179 | func (mesh *Mesh) ProcessOAM(ctx context.Context, oamReq adapter.OAMRequest) (string, error) { 180 | err := mesh.CreateKubeconfigs(oamReq.K8sConfigs) 181 | if err != nil { 182 | return "", err 183 | } 184 | kubeconfigs := oamReq.K8sConfigs 185 | var comps []v1alpha1.Component 186 | for _, acomp := range oamReq.OamComps { 187 | comp, err := oam.ParseApplicationComponent(acomp) 188 | if err != nil { 189 | mesh.Log.Error(ErrParseOAMComponent) 190 | continue 191 | } 192 | 193 | comps = append(comps, comp) 194 | } 195 | 196 | config, err := oam.ParseApplicationConfiguration(oamReq.OamConfig) 197 | if err != nil { 198 | mesh.Log.Error(ErrParseOAMConfig) 199 | } 200 | 201 | // If operation is delete then first HandleConfiguration and then handle the deployment 202 | if oamReq.DeleteOp { 203 | // Process configuration 204 | msg2, err := mesh.HandleApplicationConfiguration(config, oamReq.DeleteOp, kubeconfigs) 205 | if err != nil { 206 | return msg2, ErrProcessOAM(err) 207 | } 208 | 209 | // Process components 210 | msg1, err := mesh.HandleComponents(comps, oamReq.DeleteOp, kubeconfigs) 211 | if err != nil { 212 | return msg1 + "\n" + msg2, ErrProcessOAM(err) 213 | } 214 | 215 | return msg1 + "\n" + msg2, nil 216 | } 217 | 218 | // Process components 219 | msg1, err := mesh.HandleComponents(comps, oamReq.DeleteOp, kubeconfigs) 220 | if err != nil { 221 | return msg1, ErrProcessOAM(err) 222 | } 223 | 224 | // Process configuration 225 | msg2, err := mesh.HandleApplicationConfiguration(config, oamReq.DeleteOp, kubeconfigs) 226 | if err != nil { 227 | return msg1 + "\n" + msg2, ErrProcessOAM(err) 228 | } 229 | 230 | return msg1 + "\n" + msg2, nil 231 | } 232 | 233 | func (mesh *Mesh) streamErr(summary string, e *meshes.EventsResponse, err error) { 234 | e.Summary = summary 235 | e.Details = err.Error() 236 | e.ErrorCode = errors.GetCode(err) 237 | e.ProbableCause = errors.GetCause(err) 238 | e.SuggestedRemediation = errors.GetRemedy(err) 239 | mesh.StreamErr(e, err) 240 | } 241 | --------------------------------------------------------------------------------