Make levant template support nomad only services
This commit is contained in:
parent
4430b3570e
commit
c9a892e377
@ -51,9 +51,6 @@ job "[[.name]]" {
|
||||
mode = "bridge"
|
||||
[[ if not (empty .service_port) -]]
|
||||
port "main" {
|
||||
[[ if default false .ingress -]]
|
||||
host_network = "loopback"
|
||||
[[ end -]]
|
||||
to = [[ .service_port ]]
|
||||
}
|
||||
[[ end -]]
|
||||
@ -79,46 +76,9 @@ job "[[.name]]" {
|
||||
[[ if not (empty .service_port) ]]
|
||||
service {
|
||||
name = "[[.name | replace "_" "-"]]"
|
||||
provider = "nomad"
|
||||
port = "main"
|
||||
|
||||
[[ if default false .ingress ]]
|
||||
connect {
|
||||
sidecar_service {
|
||||
proxy {
|
||||
local_service_port = [[ .service_port ]]
|
||||
[[ if default false .mysql -]]
|
||||
upstreams {
|
||||
destination_name = "mysql-server"
|
||||
local_bind_port = 4040
|
||||
}
|
||||
[[ end -]]
|
||||
[[ if default false .redis -]]
|
||||
upstreams {
|
||||
destination_name = "redis"
|
||||
local_bind_port = 6379
|
||||
}
|
||||
[[ end -]]
|
||||
[[ with .upstreams -]]
|
||||
[[range $u := . | parseJSON -]]
|
||||
upstreams {
|
||||
destination_name = "[[ $u.destination_name ]]"
|
||||
local_bind_port = [[ $u.local_bind_port ]]
|
||||
}
|
||||
[[ end ]]
|
||||
[[ end -]]
|
||||
}
|
||||
}
|
||||
|
||||
sidecar_task {
|
||||
resources {
|
||||
cpu = 50
|
||||
memory = 20
|
||||
memory_max = 50
|
||||
}
|
||||
}
|
||||
}
|
||||
[[ end ]]
|
||||
|
||||
[[ if not (eq .healthcheck "") -]]
|
||||
check {
|
||||
type = "http"
|
||||
@ -169,15 +129,6 @@ job "[[.name]]" {
|
||||
[[ end -]]
|
||||
}
|
||||
|
||||
[[ if default false .vault -]]
|
||||
vault {
|
||||
policies = [
|
||||
"access-tables",
|
||||
"nomad-task",
|
||||
]
|
||||
}
|
||||
[[ end -]]
|
||||
|
||||
[[ with .env -]]
|
||||
env = {
|
||||
[[ range $k, $v := . | parseJSON -]]
|
||||
|
Loading…
Reference in New Issue
Block a user