Skip to content

Commit

Permalink
fix(aws): Enable stale key evictions for amazon load balancers (#1994)
Browse files Browse the repository at this point in the history
Key structures vary between classic and application/networking load
balancers.
  • Loading branch information
ajordens authored Oct 13, 2017
1 parent a849b69 commit f0d1597
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void storeAgentResult(Agent agent, CacheResult result) {
Collection<String> evictionsForType = result.getEvictions().computeIfAbsent(type, evictableKeys -> new ArrayList<>());
evictionsForType.addAll(evictableIdentifiers);

log.info("Evicting stale identifiers: {}", evictableIdentifiers);
log.debug("Evicting stale identifiers: {}", evictableIdentifiers);
}
} catch (Exception e) {
log.error("Failed to check for stale identifiers (type: {}, pattern: {}, agent: {})", type, cacheKeyPatternForType, agent, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ class AmazonApplicationLoadBalancerCachingAgent extends AbstractAmazonLoadBalanc
this.eddaTimeoutConfig = eddaTimeoutConfig
}

@Override
Optional<Map<String, String>> getCacheKeyPatterns() {
return [
(LOAD_BALANCERS.ns): Keys.getLoadBalancerKey('*', account.name, region, 'vpc-????????', '*')
]
}

@Override
OnDemandAgent.OnDemandResult handle(ProviderCache providerCache, Map<String, ? extends Object> data) {
if (!data.containsKey("loadBalancerName")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ class AmazonLoadBalancerCachingAgent extends AbstractAmazonLoadBalancerCachingAg
super(amazonCloudProvider, amazonClientProvider, account, region, objectMapper, registry)
}

@Override
Optional<Map<String, String>> getCacheKeyPatterns() {
return [
(LOAD_BALANCERS.ns): Keys.getLoadBalancerKey('*', account.name, region, 'vpc-????????', null)
]
}

@Override
OnDemandAgent.OnDemandResult handle(ProviderCache providerCache, Map<String, ? extends Object> data) {
if (!data.containsKey("loadBalancerName")) {
Expand Down

0 comments on commit f0d1597

Please sign in to comment.