Skip to content

GKE Deployments

GKE Deployments #3

name: GKE Deployments
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'
jobs:
deployments:
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: 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: Create Terraform Cloud descriptor
run: cp .github/gke/deployments ./deployments/terraform.cloud.tf
- name: Run Terraform action on deployments
run: |
cd deployments
terraform init
terraform ${{ inputs.action }} \
--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: Access to Grafana Dashboard
if: ${{ inputs.action == 'apply' }}
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 "###################################################################