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
working eu
  • Loading branch information
f0ssel committed Dec 6, 2024
commit 2e7396a748a5a30a2daf748aa296c6fc9ef1e5ac
8 changes: 8 additions & 0 deletions scaletest/terraform/new/cf_dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ resource "cloudflare_record" "coder" {
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
type = "A"
ttl = 3600
}
36 changes: 32 additions & 4 deletions scaletest/terraform/new/k8s_coder.tf
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@
namespace = kubernetes_namespace.coder_europe.metadata.0.name
}
data = {
token = terraform_data.proxy_tokens.output.europe
token = trimspace(data.local_file.europe_proxy_token.content)
}
lifecycle {
ignore_changes = [timeouts, wait_for_service_account_token]
Expand All @@ -295,6 +295,7 @@
namespace = kubernetes_namespace.coder_europe.metadata.0.name
values = [<<EOF
coder:
workspaceProxy: true
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -319,7 +320,7 @@
- name: CODER_PROXY_SESSION_TOKEN
valueFrom:
secretKeyRef:
key: europe
key: token
name: "${kubernetes_secret.proxy_token_europe.metadata.0.name}"
- name: "CODER_ACCESS_URL"
value: "${local.coder_europe_url}"
Expand Down Expand Up @@ -556,7 +557,7 @@

data "http" "coder_healthy" {
url = local.coder_url
// Wait up to 5 minutes for DNS to propogate

Check warning on line 560 in scaletest/terraform/new/k8s_coder.tf

View workflow job for this annotation

GitHub Actions / lint

"propogate" should be "propagate".
retry {
attempts = 30
min_delay_ms = 10000
Expand All @@ -572,7 +573,7 @@
depends_on = [ helm_release.coder-chart, cloudflare_record.coder ]
}

resource "terraform_data" "proxy_tokens" {
resource "null_resource" "proxy_tokens" {
provisioner "local-exec" {
interpreter = [ "/bin/bash", "-c" ]
command = <<EOF
Expand All @@ -599,10 +600,37 @@
--data-raw '{"name":"asia"}' \
--insecure --silent | jq -r .proxy_token)

echo "{\"europe\": \"$${europe_token}\", \"asia\": \"$${asia_token}\"}"
echo -n $${europe_token} > ${path.module}/europe_proxy_token
echo -n $${asia_token} > ${path.module}/asia_proxy_token
EOF
}

depends_on = [ data.http.coder_healthy ]
}

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

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

# data "external" "proxy_tokens" {
# program = ["bash", "${path.module}/workspace_proxies.sh"]
# query = {
# coder_url = local.coder_url
# coder_admin_email = local.coder_admin_email
# coder_admin_password = local.coder_admin_password
# coder_admin_user = local.coder_admin_user
# coder_admin_full_name = local.coder_admin_full_name
# coder_license = var.coder_license

# status_code = data.http.coder_healthy.status_code
# }

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

Loading