Skip to content

chore: add resources_monitoring to dogfood #16600

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 7 commits into from
Feb 19, 2025
Merged
Changes from all commits
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
39 changes: 38 additions & 1 deletion dogfood/contents/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
terraform {
required_providers {
coder = {
source = "coder/coder"
source = "coder/coder"
version = "2.2.0-pre0"
}
docker = {
source = "kreuzwerker/docker"
Expand Down Expand Up @@ -84,6 +85,30 @@ data "coder_parameter" "region" {
}
}

data "coder_parameter" "res_mon_memory_threshold" {
type = "number"
name = "Memory usage threshold"
default = 80
description = "The memory usage threshold used in resources monitoring to trigger notifications."
mutable = true
}

data "coder_parameter" "res_mon_volume_threshold" {
type = "number"
name = "Volume usage threshold"
default = 80
description = "The volume usage threshold used in resources monitoring to trigger notifications."
mutable = true
}

data "coder_parameter" "res_mon_volume_path" {
type = "string"
name = "Volume path"
default = "/home/coder"
description = "The path monitored in resources monitoring to trigger notifications."
mutable = true
}

provider "docker" {
host = lookup(local.docker_host, data.coder_parameter.region.value)
}
Expand Down Expand Up @@ -290,6 +315,18 @@ resource "coder_agent" "dev" {
timeout = 5
}

resources_monitoring {
memory {
enabled = true
threshold = data.coder_parameter.res_mon_memory_threshold.value
}
volume {
enabled = true
threshold = data.coder_parameter.res_mon_volume_threshold.value
path = data.coder_parameter.res_mon_volume_path.value
}
}

startup_script = <<-EOT
#!/usr/bin/env bash
set -eux -o pipefail
Expand Down
Loading