common/templates/constraints

42 lines
1.1 KiB
Plaintext

[[- /* Add job constraints and affinity */]]
[[- if has .nomad "constraints" ]]
[[- range $idx, $constraint := .nomad.constraints ]]
constraint {
[[- if has $constraint "attribut" ]]
attribute = "[[ $constraint.attribute ]]"
[[- end ]]
[[- if has $constraint "operator" ]]
operator = "[[ $constraint.operator ]]"
[[- end ]]
[[- if has $constraint "value" ]]
value = "[[ $constraint.value ]]"
[[- end ]]
[[- if has $constraint "distinct_host" ]]
distinct_host = [[ $constraint.distinct_host ]]
[[- end ]]
}
[[- end ]]
[[- end ]]
[[- if has .nomad "affinities" ]]
[[- range $idx, $affinity := .nomad.affinities ]]
affinity {
[[- if has $affinity "attribute" ]]
attribute = "[[ $affinity.attribute ]]"
[[- end ]]
[[- if has $affinity "operator" ]]
operator = "[[ $affinity.operator ]]"
[[- end ]]
[[- if has $affinity "value" ]]
value = "[[ $affinity.value ]]"
[[- end ]]
[[- if has $affinity "weight" ]]
weight = [[ $affinity.weight ]]
[[- end ]]
}
[[- end ]]
[[- end ]]