use of io.fabric8.api.ContainerAutoScalerFactory in project fabric8 by jboss-fuse.
the class FabricServiceImpl method createContainerAutoScaler.
@Override
public ContainerAutoScaler createContainerAutoScaler(FabricRequirements requirements, ProfileRequirements profileRequirements) {
Collection<ContainerProvider> providerCollection = getProviders().values();
for (ContainerProvider containerProvider : providerCollection) {
// lets pick the highest weighted autoscaler (e.g. to prefer openshift to docker to child
SortedMap<Integer, ContainerAutoScaler> sortedAutoScalers = new TreeMap<Integer, ContainerAutoScaler>();
if (containerProvider instanceof ContainerAutoScalerFactory) {
ContainerAutoScalerFactory provider = (ContainerAutoScalerFactory) containerProvider;
ContainerAutoScaler autoScaler = provider.createAutoScaler(requirements, profileRequirements);
if (autoScaler != null) {
int weight = autoScaler.getWeight();
sortedAutoScalers.put(weight, autoScaler);
}
}
if (!sortedAutoScalers.isEmpty()) {
Integer key = sortedAutoScalers.lastKey();
if (key != null) {
return sortedAutoScalers.get(key);
}
}
}
return null;
}
Aggregations