Skip to content

Commit

Permalink
Merge pull request #4 from TykTechnologies/updates
Browse files Browse the repository at this point in the history
Split out clusters, deployments and tests. Add workflows
  • Loading branch information
zalbiraw authored Apr 23, 2024
2 parents a55e708 + 1c8e59d commit 772ea34
Show file tree
Hide file tree
Showing 116 changed files with 1,052 additions and 1,454 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/gke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: GKE
on:
workflow_dispatch:
inputs:
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:
httpbin:
runs-on: ubuntu-latest
steps:
- 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 Terraform
uses: hashicorp/setup-terraform@v3

- name: Checkout Repository
uses: actions/checkout@v4

- name: Copy deployments vars example into main.tfvars
run: cp ./deployments/main.tfvars.example ./deployments/main.tfvars

- name: Copy tests vars example into main.tfvars
run: cp ./tests/main.tfvars.example ./tests/main.tfvars

- name: Stand up GKE cluster
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: Deploy testing resources
run: |
cd deployments
terraform init
terraform apply \
--var="kubernetes_config_path='../.kube/config'" \
--var="kubernetes_config_context=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: Run Tests
run: |
cd deployments
terraform init
terraform apply \
--var="kubernetes_config_path='../.kube/config'" \
--var="kubernetes_config_context=gke" \
--var="tests_timestamp_enabled=${{ inputs.tests_timestamp_enabled }}" \
--var="tests_httpbin_enabled=${{ inputs.tests_httpbin_enabled }}" \
--auto-approve
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**/.kube
**/.DS_Store
**/.terraform.lock.hcl
**/.terraform
**/.terraform.tfstate.lock.info
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

File renamed without changes.
19 changes: 19 additions & 0 deletions aks/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module "h" {
source = "../modules/helpers"

services_nodes_count = var.services_nodes_count
resource_nodes_count = var.resource_nodes_count

tyk_enabled = var.tyk_enabled
kong_enabled = var.kong_enabled
gravitee_enabled = var.gravitee_enabled
}

module "azure" {
source = "../modules/clouds/azure"

cluster_location = var.cluster_location
cluster_machine_type = var.cluster_machine_type
aks_version = var.aks_version
nodes = module.h.nodes
}
10 changes: 10 additions & 0 deletions aks/main.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services_nodes_count = 1
resource_nodes_count = 1

cluster_location = "westus"
cluster_machine_type = "Standard_F4s_v2"
aks_version = "1.27"

tyk_enabled = true
kong_enabled = false
gravitee_enabled = false
5 changes: 5 additions & 0 deletions azure/vars.azure.tf → aks/vars.azure.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ variable "cluster_machine_type" {
type = string
default = "Standard_F4s_v2"
}

variable "aks_version" {
type = string
default = "1.27"
}
24 changes: 24 additions & 0 deletions aks/vars.nodes.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variable "services_nodes_count" {
type = number
default = 1
}

variable "resource_nodes_count" {
type = number
default = 1
}

variable "tyk_enabled" {
type = bool
default = true
}

variable "kong_enabled" {
type = bool
default = false
}

variable "gravitee_enabled" {
type = bool
default = false
}
109 changes: 0 additions & 109 deletions aws/main.tf

This file was deleted.

33 changes: 0 additions & 33 deletions aws/main.tfvars.example

This file was deleted.

32 changes: 0 additions & 32 deletions aws/vars.deployments.tf

This file was deleted.

Loading

0 comments on commit 772ea34

Please sign in to comment.