use of com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider in project halyard by spinnaker.
the class BakeryService method getBakeryDefaults.
public BakeryDefaults getBakeryDefaults(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName).setBakeryDefaults();
List<BakeryDefaults> matching = lookupService.getMatchingNodesOfType(filter, BakeryDefaults.class);
switch(matching.size()) {
case 0:
HasImageProvider provider = providerService.getHasImageProvider(deploymentName, providerName);
BakeryDefaults bakeryDefaults = provider.emptyBakeryDefaults();
setBakeryDefaults(deploymentName, providerName, bakeryDefaults);
return bakeryDefaults;
case 1:
return matching.get(0);
default:
throw new RuntimeException("It shouldn't be possible to have multiple bakeryDefaults nodes. This is a bug.");
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider in project halyard by spinnaker.
the class BakeryService method setBakeryDefaults.
public void setBakeryDefaults(String deploymentName, String providerName, BakeryDefaults newBakeryDefaults) {
HasImageProvider provider = providerService.getHasImageProvider(deploymentName, providerName);
provider.setBakeryDefaults(newBakeryDefaults);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider in project halyard by spinnaker.
the class RoscoProfileFactory method setProfile.
@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
super.setProfile(profile, deploymentConfiguration, endpoints);
Providers providers = deploymentConfiguration.getProviders();
Providers otherProviders = getImageProviders(profile.getVersion());
NodeIterator iterator = providers.getChildren();
Provider child = (Provider) iterator.getNext();
while (child != null) {
if (child instanceof HasImageProvider) {
NodeIterator otherIterator = otherProviders.getChildren();
NodeFilter providerFilter = new NodeFilter().setProvider(child.getNodeName());
HasImageProvider otherChild = (HasImageProvider) otherIterator.getNext(providerFilter);
if (otherChild == null) {
log.warn("images.yml has no images stored for " + child.getNodeName());
} else {
log.info("Adding default images for " + child.getNodeName());
((HasImageProvider) child).getBakeryDefaults().addDefaultImages(otherChild.getBakeryDefaults().getBaseImages());
}
}
child = (Provider) iterator.getNext();
}
List<String> files = backupRequiredFiles(providers, deploymentConfiguration.getName());
profile.appendContents(yamlToString(providers)).appendContents(profile.getBaseContents()).setRequiredFiles(files);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider in project halyard by spinnaker.
the class ProviderService method getHasImageProvider.
public HasImageProvider getHasImageProvider(String deploymentName, String providerName) {
NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setProvider(providerName);
Provider provider = getProvider(deploymentName, providerName);
if (provider instanceof HasImageProvider) {
return (HasImageProvider) provider;
} else {
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "Provider \"" + providerName + "\" does not support configuring images via Halyard.").build());
}
}
Aggregations