kdebisschop / rundeck-rancher-node-plugin

Manage Rancher-controlled Docker containers in Rundeck
Apache License 2.0
5 stars 0 forks source link

When stopped nodes have the same name as running nodes, node set selection is ambiguous #43

Open kdebisschop opened 4 years ago

kdebisschop commented 4 years ago

Describe the bug Since node name is used to index the nodes, nodes with the same name write over each other. (This was initially surfaced by efforts to increase code coverage).

To Reproduce Steps to reproduce the behavior:

  1. Add a unit test in node resources that collects containers and has a stopped and running node of the same name
  2. Count nodes in he resulting node set
  3. It will be less than the full set of nodes
kdebisschop commented 4 years ago

Possible solution is to remove the option to select stopped nodes -- it is not clear that it is useful anyway.

Possible alternatives are to use a different key for the nodes (but how do we know which is the stopped node and which is running?) or to interpret the toggle so only stopped nodes will be selected when the feature is enabled.

kdebisschop commented 4 years ago

This option was removed in 0.8.3 so the list of node names would be accurate.

A possible solution is to use the Rancher instance ID as the node name for stopped containers. The ID looks like 1i1234 so it cannot conflict with the node names generated by the rancher because those have dashes and the service and counter (they look like {name}-service-1).

Since there is no possible conflict, there cannot be index problem on the node list. It will still work with service-based nodes because they are named as {stack}-{service}. If stacks were to become nodes, then there would be possibility of conflict. But that seems manageable.