mirror of https://github.com/coder/coder.git
add: resource reqs/limits on K8s template (#6308)
This commit is contained in:
parent
7c46f76c82
commit
16364db483
|
@ -26,6 +26,34 @@ variable "os" {
|
|||
default = "ubuntu"
|
||||
}
|
||||
|
||||
variable "cpu" {
|
||||
description = "CPU (__ cores)"
|
||||
default = 2
|
||||
validation {
|
||||
condition = contains([
|
||||
"2",
|
||||
"4",
|
||||
"6",
|
||||
"8"
|
||||
], var.cpu)
|
||||
error_message = "Invalid cpu!"
|
||||
}
|
||||
}
|
||||
|
||||
variable "memory" {
|
||||
description = "Memory (__ GB)"
|
||||
default = 2
|
||||
validation {
|
||||
condition = contains([
|
||||
"2",
|
||||
"4",
|
||||
"6",
|
||||
"8"
|
||||
], var.memory)
|
||||
error_message = "Invalid memory!"
|
||||
}
|
||||
}
|
||||
|
||||
resource "coder_agent" "dev" {
|
||||
os = "linux"
|
||||
arch = "amd64"
|
||||
|
@ -80,10 +108,17 @@ resource "kubernetes_pod" "main" {
|
|||
run_as_user = "1000"
|
||||
}
|
||||
resources {
|
||||
requests = {
|
||||
"cpu" = "250m"
|
||||
"memory" = "500Mi"
|
||||
}
|
||||
limits = {
|
||||
# Acquire a FUSE device, powered by smarter-device-manager
|
||||
"github.com/fuse" : 1
|
||||
cpu = "${var.cpu}"
|
||||
memory = "${var.memory}Gi"
|
||||
}
|
||||
|
||||
}
|
||||
env {
|
||||
name = "CODER_AGENT_TOKEN"
|
||||
|
|
|
@ -31,6 +31,34 @@ variable "namespace" {
|
|||
description = "The Kubernetes namespace to create workspaces in (must exist prior to creating workspaces)"
|
||||
}
|
||||
|
||||
variable "cpu" {
|
||||
description = "CPU (__ cores)"
|
||||
default = 2
|
||||
validation {
|
||||
condition = contains([
|
||||
"2",
|
||||
"4",
|
||||
"6",
|
||||
"8"
|
||||
], var.cpu)
|
||||
error_message = "Invalid cpu!"
|
||||
}
|
||||
}
|
||||
|
||||
variable "memory" {
|
||||
description = "Memory (__ GB)"
|
||||
default = 2
|
||||
validation {
|
||||
condition = contains([
|
||||
"2",
|
||||
"4",
|
||||
"6",
|
||||
"8"
|
||||
], var.memory)
|
||||
error_message = "Invalid memory!"
|
||||
}
|
||||
}
|
||||
|
||||
variable "home_disk_size" {
|
||||
type = number
|
||||
description = "How large would you like your home volume to be (in GB)?"
|
||||
|
@ -147,6 +175,16 @@ resource "kubernetes_pod" "main" {
|
|||
name = "CODER_AGENT_TOKEN"
|
||||
value = coder_agent.main.token
|
||||
}
|
||||
resources {
|
||||
requests = {
|
||||
"cpu" = "250m"
|
||||
"memory" = "512Mi"
|
||||
}
|
||||
limits = {
|
||||
"cpu" = "${var.cpu}"
|
||||
"memory" = "${var.memory}Gi"
|
||||
}
|
||||
}
|
||||
volume_mount {
|
||||
mount_path = "/home/coder"
|
||||
name = "home"
|
||||
|
|
Loading…
Reference in New Issue