rundeck-plugins / rundeck-ec2-nodes-plugin

Get resource node data from Amazon EC2
85 stars 45 forks source link

Plugin De-Duplicating EC2 Nodes with same name? #10

Closed treeves closed 7 years ago

treeves commented 10 years ago

I have a number of auto-scaling groups that create nodes that, whilst having different EC2 tags, all have the same instance "name". It seems that the plugin is de-duplicating instances that have the same name and is not displaying them as nodes in Rundeck.

I.e. when I log in to the EC2 console, I have 330 running instances that come up. In Rundeck, only 218 appear when I pull with the same key via the EC2 plugin.

Each ASG that I have for each environment (dev, qa, stage, uat, etc) has multiple instances, all with the same instance name (although different tags, security groups, etc). Like:

Name Tag

fff-dev1-cq5-stack AuthorAutoscaleGroup fff-dev1-cq5-stack PublishAutoscaleGroup fff-dev1-cq5-stack DispatchAutoscaleGroup

But in Rundeck, only one of the above appears.

Is there something I can do to convince it that different instances are different, even if they have the same name?

gschueler commented 10 years ago

Rundeck uses the node "name" as the unique identifier. If you have instances with the same "name", you will need to switch to a unique value for the nodename.

I think you would need to use the instanceId as the nodename selector.

The ec2 plugin doesn't really support any composition of values to produce a field value, i think that would be a useful feature however.

patelgaurang83 commented 10 years ago

I had the same issue. I solved it by changing the below value in mapping.properties file.

From: nodename.selector=tags/Name,instanceId To: nodename.selector=instanceId

scalp42 commented 8 years ago

Same issue here, with ASGs of more than 10 nodes, only end up seeing 1.

Unfortunately, relying on instanceID makes it non user friendly :sake:

gschueler commented 8 years ago

@scalp42 would allowing something like tags/Name+instanceId (combine the two) be sufficient?

scalp42 commented 8 years ago

yes @gschueler would totally work :+1:

I think the only issue is how do you handle something like "$name-$instanceid", meaning with a dash etc and would compounding multiple ones with multiples + allowed, just for thoughts.

scalp42 commented 8 years ago

Also, at this point anything would be great but worth mentioning that some folks might have the + in the actual name:

Allowed characters for all regions are letters, spaces, and numbers representable in UTF-8, plus the following special characters: + - = . _ : / @

So tricky at best :sake:

gschueler commented 8 years ago

It definitely makes the mapping syntax more complicated.

+ allowed in instance names is probably fine, it wouldn't affect the mapping syntax, as the value would be expanded in place.

I was imagining using + to append multiple values. and allowing a quoted value to be a literal string, like:

nodename.selector=tags/Name+'-'+instanceId

would become "$name-$id" effectively

scalp42 commented 8 years ago

Oh that makes sense, yeah would totally work!

PS: if I had Java chops, I'd def help :speak_no_evil:

gschueler commented 8 years ago

@scalp42 that was recently filed as an issue as well, see https://github.com/rundeck-plugins/rundeck-ec2-nodes-plugin/issues/41

the workaround is to configure two instances of the ec2 source

gschueler commented 8 years ago

@scalp42 sorry i misunderstood. you mean in the rundeck search? you can search tags: mesos-slave+gz-prod

scalp42 commented 8 years ago

@gschueler got it :)

wilddog64 commented 8 years ago

does this get resolved in rundeck 2.6.4? I am more interesting to know how to setup this from the mappingParam at UI level. Now I have the syntax like this,

description.default=tags/Name;nodename.selector=privateDnsName;hostname.selector=privateIpAddress;

Although it mapped the node, but it can't de-deplicate the node instances. I'd like to see one to many mapping for my autoscaling group: X --> x1, x2, x3, ... xN.

How can I accomplish that by mappingParams