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

feat(ecs): Return application load balancer info from LB provider #4526

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

allisaurus
Copy link
Contributor

Implements spinnaker/spinnaker#4797

Provides application load balancer and target group information for ECS server groups.

@allisaurus
Copy link
Contributor Author

related: spinnaker/deck#8186

@allisaurus
Copy link
Contributor Author

CC @clareliguori + @pkandasamy91 for review

Copy link
Contributor

@piradeepk piradeepk left a comment

Choose a reason for hiding this comment

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

@allisaurus This is awesome! I have a couple minor comments but overall it looks great!

@@ -54,6 +54,6 @@ public String getName() {

@Override
public String getType() {
return loadBalancerType;
return cloudProvider;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why type returns the ecscloudprovider id? Shouldn't the getCloudProvider call be used instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't the getCloudProvider call be used instead?

it should! getType was actually deprecated in favor of getCloudProvider, however it's still a part of the the LoadBalancer interface which is why the method is still here.

Returning cloudProvider instead of loadBalancerType I think aligns it better to it's intended purpose (plus loadBalancerType should always be "application" in the case of ECS, vs. AWS LBs, which is where we're sourcing the cache data), however @clareliguori might know more.

Copy link
Contributor

Choose a reason for hiding this comment

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

The @DaTa annotation on the class should already provide the default setters and getters. In this case, I don't think you'll need to override any of the accessors (as long as you update the methods calling getType to call getCloudProvider.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

there currently isn't a field just called "type", so we need the override method regardless, and I would rather return the cloud provider ID since this is in line with how most other providers are currently setting this field.

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed offline, this makes sense in order to maintain consistency with the other providers. Since the interface only has a getName and getType method, it would potentially break in many places if we add logic to create a new getProvider method.

@@ -92,27 +106,116 @@ public String getCloudProvider() {

@Override
public Item get(String name) {
return null; // TODO - Implement this.
// unused method
throw new UnsupportedOperationException("Not implemented.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we want to throw an exception here. Previously, this would just return null but allow users to continue, where as this would now throw an exception and potetially break and implementations that use this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My concern with always returning null is the client will proceed like they have correct information vs. understanding that this method should not be used. But I understand the concern about breaking folks; I'll take another look at where this (and the other such method) may cause problems and add more info here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update: going back to returning null but adding more descriptive comments. Other providers vary between returning null and OperationNotSupportedException, indicating they are not required by deck, however hitting the associated endpoints directly now results in a 500. Would rather leave existing behavior intact if both have precedence.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not opposed to returning the OperationNotSupportedException, but we may want to open an issue, and let the community know prior to making the change.

return null; // TODO - Implement this. This is used to show the details view of a load balancer
// which is not even implemented yet
// unused method
throw new UnsupportedOperationException("Not implemented.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see above

@allisaurus allisaurus force-pushed the ecs-lbs branch 2 times, most recently from d066776 to d155c9b Compare April 22, 2020 02:05
Copy link
Contributor

@piradeepk piradeepk left a comment

Choose a reason for hiding this comment

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

Ship it! 💯 This is awesome! Thanks for fixing this @allisaurus!

@clareliguori clareliguori added the ready to merge Approved and ready for a merge label Apr 22, 2020
@mergify mergify bot added the auto merged Merged automatically by a bot label Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto merged Merged automatically by a bot ready to merge Approved and ready for a merge target-release/1.20
Projects
None yet
4 participants