Skip to content

Commit 50c4243

Browse files
authored
Merge pull request Netflix#286 from robfletcher/master
Prevent bad reads from Edda marking ELBs as failing cross-zone balancing
2 parents 107bf20 + 04c73cc commit 50c4243

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

src/main/java/com/netflix/simianarmy/aws/conformity/rule/CrossZoneLoadBalancing.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.util.List;
2323
import java.util.Map;
2424

25+
import com.netflix.simianarmy.client.MonkeyRestClient;
2526
import org.slf4j.Logger;
2627
import org.slf4j.LoggerFactory;
2728

@@ -70,12 +71,17 @@ public CrossZoneLoadBalancing(AWSCredentialsProvider awsCredentialsProvider) {
7071
public Conformity check(Cluster cluster) {
7172
Collection<String> failedComponents = Lists.newArrayList();
7273
for (AutoScalingGroup asg : cluster.getAutoScalingGroups()) {
73-
for (String lbName : getLoadBalancerNamesForAsg(cluster.getRegion(), asg.getName())) {
74-
if (!isCrossZoneLoadBalancingEnabled(cluster.getRegion(), lbName)) {
75-
LOGGER.info(String.format("ELB %s in %s does not have cross-zone load balancing enabled",
76-
lbName, cluster.getRegion()));
77-
failedComponents.add(lbName);
74+
try {
75+
for (String lbName : getLoadBalancerNamesForAsg(cluster.getRegion(), asg.getName())) {
76+
if (!isCrossZoneLoadBalancingEnabled(cluster.getRegion(), lbName)) {
77+
LOGGER.info(String.format("ELB %s in %s does not have cross-zone load balancing enabled",
78+
lbName, cluster.getRegion()));
79+
failedComponents.add(lbName);
80+
}
7881
}
82+
} catch (MonkeyRestClient.DataReadException e) {
83+
LOGGER.error(String.format("Transient error reading ELB for %s in %s - skipping this check",
84+
asg.getName(), cluster.getRegion()), e);
7985
}
8086
}
8187
return new Conformity(getName(), failedComponents);

src/main/java/com/netflix/simianarmy/client/MonkeyRestClient.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public MonkeyRestClient(int timeout, int maxRetries, int retryInterval) {
5151
Validate.isTrue(timeout >= 0);
5252
Validate.isTrue(maxRetries >= 0);
5353
Validate.isTrue(retryInterval > 0);
54-
54+
5555
RequestConfig config = RequestConfig.custom()
5656
.setConnectTimeout(timeout)
5757
.build();
@@ -87,7 +87,7 @@ public JsonNode getJsonNodeFromUrl(String url) throws IOException {
8787
if (code == 404) {
8888
return null;
8989
} else if (code >= 300 || code < 200) {
90-
throw new RuntimeException(String.format("Response code %d from url %s: %s", code, url, jsonContent));
90+
throw new DataReadException(code, url, jsonContent);
9191
}
9292

9393
JsonNode result;
@@ -107,4 +107,10 @@ public JsonNode getJsonNodeFromUrl(String url) throws IOException {
107107
* @return the base url in the region
108108
*/
109109
public abstract String getBaseUrl(String region);
110+
111+
public static class DataReadException extends RuntimeException {
112+
public DataReadException(int code, String url, String jsonContent) {
113+
super(String.format("Response code %d from url %s: %s", code, url, jsonContent));
114+
}
115+
}
110116
}

0 commit comments

Comments
 (0)