Skip to content

Full Performance Test #34

Full Performance Test

Full Performance Test #34

name: Full Performance Test
on:
workflow_dispatch:
inputs:
cloud:
description: 'Choose Cloud Provider'
required: true
type: choice
default: Azure
options:
- Azure
- AWS
- GCP
tyk_version:
description: 'Tyk Gateway version'
required: true
type: string
default: 'v5.3.1'
tests_timestamp_enabled:
description: 'Enabled Timestamp Test'
required: false
default: true
type: boolean
tests_httpbin_enabled:
description: 'Enabled Httpbin Test'
required: false
default: false
type: boolean
env:
provider: ${{ inputs.cloud == 'Azure' && 'aks' || (inputs.cloud == 'AWS' && 'eks' || 'gke') }}
concurrency:
group: ${{ inputs.cloud }}
jobs:
performance_test:
name: "${{ inputs.cloud }} full performance run"
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Configure AKS credentials
if: ${{ inputs.cloud == 'Azure' }}
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Configure AWS credentials
if: ${{ inputs.cloud == 'AWS' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ vars.AWS_CLUSTER_LOCATION }}
- name: Authenticate into gcloud
if: ${{ inputs.cloud == 'GCP' }}
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Install gcloud CLI
if: ${{ inputs.cloud == 'GCP' }}
uses: google-github-actions/[email protected]
- name: Install gcloud k8s auth component
if: ${{ inputs.cloud == 'GCP' }}
run: gcloud components install gke-gcloud-auth-plugin
- name: Install Terraform
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
terraform_version: "1.8.2"
- name: Create Terraform Cloud descriptors
run: |
cp ${{ env.provider }}/terraform.cloud.tf.example ${{ env.provider }}/terraform.cloud.tf
cp .github/${{ env.provider }}/deployments.tf deployments/terraform.cloud.tf
cp .github/${{ env.provider }}/tests.tf tests/terraform.cloud.tf
- name: Stand up AKS cluster
if: ${{ inputs.cloud == 'Azure' }}
run: |
cd aks
terraform init
terraform apply \
--var="cluster_location=${{ vars.AZURE_CLUSTER_LOCATION }}" \
--var="cluster_machine_type=${{ vars.AZURE_CLUSTER_MACHINE_TYPE }}" \
--auto-approve
- name: Connect to AKS cluster
if: ${{ inputs.cloud == 'Azure' }}
run: |
az aks get-credentials \
--resource-group "pt-${{ vars.AZURE_CLUSTER_MACHINE_TYPE }}" \
--name "pt-${{ vars.AZURE_CLUSTER_MACHINE_TYPE }}"
kubectl config rename-context $(kubectl config current-context) performance-testing
- name: Stand up EKS cluster
if: ${{ inputs.cloud == 'AWS' }}
run: |
cd eks
terraform init
terraform apply \
--var="cluster_location=${{ vars.AWS_CLUSTER_LOCATION }}" \
--var="cluster_machine_type=${{ vars.AWS_CLUSTER_MACHINE_TYPE }}" \
--auto-approve
- name: Connect to EKS cluster
if: ${{ inputs.cloud == 'AWS' }}
run: |
aws eks --region "${{ vars.AWS_CLUSTER_LOCATION }}" update-kubeconfig --name "pt-$(echo "${{ vars.AWS_CLUSTER_MACHINE_TYPE }}" | sed 's/\./-/g')"
kubectl config rename-context $(kubectl config current-context) performance-testing
- name: Stand up GKE cluster
if: ${{ inputs.cloud == 'GCP' }}
run: |
cd gke
terraform init
terraform apply \
--var="project=${{ secrets.GCP_PROJECT }}" \
--var="cluster_location=${{ vars.GCP_CLUSTER_LOCATION }}" \
--var="cluster_machine_type=${{ vars.GCP_CLUSTER_MACHINE_TYPE }}" \
--auto-approve
- name: Connect to GKE cluster
if: ${{ inputs.cloud == 'GCP' }}
run: |
gcloud container clusters get-credentials "pt-${{ vars.GCP_CLUSTER_MACHINE_TYPE }}" \
--region "${{ vars.GCP_CLUSTER_LOCATION }}" \
--project "${{ secrets.GCP_PROJECT }}"
kubectl config rename-context $(kubectl config current-context) performance-testing
- name: Deploy testing resources
run: |
cd deployments
terraform init
terraform apply \
--var="kubernetes_config_context=performance-testing" \
--var="tyk_version=${{ inputs.tyk_version }}" \
--var="tyk_license=${{ secrets.DASH_LICENSE }}" \
--var="grafana_service_type=LoadBalancer" \
--auto-approve
- name: Run Tests
run: |
cd tests
terraform init
terraform apply \
--var="kubernetes_config_context=performance-testing" \
--var="tests_timestamp_enabled=${{ inputs.tests_timestamp_enabled }}" \
--var="tests_httpbin_enabled=${{ inputs.tests_httpbin_enabled }}" \
--auto-approve
- name: Access to Grafana Dashboard
run: |
echo "###################################################################
echo "#
echo "# http://$(kubectl get svc -n dependencies grafana -ojsonpath='{.status.loadBalancer.ingress[0].ip}')"
echo "# Username: admin"
echo "# Password: topsecretpassword"
echo "#
echo "###################################################################
- name: Grafana timestamp test snapshot
if: ${{ inputs.tests_timestamp_enabled == true }}
run: |
kubectl logs -n dependencies $(kubectl get pods -n dependencies --selector=job-name=snapshot-job-timestamp -o jsonpath='{.items[-1].metadata.name}') --tail=1
- name: Grafana httpbin test snapshot
if: ${{ inputs.tests_httpbin_enabled == true }}
run: |
kubectl logs -n dependencies $(kubectl get pods -n dependencies --selector=job-name=snapshot-job-httpbin -o jsonpath='{.items[-1].metadata.name}') --tail=1