-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (119 loc) · 4.22 KB
/
gke-destroy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Destroy GKE Setup
on:
workflow_dispatch:
inputs:
action:
description: 'Action'
required: false
default: 'apply'
type: choice
options:
- apply
- destroy
analytics_enabled:
description: 'Enabled Analytics gathering'
required: false
default: false
type: boolean
auth_enabled:
description: 'Enabled Authentication'
required: false
default: false
type: boolean
quota_enabled:
description: 'Enabled Quota'
required: false
default: false
type: boolean
rate_limit_enabled:
description: 'Enabled Rate Limiting'
required: false
default: false
type: boolean
open_telemetry_enabled:
description: 'Enabled Open Telemetry'
required: false
default: false
type: boolean
open_telemetry_sampling_ratio:
description: 'Open Telemetry Sampling Ratio'
required: false
type: string
default: '0.5'
tyk_version:
description: 'Tyk Gateway version'
required: true
type: string
default: 'v5.3.0'
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
jobs:
performance_test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Authenticate into gcloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Install gcloud CLI
uses: google-github-actions/[email protected]
- name: Install gcloud k8s auth component
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 }}
- name: Create Terraform Cloud descriptors
run: |
cp ./gke/terraform.cloud.tf.example ./gke/terraform.cloud.tf
cp .github/gke/deployments.tf ./deployments/terraform.cloud.tf
cp .github/gke/tests.tf ./tests/terraform.cloud.tf
- name: Connect to GKE cluster
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-gke
- name: Run Tests
run: |
cd tests
terraform init
terraform destroy \
--var="kubernetes_config_context=performance-testing-gke" \
--var="tests_timestamp_enabled=${{ inputs.tests_timestamp_enabled }}" \
--var="tests_httpbin_enabled=${{ inputs.tests_httpbin_enabled }}" \
--auto-approve
- name: Deploy testing resources
run: |
cd deployments
terraform init
terraform destroy \
--var="kubernetes_config_context=performance-testing-gke" \
--var="analytics_enabled=${{ inputs.analytics_enabled }}" \
--var="auth_enabled=${{ inputs.auth_enabled }}" \
--var="quota_enabled=${{ inputs.quota_enabled }}" \
--var="rate_limit_enabled=${{ inputs.rate_limit_enabled }}" \
--var="open_telemetry_enabled=${{ inputs.open_telemetry_enabled }}" \
--var="open_telemetry_sampling_ratio=${{ inputs.open_telemetry_sampling_ratio }}" \
--var="tyk_version=${{ inputs.tyk_version }}" \
--var="grafana_service_type=LoadBalancer" \
--auto-approve
- name: Stand up GKE cluster
run: |
cd gke
terraform init
terraform destroy \
--var="project=${{ secrets.GCP_PROJECT }}" \
--var="cluster_location=${{ vars.GCP_CLUSTER_LOCATION }}" \
--var="cluster_machine_type=${{ vars.GCP_CLUSTER_MACHINE_TYPE }}" \
--auto-approve