forked from hashicorp/levant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The include function allows templates to be composed of other templates. Fixes hashicorp#305
- Loading branch information
1 parent
2a7f995
commit 3e58eb9
Showing
8 changed files
with
190 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
template/test-fixtures/composition_services_template.nomad
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[[range $name, $port := . -]] | ||
service { | ||
name = "global-[[$name]]-check" | ||
tags = ["global"] | ||
port = "[[$name]]" | ||
check { | ||
name = "alive" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "2s" | ||
} | ||
} | ||
[[- end]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
task "[[.Name]]" { | ||
driver = "docker" | ||
config { | ||
image = "[[.Image]]" | ||
port_map = { | ||
[[range $name, $port := .Services -]] | ||
[[$name]] = [[$port]][[end]] | ||
} | ||
} | ||
|
||
resources { | ||
cpu = 500 | ||
memory = [[.Memory]] | ||
} | ||
|
||
[[include "test-fixtures/composition_services_template.nomad" .Services]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
job "[[.job_name]]" { | ||
datacenters = ["[[.datacentre]]"] | ||
type = "service" | ||
update { | ||
max_parallel = 1 | ||
min_healthy_time = "10s" | ||
healthy_deadline = "1m" | ||
auto_revert = true | ||
} | ||
|
||
group "[[env "GROUP_NAME_ENV"]]" { | ||
count = 1 | ||
restart { | ||
attempts = 10 | ||
interval = "5m" | ||
delay = "25s" | ||
mode = "delay" | ||
} | ||
ephemeral_disk { | ||
size = 300 | ||
} | ||
[[range $task := .tasks -]] | ||
[[include "test-fixtures/composition_task_template.nomad" $task | indent 2]] | ||
[[end]] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[include "test-fixtures/recursive_include_template_2.nomad" .]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[[include "test-fixtures/recursive_include_template_1.nomad" .]] |