-
Notifications
You must be signed in to change notification settings - Fork 89
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
Issue 644 Support for multiple AGWs/LBs and named backend pools #651
Conversation
…s related to the following Azure CPI PRs/issues: - cloudfoundry/bosh-azure-cpi-release#651 (Fixes ) - cloudfoundry/bosh-azure-cpi-release#541 (Fixed cloudfoundry/bosh-azure-cpi-release#328) - cloudfoundry/bosh-azure-cpi-release#638 (Fixed cloudfoundry/bosh-azure-cpi-release#111) Note: This commit assumes that PR cloudfoundry#651 will be included in a new `v37.7.0` release of the Azure CPI (in order to properly document the CPI version requirements of new features). If PR cloudfoundry#651 is included in a different CPI version, then this PR will need to be amended appropriately.
…s related to the following Azure CPI PRs/issues: - cloudfoundry/bosh-azure-cpi-release#651 (Fixes cloudfoundry/bosh-azure-cpi-release#644) - cloudfoundry/bosh-azure-cpi-release#541 (Fixed cloudfoundry/bosh-azure-cpi-release#328) - cloudfoundry/bosh-azure-cpi-release#638 (Fixed cloudfoundry/bosh-azure-cpi-release#111) Note: This commit assumes that PR cloudfoundry#651 will be included in a new `v37.7.0` release of the Azure CPI (in order to properly document the CPI version requirements of new features). If PR cloudfoundry#651 is included in a different CPI version, then this PR will need to be amended appropriately.
If you're not officially done with this PR and submitting it for review, please ignore the remainder of this comment. I'm probably not qualified to be a good reviewer for this. But. If you're officially done with this PR, would you squash the >150 commits in this PR into one or more commits that group the changes into more-easily-understandable changesets? Thanks! |
@klakin-pivotal I am officially done, and ready for the PR to be reviewed. And I'd be happy to squash the commits down if you want. However, before I squash any further, please note that the current number of commits (169) is after I had already squashed a lot of the intermediate commits, and re-ordered most of the commits into sequential, logical groups. However, some of the files changed (particularly some of the spec files) resulted in some pretty significant changes as a final result of the incremental commits. IMO, squashing some of the remaining incremental commits would make it significantly harder (or impossible) to understand the incremental changes that led to the major changes. And git tools do make it fairly easy to view diffs of arbitrary ranges of commits, but can't show you the incremental commits again after they've been squashed. I also spent a fair amount of effort on making sure that the individual commits' messages are accurate, to make analysis and review of the PR easier. So with that said, I'd still be happy to squash the PR's commits down (a little or a lot, as you prefer), if you still want me to. But it is a one-way process that seems to have more drawbacks than benefits (when considering what is easily achievable with git CLI or git clients), so I wanted to double check that you really want me to do so (and by how much) before I do it, since if I were the one reviewing such a PR, I'd prefer more, smaller, simpler commits over fewer, larger, squashed commits. But if you can (re)confirm your preference, I'll do it. 😄 |
Are you certain that -for example- this group of four commits: 150a0d2 or this group of two commits: aren't sufficiently related that the commits in each of the two groups should be squashed down to one commit per group? If -after reviewing the commits I called out-, you do change your mind about not squashing them together, then I'd politely request that you take an hour or two to do some history grooming on this PR... squashing commits together that are logically related, and even reordering the commits so that it's easier to squash together commits that are logically related but separated by other -unrelated- commits. Squashing and -where appropriate- reordering commits will better ensure that the story your remaining commits do tell makes as much sense as is reasonably possible. Additionally, it's possible that you and I are looking at two different sets of commits. If we are, then please accept my apologies for the noise, and please do direct me to the list of commits that I should be looking at. |
@klakin-pivotal Done. I think it now presents a more easily understood story. If you'd like me to squash further, I certainly can, but doing so may affect the ability to easily revert/amend isolated portions of the PR's changes, if any of the reviewers request changes to a particular design/implementation decision. Also, see notes below. Notes about the commits in this PR:
|
this PR is massive.. i didn't go in detail over all the rspec tests changes that where made. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also couldn't get into all the details here. I have some small suggestion otherwise the feature implementation looks good. One additional question. Did you consider to extend the integration tests or the unit tests provide good coverage here for the introduced changes?
Yes and yes. The new and updated unit specs provide much more thorough coverage (of both the new and old formats) of the various config variations than I saw for any other properties' unit specs. E.g. Single vs multiple LB/AGW, single vs multiple backend pools, unspecified vs explicit pool names, and specs for each supported "data format" (including already-supported formats which didn't have any unit nor integration spec coverage before). And yes, I considered adding integration specs, as well. I had started some preliminary work in 87b33ed, but reverted it in e5e3b1c, because (as noted in the Testing Notes here:
And since there is now (due to this PR's enhancements) excellent unit spec coverage of the LB and AGW config variants, and since I also wasn't sure if anyone other than my team would even be using the new feature, and since none of the previous LB variant format enhancements had updated the integration specs (and some hadn't even updated the unit specs nor the CPI docs), it seemed like it would probably be unnecessary and/or overkill to implement an entire parallel set of int specs (especially since the int suite costs real money per run). Plus, the initially-broken dev env setup instructions, LB-related refactoring, retroactive specs, and other repo cleanup work I ended up having to do for this PR already took a lot more time than I had planned on spending on this entire PR. 😄 |
…ample of" sections for alternate Load Balancer configurations, for new and existing features related to the following Azure CPI PRs/issues: - cloudfoundry/bosh-azure-cpi-release#651 (Fixes cloudfoundry/bosh-azure-cpi-release#644) - cloudfoundry/bosh-azure-cpi-release#541 (Fixed cloudfoundry/bosh-azure-cpi-release#328) - cloudfoundry/bosh-azure-cpi-release#638 (Fixed cloudfoundry/bosh-azure-cpi-release#111) Note: This commit assumes that PR cloudfoundry#651 will be included in a new `v37.7.0` release of the Azure CPI (in order to properly document the CPI version requirements of new features). If PR cloudfoundry#651 is included in a different CPI version, then this PR will need to be amended appropriately.
…y configurations, for new and existing features related to the following Azure CPI PRs/issues: - cloudfoundry/bosh-azure-cpi-release#651 (Fixes cloudfoundry/bosh-azure-cpi-release#644) - cloudfoundry/bosh-azure-cpi-release#541 (Fixed cloudfoundry/bosh-azure-cpi-release#328) - cloudfoundry/bosh-azure-cpi-release#638 (Fixed cloudfoundry/bosh-azure-cpi-release#111) Note: This commit assumes that PR cloudfoundry#651 will be included in a new `v37.7.0` release of the Azure CPI (in order to properly document the CPI version requirements of new features). If PR cloudfoundry#651 is included in a different CPI version, then this PR will need to be amended appropriately.
Is there any progress on the reviews against this PR? Would really like to take advantage of this new functionality... Thanks! |
I have some things that I want to say about the PR, but we've been quite busy with a few very urgent fires. Will hopefully get around to making some comments next week. (For what it's worth, it's not extremely difficult to roll your own CPI release. So if you're very interested in using the functionality in this PR, you can snag the code and start using it now.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Justin-W Thank you for the fast reaction on my comments. I added additional comments about empty test cases. Sorry, for missing those during the first review. I also adde @klakin-pivotal as reviewer because of the comment here #651 (comment)
src/bosh_azure_cpi/spec/unit/azure_client/list_network_interfaces_by_keyword_spec.rb
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I as commented we should remove the empty test cases which aren't related to this pr. Otherwise it looks good to me.
src/bosh_azure_cpi/spec/unit/azure_client/list_network_interfaces_by_keyword_spec.rb
Outdated
Show resolved
Hide resolved
…some typos). Note: The existing implementation was insufficiently commented to convey an immediate understanding of the relationship and locations of some separate-but-coupled sections of code related to "primary" NIC/network data. It initially seemed like these sections may possibly need to be updated as part of cloudfoundry#644, and I ended up having to investigate this code's implementation rather deeply before I was able to determine that the aforementioned code didn't need to be updated (functionally) for cloudfoundry#644. However, to try to reduce the "magic code" factor of these code sections, I added some additional code comments to (hopefully) prevent anyone else from needing to perform a similar (unnecessary) deep dive in the future.
Note: This increases/restores the symmetry between the LB and AGW functionality (and configuration), by enhancing AGW support with new (for AGWs) functionality which had already been previously supported for LBs (by cloudfoundry#541 for cloudfoundry#111 and cloudfoundry#638 for cloudfoundry#328). Restoring this level of symmetry partially resolves cloudfoundry#644. These changes include: - refactoring of existing code/implementation (and tests). E.g. Renamed some vars and methods to more accurately reflect their current values/behavior. - significant configuration API enhancements, to enable the (previously LB-only) functionality of cloudfoundry#111 and cloudfoundry#328 to be used with both LB and/or AGW configs. E.g. Allow the `application_gateway` config to be configured as a Hash; allow the `application_gateway` config to be configured as an Array (new in this PR for both LBs and AGWs); added support for `application_gateway/resource_roup_name` config. --- SQUASHED COMMIT HISTORY: issue-644: multi-AGW: Refactored the `AzureClient.get_application_gateway_by_name` method to make the `resource_group_name` param a positional param (instead of an optional keyword param). Note: This change was made so that the `AzureClient.get_application_gateway_by_name` method's signature is consistent with the signatures of the other `AzureClient.get_*` methods in requiring the `resource_group_name` param to be passed as the first positional param. issue-644: multi-AGW: Modified the `VMCloudProps._parse_application_gateway_config` method to allow the `application_gateway` config to be configured as an Array. Note: When specifying an Array of AGWs, each element of the Array should be a String and/or Hash of the same format which was previously (and still is) valid when configuring a single AGW (as a non-Array). issue-644: multi-AGW: Modified the `VMCloudProps._parse_application_gateway_config` method to accept either String or Hash config (instead of String only). issue-644: multi-AGW: Fixed the `AzureClient.parse_network_interface` method to correctly return all of the NIC's application_gateways' info (instead of only the first LB's info). NOTE: All unit test specs are now passing again. issue-644: multi-AGW: Update `VMManager._get_application_gateways` method to support multi-AGW (and also to use the new `ApplicationGatewayConfig.resource_group_name` property/data). issue-644: multi-AGW: Modified the `VMCloudProps._parse_application_gateway_config` method to init `ApplicationGatewayConfig.resource_group_name` as `nil`, unless a value is explicitly configured. (See code comment for details.) issue-644: multi-AGW: Update `AzureClient.parse_network_interface` method to use the new `resource_group_name` keyword param of the `AzureClient.get_application_gateway_by_name` method. issue-644: multi-AGW: Added a new, optional `resource_group_name` keyword param to the `AzureClient.get_application_gateway_by_name` method. issue-644: multi-AGW: Updated `AzureClient.create_network_interface` method to support multi-AGW. Renamed a spec example in the Integration test suite, to make the meaning clearer: application_gateway_spec.rb. COMMENTS: Added/updated comments and doc comments: AzureClient, VMManager. issue-644: multi-AGW: Renamed a key within the `nic_params` Hash (from "application_gateway" to "application_gateways"). issue-644: multi-AGW: Rename and update `VMManager._get_application_gateways` method issue-644: multi-AGW: Renamed various vars/keys (from `application_gateway` to `application_gateways`) issue-644: multi-AGW: Added additional specs for the `VMCloudProps._parse_application_gateway_config` method. issue-644: multi-AGW: Add new `VMCloudProps._parse_application_gateway_config` method. NOTE: This change is part of a multi-commit set of incremental changes. Some of the existing unit test specs are now failing. They will be fixed/updated by the time the incremental changes are completed.
…eways (cloudfoundry#644) Note: The new, optional `application_gateway/backend_pool_name` sub-property is an optional key of each AGW Hash config (whether specifying an Array of AGWs or a single AGW). Note: This completes the remaining feature enhancements for cloudfoundry#644. --- SQUASHED COMMIT HISTORY: issue-644: named-pool-AGW: shared_stuff.rb: Refactored the shared spec setup helper code to be able to support the `application_gateway` and/or `load_balancer` vm_props as a Hash (instead of a String). Note: This commit has not changed the shared data props referenced above to Hashes, but that change is now easy to make if needed (in future, or by overriding let statements in specific specs/examples). issue-644: named-pool-AGW: Updated `VMManager._get_application_gateways` to support the new `application_gateway/backend_pool_name` property (from the `vm_type` config). issue-644: named-pool-AGW: Updated `AzureClient.get_application_gateway` to return additional data about the AGW's `backend_address_pools`. issue-644: named-pool-AGW: Added new pending specs: create_network_interface_spec.rb. issue-644: named-pool-AGW: Modified `VMCloudProps` to allow a new, optional `application_gateway/backend_pool_name` sub-property for the `application_gateway` config. Note: The new sub-property is an optional key of each AGW Hash config, whether specifying an Array of AGWs or a single AGW.
…loudfoundry#644) Note: The new, optional `load_balancer/backend_pool_name` sub-property is an optional key of each LB Hash config (whether specifying an Array of LBs or a single LB). Note: This maintains/restores functional symmetry between the LB and AGW configs (although the symmetric LB functionality was not an explicitly requested part of the feature enhancements for cloudfoundry#644, adding the feature only for AGWs would break functional symmetry). --- SQUASHED COMMIT HISTORY: issue-644: named-pool-LB: Added a new, optional `load_balancer/backend_pool_name` sub-property for the `load_balancer` config. Note: The new sub-property is an optional key of each LB Hash config, whether specifying an Array of LBs or a single LB.
) Note: This also includes refactoring of the 2 modified spec files, to reduce code duplication and improve maintainability. Note: These unit test suite enhancements were made in parallel for the new functionality/configuration of both LBs and AWGs (and separately from the implementation of the functionality being tested) due to the high degree of symmetry between the 2 sets of functionality. Given the original implementation (especially of `create_network_interface_spec.rb`), making these change independently (e.g. by including them as part of the previous LB-specific and AGW-specific commits) would have resulted in either significant test code/setup duplication (plus increased complexity) and/or would have required significant after-the-fact refactoring to prevent/fix such duplication. Implementing (plus refactoring) the new specs in parallel significantly expedited the implementation of these tests, and made it easier to maintain appropriate symmetry between the unit tests of the underlying (also mostly symmetric) LB and AGW functionality. --- SQUASHED COMMIT HISTORY: issue-644: multi-pool-AGW: Refactored specs to reduce dupe `let`s: create_network_interface_spec.rb. issue-644: multi-pool-AGW: Implemented pending specs: create_network_interface_spec.rb. issue-644: multi-pool-LB: Refactored specs to reduce dupe `let`s: create_network_interface_spec.rb. issue-644: multi-pool-LB: Implemented pending specs: create_network_interface_spec.rb. issue-644: specs: create_network_interface_spec.rb: Removed obsolete rubocop inline comments for `RSpec/RepeatedExampleGroupBody`. issue-644: multi-pool-AGW: pre-refactoring: create_network_interface_spec.rb. issue-644: multi-pool-LB: pre-refactoring: create_network_interface_spec.rb. issue-644: multi-pool-AGW: Implemented pending specs: dynamic_public_ip_spec.rb. issue-644: multi-pool-LB: Implemented pending specs: dynamic_public_ip_spec.rb.
Thanks for the detailed feedback @klakin-pivotal. I believe I have now addressed your concerns (details below).
I have squashed most of the original commits down to 6 commits, and removed all other unrelated and "housekeeping" commits (see below for details) which seemed to be "non-essential" to this PR.
All 6 remaining commits now have messages explaining the "why" behind the "what".
The "MAYBE?" commit (and the following commit which reverted it) have been removed (refer to the explanation below for details, if interested).
TL;DR: I have removed that code from this PR. Background: This particular commit was related to the Integration test suite, and my uncertainty of whether or not that suite needed to be updated. Based on previous PR feedback (which indicated that my unit test suite updates seemed sufficient), I have removed that commit (and the revert which followed it) from this PR.
TL;DR: These were changes related to #653 but not related directly to #644, so I have removed such unrelated changes from this PR. Background: These were mostly opportunistic "leave it as good or better than you found it" attempts to reduce the (large) quantity of offenses ignored/excluded by the However, for the sake of PR clarity and based on your feedback, I have removed all of those changes from this PR.
TL;DR: I have removed that code from this PR. Background: I encountered a spec failure which was difficult to understand due to rspec truncating the output. This is a known issue with rspec, and there is a semi-official "known fix" for it which requires a newer version of rspec than the one previously configured for this project. However, after upgrading rspec, the "known fix" didn't work. So technically, the rspec upgrade wasn't required as part of this PR, since I didn't actually enable the not-yet-working "known fix". I had originally left the rspec upgrade in this PR since the effort to upgrade had already been done, and I had assumed that a newer rspec version would be preferred. However, I have now removed that upgrade from this PR, per your feedback.
These were directly related to the aforementioned opportunistic rubocop offense fixes, and have been removed from this PR.
TL;DR: I have removed that code from this PR. Background: There were a few utility methods called by code related to this PR which had no doc comments. And some of those methods' implementations had changed over time so that their method names had become inaccurate. I added the return type annotations to a few such methods while I was trying to understand the behavior of the original code (before I modified any of the behavior). Since there were also many other un-annotated methods within
TL;DR: I have removed that code from this PR. Background: That was the code for the aforementioned (see comment above RE: point # 3) "known fix" for the rspec truncation issue, which turned out to not work. Since the known issue is likely to be a problem again in future, I had left the disabled code (plus explanatory comments) for the not-yet-working fix, in case I or a future maintainer needed to attempt to et the fix working in future.
I have attempted to explain both the what and the why in the messages of all 6 of the remaining commits (referencing #644 where appropriate, but without completely re-explaining the context captured in the description and comments of that issue). Hopefully the new messages are satisfactory. I looked at many past commits within this repo for examples, but nearly all of them had very minimal, terse commit messages. So I mostly used your commit message guidance above.
I believe each of the issues you previously raised have all now been fully addressed/resolved. If any were not, please let me know.
Thank you (again) for the time you took in providing detailed PR feedback. It was helpful and much appreciated. |
Thanks also to @bgandon for his additional tips and advice. |
Background: There were a few utility methods in `azure_client.rb` called by code related to PR cloudfoundry#651 which had no doc comments. And some of those methods' implementations had changed over time so that their method names had become inaccurate. While adding return type annotations to those methods, I noticed many other methods in the same file which also lacked any doc comments and had names which weren't drectly indicative of the type of the value(s) returned, but which weren't directly related to cloudfoundry#651. Since there were also many other un-annotated methods within `azure_client.rb` which also had names which were non-indicative of the return type (thus requiring a maintainer to read each method's implementations to understand what type of value would be returned), I opportunistically added `@return` annotations to many of those methods, assuming that such annotations would be better than completely un-annotated methods. I am submitting these additional annotations as a separate PR since they weren't directly related to the functionality in cloudfoundry#651.
@klakin-pivotal are you satisfied with the changes made? |
I hope to get some time this afternoon to review the changes. If I do not get that time, then I will make the time on Friday. |
Overall, this PR looks good. Thanks for taking the time to reorganize it and clean it up. If the folks who did the technical-functionality review are still fine with that aspect of the PR, and the few things I mention below get fixed, please feel free to merge it, whoever is in charge of merging it. (And if that "whoever" is me, let me know and I'll push the button on Tuesday (as Monday is a holiday for me).) The remaining issues: Commented-out sections of code:These commented-out sections of code should be removed, if they don't serve as documentation. If they do, then do accept my apologies for not noticing their significance: c099e1f#diff-5d4d5c53bf030aa246140de1d33e1f300b0093c44e87df37e1f5bd73f2c9508eR151 4ced629#diff-9850a43e9c57d5d53acbfe53ce7dfd26ff1ecbc939f05079faf1f76873e31780R459-R462 4ced629#diff-9850a43e9c57d5d53acbfe53ce7dfd26ff1ecbc939f05079faf1f76873e31780R911-R914 4ced629#diff-9850a43e9c57d5d53acbfe53ce7dfd26ff1ecbc939f05079faf1f76873e31780R603-R606 4ced629#diff-9850a43e9c57d5d53acbfe53ce7dfd26ff1ecbc939f05079faf1f76873e31780R620-R623 4ced629#diff-9850a43e9c57d5d53acbfe53ce7dfd26ff1ecbc939f05079faf1f76873e31780R889-R892 4ced629#diff-9850a43e9c57d5d53acbfe53ce7dfd26ff1ecbc939f05079faf1f76873e31780R1036-R1039 4ced629#diff-9850a43e9c57d5d53acbfe53ce7dfd26ff1ecbc939f05079faf1f76873e31780R1048-R1051 fba4230#diff-0f27965b66475a2daee83501a79ec969ed15ce1124fd6bac0bc899e857485b9aR231 c099e1f#diff-0f27965b66475a2daee83501a79ec969ed15ce1124fd6bac0bc899e857485b9aR371 All of the places that Please don't feel obligated to re-work the commits that contain the commented-out sections of code. Adding another commit to the PR that removes any that should be removed seems fine to me. Comments added that have TODO in themI'd ask that other folks who have previously evaluated the technical side of PR evaluate whether the TODO comments in the PR are comments that indicate that there are additional tests that should be added now, are comments that are useful to future test-writers, or are comments that should be removed. |
These did seem to have documentation value to me, but since that wasn't apparent to others I've removed all of the referenced commented sections.
The only TODO comments that I added were the IMO, leaving these TODOs as suggestions for future work does no harm, since it does not worsen the state of the existing functionality or tests (the TODOs merely calls out an opportunity for future improvement). Resolving the TODOs immediately (by improving the expectations of the marked tests) would obviously be better, but I'd need some guidance and/or an example of how to implement more precise expectations for the tests in that file, since these tests relate to a portion of the CPI's functionality about which I have limited understanding and (as I mentioned above) I'm not sure how to correctly resolve these TODOs without additional guidance. |
@beyhan @ramonskie If you guys already did a technical-correctness review on the PR, would you mind re-checking this PR? Many commits have been merged together, and some of their contents have been changed, so it'd be good if you could ensure that the functionality remains correct. Check this comment for a summary of what I thought would be good to do: #651 (comment) (I'm tagging both of you, because it's not clear which of you did a technical review... so if this doesn't apply to one of you, then feel free to ignore this comment.) |
I will be able to go over again most probably tomorrow. |
Thank you both @beyhan @klakin-pivotal - much appreciated. Given the amount of time this PR has been open with holidays and such, we've now moved onto another thread of work. Hopefully we can tie a bow on this sometime soon. |
@beyhan Can we get an update on this please? |
I re-checked the pr and the logic to support multiple AGWs/LBs still looks good. @bgandon you requested changes which should be implemented now. Could you please re-check? |
@klakin-pivotal @rkoster I think this can be merged now, correct? As far as I know, all previously-raised concerns have now been resolved. |
Yes you are right. Thanks @Justin-W for all the work you have put into this PR! |
Please check this box and fill the data as below once you have run the unit tests.
Code coverage should keeps at 100%.
Testing Notes:
Rubocop:
Rubocop Notes:
Changelog
vm_type/application_gateway
config to allow an Array (of Hashes) to be specified (as an alternative to the currently-supported config data types of String and Hash), to enable multiple AGWs (with independentvm_type/application_gateway/resource_group_name
orvm_type/application_gateway/backend_pool_name
values).vm_type/load_balancer
config to support a newvm_type/load_balancer/backend_pool_name
sub-property, to allow the config to exlpicitly specify the name of the backend address pool to use. (This change re-establishes/maintains symmetry between thevm_type/load_balancer
andvm_type/application_gateway
configs.)vm_type/load_balancer
config to allow an Array (of Hashes) to be specified, to enable multiple load balancers (with independentvm_type/load_balancer/resource_group_name
orvm_type/load_balancer/backend_pool_name
values). (This change re-establishes/maintains symmetry between thevm_type/load_balancer
andvm_type/application_gateway
configs.)