Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenStack LBaaS v2 Support #7012

Merged
merged 2 commits into from
Jun 10, 2016
Merged

OpenStack LBaaS v2 Support #7012

merged 2 commits into from
Jun 10, 2016

Conversation

dkalleg
Copy link
Contributor

@dkalleg dkalleg commented Jun 4, 2016

Gives support for LBaaS V2. Relies on a recent PR that's been merged to GopherCloud master: rackspace/gophercloud#575

@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 4, 2016

Can anyone give some guidance on how to bump the gophercloud version up to 67139b9485d6fd682c5314e963b0915e18f7947a ? Once that is done the integration tests should be able to build and run.

@jtopjian
Copy link
Contributor

jtopjian commented Jun 4, 2016

@dkalleg This is so awesome - thank you!

I did a quick read through the code and it looks great. There's some nits with regard to the embedded formatting in the tests, but that always happens and wouldn't block a merge. I think this should be able to get merged in time for 0.7.

With regard to the gophercloud version, Terraform just switched from godep to govender. This diff shows the difference between the two. If you'd like to give it a shot, go for it, and we can get someone to approve it. Or, if you'd like, I can try it out in a separate PR.

@@ -105,6 +105,11 @@ func Provider() terraform.ResourceProvider {
"openstack_lb_monitor_v1": resourceLBMonitorV1(),
"openstack_lb_pool_v1": resourceLBPoolV1(),
"openstack_lb_vip_v1": resourceLBVipV1(),
"openstack_lbaas_loadbalancer_v2": resourceLoadBalancerV2(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get that LBaaS v1 used the /lb/ URL and LBaaS v2 uses the lbaas URL, so I understand why you chose to use lbaas in the name... but I wonder if the resources should keep lb and LB in their names for consistency... Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong feeling either way. Unless someone else chimes in before Monday, I'll push an update for this.

@dkalleg dkalleg force-pushed the lbaas-v2 branch 2 times, most recently from f76112f to d0c39f2 Compare June 4, 2016 19:01
@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 4, 2016

Not sure what the conflict github is reporting is. Side effect of changing a vendor project? Thoughts?

@jtopjian
Copy link
Contributor

jtopjian commented Jun 6, 2016

@dkalleg It looks like there were 117 files pulled in from gophercloud. That seems like a very large number... I would imagine the commit should just be the lbaasv2 stuff. Maybe that's where the conflict is coming from?

@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 6, 2016

@jtopjian My intention was to bring up gophercloud to its latest revision, which would include a lot of other changes. Are you recommending I try to pull in just the lbaasv2 gophercloud changes?

@jtopjian
Copy link
Contributor

jtopjian commented Jun 6, 2016

@dkalleg hm... my understanding from using Godep was that the PR contains the diff between what's currently in vendor and what's required to bring it up to date.

@jtopjian
Copy link
Contributor

jtopjian commented Jun 6, 2016

@dkalleg ah! @phinze pointed out that the hundred-some files all look like _test.go files. Godep was nice enough to strip those out, but it seems Govendor is adding them back in.

Can you check and see if you're using the latest Govendor or if there is a flag to not add in the test files?

@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 6, 2016

@jtopjian I removed the _test.go files from the gophercloud update, down to 38 files changed from 117 :) . I also refactored the resource naming from lbaas to lb.

@@ -1,5 +1,6 @@
{
"comment": "",
<<<<<<< 8c3ff933951a5ab0111c0ef6b3553e42e4ce14af
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks leftover from a merge conflict?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, sorry. Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ping on this one. Looks like it still exists?

@jtopjian
Copy link
Contributor

jtopjian commented Jun 7, 2016

@dkalleg Thank you for your patience with this one! It's never fun to be caught in between a core refactor like the current Godep to Govendor one right now...

@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 7, 2016

@jtopjian No worries! Was mostly a painless process and taught me about govendor.

@jtopjian
Copy link
Contributor

jtopjian commented Jun 8, 2016

@dkalleg I'm in the process of setting up the OpenStack acceptance test environment for LBaaS v2. Once that's done, I'll run these acceptance tests through it.

In the meantime, I'm going to do a more thorough review of the code and make some inline comments.

d.Set("default_pool_id", listener.DefaultPoolID)
d.Set("connection_limit", listener.ConnLimit)
d.Set("sni_container_refs", listener.SniContainerRefs)
d.Set("default_tls_container_ref", listener.DefaultTlsContainerRef)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For d.Set to work correctly, the arguments must have Computed: true.

Copy link
Contributor Author

@dkalleg dkalleg Jun 8, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain what doesn't work correctly if Computed: false? I ask because in testing I:

  1. Create a listener w/ TF.
  2. Note the "name" field (just calling out this attr arbitrarily) was properly populated.
  3. Manually change the listeners name in OpenStack.
  4. Call terraform plan with no changes to the .tf script
  5. Note the plan output wants to change the listeners name from what I manually set to what is in the .tf script: name: "foo" => "tf_test_listener" (forces new resource)

I do notice that the terraform.tfstate does not show the name as "foo" after the plan. I tried adding Computed: true to the name attr and re-ran through this process with the same results.

My current understanding of the Computed attribute is that its for schema elements that the user may not provide, but if that info can be captured during a Read(), you can then write it back to the tfstate via d.Set() BUT it will not cause a terraform plan to consider this field as a "user change". The id schema element is the prime example. Please do correct me if this is wrong or incomplete.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, fyi, I realized I don't need a ForceNew: true on name :) I'll fix that and go review all the other attrs.

@jtopjian
Copy link
Contributor

jtopjian commented Jun 8, 2016

@dkalleg Looks like there are three areas to work on:

  1. The FINDME debug lines, though this is more of a nitpick
  2. If you're using d.Set() with any argument, it must be configured with Computed: true.
  3. Terraform won't evaluate the HasChange portion for aguments that are configured with ForceNew: true. There seems to be a lot of arguments in these resources with ForceNew set -- maybe a review of what needs this?

Once devstack is set up, I'll run everything through and see what the result is.

By far, though, this is a great PR! I think the above items are minor compared to the rest of the work you put into this (docs, great tests, etc).

return &schema.Resource{
Create: resourceListenerV2Create,
Read: resourceListenerV2Read,
Delete: resourceListenerV2Delete,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtopjian I just realized, I missed adding the Update: entry here! But.. how could the test cases have passed if I missed this? Fixing this in my next patch.

@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 8, 2016

@jtopjian I fixed # 1 and 3. I posted a question above about your #2 comment. Thanks for reviewing!

@jtopjian
Copy link
Contributor

jtopjian commented Jun 9, 2016

@dkalleg Re #2: I ran some tests and fiddled with some code and surprised myself - it looks like d.Set works just fine on attributes that aren't computed. I was always under the impression that the two had to go together. Sorry about that.

I was able to get a working devstack installation with LBaaS. I found that I had to increase the timeout of the resource_openstack_lb_loadbalancer_v2 resource because it takes a while for the vm to start and provision. IMO, raising it from 2 minutes to 20 minutes is probably a safe thing to do.

Once I made that change, all tests passed!

But I also noticed that the files were still called resource_openstack_lbaas_*.go - any chance you can rename these to the lb version?

Once that's done, I'd say squash everything into two commits: one for the Terraform resources and one for the Govendor dependencies. Then I'll see if someone else can sign off on Govendor stuff just to make sure the commit doesn't mess anything up.

Then we should be good to go. 😄

@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 9, 2016

@jtopjian Done

@jtopjian
Copy link
Contributor

jtopjian commented Jun 9, 2016

@dkalleg Looks like that one line is still floating around vendor.json:

https://github.com/hpcloud/terraform/blob/6aa655fde4aa85ac90eff9efa6e2b8f30a79c35d/vendor/vendor.json#L3

dkalleg added 2 commits June 9, 2016 13:19
CRUD, tests and Docs for managing a LoadBalancer, Listener,
Pool, Member, and Monitor resources.
@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 9, 2016

@jtopjian Ah, sorry. Should be fixed now.

@phinze
Copy link
Contributor

phinze commented Jun 10, 2016

Great work on this @dkalleg! And thanks as always @jtopjian for the review. 👍

@phinze phinze merged commit 757aae5 into hashicorp:master Jun 10, 2016
@dkalleg
Copy link
Contributor Author

dkalleg commented Jun 10, 2016

@jtopjian @phinze Thanks!

@ghost
Copy link

ghost commented Apr 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants