You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.
Since the docs define each MachineMetadata entry as an OR, I'd expect it to mean this:
(diskType=SSD AND region=us-east-1) OR region=us-west-1
While it's actually parsed as this:
diskType=SSD AND (region=us-east-1OR region=us-west-1)
Something similar to this has caused me to post an issue a week earlier.
There's a pull request now, containing a few simple examples, including the one above, which is good. However, that doesn't fix the fact that some pretty trivial things, like an OR of two different meta keys (e.g. foo=bar OR abc=xyz), just can't be expressed using the current syntax.
I propose a simple backwards-compatible solution: SQL-like operators + brackets. To escape spaces / special words and stay consistent with the old syntax, each key=value is wrapped in double quotes. Then, key-values can be combined by either AND or OR (AND getting precedence over OR), and then grouped in brackets, if desired, just like in SQL. Additionally, for negation, use either NOT before a key-value or != / =! instead of = (the negation has been mentioned in this issue before). If the new syntax is used, then only one MachineMetadata per unit is allowed, as to avoid ambiguity.
So, the example above would look like this:
[X-Fleet]MachineMetadata=("region=us-east-1" AND "diskType=SSD") OR "region=us-west-1"
Brackets being redundant. IMO, even those unfamiliar with X-Fleet will understand what's going on.
The text was updated successfully, but these errors were encountered:
Right now
MachineMetadata
logic is quite counter-intuitive, at least to me. Here's an example:Since the docs define each
MachineMetadata
entry as anOR
, I'd expect it to mean this:While it's actually parsed as this:
Something similar to this has caused me to post an issue a week earlier.
There's a pull request now, containing a few simple examples, including the one above, which is good. However, that doesn't fix the fact that some pretty trivial things, like an
OR
of two different meta keys (e.g.foo=bar OR abc=xyz
), just can't be expressed using the current syntax.I propose a simple backwards-compatible solution: SQL-like operators + brackets. To escape spaces / special words and stay consistent with the old syntax, each
key=value
is wrapped in double quotes. Then, key-values can be combined by eitherAND
orOR
(AND
getting precedence overOR
), and then grouped in brackets, if desired, just like in SQL. Additionally, for negation, use eitherNOT
before a key-value or!=
/=!
instead of=
(the negation has been mentioned in this issue before). If the new syntax is used, then only oneMachineMetadata
per unit is allowed, as to avoid ambiguity.So, the example above would look like this:
Brackets being redundant. IMO, even those unfamiliar with
X-Fleet
will understand what's going on.The text was updated successfully, but these errors were encountered: