Closed
Description
The original idea came from @kconley-sq.
Right now, Resource Metadata values are generated at workspace build time. For example:
resource "coder_metadata" "deployment" {
count = data.coder_workspace.me.start_count
resource_id = kubernetes_deployment.coder[0].id
item {
key = "name"
value = kubernetes_deployment.coder[0].metadata[0].name
}
}
The feature excels at showing workspace configuration but can't expose key dynamic information such as CPU usage, load average, and the number of active connections. Here's an alternate syntax that could capture these dynamic values:
resource "coder_metadata" "deployment" {
count = data.coder_workspace.me.start_count
resource_id = kubernetes_deployment.coder[0].id
item {
key = "name"
value_cmd = "cat /proc/loadavg"
# This could also be a cron
value_cmd_interval = "5s"
}
}
The agent would execute the value_cmd
. So, it could also make sense to configure dynamic metadata in the coder_agent
definition block. However they are defined, I think it makes sense to expose these values in the Agent section of the resources table. See below:
Ideas:
- CPU
- Memory
curl ifconfig.me
git status