-
Notifications
You must be signed in to change notification settings - Fork 24
Istio Crypto Scheduled Workflow #79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
2e338d2
43791af
1311093
2df0a0f
79fbbe9
69f382f
ddc266a
9f67fc4
355fa95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| name: Scheduled Benchmark Tests on Self-hosted Runner | ||
| on: | ||
| # for triggering manually, provide a test configuration file name or a performance profile name | ||
| workflow_dispatch: | ||
| inputs: | ||
| profile_name: | ||
| description: "performance profile to use" | ||
| required: false | ||
| profile_filename: | ||
| description: "test configuration file" | ||
| required: false | ||
| # scheduled to run on everyhour | ||
| schedule: | ||
| - cron: '0 * * * *' | ||
|
|
||
| jobs: | ||
| # Scheduled Benchmark Test | ||
| start-runners-scheduled: | ||
| name: Start self-hosted CNCF CIL runners for scheduled test | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| if: ${{ github.event_name == 'schedule' }} | ||
| # strategy: | ||
| # fail-fast: false | ||
| # matrix: | ||
| # service-mesh: ['istio', 'linkerd', 'osm'] | ||
| # load-generator: ['fortio', 'wrk2'] | ||
| # test-configuration: ['load-test','soak-test'] | ||
| outputs: | ||
| github_run_id: ${{ env.GITHUB_RUN_ID }} # use this github_run_id as a suffix for CIL machines and runners | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Configure CNCF CIL credentials | ||
| run: | | ||
| chmod +x .github/workflows/scripts/self-hosted-credentails.sh | ||
| .github/workflows/scripts/self-hosted-credentails.sh ${{ secrets.CNCF_CIL_TOKEN }} | ||
| shell: bash | ||
|
|
||
| - name: Create registration token for CNCF CIL runner | ||
| id: getRegToken | ||
| run: | | ||
| reg_token=$(curl -s -X POST -H "Accept: application/vnd.github.v3+json" \ | ||
| -H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' \ | ||
| https://api.github.com/repos/${{github.repository}}/actions/runners/registration-token | jq -r .token) | ||
| echo REG_TOKEN=$reg_token >> $GITHUB_ENV | ||
| echo REPOSITORY=${{github.repository}} >> $GITHUB_ENV | ||
| shell: bash | ||
|
|
||
| # The hostname will be like istioCrypto-fortio-load-1997512481 | ||
| - name: Start CNCF CIL runner | ||
| id: start-cil-runner | ||
| run: | | ||
| echo GITHUB_RUN_ID=${{ github.run_id }} >> $GITHUB_ENV | ||
| chmod +x .github/workflows/scripts/start-cil-runner.sh | ||
| .github/workflows/scripts/start-cil-runner.sh ${{ secrets.cncf_cil_token }} istioCrypto-fortio-load | ||
| shell: bash | ||
|
|
||
| scheduled-test: | ||
| name: Scheduled Istio-Crypto Benchmark Test | ||
| timeout-minutes: 60 | ||
| needs: | ||
| - start-runners-scheduled | ||
| runs-on: istioCrpto-fortio-load-${{ github.run_id }} | ||
| if: ${{ github.event_name == 'schedule' }} | ||
| strategy: | ||
| # fail-fast: false | ||
| # matrix: | ||
| # service-mesh: ['istio', 'linkerd', 'osm'] | ||
| # load-generator: ['fortio', 'wrk2'] | ||
| # test-configuration: ['load-test','soak-test'] | ||
| steps: | ||
| - name: Install dependencies | ||
| run: | | ||
| echo "Current user: $(whoami)" | ||
| echo "Installing kubectl..." | ||
| curl -LO https://dl.k8s.io/release/v1.23.2/bin/linux/amd64/kubectl | ||
| sudo install -o smp -g smp -m 0755 kubectl /usr/local/bin/kubectl | ||
| echo "Installing docker..." | ||
| sudo apt update -y | ||
| sudo apt install -y jq unzip apt-transport-https ca-certificates software-properties-common | ||
| curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
| sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" | ||
| sudo apt-cache policy docker-ce | ||
| sudo apt install -y docker-ce | ||
| sudo systemctl status docker | ||
| sudo mkdir -p ~/.kube | ||
| sudo chmod 777 ~/.kube | ||
| curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | ||
| sudo install minikube-linux-amd64 /usr/local/bin/minikube | ||
|
|
||
|
|
||
| - name: Start minikube | ||
| run: | | ||
| minikube start --memory 5000 | ||
| kubectl get po -A | ||
|
|
||
| - name: Checkout Code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Deploy Istio Crypto design and deploy httpbin application | ||
| run: | | ||
| chmod +x .github/workflows/scripts/istioCrypto.sh | ||
| .github/workflows/scripts/istioCrypto.sh | ||
| shell: bash | ||
|
|
||
| - name: Get Date | ||
| id: date | ||
| run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H.%M.%S')" | ||
|
|
||
| - name: Run Benchmark Tests | ||
| uses: layer5io/meshery-smp-action@master | ||
| with: | ||
| provider_token: ${{ secrets.MESHERY_TOKEN }} | ||
| platform: docker | ||
| profile_filename: ${{ matrix.test-configuration }}.yaml | ||
| endpoint_url: ${{env.ENDPOINT_URL}} | ||
| service_mesh: ${{env.SERVICE_MESH}} | ||
| load_generator: ${{ matrix.load-generator }} | ||
| profile_name: 'istioCrypto-${{ matrix.test-configuration }}' | ||
| test_name: '${{ steps.date.outputs.date }}' | ||
|
|
||
| stop-runner-scheduled: | ||
| name: Stop self-hosted runner | ||
| timeout-minutes: 60 | ||
| needs: | ||
| - start-runners-scheduled # required to get output from the start-runner job | ||
| - scheduled-test # required to wait when the main job is done | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| service-mesh: ['istio', 'linkerd', 'osm'] | ||
asubedy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| load-generator: ['fortio', 'wrk2'] | ||
| test-configuration: ['load-test','soak-test'] | ||
| if: ${{ always() && github.event_name == 'schedule' }} # required to stop the runner even if the error happened in the previous jobs | ||
| steps: | ||
| - name: Checkout Code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Stop CNCF CIL runner | ||
| run: | | ||
| chmod +x .github/workflows/scripts/stop-cil-runner.sh | ||
| .github/workflows/scripts/stop-cil-runner.sh ${{ secrets.cncf_cil_token }} ${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ matrix.test-configuration }}-${{ needs.start-runners-scheduled.outputs.github_run_id }} | ||
| shell: bash | ||
|
|
||
| - name: Remove CNCF CIL runner from github repository | ||
| if: always() | ||
| run: | | ||
| runner_id=$(curl -s -H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{github.repository}}/actions/runners | jq '.runners[] | select(.name == "${{ matrix.service-mesh }}-${{ matrix.load-generator }}-${{ matrix.test-configuration }}-${{ needs.start-runners-scheduled.outputs.github_run_id }}") | {id}' | jq -r .id) | ||
| curl -X DELETE -H 'Authorization: token ${{ secrets.GH_ACCESS_TOKEN }}' -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/${{github.repository}}/actions/runners/$runner_id | ||
| shell: bash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
|
|
||
| # Istio, crypto deployment | ||
|
|
||
| export MESH_NAME='Istio' | ||
| export SERVICE_MESH='ISTIO' | ||
|
|
||
| # Check if mesheryctl is present, else install it | ||
| if ! [ -x "$(command -v mesheryctl)" ]; then | ||
| echo 'mesheryctl is not installed. Installing mesheryctl client... Standby... (Starting Meshery as well...)' >&2 | ||
| curl -L https://meshery.io/install | ADAPTERS=istio PLATFORM=kubernetes bash - | ||
| fi | ||
|
|
||
| sleep 200 | ||
| kubectl get pods -n meshery | ||
|
|
||
| echo "Meshery has been installed." | ||
| # mesheryctl system login --provider None | ||
|
|
||
| # mesheryctl mesh deploy istio --watch | ||
|
|
||
| sleep 200 | ||
|
|
||
| kubectl get all -n istio-system | ||
|
|
||
| # so that istio operator gets initialized | ||
| mesheryctl system stop | ||
|
|
||
| sleep 400 | ||
|
|
||
| mesheryctl system start | ||
|
|
||
| # Applying/deploying crpyto pattern | ||
| mesheryctl pattern apply -f ./AadiCrypto.yaml | ||
asubedy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| sleep 200 | ||
|
|
||
|
|
||
| kubectl get all -n istio-operator | ||
|
|
||
| # deplyoing httbin application | ||
| mesheryctl app onboard -f ./httbin.yaml -s "Kubernetes Manifest" | ||
asubedy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| sleep 100 | ||
|
|
||
| export INGRESS_NAME=istio-ingressgateway | ||
| export INGRESS_NS=istio-system | ||
|
|
||
| kubectl get svc "$INGRESS_NAME" -n "$INGRESS_NS" | ||
|
|
||
|
|
||
| export INGRESS_HOST=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.status.loadBalancer.ingress[0].ip}') | ||
| export INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="http2")].port}') | ||
| export SECURE_INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="https")].port}') | ||
| export TCP_INGRESS_PORT=$(kubectl -n "$INGRESS_NS" get service "$INGRESS_NAME" -o jsonpath='{.spec.ports[?(@.name=="tcp")].port}') | ||
|
|
||
|
|
||
| export GATEWAY_URL=http://$INGRESS_HOST:$INGRESS_PORT/headers | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @asubedy For crypto test case, the Then we can use the URL and
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gyohuangxin I created the file, so we run this script after deploying Istio Crypto and deploying httpbin application right?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @asubedy Yes, it's correct. |
||
|
|
||
| # mesheryctl perf apply --file $GITHUB_WORKSPACE/.github/$perf_filename -t ~/auth.json --url "$endpoint_url" --mesh "$service_mesh" --name "$test_name" --load-generator "$load_generator" $perf_profile_name -y | ||
|
|
||
| echo "Service Mesh: $MESH_NAME - $SERVICE_MESH" | ||
| echo "Gateway URL: $GATEWAY_URL" | ||
| echo "ENDPOINT_URL=$GATEWAY_URL/productpage" >> $GITHUB_ENV | ||
| echo "SERVICE_MESH=$SERVICE_MESH" >> $GITHUB_ENV | ||
|
|
||
|
|
||
asubedy marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.