Support passing the whole context for env and resources
This commit is contained in:
parent
ba25682e54
commit
ec581ab748
|
@ -1,4 +1,16 @@
|
|||
[[- range $k, $v := . ]]
|
||||
[[- /*
|
||||
# vim: syntax=hcl
|
||||
# Note: for compatibility, we take env either from .env (when passing the whole context to the template)
|
||||
# or from . (when only .env is passed as context)
|
||||
*/ -]]
|
||||
[[- $env := dict ]]
|
||||
[[- if and (has . "env") (isKind "map" .env) ]]
|
||||
[[- $env = .env ]]
|
||||
[[- else ]]
|
||||
[[ $env = . ]]
|
||||
[[- end -]]
|
||||
|
||||
[[- range $k, $v := $env ]]
|
||||
[[- if isKind "number" $v ]]
|
||||
[[ $k ]] = [[ $v ]]
|
||||
[[- else ]]
|
||||
|
|
|
@ -1,7 +1,19 @@
|
|||
[[- /*
|
||||
# vim: syntax=hcl
|
||||
# Note: for compatibility, we take resources either from .resources (when passing the whole context to the template)
|
||||
# or from . (when only .resources is passed as context)
|
||||
*/ -]]
|
||||
[[- $resources := dict ]]
|
||||
[[- if and (has . "resources") (isKind "map" .resources) ]]
|
||||
[[- $resources = .resources ]]
|
||||
[[- else ]]
|
||||
[[ $resources = . ]]
|
||||
[[- end -]]
|
||||
|
||||
resources {
|
||||
cpu = [[ .cpu ]]
|
||||
memory = [[ .memory ]]
|
||||
[[- if has . "memory_max" ]]
|
||||
memory_max = [[ .memory_max ]]
|
||||
[[- end ]]
|
||||
cpu = [[ $resources.cpu ]]
|
||||
memory = [[ $resources.memory ]]
|
||||
[[- if has $resources "memory_max" ]]
|
||||
memory_max = [[ $resources.memory_max ]]
|
||||
[[- end ]]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user