Full Performance Test #89
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.6' | |
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/setup-gcloud@v2.1.0 | |
- 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.1.1 | |
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 }}" \ | |
--var="upstream_machine_type=${{ vars.AZURE_UPSTREAM_MACHINE_TYPE }}" \ | |
--var="tests_machine_type=${{ vars.AZURE_TEST_MACHINE_TYPE }}" \ | |
--auto-approve | |
- name: Connect to AKS cluster | |
if: ${{ inputs.cloud == 'Azure' }} | |
run: | | |
az aks get-credentials \ | |
--resource-group "pt-${{ vars.AZURE_CLUSTER_LOCATION }}" \ | |
--name "pt-${{ vars.AZURE_CLUSTER_LOCATION }}" | |
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 }}" \ | |
--var="upstream_machine_type=${{ vars.AWS_UPSTREAM_MACHINE_TYPE }}" \ | |
--var="tests_machine_type=${{ vars.AWS_TEST_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-${{ vars.AWS_CLUSTER_LOCATION }}" | |
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 }}" \ | |
--var="upstream_machine_type=${{ vars.GCP_UPSTREAM_MACHINE_TYPE }}" \ | |
--var="tests_machine_type=${{ vars.GCP_TEST_MACHINE_TYPE }}" \ | |
--auto-approve | |
- name: Connect to GKE cluster | |
if: ${{ inputs.cloud == 'GCP' }} | |
run: | | |
gcloud container clusters get-credentials "pt-${{ vars.GCP_CLUSTER_LOCATION }}" \ | |
--zone "${{ 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=NodePort" \ | |
--auto-approve | |
- name: Run Tests | |
run: | | |
cd tests | |
terraform init | |
terraform apply \ | |
--var="kubernetes_config_context=performance-testing" \ | |
--auto-approve | |
- name: Test Grafana Snapshot | |
run: | | |
kubectl logs -n dependencies $(kubectl get pods -n dependencies --selector=app=snapshot-job -o jsonpath='{.items[-1].metadata.name}') --tail=1 | |
- name: Destroy Tests | |
run: | | |
cd tests | |
terraform destroy \ | |
--var="kubernetes_config_context=performance-testing" \ | |
--auto-approve | |
- name: Destroy testing resources | |
run: | | |
cd deployments | |
terraform destroy \ | |
--var="kubernetes_config_context=performance-testing" \ | |
--var="tyk_license=${{ secrets.DASH_LICENSE }}" \ | |
--var="grafana_service_type=LoadBalancer" \ | |
--auto-approve | |
- name: Destroy AKS cluster | |
if: ${{ inputs.cloud == 'Azure' }} | |
run: | | |
cd aks | |
terraform destroy \ | |
--var="cluster_location=${{ vars.AZURE_CLUSTER_LOCATION }}" \ | |
--var="cluster_machine_type=${{ vars.AZURE_CLUSTER_MACHINE_TYPE }}" \ | |
--var="upstream_machine_type=${{ vars.AZURE_UPSTREAM_MACHINE_TYPE }}" \ | |
--var="tests_machine_type=${{ vars.AZURE_TEST_MACHINE_TYPE }}" \ | |
--auto-approve | |
- name: Destroy EKS cluster | |
if: ${{ inputs.cloud == 'AWS' }} | |
run: | | |
cd eks | |
terraform destroy \ | |
--var="cluster_location=${{ vars.AWS_CLUSTER_LOCATION }}" \ | |
--var="cluster_machine_type=${{ vars.AWS_CLUSTER_MACHINE_TYPE }}" \ | |
--var="upstream_machine_type=${{ vars.AWS_UPSTREAM_MACHINE_TYPE }}" \ | |
--var="tests_machine_type=${{ vars.AWS_TEST_MACHINE_TYPE }}" \ | |
--auto-approve | |
- name: Destroy GKE cluster | |
if: ${{ inputs.cloud == 'GCP' }} | |
run: | | |
cd gke | |
terraform destroy \ | |
--var="project=${{ secrets.GCP_PROJECT }}" \ | |
--var="cluster_location=${{ vars.GCP_CLUSTER_LOCATION }}" \ | |
--var="cluster_machine_type=${{ vars.GCP_CLUSTER_MACHINE_TYPE }}" \ | |
--var="upstream_machine_type=${{ vars.GCP_UPSTREAM_MACHINE_TYPE }}" \ | |
--var="tests_machine_type=${{ vars.GCP_TEST_MACHINE_TYPE }}" \ | |
--auto-approve |