[llvm] [CI] Upstream premerge terraform configuration (PR #117397)

Vlad Serebrennikov via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 24 04:33:46 PST 2024


================
@@ -0,0 +1,365 @@
+terraform {
+  required_providers {
+    google = {
+      source  = "hashicorp/google"
+      version = "4.51.0"
+    }
+  }
+}
+
+provider "google" {
+  project = "llvm-premerge-checks"
+}
+
+resource "random_id" "default" {
+  byte_length = 8
+}
+
+resource "google_storage_bucket" "terraform_state_bucket" {
+  name     = "${random_id.default.hex}-terraform-remote-backend"
+  location = "US"
+
+  force_destroy               = false
+  public_access_prevention    = "enforced"
+  uniform_bucket_level_access = true
+
+  versioning {
+    enabled = true
+  }
+}
+
+resource "local_file" "terraform_state" {
+  file_permission = "0644"
+  filename        = "${path.module}/backend.tf"
+
+  content = <<-EOT
+  terraform {
+    backend "gcs" {
+      bucket = "${google_storage_bucket.terraform_state_bucket.name}"
+    }
+  }
+  EOT
+}
+
+data "google_client_config" "current" {}
+
+resource "google_container_cluster" "llvm_premerge" {
+  name     = var.cluster_name
+  location = "europe-west3-a"
+
+  # We can't create a cluster with no node pool defined, but we want to only use
+  # separately managed node pools. So we create the smallest possible default
+  # node pool and immediately delete it.
+  remove_default_node_pool = true
+  initial_node_count       = 1
+
+  # Set the networking mode to VPC Native to enable IP aliasing, which is required
+  # for adding windows nodes to the cluster.
+  networking_mode = "VPC_NATIVE"
+  ip_allocation_policy {}
+}
+
+resource "google_container_node_pool" "llvm_premerge_linux_service" {
+  name       = "llvm-premerge-linux-service"
+  location   = "europe-west3-a"
+  cluster    = google_container_cluster.llvm_premerge.name
+  node_count = 2
+
+  node_config {
+    machine_type = "e2-small"
+  }
+}
+
+resource "google_container_node_pool" "llvm_premerge_linux" {
+  name               = "llvm-premerge-linux"
+  location           = "europe-west3-a"
+  cluster            = google_container_cluster.llvm_premerge.name
+  initial_node_count = 0
+
+  autoscaling {
+    total_min_node_count = 0
+    total_max_node_count = 4
+  }
+
+  node_config {
+    machine_type = "c2d-highcpu-56"
+    taint = [{
+      key    = "premerge-platform"
+      value  = "linux"
+      effect = "NO_SCHEDULE"
+    }]
+    labels = {
+      "premerge-platform" : "linux"
+    }
+  }
+}
+
+resource "google_container_node_pool" "llvm_premerge_windows" {
+  name               = "llvm-premerge-windows"
+  location           = "europe-west3-a"
+  cluster            = google_container_cluster.llvm_premerge.name
+  initial_node_count = 0
+
+  autoscaling {
+    total_min_node_count = 0
+    total_max_node_count = 2
+  }
+
+  node_config {
----------------
Endilll wrote:

You specify tolerations for windows runners, but don't specify taints here. Is this intended? I see that for linux runners you specify both tolerations and taints.

https://github.com/llvm/llvm-project/pull/117397


More information about the llvm-commits mailing list