Skip to content

Commit

Permalink
Protect against clusters that have no endpoints at all in the feature…
Browse files Browse the repository at this point in the history
… walk.

Fixes #1532.
  • Loading branch information
Flynn committed May 13, 2019
1 parent 2e95ece commit 0f18f25
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ambassador/ambassador/ir/ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,9 +580,16 @@ def features(self) -> Dict[str, Any]:
using_http = True
cluster_http_count += 1

cluster_endpoints = cluster.urls if (lb_type == 'kube') else cluster.targets
cluster_endpoints = cluster.urls if (lb_type == 'kube') else cluster.get('targets', [])

# Paranoia, really.
if not cluster_endpoints:
cluster_endpoints = []

num_endpoints = len(cluster_endpoints)

# self.logger.debug(f'cluster {cluster.name}: lb_type {lb_type}, endpoints {cluster_endpoints} ({num_endpoints})')

if using_tls:
endpoint_tls_count += num_endpoints

Expand Down

0 comments on commit 0f18f25

Please sign in to comment.