cloudify-incubator / cloudify-awssdk-plugin

Next generation of Cloudify AWS support.
Apache License 2.0
3 stars 6 forks source link

Classic ELB does not save aws_resource_id property #140

Closed EarthmanT closed 6 years ago

gkatsaros commented 6 years ago

Hi, is there a plan/roadmap for solving this one? I am trying to associate existing VMs (use_external=true) with an ELB and the instances are not added. I think is due to this issue. Thank you very much.

Regards, Greg

EarthmanT commented 6 years ago

@gkatsaros Can you share an example Blueprint?

gkatsaros commented 6 years ago

@EarthmanT See here

EarthmanT commented 6 years ago

@gkatsaros If the VMs are existing resources, you should provide the cloudify.nodes.aws.ec2.Instances node property resource_id along with the use_external_resource. See the docs on common properties for the plugin.

Why are you using aws_resource_id operation input instead of resource_id?

gkatsaros commented 6 years ago

@EarthmanT I had found an example BP with the use_external_resource and input of aws_resource_id. It did not give any error and the resource seems to be picked up correctly for the VMs. I will give it a try though.

gkatsaros commented 6 years ago

@EarthmanT I did the change and used this BP now. Still the execution completes successful but the ELB in AWS does not contain any instances. The relationship execution for each instance seems to be successful in the logs:

Task succeeded 'cloudify_awssdk.elb.resources.classic.load_balancer.assoc'

Any ideas?

EarthmanT commented 6 years ago

Hi @gkatsaros. First, thanks for contacting about the issue. After testing your blueprint, I've identified two possible reasons that this behavior is occuring. We are now working on addressing both of the changes.

  1. Because the VM nodes are "external nodes" no relationship operation is occuring to add the VM to the LB backend. This is based on an old convention in Cloudify that nothing happens on external nodes. However, after considering it, the convention is flawed. I believe that the following logic is more desire-able:
  1. It seems like there is a race condition when 1 or more VMs are being added to a ELB simultaneously. We will need to do some state verification in the code.

Please expect to see a new version of the plugin shortly with the updated changes.

gkatsaros commented 6 years ago

@EarthmanT Thank you very much for your help. I believe that with the suggested changes my blueprint and execution scenario will work. Can I ask the reasoning for the first bullet? What is I want to orchestrate just the relationship between existing resources? Is it a valid use case? (I guess that is highly dependant on the implementation of each plugin, but could be a case if an API call is captured only through a relationship implementation.).

Thx again!

Looking forward to the new release.

EarthmanT commented 6 years ago

@gkatsaros There are two reasons why.

Consider the following case.

node_templates:

  node1:

  node2:
    properties:
      resource_id: node2
      use_external_resource: true

  node3:
    properties:
      resource_id: node3
      use_external_resource: true
    relationships:
    - target: node1
       type: cloudify.relationships.connected_to
    - target: node2
       type: cloudify.relationships.connected_to

In this case, more than one existing resources are connected, and no action will be expected, but an additional new node is also in the relationship list.

EarthmanT commented 6 years ago

@gkatsaros Issue should be fixed in this release: https://github.com/cloudify-incubator/cloudify-awssdk-plugin/releases/tag/2.5.0

160

gkatsaros commented 6 years ago

@EarthmanT I used this release, one instance was indeed registered in the ELB, however the second and third instance are not registered. Is that a normal behaviour or there is still an issue?

Thx

EarthmanT commented 6 years ago

@gkatsaros Forgot to mention: in your blueprint, you use {get_input: instance1} three times.

Can you update it to use instance1, instance2, instance3 respectively?

gkatsaros commented 6 years ago

LOL. Good catch. Thx!