diff --git a/grails-app/services/com/netflix/asgard/AwsLoadBalancerService.groovy b/grails-app/services/com/netflix/asgard/AwsLoadBalancerService.groovy index bc424acf..d52ef223 100644 --- a/grails-app/services/com/netflix/asgard/AwsLoadBalancerService.groovy +++ b/grails-app/services/com/netflix/asgard/AwsLoadBalancerService.groovy @@ -23,6 +23,7 @@ import com.amazonaws.services.elasticloadbalancing.model.AttachLoadBalancerToSub import com.amazonaws.services.elasticloadbalancing.model.ConfigureHealthCheckRequest import com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerListenersRequest import com.amazonaws.services.elasticloadbalancing.model.CreateLoadBalancerRequest +import com.amazonaws.services.elasticloadbalancing.model.CrossZoneLoadBalancing import com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerListenersRequest import com.amazonaws.services.elasticloadbalancing.model.DeleteLoadBalancerRequest import com.amazonaws.services.elasticloadbalancing.model.DeregisterInstancesFromLoadBalancerRequest @@ -35,7 +36,9 @@ import com.amazonaws.services.elasticloadbalancing.model.EnableAvailabilityZones import com.amazonaws.services.elasticloadbalancing.model.Instance import com.amazonaws.services.elasticloadbalancing.model.InstanceState import com.amazonaws.services.elasticloadbalancing.model.Listener +import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerAttributes import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription +import com.amazonaws.services.elasticloadbalancing.model.ModifyLoadBalancerAttributesRequest import com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest import com.amazonaws.services.elasticloadbalancing.model.SourceSecurityGroup import com.google.common.collect.ArrayListMultimap @@ -233,7 +236,11 @@ class AwsLoadBalancerService implements CacheInitializer, InitializingBean { } else { request.withAvailabilityZones(zoneList) } - awsClient.by(userContext.region).createLoadBalancer(request) // has result + def client = awsClient.by(userContext.region) + client.createLoadBalancer(request) + def modifyRequest = new ModifyLoadBalancerAttributesRequest(loadBalancerName: name, loadBalancerAttributes: + new LoadBalancerAttributes(crossZoneLoadBalancing: new CrossZoneLoadBalancing(enabled: true))) + client.modifyLoadBalancerAttributes(modifyRequest) }, Link.to(EntityType.loadBalancer, name)) getLoadBalancer(userContext, name) } diff --git a/src/groovy/com/netflix/asgard/mock/MockAmazonElasticLoadBalancingClient.groovy b/src/groovy/com/netflix/asgard/mock/MockAmazonElasticLoadBalancingClient.groovy index f3a415da..44e79310 100644 --- a/src/groovy/com/netflix/asgard/mock/MockAmazonElasticLoadBalancingClient.groovy +++ b/src/groovy/com/netflix/asgard/mock/MockAmazonElasticLoadBalancingClient.groovy @@ -49,6 +49,8 @@ import com.amazonaws.services.elasticloadbalancing.model.InstanceState import com.amazonaws.services.elasticloadbalancing.model.Listener import com.amazonaws.services.elasticloadbalancing.model.ListenerDescription import com.amazonaws.services.elasticloadbalancing.model.LoadBalancerDescription +import com.amazonaws.services.elasticloadbalancing.model.ModifyLoadBalancerAttributesRequest +import com.amazonaws.services.elasticloadbalancing.model.ModifyLoadBalancerAttributesResult import com.amazonaws.services.elasticloadbalancing.model.Policies import com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerRequest import com.amazonaws.services.elasticloadbalancing.model.RegisterInstancesWithLoadBalancerResult @@ -133,6 +135,10 @@ class MockAmazonElasticLoadBalancingClient extends AmazonElasticLoadBalancingCli CreateLoadBalancerResult createLoadBalancer(CreateLoadBalancerRequest createLoadBalancerRequest) { null } + ModifyLoadBalancerAttributesResult modifyLoadBalancerAttributes(ModifyLoadBalancerAttributesRequest request) { + null + } + EnableAvailabilityZonesForLoadBalancerResult enableAvailabilityZonesForLoadBalancer( EnableAvailabilityZonesForLoadBalancerRequest enableAvailabilityZonesForLoadBalancerRequest) { null }