Skip to content

chore: add terraform for spinning up load test cluster #7504

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 26 commits into from
May 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
29016dc
Port over initial version of v1 loadtest infra tf code
johnstcn May 5, 2023
8759e23
Fix VPC peering for CloudSQL
johnstcn May 8, 2023
bef9887
create clusters in vpc native networking mode
johnstcn May 8, 2023
ea42b44
gitignore tfstate
johnstcn May 8, 2023
9875f84
create pg database and user, fix db url
johnstcn May 8, 2023
8fb3511
ensure db is destroyed properly with terraform destroy
johnstcn May 8, 2023
13ca9e4
enable prometheus, add podmonitor spec
johnstcn May 10, 2023
3a3509b
add inline kubernetes template
johnstcn May 10, 2023
41ab251
add script to init coder instance and import template
johnstcn May 11, 2023
0bbf206
modify tls cert def
johnstcn May 11, 2023
d4b1fe6
fixup template
johnstcn May 11, 2023
2b5a15b
multiple fixes
johnstcn May 11, 2023
dbcfc64
rebuild docker image with certs
johnstcn May 11, 2023
69bdfd1
remove self-signed https for now
johnstcn May 12, 2023
99c0f3c
move monitoring manifest out of helm chart
johnstcn May 12, 2023
ccda05d
move generated files into .coderv2, create shim script
johnstcn May 12, 2023
6ace619
adjust template limits
johnstcn May 12, 2023
01c6d39
make fmt
johnstcn May 12, 2023
9f7c165
make lint
johnstcn May 12, 2023
660959c
make gen
johnstcn May 12, 2023
34f8b02
update README
johnstcn May 12, 2023
75d1746
fixup! update README
johnstcn May 12, 2023
5a3c801
update cluster monitoriong and workload identity
johnstcn May 12, 2023
caa04d4
fix coder depoyment node affinity
johnstcn May 12, 2023
9419701
address PR comments
johnstcn May 15, 2023
435e74d
make fmt
johnstcn May 15, 2023
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
address PR comments
  • Loading branch information
johnstcn committed May 15, 2023
commit 941970150c5cd7730dab1511abd65e0d90516d69
17 changes: 1 addition & 16 deletions scaletest/terraform/coder.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ data "google_client_config" "default" {}
locals {
coder_helm_repo = "https://helm.coder.com/v2"
coder_helm_chart = "coder"
coder_release_name = "coder-${var.name}"
coder_release_name = var.name
coder_namespace = "coder-${var.name}"
coder_admin_email = "admin@coder.com"
coder_admin_user = "coder"
Expand Down Expand Up @@ -238,21 +238,6 @@ resource "local_file" "kubernetes_template" {
}
}
}
pod_affinity {
preferred_during_scheduling_ignored_during_execution {
weight = 1
pod_affinity_term {
topology_key = "kubernetes.io/hostname"
label_selector {
match_expressions {
key = "app.kubernetes.io/name"
operator = "In"
values = ["coder-workspace"]
}
}
}
}
}
}
}
}
Expand Down
20 changes: 4 additions & 16 deletions scaletest/terraform/gcp_cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ data "google_compute_default_service_account" "default" {
}

resource "google_container_cluster" "primary" {
name = "${var.name}-cluster"
name = var.name
location = var.zone
project = var.project_id
network = google_compute_network.vpc.name
Expand Down Expand Up @@ -35,7 +35,7 @@ resource "google_container_cluster" "primary" {
}

resource "google_container_node_pool" "coder" {
name = "${var.name}-node-pool-coder"
name = "${var.name}-coder"
location = var.zone
project = var.project_id
cluster = google_container_cluster.primary.name
Expand All @@ -62,14 +62,10 @@ resource "google_container_node_pool" "coder" {
disable-legacy-endpoints = "true"
}
}

depends_on = [
google_container_cluster.primary
]
}

resource "google_container_node_pool" "workspaces" {
name = "${var.name}-node-pool-workspaces"
name = "${var.name}-workspaces"
location = var.zone
project = var.project_id
cluster = google_container_cluster.primary.name
Expand All @@ -96,14 +92,10 @@ resource "google_container_node_pool" "workspaces" {
disable-legacy-endpoints = "true"
}
}

depends_on = [
google_container_cluster.primary
]
}

resource "google_container_node_pool" "misc" {
name = "${var.name}-node-pool-misc"
name = "${var.name}-misc"
location = var.zone
project = var.project_id
cluster = google_container_cluster.primary.name
Expand All @@ -130,8 +122,4 @@ resource "google_container_node_pool" "misc" {
disable-legacy-endpoints = "true"
}
}

depends_on = [
google_container_cluster.primary
]
}
13 changes: 2 additions & 11 deletions scaletest/terraform/gcp_db.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
data "google_compute_network" "default" {
project = var.project_id
name = "default"
}

data "google_compute_global_address" "sql_peering" {
name = "sql-ip-address"
}

resource "google_sql_database_instance" "db" {
name = "${var.name}-db"
name = var.name
region = var.region
database_version = var.cloudsql_version
deletion_protection = false
Expand All @@ -26,7 +17,7 @@ resource "google_sql_database_instance" "db" {

database_flags {
name = "max_connections"
value = "500"
value = var.cloudsql_max_connections
}

ip_configuration {
Expand Down
4 changes: 2 additions & 2 deletions scaletest/terraform/gcp_vpc.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
resource "google_compute_network" "vpc" {
project = var.project_id
name = "${var.name}-vpc"
name = var.name
auto_create_subnetworks = "false"
depends_on = [
google_project_service.api["compute.googleapis.com"]
]
}

resource "google_compute_subnetwork" "subnet" {
name = "${var.name}-subnet"
name = var.name
project = var.project_id
region = var.region
network = google_compute_network.vpc.name
Expand Down
5 changes: 5 additions & 0 deletions scaletest/terraform/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ variable "cloudsql_tier" {
default = "db-f1-micro"
}

variable "cloudsql_max_connections" {
description = "CloudSQL database max_connections"
default = 500
}

// These variables control the Coder deployment.
variable "coder_replicas" {
description = "Number of Coder replicas to provision"
Expand Down