use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class DCOSAccountValidator method validate.
@Override
public void validate(final ConfigProblemSetBuilder problems, final DCOSAccount account) {
DeploymentConfiguration deploymentConfiguration;
/**
* I have copied
* the code
* that was in
* the KubernetesAccountValidator
*
* and which
* you were planning
* to refactor
* with filters
*
* Forgive me
* It did the job
* And I was lazy
* so very lazy
*/
// TODO(lwander) this is still a little messy - I should use the filters to get the necessary docker account
Node parent = account.getParent();
while (!(parent instanceof DeploymentConfiguration)) {
// Note this will crash in the above check if the halconfig representation is corrupted
// (that's ok, because it indicates a more serious error than we want to validate).
parent = parent.getParent();
}
deploymentConfiguration = (DeploymentConfiguration) parent;
validateClusters(problems, account);
if (account.getClusters().isEmpty()) {
problems.addProblem(ERROR, "Account does not have any clusters configured").setRemediation("Edit the account with either --update-user-credential or --update-service-credential");
}
final List<String> dockerRegistryNames = account.getDockerRegistries().stream().map(DockerRegistryReference::getAccountName).collect(Collectors.toList());
validateDockerRegistries(problems, deploymentConfiguration, dockerRegistryNames, Provider.ProviderType.DCOS);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class CanaryAccountService method getCanaryAccount.
public AbstractCanaryAccount getCanaryAccount(String deploymentName, String serviceIntegrationName, String accountName) {
AbstractCanaryServiceIntegration serviceIntegration = getServiceIntegration(deploymentName, serviceIntegrationName);
List<AbstractCanaryAccount> matchingAccounts = (List<AbstractCanaryAccount>) serviceIntegration.getAccounts().stream().filter(a -> (((AbstractCanaryAccount) a).getName().equals(accountName))).collect(Collectors.toList());
switch(matchingAccounts.size()) {
case 0:
throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No account with name \"" + accountName + "\" was found").setRemediation("Check if this account was defined in another service integration, or create a new one").build());
case 1:
return matchingAccounts.get(0);
default:
throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one account named \"" + accountName + "\" was found").setRemediation("Manually delete/rename duplicate canary accounts with name \"" + accountName + "\" in your halconfig file").build());
}
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class ConfigService method setCurrentDeployment.
public void setCurrentDeployment(String deploymentName) {
Halconfig config = getConfig();
boolean found = config.getDeploymentConfigurations().stream().anyMatch(c -> c.getName().equals(deploymentName));
if (!found) {
config.getDeploymentConfigurations().add(new DeploymentConfiguration().setName(deploymentName));
}
config.setCurrentDeployment(deploymentName);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class HalconfigParser method setInmemoryHalConfig.
/**
* Parse Halyard's config for inmemory usage. HalConfigs parsed with this function will NOT be written to disk for
* persistence.
*
* @param is is the input stream to read from.
* @return the fully parsed halconfig.
* @see Halconfig
*/
public Halconfig setInmemoryHalConfig(ByteArrayInputStream is) throws IllegalArgumentException {
Halconfig halconfig = parseHalconfig(is);
DaemonTaskHandler.setContext(halconfig);
return halconfig;
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Halconfig in project halyard by spinnaker.
the class HalconfigParser method transformHalconfig.
private Halconfig transformHalconfig(Halconfig input) {
if (input == null) {
log.info("No halconfig found - generating a new one...");
input = new Halconfig();
}
input.parentify();
input.setPath(halconfigPath);
return input;
}
Aggregations