├── .ci └── yamllint.yml ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── mergify.yml ├── stale.yml └── workflows │ ├── ci.yaml │ ├── e2e-metaprotocol-gateway.yaml │ ├── e2e-metaprotocol.yaml │ ├── e2e-redis.yaml │ ├── license-checker.yaml │ └── publish.yaml ├── .gitignore ├── .golangci.yml ├── .licenserc.yaml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── GOVERNANCE.md ├── LICENSE ├── MAINTAINERS.md ├── Makefile ├── README.md ├── README.zh-CN.md ├── SECURITY.md ├── cmd └── aeraki │ └── main.go ├── demo ├── addons │ ├── grafana.yaml │ ├── jaeger.yaml │ └── prometheus.yaml ├── common_func.sh ├── dubbo │ ├── destinationrule.yaml │ ├── dubbo-sample.yaml │ ├── install.sh │ ├── serviceentry.yaml │ ├── uninstall.sh │ ├── virtualservice-traffic-splitting.yaml │ ├── virtualservice-v1.yaml │ └── virtualservice-v2.yaml ├── gateway │ ├── demo-ingress.yaml │ └── istio-ingressgateway.yaml ├── grafana-dashboard.json ├── install-aeraki.sh ├── install-demo.sh ├── kafka │ ├── install.sh │ ├── kafka-sample.yaml │ └── uninstall.sh ├── metaprotocol-brpc │ ├── brpc-protocol.yaml │ ├── brpc-sample.yaml │ ├── destinationrule.yaml │ ├── install.sh │ ├── service.yaml │ ├── serviceentry.yaml │ ├── traffic-split.yaml │ └── uninstall.sh ├── metaprotocol-dubbo-app-level │ ├── destinationrule.yaml │ ├── dubbo-sample.yaml │ ├── install.sh │ ├── metarouter-header-mutation.yaml │ ├── metarouter-local-ratelimit.yaml │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── traffic-mirroring.yaml │ ├── traffic-split.yaml │ └── uninstall.sh ├── metaprotocol-dubbo │ ├── consistent-hash-lb │ │ └── destinationrule.yaml │ ├── destinationrule.yaml │ ├── dubbo-sample.yaml │ ├── install.sh │ ├── metarouter-global-ratelimit.yaml │ ├── metarouter-header-mutation.yaml │ ├── metarouter-local-ratelimit.yaml │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── rate-limit-server │ │ ├── config.yaml │ │ └── rate-limit-server.yaml │ ├── serviceentry.yaml │ ├── traffic-mirroring.yaml │ ├── traffic-split.yaml │ └── uninstall.sh ├── metaprotocol-qza │ ├── destinationrule.yaml │ ├── install.sh │ ├── metarouter-rate-limit.yaml │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── qza-protocol.yaml │ ├── qza-sample.yaml │ ├── traffic-split.yaml │ └── uninstall.sh ├── metaprotocol-thrift │ ├── consistent-hash-lb │ │ └── destinationrule.yaml │ ├── destinationrule.yaml │ ├── install.sh │ ├── metarouter-global-ratelimit.yaml │ ├── metarouter-header-mutation.yaml │ ├── metarouter-local-ratelimit.yaml │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── outlier-detection │ │ └── outlier-detection.yaml │ ├── rate-limit-server │ │ ├── config.yaml │ │ └── rate-limit-server.yaml │ ├── thrift-sample.yaml │ ├── traffic-split.yaml │ └── uninstall.sh ├── metaprotocol-trpc │ ├── destinationrule.yaml │ ├── install.sh │ ├── metarouter-header-mutation.yaml │ ├── metarouter-multi-route.yaml │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── traffic-split.yaml │ ├── trpc-protocol.yaml │ ├── trpc-sample.yaml │ └── uninstall.sh ├── metaprotocol-videopacket │ ├── destinationrule.yaml │ ├── install.sh │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── traffic-split.yaml │ ├── uninstall.sh │ ├── videopacket-protocol.yaml │ └── videopacket-sample.yaml ├── redis │ ├── client-side-password.yaml │ ├── cluster.yaml │ ├── external-redis.yaml │ ├── fault-injection.yaml │ ├── install.sh │ ├── read-policy.yaml │ ├── redis-client.yaml │ ├── redis-cluster.yaml │ ├── redis-single.yaml │ ├── routing.yaml │ ├── server-side-password.yaml │ ├── traffic-mirroring.yaml │ └── uninstall.sh ├── thrift │ ├── destinationrule.yaml │ ├── install.sh │ ├── thrift-sample.yaml │ ├── uninstall.sh │ ├── virtualservice-traffic-splitting.yaml │ ├── virtualservice-v1.yaml │ └── virtualservice-v2.yaml ├── uninstall-aeraki.sh └── uninstall-demo.sh ├── docker └── Dockerfile ├── docs ├── aeraki&istio.png ├── aeraki-architecture.png ├── aeraki-log.png ├── aeraki.png ├── metaprotocol.md ├── metrics.png ├── protocols.png └── zh │ ├── README.md │ └── redis.md ├── go.mod ├── go.sum ├── hack └── make-rules │ └── cross_build_images.sh ├── internal ├── bootstrap │ ├── aeraki_ca.go │ ├── mesh_config.go │ ├── options.go │ ├── server.go │ ├── validation.go │ └── webhook.go ├── ca │ ├── certificate.go │ └── istio_ca.go ├── config │ └── constants │ │ └── constants.go ├── controller │ ├── istio │ │ └── controller.go │ └── kube │ │ ├── dubbo.go │ │ ├── manager.go │ │ ├── metaprotocol.go │ │ ├── metarouter.go │ │ ├── namesapce.go │ │ ├── redis.go │ │ ├── serviceentry.go │ │ ├── serviceetnry_test.go │ │ └── sidecar_bootstrap_config.go ├── envoyfilter │ ├── controller.go │ ├── generator.go │ ├── network_filter.go │ └── network_filter_test.go ├── leaderelection │ ├── leaderelection.go │ └── leaderelection_test.go ├── model │ ├── config.go │ ├── metaprotocol │ │ └── application_protocol.go │ ├── protocol │ │ ├── instance.go │ │ └── instance_test.go │ └── utils.go ├── plugin │ ├── dubbo │ │ ├── authz │ │ │ ├── builder │ │ │ │ └── builder.go │ │ │ ├── matcher │ │ │ │ ├── cidr.go │ │ │ │ ├── cidr_test.go │ │ │ │ ├── header.go │ │ │ │ ├── header_test.go │ │ │ │ ├── metadata.go │ │ │ │ ├── metadata_test.go │ │ │ │ ├── string.go │ │ │ │ └── string_test.go │ │ │ └── model │ │ │ │ ├── generator.go │ │ │ │ ├── model.go │ │ │ │ ├── permission.go │ │ │ │ └── principal.go │ │ ├── dubboproxy.go │ │ ├── generator.go │ │ └── route.go │ ├── kafka │ │ ├── generator.go │ │ └── kafkafilter.go │ ├── metaprotocol │ │ ├── accesslog.go │ │ ├── filters.go │ │ ├── generator.go │ │ ├── metaprotocolproxy.go │ │ └── route.go │ ├── redis │ │ ├── generator.go │ │ ├── inbound.go │ │ ├── outbound.go │ │ ├── outboundcluster.go │ │ └── util.go │ ├── thrift │ │ ├── generator.go │ │ ├── route.go │ │ └── thriftproxy.go │ └── zookeeper │ │ ├── generator.go │ │ └── zookeeperfilter.go ├── util │ ├── error.go │ └── protoconv │ │ └── protoconv.go ├── webhook │ └── validation │ │ ├── configuration.go │ │ ├── scheme │ │ ├── collections.go │ │ └── validation.go │ │ └── server │ │ ├── monitoring.go │ │ └── server.go └── xds │ ├── cache_mgr.go │ ├── callbacks.go │ ├── logger.go │ ├── server.go │ └── utils.go ├── k8s ├── aeraki-bootstrap-config.yaml ├── aeraki.yaml ├── crd.yaml ├── tcm-apiservice.yaml └── tcm-istio-cm.yaml ├── manifests └── charts │ └── aeraki │ ├── Chart.yaml │ ├── templates │ ├── applicationprotocol.yaml │ ├── applicationprotocols-crd.yaml │ ├── clusterrole.yaml │ ├── clusterrolebinding.yaml │ ├── deployment.yaml │ ├── dubboauthorizationpolicies-crd.yaml │ ├── metarouters-crd.yaml │ ├── redisdestination-crd.yaml │ ├── redisservices-crd.yaml │ ├── role.yaml │ ├── rolebinding.yaml │ ├── service.yaml │ ├── serviceaccount.yaml │ └── tcmapiservice.yaml │ └── values.yaml ├── steering.md └── test └── e2e ├── common └── istio-config.yaml ├── dubbo ├── dubbo_test.go └── testdata │ ├── destinationrule.yaml │ ├── dubbo-sample.yaml │ ├── serviceentry.yaml │ ├── virtualservice-header-exact.yaml │ ├── virtualservice-method-exact.yaml │ ├── virtualservice-method-prefix.yaml │ ├── virtualservice-method-regex.yaml │ ├── virtualservice-traffic-splitting.yaml │ ├── virtualservice-v1.yaml │ └── virtualservice-v2.yaml ├── kafka ├── kafka_zookeeper_test.go └── testdata │ ├── install.sh │ └── kafka-sample.yaml ├── metaprotocol ├── metaprotocol_test.go └── testdata │ ├── consistent-hash-lb │ ├── destinationrule.yaml │ └── metarouter-sample.yaml │ ├── destinationrule.yaml │ ├── metaprotocol-sample.yaml │ ├── metarouter-attribute-exact.yaml │ ├── metarouter-attribute-prefix.yaml │ ├── metarouter-attribute-regex.yaml │ ├── metarouter-global-ratelimit.yaml │ ├── metarouter-header-mutation.yaml │ ├── metarouter-local-ratelimit.yaml │ ├── metarouter-traffic-splitting.yaml │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── rate-limit-server │ ├── config.yaml │ └── rate-limit-server.yaml │ ├── serviceentry.yaml │ └── traffic-mirroring.yaml ├── metaprotocolgateway ├── gen-go │ └── hello │ │ ├── GoUnusedProtection__.go │ │ ├── hello-consts.go │ │ ├── hello.go │ │ └── hello_service-remote │ │ └── hello_service-remote.go ├── hello.thrift ├── metaprotocol_gateway_test.go └── testdata │ ├── destinationrule.yaml │ ├── ingress-gateway.yaml │ ├── metarouter-v1.yaml │ ├── metarouter-v2.yaml │ ├── metarouter.yaml │ └── thrift-sample.yaml ├── redis ├── redis_test.go └── testdata │ ├── redis-client.yaml │ ├── redis-cluster.yaml │ ├── redis-single.yaml │ ├── redisdestination.yaml │ └── redisservice.yaml ├── scripts ├── addons.sh ├── aeraki.sh ├── istio.sh ├── minikube.sh ├── pre.sh ├── remove-aeraki-configmap.sh ├── uninstall-addons.sh └── uninstall-istio.sh ├── thrift ├── testdata │ ├── destinationrule.yaml │ ├── thrift-sample.yaml │ ├── virtualservice-traffic-splitting.yaml │ ├── virtualservice-v1.yaml │ └── virtualservice-v2.yaml └── thrift_test.go └── util ├── common_utils.go ├── kube_utils.go └── retry.go /.ci/yamllint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | ignore: | 5 | manifests/charts/aeraki/templates/deployment.yaml 6 | manifests/charts/aeraki/templates/service.yaml 7 | manifests/charts/aeraki/templates/serviceaccount.yaml 8 | manifests/charts/aeraki/templates/tcmapiservice.yaml 9 | k8s/crd.yaml 10 | 11 | yaml-files: 12 | - '*.yaml' 13 | - '*.yml' 14 | 15 | rules: 16 | truthy: disable 17 | # 80 chars should be enough, but don't fail if a line is longer 18 | line-length: disable 19 | comments-indentation: disable 20 | indentation: 21 | spaces: consistent 22 | indent-sequences: whatever 23 | check-multi-line-strings: false 24 | braces: 25 | level: warning 26 | max-spaces-inside: 1 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### What this PR does / Why we need it: 2 | 3 | 4 | 5 | ### Pre-Submission Checklist: 6 | 7 | 15 | 16 | * [ ] Did you explain what problem does this PR solve? Or what new features have been added? 17 | * [ ] Have you added related test cases? 18 | * [ ] Have you modified the related document? 19 | * [ ] Is this PR backward compatible? -------------------------------------------------------------------------------- /.github/mergify.yml: -------------------------------------------------------------------------------- 1 | --- 2 | queue_rules: 3 | - name: default 4 | queue_conditions: 5 | - approved-reviews-by=zhaohuabing 6 | merge_conditions: 7 | # Conditions to get out of the queue (= merged) 8 | - approved-reviews-by=zhaohuabing 9 | merge_method: squash 10 | 11 | pull_request_rules: 12 | - name: ask the maintainer team to review PR 13 | conditions: 14 | - and: 15 | - label!=invalid 16 | - -draft 17 | actions: 18 | request_reviews: 19 | users: 20 | - zhaohuabing 21 | - name: Automatic merge on CI success and review 22 | conditions: [] 23 | actions: 24 | queue: 25 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Number of days of inactivity before an issue becomes stale 3 | daysUntilStale: 60 4 | # Number of days of inactivity before a stale issue is closed 5 | daysUntilClose: 7 6 | # Issues with these labels will never be considered stale 7 | exemptLabels: 8 | - pinned 9 | - security 10 | # Label to use when marking an issue as stale 11 | staleLabel: wontfix 12 | # Comment to post when marking an issue as stale. Set to `false` to disable 13 | markComment: > 14 | This issue has been automatically marked as stale because it has not had 15 | recent activity. It will be closed if no further activity occurs. Thank you 16 | for your contributions. 17 | # Comment to post when closing a stale issue. Set to `false` to disable 18 | closeComment: false 19 | -------------------------------------------------------------------------------- /.github/workflows/e2e-metaprotocol-gateway.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: e2e-metaprotocolgateway 3 | 4 | on: 5 | push: 6 | branches: 7 | - "master" 8 | - "release/v*" 9 | paths-ignore: 10 | - "**/*.png" 11 | - "**/*.md" 12 | pull_request: 13 | branches: 14 | - "master" 15 | - "release/v*" 16 | paths-ignore: 17 | - "**/*.png" 18 | - "**/*.md" 19 | 20 | env: 21 | ISTIO_VERSION: 1.18.1 22 | ISTIO_NAMESPACE: istio-system 23 | SCRIPTS_DIR: test/e2e/scripts 24 | COMMON_DIR: test/e2e/common 25 | AERAKI_IMG_PULL_POLICY: Never 26 | jobs: 27 | TestGatewayVersionRouting: 28 | runs-on: ubuntu-latest 29 | timeout-minutes: 60 30 | strategy: 31 | fail-fast: true 32 | name: TestGatewayVersionRouting 33 | steps: 34 | - name: Check out code 35 | uses: actions/checkout@v2 36 | - name: Setup Go 37 | uses: actions/setup-go@v2 38 | with: 39 | go-version: '1.24' 40 | - name: Install dependencies 41 | run: | 42 | go version 43 | go install golang.org/x/tools/cmd/goimports@latest 44 | - name: build docker 45 | run: make docker-build-e2e 46 | - name: Prepare envrionment 47 | run: bash ${SCRIPTS_DIR}/pre.sh 48 | - name: Install Minikube 49 | run: bash ${SCRIPTS_DIR}/minikube.sh start 50 | - name: Install Istio 51 | run: bash ${SCRIPTS_DIR}/istio.sh 52 | - name: Install aeraki 53 | run: bash ${SCRIPTS_DIR}/aeraki.sh 54 | - name: test 55 | run: go test -v github.com/aeraki-mesh/aeraki/test/e2e/metaprotocolgateway/ -run TestThriftRouter 56 | -------------------------------------------------------------------------------- /.github/workflows/e2e-redis.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: e2e-redis 3 | 4 | on: 5 | push: 6 | branches: 7 | - "master" 8 | - "release/v*" 9 | paths-ignore: 10 | - "**/*.png" 11 | - "**/*.md" 12 | pull_request: 13 | branches: 14 | - "master" 15 | - "release/v*" 16 | paths-ignore: 17 | - "**/*.png" 18 | - "**/*.md" 19 | 20 | env: 21 | ISTIO_VERSION: 1.18.1 22 | ISTIO_NAMESPACE: istio-system 23 | SCRIPTS_DIR: test/e2e/scripts 24 | COMMON_DIR: test/e2e/common 25 | AERAKI_IMG_PULL_POLICY: Never 26 | jobs: 27 | redis-e2e-test: 28 | runs-on: ubuntu-latest 29 | timeout-minutes: 60 30 | strategy: 31 | fail-fast: true 32 | name: redis-e2e-test 33 | steps: 34 | - name: Check out code 35 | uses: actions/checkout@v2 36 | - name: Setup Go 37 | uses: actions/setup-go@v2 38 | with: 39 | go-version: '1.24' 40 | - name: Install dependencies 41 | run: | 42 | go install golang.org/x/tools/cmd/goimports@latest 43 | - name: build docker 44 | run: make docker-build-e2e 45 | - name: Prepare envrionment 46 | run: bash ${SCRIPTS_DIR}/pre.sh 47 | - name: Install Minikube 48 | run: bash ${SCRIPTS_DIR}/minikube.sh start 49 | - name: Install Istio 50 | run: bash ${SCRIPTS_DIR}/istio.sh 51 | - name: Install aeraki 52 | run: bash ${SCRIPTS_DIR}/aeraki.sh 53 | - name: test 54 | run: make e2e-redis 55 | -------------------------------------------------------------------------------- /.github/workflows/license-checker.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | --- 21 | name: License checker 22 | 23 | on: 24 | push: 25 | branches: 26 | - "master" 27 | - "release/v*" 28 | paths-ignore: 29 | - "**/*.png" 30 | - "**/*.md" 31 | pull_request: 32 | branches: 33 | - "master" 34 | - "release/v*" 35 | paths-ignore: 36 | - "**/*.png" 37 | - "**/*.md" 38 | 39 | jobs: 40 | check-license: 41 | runs-on: ubuntu-latest 42 | timeout-minutes: 3 43 | 44 | steps: 45 | - uses: actions/checkout@v2.4.0 46 | - name: Check License Header 47 | uses: apache/skywalking-eyes@v0.2.0 48 | -------------------------------------------------------------------------------- /.github/workflows/publish.yaml: -------------------------------------------------------------------------------- 1 | # Auto build and push docker image to docker hub when releasing tags 2 | --- 3 | name: Auto Build and Push image 4 | 5 | on: 6 | create 7 | 8 | jobs: 9 | publish_image: 10 | name: Build and Push aeraki image 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Check out code 14 | uses: actions/checkout@v2.3.5 15 | with: 16 | submodules: recursive 17 | 18 | - name: Extract Tags name 19 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 20 | id: tag_env 21 | shell: bash 22 | run: | 23 | echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/})" 24 | 25 | - name: Extract Tags Type 26 | if: ${{ startsWith(github.ref, 'refs/tags/') }} 27 | id: tag_type 28 | shell: bash 29 | run: | 30 | echo "##[set-output name=version;]$(echo ${GITHUB_REF#refs/tags/})" 31 | 32 | - name: Login to Docker Hub 33 | uses: docker/login-action@v1 34 | with: 35 | username: ${{ secrets.DOCKERHUB_USERNAME }} 36 | password: ${{ secrets.DOCKERHUB_TOKEN }} 37 | 38 | - name: Build Aeraki Docker Image 39 | if: ${{ startsWith(steps.tag_type.outputs.version, 'aeraki/') }} 40 | run: | 41 | make docker-build tag=${{ steps.tag_env.outputs.version }} 42 | 43 | - name: Push Aeraki Docker image 44 | if: ${{ startsWith(steps.tag_type.outputs.version, 'aeraki/') }} 45 | run: | 46 | docker push ghcr.io/aeraki-mesh/aeraki:${{ steps.tag_env.outputs.version }} 47 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | debug 3 | out 4 | .idea 5 | tmp 6 | .vscode 7 | -------------------------------------------------------------------------------- /.licenserc.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | header: 17 | license: 18 | spdx-id: Apache-2.0 19 | copyright-owner: Aeraki 20 | 21 | paths-ignore: 22 | - '.gitignore' 23 | - 'LICENSE' 24 | - 'NOTICE' 25 | - '**/*.json' 26 | - '**/*.md' 27 | - '.github/' 28 | - 'go.mod' 29 | - 'go.sum' 30 | - '**/*.gen.go' 31 | - '**/*.pb.go' 32 | - '**/*.pb.html' 33 | - '**/*.proto' 34 | - '**/*.dic' 35 | - '**/*.aff' 36 | - 'test/' 37 | - 'crd/' 38 | - '.ci/' 39 | - 'k8s/crd.yaml' 40 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # Code of Conduct 18 | 19 | We follow the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). 20 | 21 | Please contact the [CNCF Code of Conduct Committee](mailto:conduct@cncf.io) 22 | in order to report violations of the Code of Conduct. 23 | -------------------------------------------------------------------------------- /demo/common_func.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | 18 | set -x 19 | 20 | function LabelIstioInjectLabel() 21 | { 22 | ns=$1 23 | echo $ns 24 | label=`kubectl get po -n ${ISTIO_NAMESPACE} |grep istiod | awk '{print $1}' |xargs kubectl get po -o yaml -n ${ISTIO_NAMESPACE} |grep -A 1 REVIS |grep value: |awk '{print $2}'` 25 | echo $label 26 | if [ "$label" != "" ];then 27 | kubectl label namespace $ns istio.io/rev=$label --overwrite 28 | else 29 | kubectl label namespace $ns istio-injection=enabled --overwrite=true 30 | fi 31 | return 0; 32 | } 33 | 34 | -------------------------------------------------------------------------------- /demo/dubbo/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: dubbo-sample-provider 20 | spec: 21 | host: org.apache.dubbo.samples.basic.api.demoservice 22 | subsets: 23 | - name: v1 24 | labels: 25 | version: v1 26 | - name: v2 27 | labels: 28 | version: v2 29 | -------------------------------------------------------------------------------- /demo/dubbo/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns dubbo 21 | LabelIstioInjectLabel dubbo 22 | 23 | kubectl apply -f $BASEDIR/dubbo-sample.yaml -n dubbo 24 | kubectl apply -f $BASEDIR/serviceentry.yaml -n dubbo 25 | kubectl apply -f $BASEDIR/destinationrule.yaml -n dubbo 26 | kubectl apply -f $BASEDIR/virtualservice-traffic-splitting.yaml -n dubbo 27 | -------------------------------------------------------------------------------- /demo/dubbo/serviceentry.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: ServiceEntry 18 | metadata: 19 | name: test-dubbo-service 20 | annotations: 21 | interface: org.apache.dubbo.samples.basic.api.DemoService 22 | spec: 23 | hosts: 24 | - org.apache.dubbo.samples.basic.api.demoservice 25 | ports: 26 | - number: 20880 27 | name: tcp-dubbo 28 | protocol: TCP 29 | workloadSelector: 30 | labels: 31 | app: dubbo-sample-provider 32 | resolution: STATIC 33 | -------------------------------------------------------------------------------- /demo/dubbo/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/dubbo-sample.yaml -n dubbo 20 | kubectl delete -f $BASEDIR/serviceentry.yaml -n dubbo 21 | kubectl delete -f $BASEDIR/destinationrule.yaml -n dubbo 22 | kubectl delete -f $BASEDIR/virtualservice-traffic-splitting.yaml -n dubbo 23 | kubectl delete ns dubbo -------------------------------------------------------------------------------- /demo/dubbo/virtualservice-traffic-splitting.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: VirtualService 18 | metadata: 19 | name: test-dubbo-route 20 | spec: 21 | hosts: 22 | - org.apache.dubbo.samples.basic.api.demoservice 23 | http: 24 | - name: "traffic-splitting" 25 | route: 26 | - destination: 27 | host: org.apache.dubbo.samples.basic.api.demoservice 28 | subset: v1 29 | weight: 20 30 | - destination: 31 | host: org.apache.dubbo.samples.basic.api.demoservice 32 | subset: v2 33 | weight: 80 34 | -------------------------------------------------------------------------------- /demo/dubbo/virtualservice-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: VirtualService 18 | metadata: 19 | name: test-dubbo-route 20 | spec: 21 | hosts: 22 | - org.apache.dubbo.samples.basic.api.demoservice 23 | http: 24 | - name: "reviews-v1-routes" 25 | route: 26 | - destination: 27 | host: org.apache.dubbo.samples.basic.api.demoservice 28 | subset: v1 29 | -------------------------------------------------------------------------------- /demo/dubbo/virtualservice-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: VirtualService 18 | metadata: 19 | name: test-dubbo-route 20 | spec: 21 | hosts: 22 | - org.apache.dubbo.samples.basic.api.demoservice 23 | http: 24 | - name: "reviews-v2-routes" 25 | route: 26 | - destination: 27 | host: org.apache.dubbo.samples.basic.api.demoservice 28 | subset: v2 29 | -------------------------------------------------------------------------------- /demo/install-aeraki.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0")/.. 18 | 19 | SCRIPTS_DIR=$BASEDIR/test/e2e/scripts 20 | 21 | bash ${SCRIPTS_DIR}/aeraki.sh $1 22 | -------------------------------------------------------------------------------- /demo/install-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0")/.. 18 | 19 | DEMO=$1 20 | 21 | SCRIPTS_DIR=$BASEDIR/test/e2e/scripts 22 | 23 | if [ -z "$AERAKI_TAG" ]; then 24 | export AERAKI_TAG="1.4.1" 25 | fi 26 | bash ${SCRIPTS_DIR}/istio.sh 27 | bash ${SCRIPTS_DIR}/addons.sh 28 | bash ${SCRIPTS_DIR}/aeraki.sh 29 | 30 | if [ "${DEMO}" == "default" ] 31 | then 32 | echo "install default demo" 33 | bash ${BASEDIR}/demo/metaprotocol-dubbo/install.sh 34 | bash ${BASEDIR}/demo/metaprotocol-thrift/install.sh 35 | elif [ "${DEMO}" == "brpc" ] 36 | then 37 | echo "install brpc demo" 38 | bash ${BASEDIR}/demo/metaprotocol-brpc/install.sh 39 | elif [ "${DEMO}" == "kafka" ] 40 | then 41 | echo "install kafka demo" 42 | bash ${BASEDIR}/demo/kafka/install.sh 43 | fi 44 | -------------------------------------------------------------------------------- /demo/kafka/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | 21 | kubectl create ns kafka 22 | LabelIstioInjectLabel kafka 23 | helm repo add zhaohuabing https://zhaohuabing.github.io/helm-repo 24 | helm repo update 25 | helm install my-release --set persistence.enabled=false --set zookeeper.persistence.enabled=false zhaohuabing/kafka -n kafka 26 | kubectl apply -f $BASEDIR/kafka-sample.yaml -n kafka 27 | 28 | -------------------------------------------------------------------------------- /demo/kafka/kafka-sample.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | kind: Deployment 17 | apiVersion: apps/v1 18 | metadata: 19 | name: kafka-cat-producer 20 | spec: 21 | selector: 22 | matchLabels: 23 | app: kafka-cat-producer 24 | template: 25 | metadata: 26 | labels: 27 | app: kafka-cat-producer 28 | spec: 29 | containers: 30 | - name: kafka-cat-producer 31 | image: confluentinc/cp-kafkacat 32 | imagePullPolicy: IfNotPresent 33 | command: ["/bin/sh"] 34 | args: ["-c", "while true; do echo -e 'send kafka message '`date`'\r\n'|kafkacat -P -b my-release-kafka:9092 -t test; echo 'send message to kafka'; sleep $((1 + RANDOM % 11)); done"] 35 | --- 36 | kind: Deployment 37 | apiVersion: apps/v1 38 | metadata: 39 | name: kafka-cat-consumer 40 | spec: 41 | selector: 42 | matchLabels: 43 | app: kafka-cat-consumer 44 | template: 45 | metadata: 46 | labels: 47 | app: kafka-cat-consumer 48 | spec: 49 | containers: 50 | - name: kafka-cat-consumer 51 | image: confluentinc/cp-kafkacat 52 | imagePullPolicy: IfNotPresent 53 | command: ["/bin/sh"] 54 | args: ["-c", "while true; do kafkacat -C -b my-release-kafka:9092 -t test ; sleep 5; done"] 55 | -------------------------------------------------------------------------------- /demo/kafka/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | helm delete my-release -n kafka 20 | kubectl delete -f $BASEDIR/kafka-sample.yaml -n kafka 21 | 22 | kubectl delete ns kafka 23 | 24 | -------------------------------------------------------------------------------- /demo/metaprotocol-brpc/brpc-protocol.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: ApplicationProtocol 18 | metadata: 19 | name: brpc 20 | spec: 21 | codec: aeraki.meta_protocol.codec.brpc 22 | protocol: brpc 23 | -------------------------------------------------------------------------------- /demo/metaprotocol-brpc/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: brpc-echo-server 20 | spec: 21 | host: brpc-echo-server 22 | subsets: 23 | - name: v1 24 | labels: 25 | version: v1 26 | - name: v2 27 | labels: 28 | version: v2 29 | -------------------------------------------------------------------------------- /demo/metaprotocol-brpc/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns meta-brpc 21 | LabelIstioInjectLabel meta-brpc 22 | 23 | kubectl apply -f $BASEDIR/brpc-protocol.yaml -n meta-brpc 24 | kubectl apply -f $BASEDIR/brpc-sample.yaml -n meta-brpc 25 | kubectl apply -f $BASEDIR/service.yaml -n meta-brpc -------------------------------------------------------------------------------- /demo/metaprotocol-brpc/service.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: v1 17 | kind: Service 18 | metadata: 19 | name: brpc-echo-server 20 | labels: 21 | app: brpc-echo-server 22 | spec: 23 | ports: 24 | - name: tcp-metaprotocol-brpc 25 | port: 8000 26 | protocol: TCP 27 | selector: 28 | app: brpc-echo-server 29 | -------------------------------------------------------------------------------- /demo/metaprotocol-brpc/serviceentry.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: ServiceEntry 18 | metadata: 19 | name: brpc-echo-server 20 | spec: 21 | hosts: 22 | - brpc-echo-server 23 | ports: 24 | - number: 8000 25 | name: tcp-metaprotocol-brpc 26 | protocol: TCP 27 | workloadSelector: 28 | labels: 29 | app: brpc-echo-server 30 | resolution: STATIC 31 | -------------------------------------------------------------------------------- /demo/metaprotocol-brpc/traffic-split.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-brpc-route 20 | namespace: meta-brpc 21 | spec: 22 | hosts: 23 | - brpc-echo-server.meta-brpc.svc.cluster.local 24 | routes: 25 | - name: traffic-split 26 | route: 27 | - destination: 28 | host: brpc-echo-server.meta-brpc.svc.cluster.local 29 | subset: v1 30 | weight: 20 31 | - destination: 32 | host: brpc-echo-server.meta-brpc.svc.cluster.local 33 | subset: v2 34 | weight: 80 35 | -------------------------------------------------------------------------------- /demo/metaprotocol-brpc/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/brpc-protocol.yaml -n meta-brpc 20 | kubectl delete -f $BASEDIR/brpc-sample.yaml -n meta-brpc 21 | kubectl delete -f $BASEDIR/service.yaml -n meta-brpc 22 | kubectl delete ns meta-brpc || true 23 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: dubbo-sample-provider 20 | namespace: meta-dubbo 21 | spec: 22 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 23 | subsets: 24 | - name: v1 25 | labels: 26 | version: v1 27 | - name: v2 28 | labels: 29 | version: v2 30 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns meta-dubbo 21 | LabelIstioInjectLabel meta-dubbo 22 | 23 | kubectl apply -f $BASEDIR/dubbo-sample.yaml -n meta-dubbo 24 | kubectl apply -f $BASEDIR/destinationrule.yaml -n meta-dubbo 25 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/metarouter-header-mutation.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - dubbo-sample-provider.meta-dubbo.svc.cluster.local 24 | routes: 25 | - name: header-mutation 26 | route: 27 | - destination: 28 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 29 | requestMutation: 30 | - key: foo 31 | value: bar 32 | - key: foo1 33 | value: bar1 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/metarouter-local-ratelimit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - dubbo-sample-provider.meta-dubbo.svc.cluster.local 24 | localRateLimit: 25 | tokenBucket: 26 | fillInterval: 60s 27 | maxTokens: 10 28 | tokensPerFill: 10 29 | conditions: 30 | - tokenBucket: 31 | fillInterval: 10s 32 | maxTokens: 2 33 | tokensPerFill: 2 34 | match: 35 | attributes: 36 | method: 37 | exact: sayHello 38 | routes: 39 | - name: v1 40 | route: 41 | - destination: 42 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 43 | subset: v1 44 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - dubbo-sample-provider.meta-dubbo.svc.cluster.local 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | interface: 29 | exact: org.apache.dubbo.samples.basic.api.DemoService 30 | method: 31 | exact: sayHello 32 | foo: 33 | exact: bar 34 | route: 35 | - destination: 36 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 37 | subset: v1 38 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - dubbo-sample-provider.meta-dubbo.svc.cluster.local 24 | routes: 25 | - name: v2 26 | match: 27 | attributes: 28 | interface: 29 | exact: org.apache.dubbo.samples.basic.api.DemoService 30 | method: 31 | exact: sayHello 32 | foo: 33 | exact: bar 34 | route: 35 | - destination: 36 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 37 | subset: v2 38 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/traffic-mirroring.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - dubbo-sample-provider.meta-dubbo.svc.cluster.local 24 | routes: 25 | - name: traffic-mirroring 26 | route: 27 | - destination: 28 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 29 | subset: v1 30 | mirror: 31 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 32 | subset: v2 33 | mirrorPercentage: 34 | value: 100.0 35 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/traffic-split.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - dubbo-sample-provider.meta-dubbo.svc.cluster.local 24 | routes: 25 | - name: traffic-split 26 | match: 27 | attributes: 28 | interface: 29 | exact: org.apache.dubbo.samples.basic.api.DemoService 30 | method: 31 | exact: sayHello 32 | foo: 33 | exact: bar 34 | route: 35 | - destination: 36 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 37 | subset: v1 38 | weight: 20 39 | - destination: 40 | host: dubbo-sample-provider.meta-dubbo.svc.cluster.local 41 | subset: v2 42 | weight: 80 43 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo-app-level/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/dubbo-sample.yaml -n meta-dubbo 20 | kubectl delete -f $BASEDIR/serviceentry.yaml -n meta-dubbo 21 | kubectl delete -f $BASEDIR/destinationrule.yaml -n meta-dubbo 22 | kubectl delete ns meta-dubbo -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/consistent-hash-lb/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: dubbo-sample-provider 20 | namespace: meta-dubbo 21 | spec: 22 | host: org.apache.dubbo.samples.basic.api.demoservice 23 | trafficPolicy: 24 | loadBalancer: 25 | consistentHash: 26 | httpHeaderName: method 27 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: dubbo-sample-provider 20 | namespace: meta-dubbo 21 | spec: 22 | host: org.apache.dubbo.samples.basic.api.demoservice 23 | subsets: 24 | - name: v1 25 | labels: 26 | version: v1 27 | - name: v2 28 | labels: 29 | version: v2 30 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns meta-dubbo || true 21 | LabelIstioInjectLabel meta-dubbo 22 | 23 | kubectl apply -f $BASEDIR/dubbo-sample.yaml -n meta-dubbo 24 | kubectl apply -f $BASEDIR/serviceentry.yaml -n meta-dubbo 25 | kubectl apply -f $BASEDIR/destinationrule.yaml -n meta-dubbo 26 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/metarouter-global-ratelimit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - org.apache.dubbo.samples.basic.api.demoservice 24 | globalRateLimit: 25 | domain: production 26 | match: 27 | attributes: 28 | method: 29 | exact: sayHello 30 | rateLimitService: outbound|8081||rate-limit-server.meta-dubbo.svc.cluster.local 31 | requestTimeout: 100ms 32 | denyOnFail: true 33 | descriptors: 34 | - property: method 35 | descriptorKey: method 36 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/metarouter-header-mutation.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - org.apache.dubbo.samples.basic.api.demoservice 24 | routes: 25 | - name: header-mutation 26 | route: 27 | - destination: 28 | host: org.apache.dubbo.samples.basic.api.demoservice 29 | requestMutation: 30 | - key: foo 31 | value: bar 32 | - key: foo1 33 | value: bar1 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/metarouter-local-ratelimit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - org.apache.dubbo.samples.basic.api.demoservice 24 | localRateLimit: 25 | tokenBucket: 26 | fillInterval: 60s 27 | maxTokens: 10 28 | tokensPerFill: 10 29 | conditions: 30 | - tokenBucket: 31 | fillInterval: 10s 32 | maxTokens: 2 33 | tokensPerFill: 2 34 | match: 35 | attributes: 36 | method: 37 | exact: sayHello 38 | routes: 39 | - name: v1 40 | route: 41 | - destination: 42 | host: org.apache.dubbo.samples.basic.api.demoservice 43 | subset: v1 44 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - org.apache.dubbo.samples.basic.api.demoservice 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | interface: 29 | exact: org.apache.dubbo.samples.basic.api.DemoService 30 | method: 31 | exact: sayHello 32 | foo: 33 | exact: bar 34 | route: 35 | - destination: 36 | host: org.apache.dubbo.samples.basic.api.demoservice 37 | subset: v1 38 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - org.apache.dubbo.samples.basic.api.demoservice 24 | routes: 25 | - name: v2 26 | match: 27 | attributes: 28 | interface: 29 | exact: org.apache.dubbo.samples.basic.api.DemoService 30 | method: 31 | exact: sayHello 32 | foo: 33 | exact: bar 34 | route: 35 | - destination: 36 | host: org.apache.dubbo.samples.basic.api.demoservice 37 | subset: v2 38 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/rate-limit-server/config.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | 17 | domain: production 18 | descriptors: 19 | - key: method 20 | value: "sayHello" 21 | rate_limit: 22 | unit: minute 23 | requests_per_unit: 10 24 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/serviceentry.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: ServiceEntry 18 | metadata: 19 | name: dubbo-demoservice 20 | namespace: meta-dubbo 21 | annotations: 22 | interface: org.apache.dubbo.samples.basic.api.DemoService 23 | spec: 24 | hosts: 25 | - org.apache.dubbo.samples.basic.api.demoservice 26 | ports: 27 | - number: 20880 28 | name: tcp-metaprotocol-dubbo 29 | protocol: TCP 30 | workloadSelector: 31 | labels: 32 | app: dubbo-sample-provider 33 | resolution: STATIC 34 | --- 35 | apiVersion: networking.istio.io/v1alpha3 36 | kind: ServiceEntry 37 | metadata: 38 | name: dubbo-secondservice 39 | namespace: meta-dubbo 40 | annotations: 41 | interface: org.apache.dubbo.samples.basic.api.SecondService 42 | spec: 43 | hosts: 44 | - org.apache.dubbo.samples.basic.api.secondservice 45 | ports: 46 | - number: 20880 47 | name: tcp-metaprotocol-dubbo 48 | protocol: TCP 49 | workloadSelector: 50 | labels: 51 | app: dubbo-sample-second-provider 52 | resolution: STATIC 53 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/traffic-mirroring.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - org.apache.dubbo.samples.basic.api.demoservice 24 | routes: 25 | - name: traffic-mirroring 26 | route: 27 | - destination: 28 | host: org.apache.dubbo.samples.basic.api.demoservice 29 | subset: v1 30 | mirror: 31 | host: org.apache.dubbo.samples.basic.api.demoservice 32 | subset: v2 33 | mirrorPercentage: 34 | value: 100.0 35 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/traffic-split.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-dubbo-route 20 | namespace: meta-dubbo 21 | spec: 22 | hosts: 23 | - org.apache.dubbo.samples.basic.api.demoservice 24 | routes: 25 | - name: traffic-split 26 | match: 27 | attributes: 28 | interface: 29 | exact: org.apache.dubbo.samples.basic.api.DemoService 30 | method: 31 | exact: sayHello 32 | foo: 33 | exact: bar 34 | route: 35 | - destination: 36 | host: org.apache.dubbo.samples.basic.api.demoservice 37 | subset: v1 38 | weight: 20 39 | - destination: 40 | host: org.apache.dubbo.samples.basic.api.demoservice 41 | subset: v2 42 | weight: 80 43 | -------------------------------------------------------------------------------- /demo/metaprotocol-dubbo/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/dubbo-sample.yaml -n meta-dubbo 20 | kubectl delete -f $BASEDIR/serviceentry.yaml -n meta-dubbo 21 | kubectl delete -f $BASEDIR/destinationrule.yaml -n meta-dubbo 22 | kubectl delete ns meta-dubbo || true -------------------------------------------------------------------------------- /demo/metaprotocol-qza/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: qza-sample-server 20 | namespace: meta-qza 21 | spec: 22 | host: qza-sample-server.meta-qza.svc.cluster.local 23 | subsets: 24 | - name: v1 25 | labels: 26 | version: v1 27 | - name: v2 28 | labels: 29 | version: v2 30 | -------------------------------------------------------------------------------- /demo/metaprotocol-qza/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns meta-qza 21 | LabelIstioInjectLabel meta-qza 22 | 23 | kubectl apply -f $BASEDIR/qza-protocol.yaml -n istio-system 24 | kubectl apply -f $BASEDIR/qza-sample.yaml -n meta-qza 25 | kubectl apply -f $BASEDIR/destinationrule.yaml -n meta-qza 26 | -------------------------------------------------------------------------------- /demo/metaprotocol-qza/metarouter-rate-limit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-qza-route 20 | namespace: meta-qza 21 | spec: 22 | hosts: 23 | - qza-sample-server.meta-qza.svc.cluster.local 24 | localRateLimit: 25 | tokenBucket: 26 | maxTokens: 5 27 | tokensPerFill: 5 28 | fillInterval: 10s 29 | routes: 30 | - name: v2 31 | match: 32 | attributes: 33 | cmd: 34 | exact: "153" 35 | sub_cmd: 36 | regex: "1|2" 37 | route: 38 | - destination: 39 | host: qza-sample-server.meta-qza.svc.cluster.local 40 | subset: v2 41 | -------------------------------------------------------------------------------- /demo/metaprotocol-qza/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-qza-route 20 | namespace: meta-qza 21 | spec: 22 | hosts: 23 | - qza-sample-server.meta-qza.svc.cluster.local 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | cmd: 29 | exact: "153" 30 | sub_cmd: 31 | regex: "1|2" 32 | route: 33 | - destination: 34 | host: qza-sample-server.meta-qza.svc.cluster.local 35 | subset: v1 36 | -------------------------------------------------------------------------------- /demo/metaprotocol-qza/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-qza-route 20 | namespace: meta-qza 21 | spec: 22 | hosts: 23 | - qza-sample-server.meta-qza.svc.cluster.local 24 | routes: 25 | - name: v2 26 | match: 27 | attributes: 28 | cmd: 29 | exact: "153" 30 | sub_cmd: 31 | regex: "1|2" 32 | route: 33 | - destination: 34 | host: qza-sample-server.meta-qza.svc.cluster.local 35 | subset: v2 36 | -------------------------------------------------------------------------------- /demo/metaprotocol-qza/qza-protocol.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: ApplicationProtocol 18 | metadata: 19 | name: qza 20 | spec: 21 | codec: aeraki.meta_protocol.codec.qza 22 | protocol: qza 23 | -------------------------------------------------------------------------------- /demo/metaprotocol-qza/traffic-split.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-qza-route 20 | namespace: meta-qza 21 | spec: 22 | hosts: 23 | - qza-sample-server.meta-qza.svc.cluster.local 24 | routes: 25 | - name: traffic-split 26 | match: 27 | attributes: 28 | cmd: 29 | exact: "153" 30 | sub_cmd: 31 | regex: "1|2" 32 | route: 33 | - destination: 34 | host: qza-sample-server.meta-qza.svc.cluster.local 35 | subset: v1 36 | weight: 20 37 | - destination: 38 | host: qza-sample-server.meta-qza.svc.cluster.local 39 | subset: v2 40 | weight: 80 41 | -------------------------------------------------------------------------------- /demo/metaprotocol-qza/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/qza-protocol.yaml -n istio-system 20 | kubectl delete -f $BASEDIR/qza-sample.yaml -n meta-qza 21 | kubectl delete -f $BASEDIR/destinationrule.yaml -n meta-qza 22 | kubectl delete ns meta-qza -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/consistent-hash-lb/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: thrift-sample-server 20 | namespace: meta-thrift 21 | spec: 22 | host: thrift-sample-server.meta-thrift.svc.cluster.local 23 | trafficPolicy: 24 | loadBalancer: 25 | consistentHash: 26 | httpHeaderName: method 27 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: thrift-sample-server 20 | namespace: meta-thrift 21 | spec: 22 | host: thrift-sample-server.meta-thrift.svc.cluster.local 23 | subsets: 24 | - name: v1 25 | labels: 26 | version: v1 27 | - name: v2 28 | labels: 29 | version: v2 30 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns meta-thrift 21 | LabelIstioInjectLabel meta-thrift 22 | 23 | kubectl apply -f $BASEDIR/thrift-sample.yaml -n meta-thrift 24 | kubectl apply -f $BASEDIR/destinationrule.yaml -n meta-thrift 25 | kubectl create cm rate-limit-config -n meta-thrift --from-file $BASEDIR/rate-limit-server/config.yaml 26 | kubectl apply -f $BASEDIR/rate-limit-server/rate-limit-server.yaml -n meta-thrift 27 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/metarouter-global-ratelimit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-thrift-route 20 | namespace: meta-thrift 21 | spec: 22 | hosts: 23 | - thrift-sample-server.meta-thrift.svc.cluster.local 24 | globalRateLimit: 25 | domain: production 26 | match: 27 | attributes: 28 | method: 29 | exact: sayHello 30 | rateLimitService: outbound|8081||rate-limit-server.meta-thrift.svc.cluster.local 31 | requestTimeout: 100ms 32 | denyOnFail: true 33 | descriptors: 34 | - property: method 35 | descriptorKey: method 36 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/metarouter-header-mutation.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-thrift-route 20 | namespace: meta-thrift 21 | spec: 22 | hosts: 23 | - thrift-sample-server.meta-thrift.svc.cluster.local 24 | routes: 25 | - name: header-mutation 26 | route: 27 | - destination: 28 | host: thrift-sample-server.meta-thrift.svc.cluster.local 29 | requestMutation: 30 | - key: foo 31 | value: bar 32 | - key: foo1 33 | value: bar1 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/metarouter-local-ratelimit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-thrift-route 20 | namespace: meta-thrift 21 | spec: 22 | hosts: 23 | - thrift-sample-server.meta-thrift.svc.cluster.local 24 | localRateLimit: 25 | tokenBucket: 26 | fillInterval: 60s 27 | maxTokens: 5 28 | tokensPerFill: 5 29 | conditions: 30 | - tokenBucket: 31 | fillInterval: 30s 32 | maxTokens: 2 33 | tokensPerFill: 2 34 | match: 35 | attributes: 36 | method: 37 | exact: sayHello 38 | routes: 39 | - name: v1 40 | match: 41 | attributes: 42 | method: 43 | exact: sayHello 44 | route: 45 | - destination: 46 | host: thrift-sample-server.meta-thrift.svc.cluster.local 47 | subset: v1 48 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-thrift-route 20 | namespace: meta-thrift 21 | spec: 22 | hosts: 23 | - thrift-sample-server.meta-thrift.svc.cluster.local 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | method: 29 | exact: sayHello 30 | route: 31 | - destination: 32 | host: thrift-sample-server.meta-thrift.svc.cluster.local 33 | subset: v1 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-thrift-route 20 | namespace: meta-thrift 21 | spec: 22 | hosts: 23 | - thrift-sample-server.meta-thrift.svc.cluster.local 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | method: 29 | exact: sayHello 30 | route: 31 | - destination: 32 | host: thrift-sample-server.meta-thrift.svc.cluster.local 33 | subset: v2 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/outlier-detection/outlier-detection.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: apps/v1 17 | kind: Deployment 18 | metadata: 19 | name: thrift-sample-server-fake 20 | namespace: meta-thrift 21 | labels: 22 | app: thrift-sample-server 23 | spec: 24 | selector: 25 | matchLabels: 26 | app: thrift-sample-server 27 | replicas: 1 28 | template: 29 | metadata: 30 | annotations: 31 | sidecar.istio.io/bootstrapOverride: aeraki-bootstrap-config 32 | sidecar.istio.io/proxyImage: ghcr.io/aeraki-mesh/meta-protocol-proxy:1.4.2 33 | sidecar.istio.io/rewriteAppHTTPProbers: "false" 34 | labels: 35 | app: thrift-sample-server 36 | spec: 37 | containers: 38 | - name: thrift-sample-server 39 | image: nginx 40 | ports: 41 | - containerPort: 9090 42 | --- 43 | apiVersion: networking.istio.io/v1alpha3 44 | kind: DestinationRule 45 | metadata: 46 | name: thrift-sample-server 47 | namespace: meta-thrift 48 | spec: 49 | host: thrift-sample-server.meta-thrift.svc.cluster.local 50 | trafficPolicy: 51 | outlierDetection: 52 | baseEjectionTime: 15m 53 | consecutive5xxErrors: 5 54 | interval: 5m 55 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/rate-limit-server/config.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | 17 | domain: production 18 | descriptors: 19 | - key: method 20 | value: "sayHello" 21 | rate_limit: 22 | unit: minute 23 | requests_per_unit: 10 24 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/traffic-split.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-thrift-route 20 | namespace: meta-thrift 21 | spec: 22 | hosts: 23 | - thrift-sample-server.meta-thrift.svc.cluster.local 24 | routes: 25 | - name: traffic-split 26 | match: 27 | attributes: 28 | method: 29 | exact: sayHello 30 | route: 31 | - destination: 32 | host: thrift-sample-server.meta-thrift.svc.cluster.local 33 | subset: v1 34 | weight: 20 35 | - destination: 36 | host: thrift-sample-server.meta-thrift.svc.cluster.local 37 | subset: v2 38 | weight: 80 39 | -------------------------------------------------------------------------------- /demo/metaprotocol-thrift/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/thrift-sample.yaml -n meta-thrift 20 | kubectl delete -f $BASEDIR/destinationrule.yaml -n meta-thrift 21 | kubectl delete cm rate-limit-config -n meta-thrift 22 | kubectl delete -f $BASEDIR/rate-limit-server/rate-limit-server.yaml -n meta-thrift 23 | kubectl delete ns meta-thrift || true -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: trpc-sample-server 20 | namespace: meta-trpc 21 | spec: 22 | host: trpc-sample-server.meta-trpc.svc.cluster.local 23 | subsets: 24 | - name: v1 25 | labels: 26 | version: v1 27 | - name: v2 28 | labels: 29 | version: v2 30 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns meta-trpc 21 | LabelIstioInjectLabel meta-trpc 22 | kubectl apply -f $BASEDIR/trpc-protocol.yaml -n istio-system 23 | kubectl apply -f $BASEDIR/trpc-sample.yaml -n meta-trpc 24 | kubectl apply -f $BASEDIR/destinationrule.yaml -n meta-trpc 25 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/metarouter-header-mutation.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-trpc-route 20 | namespace: meta-trpc 21 | spec: 22 | hosts: 23 | - trpc-sample-server.meta-trpc.svc.cluster.local 24 | routes: 25 | - name: header-mutation 26 | route: 27 | - destination: 28 | host: trpc-sample-server.meta-trpc.svc.cluster.local 29 | requestMutation: 30 | - key: foo 31 | value: bar 32 | - key: foo1 33 | value: bar1 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/metarouter-multi-route.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-trpc-route 20 | namespace: meta-trpc 21 | spec: 22 | hosts: 23 | - trpc-sample-server.meta-trpc.svc.cluster.local 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | callee: 29 | exact: "trpc.test.helloworld" 30 | version: 31 | exact: "v1" 32 | func: 33 | prefix: "/trpc.test.helloworld.Greeter/SayHello" 34 | route: 35 | - destination: 36 | host: trpc-sample-server.meta-trpc.svc.cluster.local 37 | subset: v1 38 | - name: v2 39 | match: 40 | attributes: 41 | callee: 42 | exact: "trpc.test.helloworld" 43 | version: 44 | exact: "v2" 45 | func: 46 | prefix: "/trpc.test.helloworld.Greeter/SayHello" 47 | route: 48 | - destination: 49 | host: trpc-sample-server.meta-trpc.svc.cluster.local 50 | subset: v2 51 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-trpc-route 20 | namespace: meta-trpc 21 | spec: 22 | hosts: 23 | - trpc-sample-server.meta-trpc.svc.cluster.local 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | callee: 29 | exact: "trpc.test.helloworld" 30 | func: 31 | prefix: "/trpc.test.helloworld.Greeter/SayHello" 32 | route: 33 | - destination: 34 | host: trpc-sample-server.meta-trpc.svc.cluster.local 35 | subset: v1 36 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-trpc-route 20 | namespace: meta-trpc 21 | spec: 22 | hosts: 23 | - trpc-sample-server.meta-trpc.svc.cluster.local 24 | routes: 25 | - name: v2 26 | match: 27 | attributes: 28 | callee: 29 | exact: "trpc.test.helloworld" 30 | func: 31 | prefix: "/trpc.test.helloworld.Greeter/SayHello" 32 | route: 33 | - destination: 34 | host: trpc-sample-server.meta-trpc.svc.cluster.local 35 | subset: v2 36 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/traffic-split.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-trpc-route 20 | namespace: meta-trpc 21 | spec: 22 | hosts: 23 | - trpc-sample-server.meta-trpc.svc.cluster.local 24 | routes: 25 | - name: traffic-split 26 | match: 27 | attributes: 28 | callee: 29 | exact: "trpc.test.helloworld" 30 | caller: 31 | exact: "trpc.app.trpc-client.service" 32 | func: 33 | exact: "/trpc.test.helloworld.Greeter/SayHello" 34 | route: 35 | - destination: 36 | host: trpc-sample-server.meta-trpc.svc.cluster.local 37 | subset: v1 38 | weight: 20 39 | - destination: 40 | host: trpc-sample-server.meta-trpc.svc.cluster.local 41 | subset: v2 42 | weight: 80 43 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/trpc-protocol.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: ApplicationProtocol 18 | metadata: 19 | name: trpc 20 | spec: 21 | codec: aeraki.meta_protocol.codec.trpc 22 | protocol: trpc 23 | -------------------------------------------------------------------------------- /demo/metaprotocol-trpc/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/trpc-protocol.yaml -n istio-system 20 | kubectl delete -f $BASEDIR/trpc-sample.yaml -n meta-trpc 21 | kubectl delete -f $BASEDIR/destinationrule.yaml -n meta-trpc 22 | kubectl delete ns meta-trpc -------------------------------------------------------------------------------- /demo/metaprotocol-videopacket/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: videopacket-sample-server 20 | namespace: meta-videopacket 21 | spec: 22 | host: videopacket-sample-server.meta-videopacket.svc.cluster.local 23 | subsets: 24 | - name: v1 25 | labels: 26 | version: v1 27 | - name: v2 28 | labels: 29 | version: v2 30 | -------------------------------------------------------------------------------- /demo/metaprotocol-videopacket/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns meta-videopacket 21 | LabelIstioInjectLabel meta-videopacket 22 | kubectl apply -f $BASEDIR/videopacket-protocol.yaml -n istio-system 23 | kubectl apply -f $BASEDIR/videopacket-sample.yaml -n meta-videopacket 24 | kubectl apply -f $BASEDIR/destinationrule.yaml -n meta-videopacket 25 | -------------------------------------------------------------------------------- /demo/metaprotocol-videopacket/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-videopacket-route 20 | namespace: meta-videopacket 21 | spec: 22 | hosts: 23 | - videopacket-sample-server.meta-videopacket.svc.cluster.local 24 | routes: 25 | - name: v1 26 | match: 27 | attributes: 28 | command: 29 | exact: "1" 30 | route: 31 | - destination: 32 | host: videopacket-sample-server.meta-videopacket.svc.cluster.local 33 | subset: v1 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-videopacket/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-videopacket-route 20 | namespace: meta-videopacket 21 | spec: 22 | hosts: 23 | - videopacket-sample-server.meta-videopacket.svc.cluster.local 24 | routes: 25 | - name: v2 26 | match: 27 | attributes: 28 | command: 29 | exact: "1" 30 | route: 31 | - destination: 32 | host: videopacket-sample-server.meta-videopacket.svc.cluster.local 33 | subset: v2 34 | -------------------------------------------------------------------------------- /demo/metaprotocol-videopacket/traffic-split.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-videopacket-route 20 | namespace: meta-videopacket 21 | spec: 22 | hosts: 23 | - videopacket-sample-server.meta-videopacket.svc.cluster.local 24 | routes: 25 | - name: traffic-split 26 | match: 27 | attributes: 28 | command: 29 | exact: "1" 30 | route: 31 | - destination: 32 | host: videopacket-sample-server.meta-videopacket.svc.cluster.local 33 | subset: v1 34 | weight: 20 35 | - destination: 36 | host: videopacket-sample-server.meta-videopacket.svc.cluster.local 37 | subset: v2 38 | weight: 80 39 | -------------------------------------------------------------------------------- /demo/metaprotocol-videopacket/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/videopacket-protocol.yaml -n istio-system 20 | kubectl delete -f $BASEDIR/videopacket-sample.yaml -n meta-videopacket 21 | kubectl delete -f $BASEDIR/destinationrule.yaml -n meta-videopacket 22 | kubectl delete ns meta-videopacket -------------------------------------------------------------------------------- /demo/metaprotocol-videopacket/videopacket-protocol.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: ApplicationProtocol 18 | metadata: 19 | name: videopacket 20 | spec: 21 | codec: aeraki.meta_protocol.codec.videopacket 22 | protocol: videopacket 23 | -------------------------------------------------------------------------------- /demo/redis/client-side-password.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: redis.aeraki.io/v1alpha1 17 | kind: RedisService 18 | metadata: 19 | name: redis-single 20 | namespace: redis 21 | spec: 22 | host: 23 | - redis-single.redis.svc.cluster.local 24 | settings: 25 | auth: 26 | plain: 27 | password: testredis123! 28 | -------------------------------------------------------------------------------- /demo/redis/cluster.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | 17 | apiVersion: redis.aeraki.io/v1alpha1 18 | kind: RedisDestination 19 | metadata: 20 | name: redis-cluster 21 | namespace: redis 22 | spec: 23 | host: redis-cluster.redis.svc.cluster.local 24 | trafficPolicy: 25 | connectionPool: 26 | redis: 27 | mode: CLUSTER 28 | -------------------------------------------------------------------------------- /demo/redis/external-redis.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: v1 17 | kind: Service 18 | metadata: 19 | name: external-redis 20 | namespace: redis 21 | spec: 22 | ports: 23 | - name: tcp-redis 24 | protocol: TCP 25 | port: 6379 26 | targetPort: 6379 27 | --- 28 | apiVersion: discovery.k8s.io/v1 29 | kind: EndpointSlice 30 | metadata: 31 | name: external-redis 32 | namespace: redis 33 | labels: 34 | kubernetes.io/service-name: external-redis 35 | addressType: IPv4 36 | ports: 37 | - name: tcp-redis 38 | port: 6379 39 | protocol: TCP 40 | endpoints: 41 | - addresses: 42 | - 10.244.0.26 # 集群外 Redis 实例的地址,比如云厂商提供的 Redis 服务。 43 | -------------------------------------------------------------------------------- /demo/redis/fault-injection.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: redis.aeraki.io/v1alpha1 17 | kind: RedisService 18 | metadata: 19 | name: redis-cluster 20 | namespace: redis 21 | spec: 22 | host: 23 | - redis-cluster.redis.svc.cluster.local 24 | redis: 25 | - route: 26 | host: redis-cluster.redis.svc.cluster.local 27 | faults: 28 | - type: ERROR 29 | percentage: 30 | value: 50 31 | commands: 32 | - GET 33 | -------------------------------------------------------------------------------- /demo/redis/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set +x 18 | 19 | if ! command -v jq &> /dev/null 20 | then 21 | echo "can't find jq, please install jq first" 22 | exit 1 23 | fi 24 | 25 | set -x 26 | 27 | BASEDIR=$(dirname "$0") 28 | source $BASEDIR/../common_func.sh 29 | 30 | kubectl create ns redis 31 | LabelIstioInjectLabel redis 32 | kubectl -n redis apply -f $BASEDIR/redis-client.yaml 33 | kubectl -n redis apply -f $BASEDIR/redis-single.yaml 34 | kubectl -n redis apply -f $BASEDIR/redis-cluster.yaml 35 | kubectl -n redis wait deployment redis-single --for condition=Available=True --timeout=600s 36 | kubectl -n redis rollout status --watch statefulset/redis-cluster --timeout=600s 37 | kubectl -n redis wait pod --selector=app=redis-cluster --for=condition=ContainersReady=True --timeout=600s -o jsonpath='{.status.podIP}' 38 | kubectl exec -it redis-cluster-0 -c redis -n redis -- redis-cli --cluster create --cluster-yes --cluster-replicas 1 $(kubectl get pod -n redis -l=app=redis-cluster -o json | jq -r '.items[] | .status.podIP + ":6379"') 39 | -------------------------------------------------------------------------------- /demo/redis/read-policy.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: redis.aeraki.io/v1alpha1 17 | kind: RedisService 18 | metadata: 19 | name: redis-cluster 20 | namespace: redis 21 | spec: 22 | host: 23 | - redis-cluster.redis.svc.cluster.local 24 | settings: 25 | readPolicy: REPLICA 26 | redis: 27 | - route: 28 | host: redis-cluster.redis.svc.cluster.local 29 | -------------------------------------------------------------------------------- /demo/redis/redis-client.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: apps/v1 17 | kind: Deployment 18 | metadata: 19 | labels: 20 | app: redis-client 21 | name: redis-client 22 | namespace: redis 23 | spec: 24 | selector: 25 | matchLabels: 26 | app: redis-client 27 | template: 28 | metadata: 29 | annotations: 30 | sidecar.istio.io/logLevel: debug 31 | labels: 32 | app: redis-client 33 | spec: 34 | containers: 35 | - image: redis 36 | imagePullPolicy: Always 37 | name: redis-client 38 | -------------------------------------------------------------------------------- /demo/redis/routing.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: redis.aeraki.io/v1alpha1 17 | kind: RedisService 18 | metadata: 19 | name: redis-cluster 20 | namespace: redis 21 | spec: 22 | host: 23 | - redis-cluster.redis.svc.cluster.local 24 | redis: 25 | - match: 26 | key: 27 | prefix: cluster 28 | route: 29 | host: redis-cluster.redis.svc.cluster.local 30 | - route: 31 | host: redis-single.redis.svc.cluster.local 32 | -------------------------------------------------------------------------------- /demo/redis/server-side-password.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: v1 17 | kind: Secret 18 | metadata: 19 | name: redis-service-secret 20 | namespace: redis 21 | type: Opaque 22 | data: 23 | password: dGVzdHJlZGlzCg== 24 | --- 25 | apiVersion: redis.aeraki.io/v1alpha1 26 | kind: RedisDestination 27 | metadata: 28 | name: redis-single 29 | namespace: redis 30 | spec: 31 | host: redis-single.redis.svc.cluster.local 32 | trafficPolicy: 33 | connectionPool: 34 | redis: 35 | auth: 36 | secret: 37 | name: redis-service-secret 38 | -------------------------------------------------------------------------------- /demo/redis/traffic-mirroring.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: redis.aeraki.io/v1alpha1 17 | kind: RedisService 18 | metadata: 19 | name: redis-cluster 20 | namespace: redis 21 | spec: 22 | host: 23 | - redis-cluster.redis.svc.cluster.local 24 | redis: 25 | - route: 26 | host: redis-cluster.redis.svc.cluster.local 27 | mirror: 28 | - route: 29 | host: redis-single.redis.svc.cluster.local 30 | percentage: 31 | value: 100 32 | -------------------------------------------------------------------------------- /demo/redis/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl -n redis delete -f $BASEDIR/redis-client.yaml 21 | kubectl -n redis delete -f $BASEDIR/redis-single.yaml 22 | kubectl -n redis delete -f $BASEDIR/redis-cluster.yaml 23 | kubectl delete ns redis 24 | -------------------------------------------------------------------------------- /demo/thrift/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: DestinationRule 18 | metadata: 19 | name: thrift-sample-server 20 | spec: 21 | host: thrift-sample-server.thrift.svc.cluster.local 22 | subsets: 23 | - name: v1 24 | labels: 25 | version: v1 26 | - name: v2 27 | labels: 28 | version: v2 29 | -------------------------------------------------------------------------------- /demo/thrift/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | source $BASEDIR/../common_func.sh 19 | 20 | kubectl create ns thrift 21 | LabelIstioInjectLabel thrift 22 | kubectl apply -f $BASEDIR/thrift-sample.yaml -n thrift 23 | kubectl apply -f $BASEDIR/destinationrule.yaml -n thrift 24 | kubectl apply -f $BASEDIR/virtualservice-traffic-splitting.yaml -n thrift 25 | -------------------------------------------------------------------------------- /demo/thrift/uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0") 18 | 19 | kubectl delete -f $BASEDIR/thrift-sample.yaml -n thrift 20 | kubectl delete -f $BASEDIR/destinationrule.yaml -n thrift 21 | kubectl delete -f $BASEDIR/virtualservice-traffic-splitting.yaml -n thrift 22 | kubectl delete ns thrift -------------------------------------------------------------------------------- /demo/thrift/virtualservice-traffic-splitting.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: VirtualService 18 | metadata: 19 | name: test-thrift-route 20 | spec: 21 | hosts: 22 | - thrift-sample-server.thrift.svc.cluster.local 23 | http: 24 | - name: "thrift-traffic-splitting" 25 | route: 26 | - destination: 27 | host: thrift-sample-server.thrift.svc.cluster.local 28 | subset: v1 29 | weight: 20 30 | - destination: 31 | host: thrift-sample-server.thrift.svc.cluster.local 32 | subset: v2 33 | weight: 80 34 | -------------------------------------------------------------------------------- /demo/thrift/virtualservice-v1.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: VirtualService 18 | metadata: 19 | name: test-thrift-route 20 | spec: 21 | hosts: 22 | - thrift-sample-server.thrift.svc.cluster.local 23 | http: 24 | - name: "thrift-v1-routes" 25 | route: 26 | - destination: 27 | host: thrift-sample-server.thrift.svc.cluster.local 28 | subset: v1 29 | -------------------------------------------------------------------------------- /demo/thrift/virtualservice-v2.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: networking.istio.io/v1alpha3 17 | kind: VirtualService 18 | metadata: 19 | name: test-thrift-route 20 | spec: 21 | hosts: 22 | - thrift-sample-server.thrift.svc.cluster.local 23 | http: 24 | - name: "thrift-v2-routes" 25 | route: 26 | - destination: 27 | host: thrift-sample-server.thrift.svc.cluster.local 28 | subset: v2 29 | -------------------------------------------------------------------------------- /demo/uninstall-aeraki.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0")/.. 18 | 19 | SCRIPTS_DIR=$BASEDIR/test/e2e/scripts 20 | 21 | MODE=$1 22 | 23 | if [ -z "$ISTIO_NAMESPACE" ]; then 24 | export ISTIO_NAMESPACE="istio-system" 25 | fi 26 | 27 | if [ -z "$AERAKI_NAMESPACE" ]; then 28 | export AERAKI_NAMESPACE=${ISTIO_NAMESPACE} 29 | fi 30 | 31 | if [ "${MODE}" == "tcm" ]; then 32 | kubectl delete -f $BASEDIR/k8s/tcm-apiservice.yaml 33 | kubectl delete -f $BASEDIR/k8s/tcm-istio-cm.yaml 34 | else 35 | kubectl delete -f $BASEDIR/k8s/aeraki.yaml 36 | kubectl delete -f $BASEDIR/k8s/crd.yaml 37 | fi 38 | 39 | kubectl delete validatingwebhookconfigurations aeraki-${AERAKI_NAMESPACE} || true 40 | 41 | bash ${SCRIPTS_DIR}/remove-aeraki-configmap.sh 42 | -------------------------------------------------------------------------------- /demo/uninstall-demo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | BASEDIR=$(dirname "$0")/.. 18 | 19 | SCRIPTS_DIR=$BASEDIR/test/e2e/scripts 20 | 21 | bash ${SCRIPTS_DIR}/uninstall-addons.sh 22 | bash ${SCRIPTS_DIR}/uninstall-istio.sh 23 | bash demo/uninstall-aeraki.sh 24 | 25 | DEMO=$1 26 | if [ "${DEMO}" == "default" ] 27 | then 28 | bash ${BASEDIR}/demo/metaprotocol-dubbo/uninstall.sh 29 | bash ${BASEDIR}/demo/metaprotocol-thrift/uninstall.sh 30 | elif [ "${DEMO}" == "brpc" ] 31 | then 32 | bash ${BASEDIR}/demo/metaprotocol-brpc/uninstall.sh 33 | elif [ "${DEMO}" == "kafka" ] 34 | then 35 | bash ${BASEDIR}/demo/kafka/uninstall.sh 36 | fi -------------------------------------------------------------------------------- /docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | FROM alpine:3.17 16 | 17 | LABEL org.opencontainers.image.source="https://github.com/aeraki-mesh/aeraki" 18 | LABEL org.opencontainers.image.authors="zhaohuabing@gmail.com" 19 | LABEL org.opencontainers.image.documentation="https://aeraki.net" 20 | 21 | ARG AERAKI_ROOT_BIN_DIR 22 | ARG ARCH 23 | ARG OS 24 | 25 | RUN apk update && \ 26 | apk add curl 27 | 28 | COPY ${AERAKI_ROOT_BIN_DIR}/${ARCH}/${OS}/aeraki /usr/local/bin/ 29 | ENTRYPOINT ["/usr/local/bin/aeraki"] 30 | -------------------------------------------------------------------------------- /docs/aeraki&istio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/aeraki/56e4de0f28d7bb0feab9d899eec08a28a62ad27a/docs/aeraki&istio.png -------------------------------------------------------------------------------- /docs/aeraki-architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/aeraki/56e4de0f28d7bb0feab9d899eec08a28a62ad27a/docs/aeraki-architecture.png -------------------------------------------------------------------------------- /docs/aeraki-log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/aeraki/56e4de0f28d7bb0feab9d899eec08a28a62ad27a/docs/aeraki-log.png -------------------------------------------------------------------------------- /docs/aeraki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/aeraki/56e4de0f28d7bb0feab9d899eec08a28a62ad27a/docs/aeraki.png -------------------------------------------------------------------------------- /docs/metrics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/aeraki/56e4de0f28d7bb0feab9d899eec08a28a62ad27a/docs/metrics.png -------------------------------------------------------------------------------- /docs/protocols.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/aeraki/56e4de0f28d7bb0feab9d899eec08a28a62ad27a/docs/protocols.png -------------------------------------------------------------------------------- /internal/bootstrap/aeraki_ca.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package bootstrap 16 | 17 | import ( 18 | "crypto/tls" 19 | 20 | "github.com/aeraki-mesh/aeraki/internal/ca" 21 | ) 22 | 23 | func (s *Server) initRootCA() error { 24 | s.certMu.Lock() 25 | defer s.certMu.Unlock() 26 | 27 | if s.istiodCert == nil { 28 | bundle, err := ca.GenerateKeyCertBundle(s.kubeClient, s.args.RootNamespace) 29 | if err != nil { 30 | return err 31 | } 32 | x509Cert, err := tls.X509KeyPair(bundle.CertPem.Bytes(), bundle.KeyPem.Bytes()) 33 | if err != nil { 34 | return err 35 | } 36 | s.istiodCert = &x509Cert 37 | s.CABundle = bundle.CABundle 38 | } 39 | return nil 40 | } 41 | -------------------------------------------------------------------------------- /internal/bootstrap/mesh_config.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package bootstrap 16 | 17 | import ( 18 | "istio.io/istio/pkg/config/mesh/kubemesh" 19 | ) 20 | 21 | const ( 22 | // defaultMeshConfigMapName is the default name of the ConfigMap with the mesh config 23 | // The actual name can be different - use getMeshConfigMapName 24 | // defaultMeshConfigMapName = "istio" 25 | // configMapKey should match the expected MeshConfig file name 26 | configMapKey = "mesh" 27 | ) 28 | 29 | // initSSecureWebhookServer handles initialization for the HTTPS webhook server. 30 | func (s *Server) initConfigMapWatcher(args *AerakiArgs, handler func()) { 31 | // Watch the istio ConfigMap for mesh config changes. 32 | // This may be necessary for external Istiod. 33 | s.configMapWatcher = kubemesh.NewConfigMapWatcher( 34 | s.kubeClient, args.RootNamespace, args.IstioConfigMapName, configMapKey, false, s.internalStop) 35 | s.configMapWatcher.AddMeshHandler(handler) 36 | } 37 | -------------------------------------------------------------------------------- /internal/bootstrap/options.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package bootstrap 16 | 17 | import ( 18 | "github.com/aeraki-mesh/aeraki/internal/envoyfilter" 19 | "github.com/aeraki-mesh/aeraki/internal/model/protocol" 20 | ) 21 | 22 | // AerakiArgs provides all of the configuration parameters for the Aeraki service. 23 | type AerakiArgs struct { 24 | Master bool 25 | IstiodAddr string 26 | AerakiXdsAddr string 27 | AerakiXdsPort string 28 | PodName string 29 | IstioConfigMapName string 30 | HTTPSAddr string // The listening address for HTTPS (webhooks). 31 | HTTPAddr string // The listening address for HTTP (health). 32 | RootNamespace string 33 | ClusterID string 34 | ConfigStoreSecret string 35 | ElectionID string 36 | ServerID string 37 | LogLevel string 38 | KubeDomainSuffix string 39 | EnableEnvoyFilterNSScope bool 40 | Protocols map[protocol.Instance]envoyfilter.Generator 41 | } 42 | 43 | // NewAerakiArgs constructs AerakiArgs with default value. 44 | func NewAerakiArgs() *AerakiArgs { 45 | return &AerakiArgs{} 46 | } 47 | -------------------------------------------------------------------------------- /internal/bootstrap/validation.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package bootstrap 16 | 17 | import ( 18 | "istio.io/pkg/log" 19 | 20 | "github.com/aeraki-mesh/aeraki/internal/webhook/validation/scheme" 21 | "github.com/aeraki-mesh/aeraki/internal/webhook/validation/server" 22 | ) 23 | 24 | func (s *Server) initConfigValidation(args *AerakiArgs) error { 25 | if s.kubeClient == nil { 26 | return nil 27 | } 28 | 29 | log.Info("initializing config validator") 30 | // always start the validation server 31 | params := server.Options{ 32 | Schemas: scheme.Aeraki, 33 | DomainSuffix: args.KubeDomainSuffix, 34 | Mux: s.httpsMux, 35 | } 36 | _, err := server.New(params) 37 | if err != nil { 38 | return err 39 | } 40 | 41 | return nil 42 | } 43 | -------------------------------------------------------------------------------- /internal/config/constants/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package constants 16 | 17 | const ( 18 | // AerakiFieldManager is the FileldManager for Aeraki CRDs 19 | AerakiFieldManager = "Aeraki" 20 | // DefaultAerakiXdsPort is the default value for Aeraki xds port 21 | DefaultAerakiXdsPort = ":15010" 22 | // DefaultAerakiXdsAddr is the default value for Aeraki xds address 23 | DefaultAerakiXdsAddr = "aeraki.istio-system" 24 | ) 25 | -------------------------------------------------------------------------------- /internal/controller/kube/manager.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package kube 16 | 17 | import ( 18 | "istio.io/pkg/log" 19 | "k8s.io/client-go/rest" 20 | "sigs.k8s.io/controller-runtime/pkg/manager" 21 | ) 22 | 23 | var controllerLog = log.RegisterScope("controller", "crd controller", 0) 24 | 25 | // NewManager create a manager to manager all crd controllers. 26 | func NewManager(kubeConfig *rest.Config, namespace string, leaderElection bool, 27 | leaderElectionID string) (manager.Manager, error) { 28 | mgrOpt := manager.Options{ 29 | MetricsBindAddress: "0", 30 | LeaderElection: leaderElection, 31 | LeaderElectionID: leaderElectionID, 32 | LeaderElectionNamespace: namespace, 33 | } 34 | m, err := manager.New(kubeConfig, mgrOpt) 35 | if err != nil { 36 | return nil, err 37 | } 38 | 39 | m.Elected() 40 | return m, nil 41 | } 42 | -------------------------------------------------------------------------------- /internal/envoyfilter/generator.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package envoyfilter 16 | 17 | import ( 18 | "github.com/aeraki-mesh/aeraki/internal/model" 19 | ) 20 | 21 | // Generator generates protocol specified envoyfilters 22 | type Generator interface { 23 | Generate(context *model.EnvoyFilterContext) ([]*model.EnvoyFilterWrapper, error) 24 | } 25 | -------------------------------------------------------------------------------- /internal/model/metaprotocol/application_protocol.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package metaprotocol 16 | 17 | import ( 18 | "fmt" 19 | "strings" 20 | "sync" 21 | ) 22 | 23 | var applicationProtocols sync.Map 24 | 25 | // nolint: gochecknoinits 26 | func init() { 27 | applicationProtocols.Store("dubbo", "aeraki.meta_protocol.codec.dubbo") 28 | applicationProtocols.Store("thrift", "aeraki.meta_protocol.codec.thrift") 29 | } 30 | 31 | // SetApplicationProtocolCodec sets the codec for a specific protocol 32 | func SetApplicationProtocolCodec(protocol, codec string) { 33 | applicationProtocols.Store(protocol, codec) 34 | } 35 | 36 | // GetApplicationProtocolCodec get the codec for a specific protocol 37 | func GetApplicationProtocolCodec(protocol string) (string, error) { 38 | codec, ok := applicationProtocols.Load(protocol) 39 | if !ok { 40 | return "", fmt.Errorf("can't find codec for protocol: %s", protocol) 41 | } 42 | return fmt.Sprintf("%s", codec), nil 43 | } 44 | 45 | // GetApplicationProtocolFromPortName extracts the application protocol name from metaprotocol port name 46 | func GetApplicationProtocolFromPortName(portName string) (string, error) { 47 | s := strings.Split(portName, "-") 48 | if len(s) > 1 { 49 | return s[2], nil 50 | } 51 | return "", fmt.Errorf("can't find application protocol in port name: %s", portName) 52 | } 53 | -------------------------------------------------------------------------------- /internal/plugin/kafka/generator.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package kafka 16 | 17 | import ( 18 | "github.com/aeraki-mesh/aeraki/internal/envoyfilter" 19 | "github.com/aeraki-mesh/aeraki/internal/model" 20 | ) 21 | 22 | // Generator defines a kafka envoyfilter Generator 23 | type Generator struct { 24 | } 25 | 26 | // NewGenerator creates an new kafka Generator instance 27 | func NewGenerator() *Generator { 28 | return &Generator{} 29 | } 30 | 31 | // Generate create EnvoyFilters for Dubbo services 32 | func (*Generator) Generate(context *model.EnvoyFilterContext) ([]*model.EnvoyFilterWrapper, error) { 33 | return envoyfilter.GenerateInsertBeforeNetworkFilter( 34 | context.ServiceEntry, 35 | buildOutboundProxy(context), 36 | buildInboundProxy(context), 37 | "envoy.filters.network.kafka_broker", 38 | "type.googleapis.com/envoy.extensions.filters.network.kafka_broker.v3.KafkaBroker"), nil 39 | } 40 | -------------------------------------------------------------------------------- /internal/plugin/kafka/kafkafilter.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package kafka 16 | 17 | import ( 18 | kafka "github.com/envoyproxy/go-control-plane/contrib/envoy/extensions/filters/network/kafka_broker/v3" 19 | 20 | "github.com/aeraki-mesh/aeraki/internal/model" 21 | ) 22 | 23 | func buildOutboundProxy(context *model.EnvoyFilterContext) *kafka.KafkaBroker { 24 | return &kafka.KafkaBroker{ 25 | StatPrefix: model.BuildClusterName(model.TrafficDirectionOutbound, "", 26 | context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)), 27 | } 28 | } 29 | 30 | func buildInboundProxy(context *model.EnvoyFilterContext) *kafka.KafkaBroker { 31 | return &kafka.KafkaBroker{ 32 | StatPrefix: model.BuildClusterName(model.TrafficDirectionInbound, "", 33 | context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)), 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /internal/plugin/metaprotocol/route.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package metaprotocol 16 | 17 | import ( 18 | metaroute "github.com/aeraki-mesh/meta-protocol-control-plane-api/aeraki/meta_protocol_proxy/config/route/v1alpha" 19 | istionetworking "istio.io/api/networking/v1alpha3" 20 | 21 | "github.com/aeraki-mesh/aeraki/internal/model" 22 | ) 23 | 24 | func buildInboundRouteConfig(context *model.EnvoyFilterContext, 25 | port *istionetworking.ServicePort) *metaroute.RouteConfiguration { 26 | clusterName := model.BuildClusterName(model.TrafficDirectionInbound, "", 27 | context.ServiceEntry.Spec.Hosts[0], int(port.Number)) 28 | 29 | return &metaroute.RouteConfiguration{ 30 | Name: clusterName, 31 | Routes: []*metaroute.Route{ 32 | defaultRoute(clusterName), 33 | }, 34 | } 35 | } 36 | 37 | func defaultRoute(clusterName string) *metaroute.Route { 38 | return &metaroute.Route{ 39 | Route: &metaroute.RouteAction{ 40 | ClusterSpecifier: &metaroute.RouteAction_Cluster{ 41 | Cluster: clusterName, 42 | }, 43 | }, 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /internal/plugin/redis/inbound.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package redis 16 | 17 | import ( 18 | redis "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/redis_proxy/v3" 19 | 20 | "github.com/aeraki-mesh/aeraki/internal/model" 21 | ) 22 | 23 | func (g *Generator) buildInboundProxy(context *model.EnvoyFilterContext) *redis.RedisProxy { 24 | name := model.BuildClusterName(model.TrafficDirectionInbound, "", "", int(context.ServiceEntry.Spec.Ports[0].Number)) 25 | proxy := &redis.RedisProxy{ 26 | StatPrefix: name, 27 | Settings: &redis.RedisProxy_ConnPoolSettings{ 28 | OpTimeout: defaultInboundOpTimeout, 29 | }, 30 | PrefixRoutes: &redis.RedisProxy_PrefixRoutes{ 31 | CatchAllRoute: &redis.RedisProxy_PrefixRoutes_Route{Cluster: name}, 32 | }, 33 | } 34 | return proxy 35 | } 36 | -------------------------------------------------------------------------------- /internal/plugin/thrift/generator.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package thrift 16 | 17 | import ( 18 | "github.com/aeraki-mesh/aeraki/internal/envoyfilter" 19 | "github.com/aeraki-mesh/aeraki/internal/model" 20 | ) 21 | 22 | // Generator defines a Thrift envoyfilter Generator 23 | type Generator struct { 24 | } 25 | 26 | // NewGenerator creates an new Thrift Generator instance 27 | func NewGenerator() *Generator { 28 | return &Generator{} 29 | } 30 | 31 | // Generate create EnvoyFilters for Thrift services 32 | func (*Generator) Generate(context *model.EnvoyFilterContext) ([]*model.EnvoyFilterWrapper, error) { 33 | return envoyfilter.GenerateReplaceNetworkFilter( 34 | context.ServiceEntry, 35 | context.ServiceEntry.Spec.Ports[0], 36 | buildOutboundProxy(context), 37 | buildInboundProxy(context), 38 | "envoy.filters.network.thrift_proxy", 39 | "type.googleapis.com/envoy.extensions.filters.network.thrift_proxy.v3.ThriftProxy"), nil 40 | } 41 | -------------------------------------------------------------------------------- /internal/plugin/thrift/thriftproxy.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package thrift 16 | 17 | import ( 18 | thrift "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/thrift_proxy/v3" 19 | 20 | "github.com/aeraki-mesh/aeraki/internal/model" 21 | ) 22 | 23 | func buildOutboundProxy(context *model.EnvoyFilterContext) *thrift.ThriftProxy { 24 | route := buildOutboundRouteConfig(context) 25 | 26 | return newThriftProxy(context, route, model.TrafficDirectionOutbound) 27 | } 28 | 29 | func buildInboundProxy(context *model.EnvoyFilterContext) *thrift.ThriftProxy { 30 | route := buildInboundRouteConfig(context) 31 | return newThriftProxy(context, route, model.TrafficDirectionInbound) 32 | } 33 | 34 | func newThriftProxy(context *model.EnvoyFilterContext, route *thrift.RouteConfiguration, 35 | trafficDirection model.TrafficDirection) *thrift.ThriftProxy { 36 | return &thrift.ThriftProxy{ 37 | StatPrefix: model.BuildClusterName(trafficDirection, "", 38 | context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)), 39 | Transport: thrift.TransportType_AUTO_TRANSPORT, 40 | Protocol: thrift.ProtocolType_AUTO_PROTOCOL, 41 | RouteConfig: route, 42 | ThriftFilters: []*thrift.ThriftFilter{ 43 | { 44 | Name: "envoy.filters.thrift.router", 45 | }, 46 | }, 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /internal/plugin/zookeeper/generator.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package zookeeper 16 | 17 | import ( 18 | "github.com/aeraki-mesh/aeraki/internal/envoyfilter" 19 | "github.com/aeraki-mesh/aeraki/internal/model" 20 | ) 21 | 22 | // Generator defines a zookeeper envoyfilter Generator 23 | type Generator struct { 24 | } 25 | 26 | // NewGenerator creates an new zookeeper Generator instance 27 | func NewGenerator() *Generator { 28 | return &Generator{} 29 | } 30 | 31 | // Generate create EnvoyFilters for Dubbo services 32 | func (*Generator) Generate(context *model.EnvoyFilterContext) ([]*model.EnvoyFilterWrapper, error) { 33 | return envoyfilter.GenerateInsertBeforeNetworkFilter( 34 | context.ServiceEntry, 35 | buildOutboundProxy(context), 36 | buildInboundProxy(context), 37 | "envoy.filters.network.zookeeper_proxy", 38 | "type.googleapis.com/envoy.extensions.filters.network.zookeeper_proxy.v3.ZooKeeperProxy"), nil 39 | } 40 | -------------------------------------------------------------------------------- /internal/plugin/zookeeper/zookeeperfilter.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package zookeeper 16 | 17 | import ( 18 | zookeeper "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/network/zookeeper_proxy/v3" 19 | 20 | "github.com/aeraki-mesh/aeraki/internal/model" 21 | ) 22 | 23 | func buildOutboundProxy(context *model.EnvoyFilterContext) *zookeeper.ZooKeeperProxy { 24 | return &zookeeper.ZooKeeperProxy{ 25 | StatPrefix: model.BuildClusterName(model.TrafficDirectionOutbound, "", 26 | context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)), 27 | } 28 | } 29 | 30 | func buildInboundProxy(context *model.EnvoyFilterContext) *zookeeper.ZooKeeperProxy { 31 | return &zookeeper.ZooKeeperProxy{ 32 | StatPrefix: model.BuildClusterName(model.TrafficDirectionInbound, "", 33 | context.ServiceEntry.Spec.Hosts[0], int(context.ServiceEntry.Spec.Ports[0].Number)), 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /internal/util/error.go: -------------------------------------------------------------------------------- 1 | // Copyright Aeraki 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 | package util 16 | 17 | import ( 18 | "errors" 19 | "net" 20 | "net/http" 21 | ) 22 | 23 | // IsUnexpectedListenerError handles the error returned by the listener 24 | func IsUnexpectedListenerError(err error) bool { 25 | if err == nil { 26 | return false 27 | } 28 | if errors.Is(err, net.ErrClosed) { 29 | return false 30 | } 31 | if errors.Is(err, http.ErrServerClosed) { 32 | return false 33 | } 34 | return true 35 | } 36 | -------------------------------------------------------------------------------- /internal/util/protoconv/protoconv.go: -------------------------------------------------------------------------------- 1 | // Copyright Istio 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 | package protoconv 16 | 17 | import ( 18 | "fmt" 19 | 20 | udpa "github.com/cncf/xds/go/udpa/type/v1" 21 | "google.golang.org/protobuf/encoding/prototext" 22 | "google.golang.org/protobuf/proto" 23 | "google.golang.org/protobuf/types/known/anypb" 24 | "istio.io/pkg/log" 25 | ) 26 | 27 | // MessageToAnyWithError converts from proto message to proto Any 28 | func MessageToAnyWithError(msg proto.Message) (*anypb.Any, error) { 29 | b, err := proto.MarshalOptions{Deterministic: true}.Marshal(msg) 30 | if err != nil { 31 | return nil, err 32 | } 33 | return &anypb.Any{ 34 | TypeUrl: "type.googleapis.com/" + string(msg.ProtoReflect().Descriptor().FullName()), 35 | Value: b, 36 | }, nil 37 | } 38 | 39 | // MessageToAny converts from proto message to proto Any 40 | func MessageToAny(msg proto.Message) *anypb.Any { 41 | out, err := MessageToAnyWithError(msg) 42 | if err != nil { 43 | log.Error(fmt.Sprintf("error marshaling Any %s: %v", prototext.Format(msg), err)) 44 | return nil 45 | } 46 | return out 47 | } 48 | 49 | // TypedStruct creates a typedStrcut from the given typeURL 50 | func TypedStruct(typeURL string) *anypb.Any { 51 | return MessageToAny(&udpa.TypedStruct{ 52 | TypeUrl: typeURL, 53 | Value: nil, 54 | }) 55 | } 56 | -------------------------------------------------------------------------------- /internal/xds/logger.go: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Envoyproxy 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 | package xds 16 | 17 | // An example of a logger that implements `pkg/log/Logger`. Logs to 18 | // stdout. If Debug == false then Debugf() and Infof() won't output 19 | // anything. 20 | type logger struct { 21 | } 22 | 23 | // Log to stdout only if Debug is true. 24 | func (logger logger) Debugf(format string, args ...interface{}) { 25 | newArgs := []interface{}{} 26 | newArgs = append(newArgs, format) 27 | newArgs = append(newArgs, args...) 28 | xdsLog.Debugf(newArgs...) 29 | } 30 | 31 | // Log to stdout only if Debug is true. 32 | func (logger logger) Infof(format string, args ...interface{}) { 33 | newArgs := []interface{}{} 34 | newArgs = append(newArgs, format) 35 | newArgs = append(newArgs, args...) 36 | xdsLog.Infof(newArgs...) 37 | } 38 | 39 | // Log to stdout always. 40 | func (logger logger) Warnf(format string, args ...interface{}) { 41 | newArgs := []interface{}{} 42 | newArgs = append(newArgs, format) 43 | newArgs = append(newArgs, args...) 44 | xdsLog.Warnf(newArgs...) 45 | } 46 | 47 | // Log to stdout always. 48 | func (logger logger) Errorf(format string, args ...interface{}) { 49 | newArgs := []interface{}{} 50 | newArgs = append(newArgs, format) 51 | newArgs = append(newArgs, args...) 52 | xdsLog.Errorf(newArgs...) 53 | } 54 | -------------------------------------------------------------------------------- /k8s/tcm-apiservice.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: apiregistration.k8s.io/v1 17 | kind: APIService 18 | metadata: 19 | name: v1alpha1.dubbo.aeraki.io 20 | spec: 21 | insecureSkipTLSVerify: true 22 | group: dubbo.aeraki.io 23 | groupPriorityMinimum: 1000 24 | versionPriority: 10 25 | service: 26 | name: istio-crd 27 | namespace: istio-system 28 | port: 61011 29 | version: v1alpha1 30 | 31 | --- 32 | apiVersion: apiregistration.k8s.io/v1 33 | kind: APIService 34 | metadata: 35 | name: v1alpha1.redis.aeraki.io 36 | spec: 37 | insecureSkipTLSVerify: true 38 | group: redis.aeraki.io 39 | groupPriorityMinimum: 1000 40 | versionPriority: 10 41 | service: 42 | name: istio-crd 43 | namespace: istio-system 44 | port: 61011 45 | version: v1alpha1 46 | 47 | --- 48 | apiVersion: apiregistration.k8s.io/v1 49 | kind: APIService 50 | metadata: 51 | name: v1alpha1.metaprotocol.aeraki.io 52 | spec: 53 | insecureSkipTLSVerify: true 54 | group: metaprotocol.aeraki.io 55 | groupPriorityMinimum: 1000 56 | versionPriority: 10 57 | service: 58 | name: istio-crd 59 | namespace: istio-system 60 | port: 61011 61 | version: v1alpha1 62 | --- 63 | -------------------------------------------------------------------------------- /k8s/tcm-istio-cm.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: v1 17 | kind: ConfigMap 18 | metadata: 19 | labels: 20 | name: istio 21 | namespace: istio-system 22 | data: 23 | mesh: | 24 | defaultConfig: 25 | tracing: 26 | sampling: 100 27 | -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/applicationprotocol.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: ApplicationProtocol 18 | metadata: 19 | name: dubbo 20 | spec: 21 | protocol: dubbo 22 | codec: aeraki.meta_protocol.codec.dubbo 23 | --- 24 | apiVersion: metaprotocol.aeraki.io/v1alpha1 25 | kind: ApplicationProtocol 26 | metadata: 27 | name: thrift 28 | spec: 29 | protocol: thrift 30 | codec: aeraki.meta_protocol.codec.thrift 31 | -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/clusterrole.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: rbac.authorization.k8s.io/v1 17 | kind: ClusterRole 18 | metadata: 19 | labels: 20 | app: aeraki 21 | name: aeraki 22 | rules: 23 | - apiGroups: 24 | - "" 25 | resources: 26 | - secrets 27 | verbs: 28 | - get 29 | - apiGroups: 30 | - networking.istio.io 31 | resources: 32 | - '*' 33 | verbs: 34 | - get 35 | - watch 36 | - list 37 | - apiGroups: 38 | - redis.aeraki.io 39 | - dubbo.aeraki.io 40 | - metaprotocol.aeraki.io 41 | resources: 42 | - '*' 43 | verbs: 44 | - get 45 | - watch 46 | - list 47 | - update 48 | - patch 49 | - create 50 | - delete 51 | - apiGroups: 52 | - networking.istio.io 53 | resources: 54 | - virtualservices 55 | - destinationrules 56 | - envoyfilters 57 | - serviceentries 58 | verbs: 59 | - get 60 | - watch 61 | - list 62 | - update 63 | - patch 64 | - create 65 | - delete 66 | - apiGroups: 67 | - admissionregistration.k8s.io 68 | resources: 69 | - validatingwebhookconfigurations 70 | verbs: 71 | - '*' 72 | -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/clusterrolebinding.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: rbac.authorization.k8s.io/v1 17 | kind: ClusterRoleBinding 18 | metadata: 19 | labels: 20 | app: aeraki 21 | name: aeraki 22 | roleRef: 23 | apiGroup: rbac.authorization.k8s.io 24 | kind: ClusterRole 25 | name: aeraki 26 | subjects: 27 | - kind: ServiceAccount 28 | name: aeraki 29 | namespace: {{ .Release.Namespace }} 30 | -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/role.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: rbac.authorization.k8s.io/v1 17 | kind: Role 18 | metadata: 19 | labels: 20 | app: aeraki 21 | name: aeraki 22 | namespace: {{ .Release.Namespace }} 23 | rules: 24 | - apiGroups: 25 | - "" 26 | resources: 27 | - configmaps 28 | - events 29 | verbs: 30 | - '*' 31 | - verbs: 32 | - '*' 33 | apiGroups: 34 | - coordination.k8s.io 35 | resources: 36 | - '*' 37 | -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/rolebinding.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: rbac.authorization.k8s.io/v1 17 | kind: RoleBinding 18 | metadata: 19 | labels: 20 | app: aeraki 21 | name: aeraki 22 | namespace: {{ .Release.Namespace }} 23 | roleRef: 24 | apiGroup: rbac.authorization.k8s.io 25 | kind: Role 26 | name: aeraki 27 | subjects: 28 | - kind: ServiceAccount 29 | name: aeraki 30 | -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/service.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | {{- if .Values.service.create -}} 17 | apiVersion: v1 18 | kind: Service 19 | metadata: 20 | name: aeraki 21 | namespace: {{ .Release.Namespace }} 22 | labels: 23 | app: aeraki 24 | spec: 25 | type: {{ .Values.service.type }} 26 | ports: 27 | - port: {{ .Values.service.port }} 28 | targetPort: http 29 | protocol: TCP 30 | name: http 31 | selector: 32 | app: aeraki 33 | {{- end }} 34 | 35 | --- 36 | apiVersion: v1 37 | kind: Service 38 | metadata: 39 | labels: 40 | app: aeraki 41 | name: aeraki 42 | namespace: {{ .Release.Namespace }} 43 | spec: 44 | ports: 45 | - name: grpc-xds 46 | port: 15010 47 | protocol: TCP 48 | targetPort: 15010 49 | - name: https-validation 50 | port: 443 51 | protocol: TCP 52 | targetPort: 15017 53 | selector: 54 | app: aeraki -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/serviceaccount.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | {{- if .Values.serviceAccount.create -}} 17 | apiVersion: v1 18 | kind: ServiceAccount 19 | metadata: 20 | name: aeraki 21 | namespace: {{ .Release.Namespace }} 22 | labels: 23 | app: aeraki 24 | {{- end }} 25 | -------------------------------------------------------------------------------- /manifests/charts/aeraki/templates/tcmapiservice.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | {{- if .Values.tcmapiservice.create -}} 17 | apiVersion: apiregistration.k8s.io/v1 18 | kind: APIService 19 | metadata: 20 | name: v1alpha1.dubbo.aeraki.io 21 | spec: 22 | insecureSkipTLSVerify: true 23 | group: dubbo.aeraki.io 24 | groupPriorityMinimum: 1000 25 | versionPriority: 10 26 | service: 27 | name: istio-crd 28 | namespace: istio-system 29 | port: 61011 30 | version: v1alpha1 31 | 32 | --- 33 | apiVersion: apiregistration.k8s.io/v1 34 | kind: APIService 35 | metadata: 36 | name: v1alpha1.redis.aeraki.io 37 | spec: 38 | insecureSkipTLSVerify: true 39 | group: redis.aeraki.io 40 | groupPriorityMinimum: 1000 41 | versionPriority: 10 42 | service: 43 | name: istio-crd 44 | namespace: istio-system 45 | port: 61011 46 | version: v1alpha1 47 | 48 | --- 49 | apiVersion: apiregistration.k8s.io/v1 50 | kind: APIService 51 | metadata: 52 | name: v1alpha1.metaprotocol.aeraki.io 53 | spec: 54 | insecureSkipTLSVerify: true 55 | group: metaprotocol.aeraki.io 56 | groupPriorityMinimum: 1000 57 | versionPriority: 10 58 | service: 59 | name: istio-crd 60 | namespace: istio-system 61 | port: 61011 62 | version: v1alpha1 63 | {{- end }} 64 | -------------------------------------------------------------------------------- /steering.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aeraki-mesh/aeraki/56e4de0f28d7bb0feab9d899eec08a28a62ad27a/steering.md -------------------------------------------------------------------------------- /test/e2e/common/istio-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: install.istio.io/v1alpha1 3 | kind: IstioOperator 4 | metadata: 5 | name: test-iop 6 | namespace: ${ISTIO_NAMESPACE} 7 | spec: 8 | profile: default 9 | values: 10 | global: 11 | istioNamespace: ${ISTIO_NAMESPACE} 12 | logging: 13 | level: default:debug 14 | meshConfig: 15 | enableTracing: true 16 | accessLogFile: /dev/stdout 17 | accessLogFormat: "[%START_TIME%] %REQ(X-META-PROTOCOL-APPLICATION-PROTOCOL)% 18 | %RESPONSE_CODE% %RESPONSE_CODE_DETAILS% %CONNECTION_TERMINATION_DETAILS% \"%UPSTREAM_TRANSPORT_FAILURE_REASON%\" 19 | %BYTES_RECEIVED% %BYTES_SENT% %DURATION% \"%REQ(X-FORWARDED-FOR)%\" \"%REQ(X-REQUEST-ID)%\" %UPSTREAM_CLUSTER% 20 | %UPSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_LOCAL_ADDRESS% %DOWNSTREAM_REMOTE_ADDRESS% %ROUTE_NAME%\n" 21 | defaultConfig: 22 | holdApplicationUntilProxyStarts: true 23 | proxyMetadata: 24 | ISTIO_META_DNS_CAPTURE: "true" 25 | proxyStatsMatcher: 26 | inclusionPrefixes: 27 | - thrift 28 | - dubbo 29 | - kafka 30 | - meta_protocol 31 | inclusionRegexps: 32 | - .*dubbo.* 33 | - .*thrift.* 34 | - .*kafka.* 35 | - .*zookeeper.* 36 | - .*meta_protocol.* 37 | tracing: 38 | sampling: 100 39 | zipkin: 40 | address: zipkin.${ISTIO_NAMESPACE}:9411 41 | components: 42 | pilot: 43 | hub: istio 44 | tag: ${ISTIO_VERSION} 45 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: DestinationRule 4 | metadata: 5 | name: dubbo-sample-provider 6 | spec: 7 | host: org.apache.dubbo.samples.basic.api.demoservice 8 | subsets: 9 | - name: v1 10 | labels: 11 | version: v1 12 | - name: v2 13 | labels: 14 | version: v2 15 | - labels: 16 | service_group: batchjob 17 | name: batchjob 18 | - labels: 19 | service_group: user 20 | name: user 21 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/serviceentry.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: ServiceEntry 4 | metadata: 5 | name: dubbo-demoservice 6 | annotations: 7 | interface: org.apache.dubbo.samples.basic.api.DemoService 8 | spec: 9 | hosts: 10 | - org.apache.dubbo.samples.basic.api.demoservice 11 | ports: 12 | - number: 20880 13 | name: tcp-dubbo 14 | protocol: TCP 15 | workloadSelector: 16 | labels: 17 | app: dubbo-sample-provider 18 | resolution: STATIC 19 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/virtualservice-header-exact.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-dubbo-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | http: 10 | - name: route-batchjob 11 | match: 12 | - headers: 13 | batchJob: 14 | exact: "true" 15 | route: 16 | - destination: 17 | host: org.apache.dubbo.samples.basic.api.demoservice 18 | subset: batchjob 19 | - name: route-user 20 | match: 21 | - headers: 22 | batchJob: 23 | exact: "false" 24 | route: 25 | - destination: 26 | host: org.apache.dubbo.samples.basic.api.demoservice 27 | subset: user 28 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/virtualservice-method-exact.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-dubbo-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | http: 10 | - name: "v1-routes" 11 | match: 12 | - method: 13 | exact: sayHello01 14 | route: 15 | - destination: 16 | host: org.apache.dubbo.samples.basic.api.demoservice 17 | subset: v1 18 | - name: "v2-routes" 19 | match: 20 | - method: 21 | exact: sayHello 22 | route: 23 | - destination: 24 | host: org.apache.dubbo.samples.basic.api.demoservice 25 | subset: v2 26 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/virtualservice-method-prefix.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-dubbo-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | http: 10 | - name: "v1-routes" 11 | match: 12 | - method: 13 | prefix: sayHello01 14 | route: 15 | - destination: 16 | host: org.apache.dubbo.samples.basic.api.demoservice 17 | subset: v1 18 | - name: "v2-routes" 19 | match: 20 | - method: 21 | prefix: say 22 | route: 23 | - destination: 24 | host: org.apache.dubbo.samples.basic.api.demoservice 25 | subset: v2 26 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/virtualservice-method-regex.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-dubbo-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | http: 10 | - name: "v1-routes" 11 | match: 12 | - method: 13 | regex: sayHello01 14 | route: 15 | - destination: 16 | host: org.apache.dubbo.samples.basic.api.demoservice 17 | subset: v1 18 | - name: "v2-routes" 19 | match: 20 | - method: 21 | regex: ^s.*o$ 22 | route: 23 | - destination: 24 | host: org.apache.dubbo.samples.basic.api.demoservice 25 | subset: v2 26 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/virtualservice-traffic-splitting.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-dubbo-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | http: 10 | - name: "demoservice-traffic-splitting" 11 | route: 12 | - destination: 13 | host: org.apache.dubbo.samples.basic.api.demoservice 14 | subset: v1 15 | weight: 20 16 | - destination: 17 | host: org.apache.dubbo.samples.basic.api.demoservice 18 | subset: v2 19 | weight: 80 20 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/virtualservice-v1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-dubbo-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | http: 10 | - name: "v1-routes" 11 | route: 12 | - destination: 13 | host: org.apache.dubbo.samples.basic.api.demoservice 14 | subset: v1 15 | -------------------------------------------------------------------------------- /test/e2e/dubbo/testdata/virtualservice-v2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-dubbo-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | http: 10 | - name: "v2-routes" 11 | route: 12 | - destination: 13 | host: org.apache.dubbo.samples.basic.api.demoservice 14 | subset: v2 15 | -------------------------------------------------------------------------------- /test/e2e/kafka/testdata/install.sh: -------------------------------------------------------------------------------- 1 | BASEDIR=$(dirname "$0") 2 | 3 | kubectl create ns kafka 4 | kubectl label namespace kafka istio-injection=enabled --overwrite=true 5 | helm repo add bitnami https://charts.bitnami.com/bitnami 6 | helm repo add zhaohuabing http://zhaohuabing.com/helm-repo/ 7 | helm repo update 8 | helm install my-release --set persistence.enabled=false --set zookeeper.persistence.enabled=false bitnami/kafka -n kafka 9 | kubectl apply -f $BASEDIR/kafka-sample.yaml -n kafka 10 | 11 | -------------------------------------------------------------------------------- /test/e2e/kafka/testdata/kafka-sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | kind: Deployment 3 | apiVersion: apps/v1 4 | metadata: 5 | name: kafka-cat-producer 6 | spec: 7 | selector: 8 | matchLabels: 9 | app: kafka-cat-producer 10 | template: 11 | metadata: 12 | labels: 13 | app: kafka-cat-producer 14 | spec: 15 | containers: 16 | - name: kafka-cat-producer 17 | image: confluentinc/cp-kafkacat 18 | imagePullPolicy: IfNotPresent 19 | command: ["/bin/sh"] 20 | args: ["-c", "while true; do echo -e 'send kafka message '`date`'\r\n'|kafkacat -P -b my-release-kafka:9092 -t test; echo 'send message to kafka'; sleep $((1 + RANDOM % 11)); done"] 21 | --- 22 | kind: Deployment 23 | apiVersion: apps/v1 24 | metadata: 25 | name: kafka-cat-consumer 26 | spec: 27 | selector: 28 | matchLabels: 29 | app: kafka-cat-consumer 30 | template: 31 | metadata: 32 | labels: 33 | app: kafka-cat-consumer 34 | spec: 35 | containers: 36 | - name: kafka-cat-consumer 37 | image: confluentinc/cp-kafkacat 38 | imagePullPolicy: IfNotPresent 39 | command: ["/bin/sh"] 40 | args: ["-c", "while true; do kafkacat -C -b my-release-kafka:9092 -t test ; sleep 5; done"] 41 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/consistent-hash-lb/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: DestinationRule 4 | metadata: 5 | name: dubbo-sample-provider 6 | spec: 7 | host: org.apache.dubbo.samples.basic.api.demoservice 8 | subsets: 9 | - name: sample 10 | labels: 11 | app: dubbo-sample-provider 12 | trafficPolicy: 13 | loadBalancer: 14 | consistentHash: 15 | httpHeaderName: method 16 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/consistent-hash-lb/metarouter-sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | routes: 10 | - name: sample 11 | route: 12 | - destination: 13 | host: org.apache.dubbo.samples.basic.api.demoservice 14 | subset: sample 15 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: DestinationRule 4 | metadata: 5 | name: dubbo-sample-provider 6 | spec: 7 | host: org.apache.dubbo.samples.basic.api.demoservice 8 | subsets: 9 | - name: v1 10 | labels: 11 | version: v1 12 | - name: v2 13 | labels: 14 | version: v2 15 | - labels: 16 | service_group: batchjob 17 | name: batchjob 18 | - labels: 19 | service_group: user 20 | name: user 21 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-attribute-exact.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | routes: 10 | - name: v1 11 | match: 12 | attributes: 13 | method: 14 | exact: sayHello01 15 | route: 16 | - destination: 17 | host: org.apache.dubbo.samples.basic.api.demoservice 18 | subset: v1 19 | - name: v2 20 | match: 21 | attributes: 22 | method: 23 | exact: sayHello 24 | route: 25 | - destination: 26 | host: org.apache.dubbo.samples.basic.api.demoservice 27 | subset: v2 28 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-attribute-prefix.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | routes: 10 | - name: v1 11 | match: 12 | attributes: 13 | method: 14 | prefix: sayHello01 15 | route: 16 | - destination: 17 | host: org.apache.dubbo.samples.basic.api.demoservice 18 | subset: v1 19 | - name: v2 20 | match: 21 | attributes: 22 | method: 23 | prefix: say 24 | route: 25 | - destination: 26 | host: org.apache.dubbo.samples.basic.api.demoservice 27 | subset: v2 28 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-attribute-regex.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | routes: 10 | - name: v1 11 | match: 12 | attributes: 13 | method: 14 | regex: sayHello01 15 | route: 16 | - destination: 17 | host: org.apache.dubbo.samples.basic.api.demoservice 18 | subset: v1 19 | - name: v2 20 | match: 21 | attributes: 22 | method: 23 | regex: ^s.*o$ 24 | route: 25 | - destination: 26 | host: org.apache.dubbo.samples.basic.api.demoservice 27 | subset: v2 28 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-global-ratelimit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-route 20 | spec: 21 | hosts: 22 | - org.apache.dubbo.samples.basic.api.demoservice 23 | globalRateLimit: 24 | domain: production 25 | match: 26 | attributes: 27 | method: 28 | exact: sayHello 29 | rateLimitService: outbound|8081||rate-limit-server.metaprotocol.svc.cluster.local 30 | requestTimeout: 100ms 31 | denyOnFail: true 32 | descriptors: 33 | - property: method 34 | descriptorKey: method 35 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-header-mutation.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-route 20 | spec: 21 | hosts: 22 | - org.apache.dubbo.samples.basic.api.demoservice 23 | routes: 24 | - name: header-mutation 25 | route: 26 | - destination: 27 | host: org.apache.dubbo.samples.basic.api.demoservice 28 | subset: v1 29 | requestMutation: 30 | - key: foo 31 | value: bar 32 | - key: foo1 33 | value: bar1 34 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-local-ratelimit.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-route 20 | spec: 21 | hosts: 22 | - org.apache.dubbo.samples.basic.api.demoservice 23 | routes: 24 | - name: default 25 | match: 26 | attributes: 27 | method: 28 | exact: sayHello 29 | route: 30 | - destination: 31 | host: org.apache.dubbo.samples.basic.api.demoservice 32 | subset: v1 33 | localRateLimit: 34 | tokenBucket: 35 | fillInterval: 60s 36 | maxTokens: 5 37 | tokensPerFill: 5 38 | conditions: 39 | - tokenBucket: 40 | fillInterval: 60s 41 | maxTokens: 2 42 | tokensPerFill: 2 43 | match: 44 | attributes: 45 | method: 46 | exact: sayHello 47 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-traffic-splitting.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | routes: 10 | - name: traffic-spilt 11 | route: 12 | - destination: 13 | host: org.apache.dubbo.samples.basic.api.demoservice 14 | subset: v1 15 | weight: 20 16 | - destination: 17 | host: org.apache.dubbo.samples.basic.api.demoservice 18 | subset: v2 19 | weight: 80 20 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-route 6 | spec: 7 | exportTo: 8 | - metaprotocol 9 | - default 10 | hosts: 11 | - org.apache.dubbo.samples.basic.api.demoservice 12 | routes: 13 | - name: v1 14 | route: 15 | - destination: 16 | host: org.apache.dubbo.samples.basic.api.demoservice 17 | subset: v1 18 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-route 6 | spec: 7 | hosts: 8 | - org.apache.dubbo.samples.basic.api.demoservice 9 | routes: 10 | - name: v2 11 | route: 12 | - destination: 13 | host: org.apache.dubbo.samples.basic.api.demoservice 14 | subset: v2 15 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/rate-limit-server/config.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: v1 17 | kind: ConfigMap 18 | metadata: 19 | name: rate-limit-config 20 | data: 21 | config.yaml: | 22 | domain: production 23 | descriptors: 24 | - key: method 25 | value: "sayHello" 26 | rate_limit: 27 | unit: hour 28 | requests_per_unit: 5 29 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/serviceentry.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: ServiceEntry 4 | metadata: 5 | name: dubbo-demoservice 6 | annotations: 7 | interface: org.apache.dubbo.samples.basic.api.DemoService 8 | spec: 9 | hosts: 10 | - org.apache.dubbo.samples.basic.api.demoservice 11 | ports: 12 | - number: 20880 13 | name: tcp-metaprotocol-dubbo 14 | protocol: TCP 15 | workloadSelector: 16 | labels: 17 | app: dubbo-sample-provider 18 | resolution: STATIC 19 | --- 20 | apiVersion: networking.istio.io/v1alpha3 21 | kind: ServiceEntry 22 | metadata: 23 | name: dubbo-secondservice 24 | annotations: 25 | interface: org.apache.dubbo.samples.basic.api.SecondService 26 | spec: 27 | hosts: 28 | - org.apache.dubbo.samples.basic.api.secondservice 29 | ports: 30 | - number: 20880 31 | name: tcp-metaprotocol-dubbo 32 | protocol: TCP 33 | workloadSelector: 34 | labels: 35 | app: dubbo-sample-second-provider 36 | resolution: STATIC 37 | -------------------------------------------------------------------------------- /test/e2e/metaprotocol/testdata/traffic-mirroring.yaml: -------------------------------------------------------------------------------- 1 | # Copyright Aeraki 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 | apiVersion: metaprotocol.aeraki.io/v1alpha1 17 | kind: MetaRouter 18 | metadata: 19 | name: test-metaprotocol-route 20 | spec: 21 | hosts: 22 | - org.apache.dubbo.samples.basic.api.demoservice 23 | routes: 24 | - name: traffic-mirroring 25 | route: 26 | - destination: 27 | host: org.apache.dubbo.samples.basic.api.demoservice 28 | subset: v1 29 | mirror: 30 | host: org.apache.dubbo.samples.basic.api.demoservice 31 | subset: v2 32 | mirrorPercentage: 33 | value: 50.0 34 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/gen-go/hello/GoUnusedProtection__.go: -------------------------------------------------------------------------------- 1 | // Code generated by Thrift Compiler (0.14.2). DO NOT EDIT. 2 | 3 | package hello 4 | 5 | var GoUnusedProtection__ int 6 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/gen-go/hello/hello-consts.go: -------------------------------------------------------------------------------- 1 | // Code generated by Thrift Compiler (0.14.2). DO NOT EDIT. 2 | 3 | package hello 4 | 5 | import ( 6 | "bytes" 7 | "context" 8 | "fmt" 9 | "time" 10 | 11 | "github.com/apache/thrift/lib/go/thrift" 12 | ) 13 | 14 | // (needed to ensure safety because of naive import list construction.) 15 | var _ = thrift.ZERO 16 | var _ = fmt.Printf 17 | var _ = context.Background 18 | var _ = time.Now 19 | var _ = bytes.Equal 20 | 21 | func init() { 22 | } 23 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/hello.thrift: -------------------------------------------------------------------------------- 1 | namespace java org.aeraki 2 | 3 | service HelloService { 4 | string sayHello(1:required string name) 5 | } 6 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/testdata/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1beta1 3 | kind: DestinationRule 4 | metadata: 5 | name: thrift-sample-server 6 | namespace: meta-thrift 7 | spec: 8 | host: thrift-sample-server.meta-thrift.svc.cluster.local 9 | subsets: 10 | - labels: 11 | version: v1 12 | name: v1 13 | - labels: 14 | version: v2 15 | name: v2 16 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/testdata/metarouter-v1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-thrift-route 6 | namespace: meta-thrift 7 | spec: 8 | gateways: 9 | - istio-system/istio-ingressgateway 10 | hosts: 11 | - thrift-sample-server.meta-thrift.svc.cluster.local 12 | routes: 13 | - match: 14 | attributes: 15 | method: 16 | exact: "" 17 | route: 18 | - destination: 19 | host: thrift-sample-server.meta-thrift.svc.cluster.local 20 | port: 21 | number: 9090 22 | subset: v1 23 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/testdata/metarouter-v2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-thrift-route 6 | namespace: meta-thrift 7 | spec: 8 | gateways: 9 | - istio-system/istio-ingressgateway 10 | hosts: 11 | - thrift-sample-server.meta-thrift.svc.cluster.local 12 | routes: 13 | - match: 14 | attributes: 15 | method: 16 | exact: "" 17 | route: 18 | - destination: 19 | host: thrift-sample-server.meta-thrift.svc.cluster.local 20 | port: 21 | number: 9090 22 | subset: v2 23 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/testdata/metarouter.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: metaprotocol.aeraki.io/v1alpha1 3 | kind: MetaRouter 4 | metadata: 5 | name: test-metaprotocol-thrift-route 6 | namespace: meta-thrift 7 | spec: 8 | gateways: 9 | - istio-system/istio-ingressgateway 10 | hosts: 11 | - thrift-sample-server.meta-thrift.svc.cluster.local 12 | routes: 13 | - match: 14 | attributes: 15 | method: 16 | exact: "" 17 | route: 18 | - destination: 19 | host: thrift-sample-server.meta-thrift.svc.cluster.local 20 | port: 21 | number: 9090 22 | -------------------------------------------------------------------------------- /test/e2e/metaprotocolgateway/testdata/thrift-sample.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: thrift-sample-server-v1 6 | labels: 7 | app: thrift-sample-server 8 | spec: 9 | selector: 10 | matchLabels: 11 | app: thrift-sample-server 12 | replicas: 1 13 | template: 14 | metadata: 15 | labels: 16 | app: thrift-sample-server 17 | version: v1 18 | spec: 19 | containers: 20 | - name: thrift-sample-server 21 | image: aeraki/thrift-sample-server 22 | ports: 23 | - containerPort: 9090 24 | --- 25 | apiVersion: apps/v1 26 | kind: Deployment 27 | metadata: 28 | name: thrift-sample-server-v2 29 | labels: 30 | app: thrift-sample-server 31 | spec: 32 | selector: 33 | matchLabels: 34 | app: thrift-sample-server 35 | replicas: 1 36 | template: 37 | metadata: 38 | labels: 39 | app: thrift-sample-server 40 | version: v2 41 | spec: 42 | containers: 43 | - name: thrift-sample-server 44 | image: aeraki/thrift-sample-server 45 | ports: 46 | - containerPort: 9090 47 | --- 48 | apiVersion: v1 49 | kind: Service 50 | metadata: 51 | name: thrift-sample-server 52 | spec: 53 | selector: 54 | app: thrift-sample-server 55 | ports: 56 | - name: tcp-metaprotocol-thrift-9090 57 | protocol: TCP 58 | port: 9090 59 | targetPort: 9090 60 | -------------------------------------------------------------------------------- /test/e2e/redis/testdata/redis-client.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | labels: 6 | app: redis-client 7 | name: redis-client 8 | spec: 9 | selector: 10 | matchLabels: 11 | app: redis-client 12 | template: 13 | metadata: 14 | annotations: 15 | sidecar.istio.io/logLevel: debug 16 | labels: 17 | app: redis-client 18 | spec: 19 | containers: 20 | - image: redis 21 | imagePullPolicy: Always 22 | name: redis-client 23 | -------------------------------------------------------------------------------- /test/e2e/redis/testdata/redis-single.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: redis-single 6 | data: 7 | redis.conf: | 8 | protected-mode no 9 | requirepass testredis 10 | --- 11 | apiVersion: apps/v1 12 | kind: Deployment 13 | metadata: 14 | name: redis-single 15 | spec: 16 | selector: 17 | matchLabels: 18 | app: redis-single 19 | template: 20 | metadata: 21 | annotations: 22 | sidecar.istio.io/logLevel: debug 23 | labels: 24 | app: redis-single 25 | spec: 26 | containers: 27 | - name: server 28 | image: redis:6.0.8-alpine 29 | ports: 30 | - containerPort: 6379 31 | name: tcp-redis 32 | command: ["redis-server", "/conf/redis.conf"] 33 | volumeMounts: 34 | - name: conf 35 | mountPath: /conf 36 | readOnly: false 37 | volumes: 38 | - name: conf 39 | configMap: 40 | name: redis-single 41 | defaultMode: 0755 42 | --- 43 | apiVersion: v1 44 | kind: Service 45 | metadata: 46 | name: redis-single 47 | spec: 48 | type: ClusterIP 49 | ports: 50 | - port: 6379 51 | targetPort: 6379 52 | name: tcp-redis 53 | selector: 54 | app: redis-single 55 | -------------------------------------------------------------------------------- /test/e2e/redis/testdata/redisdestination.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: redis.aeraki.io/v1alpha1 3 | kind: RedisDestination 4 | metadata: 5 | name: redis-cluster 6 | spec: 7 | host: redis-cluster.redis.svc.cluster.local 8 | trafficPolicy: 9 | connectionPool: 10 | redis: 11 | mode: CLUSTER 12 | --- 13 | apiVersion: redis.aeraki.io/v1alpha1 14 | kind: RedisDestination 15 | metadata: 16 | name: redis-single 17 | spec: 18 | host: redis-single.redis.svc.cluster.local 19 | trafficPolicy: 20 | connectionPool: 21 | redis: 22 | auth: 23 | plain: 24 | password: testredis 25 | -------------------------------------------------------------------------------- /test/e2e/redis/testdata/redisservice.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: redis-service-secret 6 | type: Opaque 7 | data: 8 | password: dGVzdHJlZGlzCg== 9 | --- 10 | apiVersion: redis.aeraki.io/v1alpha1 11 | kind: RedisService 12 | metadata: 13 | name: redis-cluster 14 | spec: 15 | host: 16 | - redis-cluster.redis.svc.cluster.local 17 | settings: 18 | auth: 19 | secret: 20 | name: redis-service-secret 21 | redis: 22 | - match: 23 | key: 24 | prefix: cluster 25 | route: 26 | host: redis-cluster.redis.svc.cluster.local 27 | - route: 28 | host: redis-single.redis.svc.cluster.local 29 | --- 30 | apiVersion: redis.aeraki.io/v1alpha1 31 | kind: RedisService 32 | metadata: 33 | name: redis-single 34 | spec: 35 | host: 36 | - redis-single.redis.svc.cluster.local 37 | redis: 38 | - route: 39 | host: redis-single.redis.svc.cluster.local 40 | -------------------------------------------------------------------------------- /test/e2e/scripts/istio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -ex 18 | 19 | BASEDIR=$(dirname "$0")/../../.. 20 | 21 | COMMON_DIR=$BASEDIR/test/e2e/common 22 | 23 | if [ -z "$ISTIO_NAMESPACE" ]; then 24 | export ISTIO_NAMESPACE="istio-system" 25 | fi 26 | 27 | if [ -z "$ISTIO_VERSION" ]; then 28 | export ISTIO_VERSION=1.18.1 29 | fi 30 | 31 | kubectl create ns ${ISTIO_NAMESPACE} || true 32 | 33 | rm -rf ~/.aeraki/istio/istio-config.yaml 34 | mkdir -p ~/.aeraki/istio 35 | envsubst < ${COMMON_DIR}/istio-config.yaml > ~/.aeraki/istio/istio-config.yaml 36 | 37 | [ -n "$(istioctl version --remote=false |grep $ISTIO_VERSION)" ] || (curl -L https://istio.io/downloadIstio | ISTIO_VERSION=$ISTIO_VERSION sh - && sudo mv $PWD/istio-$ISTIO_VERSION/bin/istioctl /usr/local/bin/) 38 | 39 | /usr/local/bin/istioctl install -f ~/.aeraki/istio/istio-config.yaml -y 40 | -------------------------------------------------------------------------------- /test/e2e/scripts/pre.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This file is copied from github.com/apache/skywalking 4 | # ---------------------------------------------------------------------------- 5 | # Licensed to the Apache Software Foundation (ASF) under one 6 | # or more contributor license agreements. See the NOTICE file 7 | # distributed with this work for additional information 8 | # regarding copyright ownership. The ASF licenses this file 9 | # to you under the Apache License, Version 2.0 (the 10 | # "License"); you may not use this file except in compliance 11 | # with the License. You may obtain a copy of the License at 12 | # 13 | # http://www.apache.org/licenses/LICENSE-2.0 14 | # 15 | # Unless required by applicable law or agreed to in writing, 16 | # software distributed under the License is distributed on an 17 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 | # KIND, either express or implied. See the License for the 19 | # specific language governing permissions and limitations 20 | # under the License. 21 | # ---------------------------------------------------------------------------- 22 | 23 | set -ex 24 | 25 | HELMVERSION=${HELMVERSION:-'helm-v3.0.0'} 26 | MINIKUBEVERESION=${MINIKUBEVERESION:-'minikube-v1.23.1'} 27 | K8SVERSION=${K8SVERSION:-'k8s-v1.20.11'} 28 | 29 | curl -sSL https://get.helm.sh/${HELMVERSION}-linux-amd64.tar.gz | \ 30 | sudo tar xz -C /usr/local/bin --strip-components=1 linux-amd64/helm 31 | 32 | sudo mkdir -p /usr/local/bin 33 | curl -sSL "https://storage.googleapis.com/minikube/releases/${MINIKUBEVERESION#minikube-}/minikube-linux-amd64" -o /tmp/minikube 34 | chmod +x /tmp/minikube 35 | sudo mv /tmp/minikube /usr/local/bin/minikube 36 | 37 | curl -sSL "https://storage.googleapis.com/kubernetes-release/release/${K8SVERSION#k8s-}/bin/linux/amd64/kubectl" -o /tmp/kubectl 38 | chmod +x /tmp/kubectl 39 | sudo mv /tmp/kubectl /usr/local/bin/kubectl 40 | 41 | sudo apt-get install -y socat conntrack 42 | 43 | -------------------------------------------------------------------------------- /test/e2e/scripts/remove-aeraki-configmap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | if [ -z "$AERAKI_CONFIGMAP_NAME" ]; then 20 | export AERAKI_CONFIGMAP_NAME=aeraki-bootstrap-config 21 | fi 22 | 23 | namespaces=`kubectl get ns | awk 'NR != 1 {print $1}'` 24 | 25 | for ns in $namespaces; do 26 | kubectl delete configmap $AERAKI_CONFIGMAP_NAME -n $ns || true 27 | done 28 | -------------------------------------------------------------------------------- /test/e2e/scripts/uninstall-addons.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -e 18 | 19 | BASEDIR=$(dirname "$0")/../../.. 20 | 21 | if [ -z "$ISTIO_NAMESPACE" ]; then 22 | export ISTIO_NAMESPACE="istio-system" 23 | fi 24 | 25 | rm -rf ~/.aeraki/istio/addons 26 | mkdir -p ~/.aeraki/istio/addons 27 | envsubst < $BASEDIR/demo/addons/grafana.yaml > ~/.aeraki/istio/addons/grafana.yaml 28 | envsubst < $BASEDIR/demo/addons/jaeger.yaml > ~/.aeraki/istio/addons/jaeger.yaml 29 | envsubst < $BASEDIR/demo/addons/prometheus.yaml > ~/.aeraki/istio/addons/prometheus.yaml 30 | kubectl delete -f ~/.aeraki/istio/addons/grafana.yaml 31 | kubectl delete -f ~/.aeraki/istio/addons/jaeger.yaml 32 | kubectl delete -f ~/.aeraki/istio/addons/prometheus.yaml 33 | 34 | rm -rf ~/.aeraki/istio/gateway 35 | mkdir -p ~/.aeraki/istio/gateway 36 | envsubst < $BASEDIR/demo/gateway/demo-ingress.yaml > ~/.aeraki/istio/gateway/demo-ingress.yaml 37 | envsubst < $BASEDIR/demo/gateway/istio-ingressgateway.yaml > ~/.aeraki/istio/gateway/istio-ingressgateway.yaml 38 | kubectl delete -f ~/.aeraki/istio/gateway/demo-ingress.yaml 39 | kubectl delete -f ~/.aeraki/istio/gateway/istio-ingressgateway.yaml 40 | -------------------------------------------------------------------------------- /test/e2e/scripts/uninstall-istio.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Copyright Aeraki Authors 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | set -ex 18 | 19 | BASEDIR=$(dirname "$0")/../../.. 20 | 21 | COMMON_DIR=$BASEDIR/test/e2e/common 22 | 23 | if [ -z "$ISTIO_NAMESPACE" ]; then 24 | export ISTIO_NAMESPACE="istio-system" 25 | fi 26 | 27 | if [ -z "$ISTIO_VERSION" ]; then 28 | export ISTIO_VERSION=1.18.1 29 | fi 30 | 31 | rm -rf ~/.aeraki/istio/istio-config.yaml 32 | mkdir -p ~/.aeraki/istio 33 | envsubst <${COMMON_DIR}/istio-config.yaml> ~/.aeraki/istio/istio-config.yaml 34 | 35 | [ -n $(istioctl version --remote=false |grep $ISTIO_VERSION) ] || (curl -L https://istio.io/downloadIstio | ISTIO_VERSION=$ISTIO_VERSION sh - && sudo mv $PWD/istio-$ISTIO_VERSION/bin/istioctl /usr/local/bin/) 36 | 37 | istioctl x uninstall -f ~/.aeraki/istio/istio-config.yaml -y || true 38 | 39 | # By default, istioctl will generates validatingwebhookconfigurations and mutatingwebhookconfigurations for istio-system. 40 | # This is a known bug, so manually delete it here. 41 | kubectl delete validatingwebhookconfigurations istiod-default-validator || true 42 | kubectl delete mutatingwebhookconfigurations istio-revision-tag-default || true 43 | kubectl delete mutatingwebhookconfigurations istio-revision-tag-default-${ISTIO_NAMESPACE} || true 44 | 45 | kubectl delete ns ${ISTIO_NAMESPACE} || true 46 | -------------------------------------------------------------------------------- /test/e2e/thrift/testdata/destinationrule.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: DestinationRule 4 | metadata: 5 | name: thrift-sample-server 6 | spec: 7 | host: thrift-sample-server 8 | subsets: 9 | - name: v1 10 | labels: 11 | version: v1 12 | - name: v2 13 | labels: 14 | version: v2 15 | -------------------------------------------------------------------------------- /test/e2e/thrift/testdata/virtualservice-traffic-splitting.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-thrift-route 6 | spec: 7 | hosts: 8 | - thrift-sample-server.thrift.svc.cluster.local 9 | http: 10 | - name: "thrift-traffic-splitting" 11 | route: 12 | - destination: 13 | host: thrift-sample-server.thrift.svc.cluster.local 14 | subset: v1 15 | weight: 30 16 | - destination: 17 | host: thrift-sample-server.thrift.svc.cluster.local 18 | subset: v2 19 | weight: 70 20 | -------------------------------------------------------------------------------- /test/e2e/thrift/testdata/virtualservice-v1.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-thrift-route 6 | spec: 7 | hosts: 8 | - thrift-sample-server.thrift.svc.cluster.local 9 | http: 10 | - name: "thrift-v1-routes" 11 | route: 12 | - destination: 13 | host: thrift-sample-server.thrift.svc.cluster.local 14 | subset: v1 15 | -------------------------------------------------------------------------------- /test/e2e/thrift/testdata/virtualservice-v2.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: networking.istio.io/v1alpha3 3 | kind: VirtualService 4 | metadata: 5 | name: test-thrift-route 6 | spec: 7 | hosts: 8 | - thrift-sample-server.thrift.svc.cluster.local 9 | http: 10 | - name: "thrift-v2-routes" 11 | route: 12 | - destination: 13 | host: thrift-sample-server.thrift.svc.cluster.local 14 | subset: v2 15 | --------------------------------------------------------------------------------