-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider/kubernetes): v2 generic on demand caching (#1884)
- Loading branch information
Showing
10 changed files
with
509 additions
and
67 deletions.
There are no files selected for viewing
59 changes: 0 additions & 59 deletions
59
...ddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/cache/OnDemandAgent.groovy
This file was deleted.
Oops, something went wrong.
70 changes: 70 additions & 0 deletions
70
clouddriver-core/src/main/groovy/com/netflix/spinnaker/clouddriver/cache/OnDemandAgent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.clouddriver.cache; | ||
|
||
import com.netflix.spinnaker.cats.agent.CacheResult; | ||
import com.netflix.spinnaker.cats.provider.ProviderCache; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public interface OnDemandAgent { | ||
String getProviderName(); | ||
|
||
String getOnDemandAgentType(); | ||
|
||
// TODO(ttomsu): This seems like it should go in a different interface. | ||
OnDemandMetricsSupport getMetricsSupport(); | ||
|
||
enum OnDemandType { | ||
ServerGroup, | ||
SecurityGroup, | ||
LoadBalancer, | ||
Job, | ||
TargetGroup; | ||
|
||
static OnDemandType fromString(String s) { | ||
return Arrays.stream(values()) | ||
.filter(v -> v.toString().equalsIgnoreCase(s)) | ||
.findFirst() | ||
.orElseThrow(() -> new IllegalArgumentException("Cannot create OnDemandType from '" + s + "'")); | ||
} | ||
} | ||
|
||
boolean handles(OnDemandType type, String cloudProvider); | ||
|
||
static class OnDemandResult { | ||
String sourceAgentType; | ||
Collection<String> authoritativeTypes = new ArrayList<>(); | ||
CacheResult cacheResult; | ||
Map<String, Collection<String>> evictions = new HashMap<>(); | ||
|
||
public OnDemandResult() {} | ||
|
||
public OnDemandResult(String sourceAgentType, CacheResult cacheResult, Map<String, Collection<String>> evictions) { | ||
this.sourceAgentType = sourceAgentType; | ||
this.cacheResult = cacheResult; | ||
this.evictions = evictions; | ||
} | ||
} | ||
|
||
OnDemandResult handle(ProviderCache providerCache, Map<String, ?> data); | ||
Collection<Map> pendingOnDemandRequests(ProviderCache providerCache); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.