Skip to content

refactor(scaletest/terraform): break up infra creation and k8s resource provisioning #9824

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 5 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
johnstcn committed Sep 22, 2023
commit 7ba1cd5e0227cce5a79a7e22c295ffa23e817bb6
6 changes: 3 additions & 3 deletions scaletest/terraform/infra/gcp_cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ data "google_compute_default_service_account" "default" {
}

locals {
abs_module_path = "${abspath(path.module)}"
rel_kubeconfig_path = "../../.coderv2/${var.name}-cluster.kubeconfig"
cluster_kubeconfig_path = "${abspath("${local.abs_module_path}/${local.rel_kubeconfig_path}")}"
abs_module_path = abspath(path.module)
rel_kubeconfig_path = "../../.coderv2/${var.name}-cluster.kubeconfig"
cluster_kubeconfig_path = abspath("${local.abs_module_path}/${local.rel_kubeconfig_path}")
}

resource "google_container_cluster" "primary" {
Expand Down
28 changes: 14 additions & 14 deletions scaletest/terraform/infra/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
output "coder_db_url" {
description = "URL of the database for Coder."
value = local.coder_db_url
sensitive = true
value = local.coder_db_url
sensitive = true
}

output "coder_address" {
description = "IP address to use for the Coder service."
value = google_compute_address.coder.address
value = google_compute_address.coder.address
}

output "kubernetes_kubeconfig_path" {
description = "Kubeconfig path."
value = local.cluster_kubeconfig_path
value = local.cluster_kubeconfig_path
}

output "kubernetes_nodepool_coder" {
description = "Name of the nodepool on which to run Coder."
value = google_container_node_pool.coder.name
value = google_container_node_pool.coder.name
}

output "kubernetes_nodepool_misc" {
description = "Name of the nodepool on which to run everything else."
value = google_container_node_pool.misc.name
value = google_container_node_pool.misc.name
}

output "kubernetes_nodepool_workspaces" {
description = "Name of the nodepool on which to run workspaces."
value = google_container_node_pool.workspaces.name
value = google_container_node_pool.workspaces.name
}

output "prometheus_external_label_cluster" {
description = "Value for the Prometheus external label named cluster."
value = google_container_cluster.primary.name
value = google_container_cluster.primary.name
}

output "prometheus_postgres_dbname" {
description = "Name of the database for Prometheus to monitor."
value = google_sql_database.coder.name
value = google_sql_database.coder.name
}

output "prometheus_postgres_host" {
description = "Hostname of the database for Prometheus to connect to."
value = google_sql_database_instance.db.private_ip_address
value = google_sql_database_instance.db.private_ip_address
}

output "prometheus_postgres_password" {
description = "Postgres password for Prometheus."
value = random_password.prometheus-postgres-password.result
sensitive = true
value = random_password.prometheus-postgres-password.result
sensitive = true
}

output "prometheus_postgres_user" {
description = "Postgres username for Prometheus."
value = google_sql_user.prometheus.name
value = google_sql_user.prometheus.name
}

resource "local_file" "outputs" {
filename = "${path.module}/../../.coderv2/infra_outputs.tfvars"
content = <<EOF
content = <<EOF
coder_db_url = "${local.coder_db_url}"
coder_address = "${google_compute_address.coder.address}"
kubernetes_kubeconfig_path = "${local.cluster_kubeconfig_path}"
Expand Down
6 changes: 3 additions & 3 deletions scaletest/terraform/k8s/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ variable "coder_address" {

variable "coder_db_url" {
description = "URL of the database for Coder to use."
sensitive = true
sensitive = true
}

// Ensure that requests allow for at least two replicas to be scheduled
Expand Down Expand Up @@ -247,7 +247,7 @@ variable "prometheus_postgres_host" {

variable "prometheus_postgres_password" {
description = "Postgres password for Prometheus."
sensitive = true
sensitive = true
}

variable "prometheus_postgres_user" {
Expand All @@ -262,7 +262,7 @@ variable "prometheus_remote_write_user" {
variable "prometheus_remote_write_password" {
description = "Password for Prometheus remote write."
default = ""
sensitive = true
sensitive = true
}

variable "prometheus_remote_write_url" {
Expand Down