Skip to content

feat: add scaletest load generation infrastructure #15816

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 36 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fmt
  • Loading branch information
f0ssel committed Dec 17, 2024
commit ca6fed8823283b52748816bf3fa386bf94d3ea42
10 changes: 5 additions & 5 deletions scaletest/terraform/new/cf_dns.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource "cloudflare_record" "coder" {
for_each = local.deployments
zone_id = var.cloudflare_zone_id
name = each.value.subdomain
content = google_compute_address.coder[each.key].address
type = "A"
ttl = 3600
zone_id = var.cloudflare_zone_id
name = each.value.subdomain
content = google_compute_address.coder[each.key].address
type = "A"
ttl = 3600
}
24 changes: 12 additions & 12 deletions scaletest/terraform/new/deployments.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ 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"
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"
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"
url = "http://${var.name}-asia-scaletest.${var.cloudflare_domain}"
region = "asia-southeast1"
zone = "asia-southeast1-a"
cidr = "10.202.0.0/24"
}
}
}
40 changes: 20 additions & 20 deletions scaletest/terraform/new/gcp_clusters.tf
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
data "google_compute_default_service_account" "default" {
project = var.project_id
depends_on = [ google_project_service.api["compute.googleapis.com"] ]
project = var.project_id
depends_on = [google_project_service.api["compute.googleapis.com"]]
}

locals {
node_pools = {
primary_coder = {
name = "coder"
name = "coder"
cluster = "primary"
size = 1
size = 1
}
primary_workspaces = {
name = "workspaces"
name = "workspaces"
cluster = "primary"
size = 1
size = 1
}
primary_misc = {
name = "misc"
name = "misc"
cluster = "primary"
size = 1
size = 1
}
europe_coder = {
name = "coder"
name = "coder"
cluster = "europe"
size = 1
size = 1
}
europe_workspaces = {
name = "workspaces"
name = "workspaces"
cluster = "europe"
size = 1
size = 1
}
europe_misc = {
name = "misc"
name = "misc"
cluster = "europe"
size = 1
size = 1
}
asia_coder = {
name = "coder"
name = "coder"
cluster = "asia"
size = 1
size = 1
}
asia_workspaces = {
name = "workspaces"
name = "workspaces"
cluster = "asia"
size = 1
size = 1
}
asia_misc = {
name = "misc"
name = "misc"
cluster = "asia"
size = 1
size = 1
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion scaletest/terraform/new/k8s_coder_asia.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ EOF

resource "helm_release" "provisionerd_asia" {
provider = helm.asia

repository = local.coder_helm_repo
chart = local.provisionerd_helm_chart
name = local.provisionerd_release_name
Expand Down
2 changes: 1 addition & 1 deletion scaletest/terraform/new/k8s_coder_europe.tf
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ EOF

resource "helm_release" "provisionerd_europe" {
provider = helm.europe

repository = local.coder_helm_repo
chart = local.provisionerd_helm_chart
name = local.provisionerd_release_name
Expand Down
2 changes: 1 addition & 1 deletion scaletest/terraform/new/k8s_coder_primary.tf
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ EOF

resource "helm_release" "provisionerd_chart" {
provider = helm.primary

repository = local.coder_helm_repo
chart = local.provisionerd_helm_chart
name = local.provisionerd_release_name
Expand Down
22 changes: 11 additions & 11 deletions scaletest/terraform/new/k8s_coder_proxies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ data "http" "coder_healthy" {
url = local.deployments.primary.url
// Wait up to 5 minutes for DNS to propogate
retry {
attempts = 30
attempts = 30
min_delay_ms = 10000
}

lifecycle {
postcondition {
condition = self.status_code == 200
error_message = "${self.url} returned an unhealthy status code"
condition = self.status_code == 200
error_message = "${self.url} returned an unhealthy status code"
}
}

depends_on = [ helm_release.coder_primary, cloudflare_record.coder["primary"] ]
depends_on = [helm_release.coder_primary, cloudflare_record.coder["primary"]]
}

resource "null_resource" "proxy_tokens" {
provisioner "local-exec" {
interpreter = [ "/bin/bash", "-c" ]
command = <<EOF
interpreter = ["/bin/bash", "-c"]
command = <<EOF
curl '${local.deployments.primary.url}/api/v2/users/first' \
--data-raw $'{"email":"${local.coder_admin_email}","password":"${local.coder_admin_password}","username":"${local.coder_admin_user}","name":"${local.coder_admin_full_name}","trial":false}' \
--insecure --silent --output /dev/null
Expand Down Expand Up @@ -49,15 +49,15 @@ echo -n $${asia_token} > ${path.module}/.coderv2/asia_proxy_token
EOF
}

depends_on = [ data.http.coder_healthy ]
depends_on = [data.http.coder_healthy]
}

data "local_file" "europe_proxy_token" {
filename = "${path.module}/.coderv2/europe_proxy_token"
depends_on = [ null_resource.proxy_tokens ]
filename = "${path.module}/.coderv2/europe_proxy_token"
depends_on = [null_resource.proxy_tokens]
}

data "local_file" "asia_proxy_token" {
filename = "${path.module}/.coderv2/asia_proxy_token"
depends_on = [ null_resource.proxy_tokens ]
filename = "${path.module}/.coderv2/asia_proxy_token"
depends_on = [null_resource.proxy_tokens]
}
12 changes: 6 additions & 6 deletions scaletest/terraform/new/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,44 @@ provider "cloudflare" {
}

provider "kubernetes" {
alias = "primary"
alias = "primary"
host = "https://${google_container_cluster.cluster["primary"].endpoint}"
cluster_ca_certificate = base64decode(google_container_cluster.cluster["primary"].master_auth.0.cluster_ca_certificate)
token = data.google_client_config.default.access_token
}

provider "kubernetes" {
alias = "europe"
alias = "europe"
host = "https://${google_container_cluster.cluster["europe"].endpoint}"
cluster_ca_certificate = base64decode(google_container_cluster.cluster["europe"].master_auth.0.cluster_ca_certificate)
token = data.google_client_config.default.access_token
}

provider "kubernetes" {
alias = "asia"
alias = "asia"
host = "https://${google_container_cluster.cluster["asia"].endpoint}"
cluster_ca_certificate = base64decode(google_container_cluster.cluster["asia"].master_auth.0.cluster_ca_certificate)
token = data.google_client_config.default.access_token
}

provider "kubectl" {
alias = "primary"
alias = "primary"
host = "https://${google_container_cluster.cluster["primary"].endpoint}"
cluster_ca_certificate = base64decode(google_container_cluster.cluster["primary"].master_auth.0.cluster_ca_certificate)
token = data.google_client_config.default.access_token
load_config_file = false
}

provider "kubectl" {
alias = "europe"
alias = "europe"
host = "https://${google_container_cluster.cluster["europe"].endpoint}"
cluster_ca_certificate = base64decode(google_container_cluster.cluster["europe"].master_auth.0.cluster_ca_certificate)
token = data.google_client_config.default.access_token
load_config_file = false
}

provider "kubectl" {
alias = "asia"
alias = "asia"
host = "https://${google_container_cluster.cluster["asia"].endpoint}"
cluster_ca_certificate = base64decode(google_container_cluster.cluster["asia"].master_auth.0.cluster_ca_certificate)
token = data.google_client_config.default.access_token
Expand Down