Add group_start template

This commit is contained in:
Daniel Berteaud 2024-04-08 23:02:56 +02:00
parent 6eff79ad64
commit 65e9771acc
2 changed files with 21 additions and 1 deletions

20
templates/group_start Normal file
View File

@ -0,0 +1,20 @@
[[- if has . "count" ]]
count = [[ .count ]]
[[- end ]]
shutdown_delay = "6s"
[[ template "common/constraints" . ]]
[[- if has .nomad "update" ]]
update {
[[- range $key := coll.Slice "max_parallel" "health_check" "min_healthy_time" "healthy_deadline" "progress_deadline" "auto_revert" "auto_promote" "canary" "stagger" ]]
[[- if has $.nomad.update $key ]]
[[- if or (test.IsKind "bool" (index $.nomad.update $key)) (test.IsKind "number" (index $.nomad.update $key)) ]]
[[ $key ]] = [[ index $.nomad.update $key ]]
[[- else ]]
[[ $key ]] = [[ index $.nomad.update $key | toJSON ]]
[[- end ]]
[[- end ]]
[[- end ]]
}
[[- end ]]

View File

@ -16,7 +16,7 @@
update {
[[- range $key := coll.Slice "max_parallel" "health_check" "min_healthy_time" "healthy_deadline" "progress_deadline" "auto_revert" "auto_promote" "canary" "stagger" ]]
[[- if has $.nomad.update $key ]]
[[- if or (test.IsKind "bool" (index $.nomad.update $key)) (test.IsKind "int" (index $.nomad.update $key)) ]]
[[- if or (test.IsKind "bool" (index $.nomad.update $key)) (test.IsKind "number" (index $.nomad.update $key)) ]]
[[ $key ]] = [[ index $.nomad.update $key ]]
[[- else ]]
[[ $key ]] = [[ index $.nomad.update $key | toJSON ]]