Add metrics support to service template
This commit is contained in:
parent
e104cbccc4
commit
17ab7f637f
@ -13,6 +13,7 @@ resource "nomad_job" "service" {
|
||||
ingress_rule = var.ingress_rule
|
||||
ingress_middlewares = var.ingress_middlewares
|
||||
healthcheck_path = var.healthcheck_path
|
||||
metrics_port_name = var.metrics_port_name
|
||||
|
||||
templates = var.templates
|
||||
host_volumes = var.host_volumes
|
||||
|
@ -88,6 +88,12 @@ job "${name}" {
|
||||
timeout = "10s"
|
||||
}
|
||||
|
||||
%{ endif ~}
|
||||
%{ if metrics_port_name != null ~}
|
||||
meta {
|
||||
metrics_addr = "$${NOMAD_ADDR_${metrics_port_name}}"
|
||||
}
|
||||
|
||||
%{ endif ~}
|
||||
tags = [
|
||||
%{ if ingress ~}
|
||||
|
@ -11,7 +11,13 @@ variable "image" {
|
||||
variable "service_port" {
|
||||
type = number
|
||||
default = null
|
||||
description = "Port used by the service for ingress"
|
||||
description = "Port number used by the service"
|
||||
}
|
||||
|
||||
variable "metrics_port_name" {
|
||||
type = string
|
||||
default = null
|
||||
description = "Name of port that /metrics can be scraped from"
|
||||
}
|
||||
|
||||
variable "ingress" {
|
||||
@ -73,8 +79,8 @@ variable "templates" {
|
||||
change_signal = optional(string)
|
||||
left_delimiter = optional(string)
|
||||
right_delimiter = optional(string)
|
||||
mount = optional(bool)
|
||||
env = optional(bool)
|
||||
mount = optional(bool, true)
|
||||
env = optional(bool, false)
|
||||
}))
|
||||
default = []
|
||||
description = "Templates to be used"
|
||||
|
Loading…
Reference in New Issue
Block a user