Salt: No support for GCP static internal IP creation for instance

Created on 8 Feb 2018  路  15Comments  路  Source: saltstack/salt

Description of Issue/Question

Salt GCP integration currently does not support static internal IP creation / assignment.

Is there any plan to provide this?

Confirmed Feature

Most helpful comment

Even if the status says "Closed" above, the change is now in libcloud trunk! Yay. It won't make it into libcloud 2.3.0, but will be in the next minor release (probably 2.3.1).

All 15 comments

@jeremysolarz Thanks for the report. This would definitely be a good feature to include in the GCE support.

This looks like it could be a fairly trivial implementation.

salt-cloud gce driver uses libcloud gce driver which apparently already implements the create_node(internal_ip='10.1.2.3') style address assignment at node creation time.
https://github.com/apache/libcloud/blob/trunk/libcloud/compute/drivers/gce.py#L3773

The GCP REST API appears to create a new VM with assigned resource.networkInterfaces[].networkIP
https://cloud.google.com/compute/docs/reference/rest/v1/instances/insert

However from GCP docs it seems the instance creation requires an IP address reservation before assigning the IP. Apache libcloud gce driver does not appear to implement the address reservation part of the GCP API.
https://cloud.google.com/compute/docs/ip-addresses/reserve-static-internal-ip-address#creating_a_vm_instance_with_a_static_internal_ip_address

@jeremysolarz can you provide some clarification on the behavior required by the salt-cloud gce driver to make the IP address assignment at instance creation time work properly?

Hi @aphor,

Thanks for the response.

Similar to how you handle External IP assignment it would be great to have a create_or_get here.

So, if there exists an internal IP use it otherwise create it.

Does this make sense?

Does the static external IP address assignment functionality currently behave exactly the way we want the static internal IP address assignment to work? It's easier to implement a pattern established by existing code, which is what I think you're suggesting.

According to this it's same behavior.

Especially that line

Optionally, pass the name of a GCE address to use a fixed IP address. If the address does not already exist, it will be created.

Coming back to your statement above

Looks like libcloud is missing the parameter to create internal ips ...
Or could you find another hint?

Looks like two parameters are missing in libcloud ex_create_address (taken from GCP docu)

  • addressType
  • subnetwork

Furthermore, it looks like creation of static internal ips vs external ips is only distinguished by attaching --subnet parameter in gcloud command
gcloud compute addresses create example-address-1 \ --region us-central1 --subnet subnet-1 --addresses 10.128.0.12

Hi @aphor,

If you already started on implementing this please tell. I have bandwidth this weekend to implement this and don't want that we cross each others lines here.

Best,

JS

Please go ahead :) I don't have the time this week or next.

Even if the status says "Closed" above, the change is now in libcloud trunk! Yay. It won't make it into libcloud 2.3.0, but will be in the next minor release (probably 2.3.1).

@pquentin could you please update when the release will be available?

Would love to update Salt dependencies to the new version and start with extending Salt with the new functionality.

I can't promise I won't forget, but I'll try!

@jeremysolarz libcloud 2.4.0 is now out with your change! Thank you, and sorry for the delay

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Thank you for updating this issue. It is no longer marked as stale.

Was this page helpful?
0 / 5 - 0 ratings