Add windows slaves
This commit is contained in:
parent
23eb634e9c
commit
41f6b6d5c2
7 changed files with 143 additions and 8 deletions
4
terraform/README.md
Normal file
4
terraform/README.md
Normal file
|
@ -0,0 +1,4 @@
|
|||
export PROJECT_ID="pre-merge-checks"
|
||||
terraform init -backend-config="bucket=terraform-state-${PROJECT_ID}" -backend-config="prefix=terraform/state"
|
||||
|
||||
terraform apply -var-file="variables.tfvars" --auto-approve
|
|
@ -1,7 +1,4 @@
|
|||
terraform {
|
||||
backend "gcs" {
|
||||
#has to have the same name as the tf state bucket created in main.tf
|
||||
bucket = "terraform-state-pre-merge-checks" #todo var
|
||||
prefix = "terraform/state"
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@ resource "google_container_node_pool" "linux_agents_nodepool" {
|
|||
|
||||
node_config {
|
||||
machine_type = var.linux-agents-machine-type
|
||||
image_type = "cos_containerd"
|
||||
|
||||
#todo: assign right permissions and use custom service account
|
||||
service_account = "1047329282069-compute@developer.gserviceaccount.com" #google_service_account.llvm_premerge_checks_sa.email
|
||||
|
@ -49,7 +50,28 @@ resource "google_container_node_pool" "linux_agents_nodepool" {
|
|||
|
||||
autoscaling {
|
||||
min_node_count = 0
|
||||
max_node_count = 6
|
||||
max_node_count = var.linux-agents-count
|
||||
}
|
||||
}
|
||||
|
||||
resource "google_container_node_pool" "windows_agents_nodepool" {
|
||||
name = "windows-agents"
|
||||
cluster = google_container_cluster.llvm_premerge_checks_cluster.id
|
||||
|
||||
node_config {
|
||||
machine_type = var.windows-agents-machine-type
|
||||
image_type = "windows_ltsc_containerd" # todo ltsc or sac ?
|
||||
|
||||
#todo: assign right permissions and use custom service account
|
||||
service_account = "1047329282069-compute@developer.gserviceaccount.com" #google_service_account.llvm_premerge_checks_sa.email
|
||||
oauth_scopes = [
|
||||
"https://www.googleapis.com/auth/cloud-platform"
|
||||
]
|
||||
}
|
||||
|
||||
autoscaling {
|
||||
min_node_count = 0
|
||||
max_node_count = var.windows-agents-count
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,3 +114,8 @@ resource "kubernetes_manifest" "buildkite_linux_agent" {
|
|||
manifest = yamldecode(templatefile("kubernetes/linux-agents.yaml", { project-id = var.project-id, gke-nodepool = google_container_node_pool.linux_agents_nodepool.name, build-queue = var.linux-agents-build-queue, cpu-request = var.linux-agents-cpu-request, mem-request = var.linux-agents-mem-request, replicas-count = var.linux-agents-count }))
|
||||
depends_on = [kubernetes_manifest.buildkite_namespace]
|
||||
}
|
||||
|
||||
resource "kubernetes_manifest" "buildkite_windows_agent" {
|
||||
manifest = yamldecode(templatefile("kubernetes/windows-agents.yaml", { project-id = var.project-id, gke-nodepool = google_container_node_pool.windows_agents_nodepool.name, build-queue = var.windows-agents-build-queue, cpu-request = var.windows-agents-cpu-request, mem-request = var.windows-agents-mem-request, replicas-count = var.windows-agents-count }))
|
||||
depends_on = [kubernetes_manifest.buildkite_namespace]
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2021 Google LLC
|
||||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
|
@ -78,5 +78,5 @@ spec:
|
|||
- name: workdir
|
||||
emptyDir: {}
|
||||
nodeSelector:
|
||||
cloud.google.com/gke-nodepool: ${gke-nodepool} #generate dynamically
|
||||
cloud.google.com/gke-nodepool: ${gke-nodepool}
|
||||
terminationGracePeriodSeconds: 3600
|
82
terraform/kubernetes/windows-agents.yaml
Normal file
82
terraform/kubernetes/windows-agents.yaml
Normal file
|
@ -0,0 +1,82 @@
|
|||
# Copyright 2022 Google LLC
|
||||
#
|
||||
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://llvm.org/LICENSE.txt
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: windows-agents
|
||||
namespace: buildkite
|
||||
spec:
|
||||
replicas: ${replicas-count}
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 50%
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: agent-premerge-windows
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: agent-premerge-windows
|
||||
spec:
|
||||
containers:
|
||||
- name: buildkite-premerge-windows
|
||||
image: gcr.io/${project-id}/buildkite-premerge-windows
|
||||
resources:
|
||||
limits:
|
||||
cpu: ${cpu-request}
|
||||
memory: ${mem-request}
|
||||
requests:
|
||||
cpu: ${cpu-request}
|
||||
memory: ${mem-request}
|
||||
# volumeMounts:
|
||||
# - name: workdir
|
||||
# mountPath: "C:\\ws"
|
||||
env:
|
||||
- name: buildkiteAgentToken
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: buildkite-agent-token
|
||||
key: token
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: BUILDKITE_AGENT_TAGS
|
||||
value: "queue=${build-queue},name=$(POD_NAME)"
|
||||
# - name: BUILDKITE_BUILD_PATH
|
||||
# value: "C:\\ws"
|
||||
- name: CONDUIT_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: conduit-api-token
|
||||
key: token
|
||||
- name: BUILDKITE_API_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: buildkite-api-token-readonly
|
||||
key: token
|
||||
# volumes:
|
||||
# - name: workdir
|
||||
# emptyDir: {}
|
||||
nodeSelector:
|
||||
cloud.google.com/gke-nodepool: ${gke-nodepool}
|
||||
tolerations:
|
||||
- key: "node.kubernetes.io/os"
|
||||
operator: "Equal"
|
||||
value: "windows"
|
||||
effect: "NoSchedule"
|
||||
terminationGracePeriodSeconds: 3600
|
|
@ -5,7 +5,7 @@ resource "google_project_service" "cloudbuild_api" {
|
|||
}
|
||||
|
||||
resource "google_storage_bucket" "terraform_state" {
|
||||
name = "terraform-state-${var.project-id}" #todo var
|
||||
name = "terraform-state-${var.project-id}"
|
||||
location = "EU"
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ resource "google_compute_router" "router" {
|
|||
network = google_compute_network.vpc_network.id
|
||||
|
||||
bgp {
|
||||
asn = 64514
|
||||
asn = 64514 #todo recheck
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,31 @@ variable "linux-agents-mem-request" {
|
|||
default = "80Gi"
|
||||
}
|
||||
|
||||
variable "windows-agents-machine-type" {
|
||||
type = string
|
||||
default = "c2-standard-16"
|
||||
}
|
||||
|
||||
variable "windows-agents-count" {
|
||||
type = number
|
||||
default = 8
|
||||
}
|
||||
|
||||
variable "windows-agents-build-queue" {
|
||||
type = string
|
||||
default = "windows"
|
||||
}
|
||||
|
||||
variable "windows-agents-cpu-request" {
|
||||
type = string
|
||||
default = "15"
|
||||
}
|
||||
|
||||
variable "windows-agents-mem-request" {
|
||||
type = string
|
||||
default = "60Gi"
|
||||
}
|
||||
|
||||
variable "buildkite-api-token-readonly" {
|
||||
type = string
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue