Bundle YAML files should use YAML key/value , syntax rather than implement a mini-language in value strings
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Canonical Juju |
Triaged
|
Low
|
Unassigned |
Bug Description
We should ensure that our YAML files are amenable to syntax highlighting and other forms of static analysis. This will minimise the likelihood that typos will propagate into deployments. For example, bundles recycle the command-line constraints syntax for the application constraints key:
The (currently valid) snippet:
applications:
<app>:
constraints: "mem=1G arch=amd64"
Would ideally be expressed as:
applications:
<app>:
constraints:
arch: amd64
mem: 1G
This also appears in kubernetes bundles. The placement directive is a set of key/value pairs wedged into a string.
The placement directive here:
applications:
<app>:
placement: "a=b c=d"
Could be:
applications:
<app>:
placement:
a: b
c: d
This would not need to be a breaking change. Juju could inspect the type of the value. When it's presented as a string, interpret using the current behaviour.
The one thing to watch out for is making sure that it's easy for users to map what they'd type in the CLI to the bundle here as much of this is still hand tweaked and written. The reason for the current string versions is that it takes what the CLI does for commonality. It would be nice to support both setups to avoid users having to do the lookups themselves.