Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Operators in Metadata #1143

Open
ForbiddenEra opened this issue Mar 7, 2015 · 5 comments
Open

Operators in Metadata #1143

ForbiddenEra opened this issue Mar 7, 2015 · 5 comments

Comments

@ForbiddenEra
Copy link

Would the authors consider allowing operators in metadata?

ie:

[X-fleet]
MachineMetadata=ram>=2048

This + way to update metadata easier = dynamic metadata, awesome? lame? opinions?

thanks

@ForbiddenEra
Copy link
Author

I was doing some reading last night, and it turns out systemd actually supports some of this (similar) already in unit files.

Here's the article I was reading (look under the header of "Language Issues")
http://lwn.net/Articles/584176/

Though I'm guessing something like..

[X-fleet]
MachineMetadata=!ram=1024

..wouldn't work..?

@bcwaldon
Copy link
Contributor

I don't really have an issue with this, but we need to put some effort into design before we can move forward.

@HarryR
Copy link

HarryR commented Mar 24, 2015

Variable expansion in the MachineMetadata field would be a good use case too, for example in a template I could specify that no two units will be placed in the same datacenter or on a machine which is already running the service.

[X-Fleet]
MachineMetadata=dc!=$METADATA_DC
MachineMetadata=role!=db
MachineMetadata=cores>=4
Conflicts=$NAME

wuqixuan pushed a commit to wuqixuan/fleet that referenced this issue Jul 6, 2015
If define metadata in fleet conf, such as "ram=1024", we can
define the operator in [X-Fleet] unit as below:
[X-Fleet]
MachineMetadata=ram>=2048
The operators have been supported: "<=", ">=", "!=", "<", ">", "="
If the operatior are "<=", ">=", "!=", "<", ">", the value should
be integer, otherwise, the unit will never be launched.

Fixes coreos#1143
wuqixuan pushed a commit to wuqixuan/fleet that referenced this issue Jul 7, 2015
@iby
Copy link

iby commented Sep 25, 2015

That would be pretty awesome indeed. Is there a way of dealing with list values at all? For example, if I have several groups, like app, lb, postgres and mongo, where a host may be present in more than one group, then I'd like to have group='app,lb,postgres' metadata set on it. But the only way to describe this with fleet would be more like group_app=true, group_lb=true, group_postgres=true, right?

Would you also consider supporting lists and contains or in operator? Or maybe even better (for consistency sake) support repeating keys in metadata, combine items with repeated keys into a list, and use same operators, e.g., group==lb would check if an item is present in the list, group!=mongo that it's not, etc.

@jbguerraz
Copy link

@ianbytchek +1
list values (typically for groups/roles usage) is definitely something needed

dongsupark pushed a commit to dongsupark/fleet that referenced this issue Jun 3, 2016
If define metadata in fleet conf, such as "ram=1024", we can
define the operator in [X-Fleet] unit as below:
[X-Fleet]
MachineMetadata=ram>=2048
The operators have been supported: "<=", ">=", "!=", "<", ">", "="
If the operatior are "<=", ">=", "!=", "<", ">", the value should
be integer, otherwise, the unit will never be launched.

Fixes coreos#1143
dongsupark pushed a commit to dongsupark/fleet that referenced this issue Jun 3, 2016
dongsupark pushed a commit to dongsupark/fleet that referenced this issue Jul 13, 2016
If define metadata in fleet conf, such as "ram=1024", we can
define the operator in [X-Fleet] unit as below:
[X-Fleet]
MachineMetadata=ram>=2048
The operators have been supported: "<=", ">=", "!=", "<", ">", "="
If the operatior are "<=", ">=", "!=", "<", ">", the value should
be integer, otherwise, the unit will never be launched.

Fixes coreos#1143
dongsupark pushed a commit to dongsupark/fleet that referenced this issue Jul 13, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants