Skip to content

feat: add new scaletest infrastructure #15573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Dec 12, 2024
Prev Previous commit
Next Next commit
all working
  • Loading branch information
f0ssel committed Dec 6, 2024
commit bb5c9a88692cc001d0c9fc9758156d6a2d7b9dec
13 changes: 3 additions & 10 deletions scaletest/terraform/new/cf_dns.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
resource "cloudflare_record" "coder" {
for_each = local.deployments
zone_id = var.cloudflare_zone_id
name = local.coder_subdomain
content = google_compute_address.coder["primary"].address
type = "A"
ttl = 3600
}

resource "cloudflare_record" "coder_europe" {
zone_id = var.cloudflare_zone_id
name = local.coder_europe_subdomain
content = google_compute_address.coder["europe"].address
name = each.value.subdomain
content = google_compute_address.coder[each.key].address
type = "A"
ttl = 3600
}
25 changes: 25 additions & 0 deletions scaletest/terraform/new/deployments.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
locals {
deployments = {
primary = {
subdomain = "${var.name}-scaletest"
url = "http://${var.name}-scaletest.${var.cloudflare_domain}"
region = "us-east1"
zone = "us-east1-c"
cidr = "10.200.0.0/24"
}
europe = {
subdomain = "${var.name}-europe-scaletest"
url = "http://${var.name}-europe-scaletest.${var.cloudflare_domain}"
region = "europe-west1"
zone = "europe-west1-b"
cidr = "10.201.0.0/24"
}
asia = {
subdomain = "${var.name}-asia-scaletest"
url = "http://${var.name}-asia-scaletest.${var.cloudflare_domain}"
region = "asia-southeast1"
zone = "asia-southeast1-a"
cidr = "10.202.0.0/24"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,6 @@ data "google_compute_default_service_account" "default" {
}

locals {
clusters = {
primary = {
region = "us-east1"
zone = "us-east1-c"
cidr = "10.200.0.0/24"
}
europe = {
region = "europe-west1"
zone = "europe-west1-b"
cidr = "10.201.0.0/24"
}
asia = {
region = "asia-southeast1"
zone = "asia-southeast1-a"
cidr = "10.202.0.0/24"
}
}
node_pools = {
primary_coder = {
name = "coder"
Expand Down Expand Up @@ -71,7 +54,7 @@ locals {
}

resource "google_container_cluster" "cluster" {
for_each = local.clusters
for_each = local.deployments
name = "${var.name}-${each.key}"
location = each.value.zone
project = var.project_id
Expand Down Expand Up @@ -118,7 +101,7 @@ resource "google_container_cluster" "cluster" {
resource "google_container_node_pool" "node_pool" {
for_each = local.node_pools
name = each.value.name
location = local.clusters[each.value.cluster].zone
location = local.deployments[each.value.cluster].zone
project = var.project_id
cluster = google_container_cluster.cluster[each.value.cluster].name
autoscaling {
Expand Down
4 changes: 2 additions & 2 deletions scaletest/terraform/new/gcp_db.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "google_sql_database_instance" "db" {
name = "${var.name}-coder"
project = var.project_id
region = local.clusters.primary.region
region = local.deployments.primary.region
database_version = var.cloudsql_version
deletion_protection = false

Expand All @@ -13,7 +13,7 @@ resource "google_sql_database_instance" "db" {
availability_type = "ZONAL"

location_preference {
zone = local.clusters.primary.zone
zone = local.deployments.primary.zone
}

database_flags {
Expand Down
4 changes: 2 additions & 2 deletions scaletest/terraform/new/gcp_vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "google_compute_network" "vpc" {
}

resource "google_compute_subnetwork" "subnet" {
for_each = local.clusters
for_each = local.deployments
name = "${var.name}-${each.key}"
project = var.project_id
region = each.value.region
Expand All @@ -18,7 +18,7 @@ resource "google_compute_subnetwork" "subnet" {
}

resource "google_compute_address" "coder" {
for_each = local.clusters
for_each = local.deployments
project = var.project_id
region = each.value.region
name = "${var.name}-${each.key}-coder"
Expand Down
68 changes: 0 additions & 68 deletions scaletest/terraform/new/k8s_certmanager.tf

This file was deleted.

Loading
Loading