Search in sources :

Example 16 with NodeFilter

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.

the class CiService method getAllCis.

public List<Ci> getAllCis(String deploymentName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).withAnyCi();
    List<Ci> matching = lookupService.getMatchingNodesOfType(filter, Ci.class);
    if (matching.size() == 0) {
        throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No cis could be found").build());
    } else {
        return matching;
    }
}
Also used : Ci(com.netflix.spinnaker.halyard.config.model.v1.node.Ci) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 17 with NodeFilter

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.

the class CiService method getCi.

public Ci getCi(String deploymentName, String ciName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setCi(ciName);
    List<Ci> matching = lookupService.getMatchingNodesOfType(filter, Ci.class);
    switch(matching.size()) {
        case 0:
            throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No Continuous Integration service with name \"" + ciName + "\" could be found").build());
        case 1:
            return matching.get(0);
        default:
            throw new IllegalConfigException(new ConfigProblemBuilder(Severity.FATAL, "More than one CI with name \"" + ciName + "\" found").build());
    }
}
Also used : Ci(com.netflix.spinnaker.halyard.config.model.v1.node.Ci) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) IllegalConfigException(com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 18 with NodeFilter

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.

the class MasterService method getAllMasters.

public List<Master> getAllMasters(String deploymentName, String ciName) {
    NodeFilter filter = new NodeFilter().setDeployment(deploymentName).setCi(ciName).withAnyMaster();
    List<Master> matchingMasters = lookupService.getMatchingNodesOfType(filter, Master.class);
    if (matchingMasters.size() == 0) {
        throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No masters could be found").build());
    } else {
        return matchingMasters;
    }
}
Also used : Master(com.netflix.spinnaker.halyard.config.model.v1.node.Master) ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 19 with NodeFilter

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter 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);
}
Also used : NodeIterator(com.netflix.spinnaker.halyard.config.model.v1.node.NodeIterator) Providers(com.netflix.spinnaker.halyard.config.model.v1.node.Providers) HasImageProvider(com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider) Provider(com.netflix.spinnaker.halyard.config.model.v1.node.Provider) HasImageProvider(com.netflix.spinnaker.halyard.config.model.v1.node.HasImageProvider) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Example 20 with NodeFilter

use of com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter in project halyard by spinnaker.

the class DeploymentService method getAllDeploymentConfigurations.

public List<DeploymentConfiguration> getAllDeploymentConfigurations() {
    NodeFilter filter = new NodeFilter().withAnyDeployment();
    List<DeploymentConfiguration> matching = lookupService.getMatchingNodesOfType(filter, DeploymentConfiguration.class);
    if (matching.size() == 0) {
        throw new ConfigNotFoundException(new ConfigProblemBuilder(Severity.FATAL, "No deployments could be found in your currently loaded halconfig").build());
    } else {
        return matching;
    }
}
Also used : ConfigProblemBuilder(com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder) ConfigNotFoundException(com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration) NodeFilter(com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)

Aggregations

NodeFilter (com.netflix.spinnaker.halyard.config.model.v1.node.NodeFilter)26 ConfigProblemBuilder (com.netflix.spinnaker.halyard.config.problem.v1.ConfigProblemBuilder)20 ConfigNotFoundException (com.netflix.spinnaker.halyard.config.error.v1.ConfigNotFoundException)17 IllegalConfigException (com.netflix.spinnaker.halyard.config.error.v1.IllegalConfigException)9 Node (com.netflix.spinnaker.halyard.config.model.v1.node.Node)3 NodeIterator (com.netflix.spinnaker.halyard.config.model.v1.node.NodeIterator)3 PersistentStorage (com.netflix.spinnaker.halyard.config.model.v1.node.PersistentStorage)3 AppengineProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.appengine.AppengineProvider)3 AwsProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.aws.AwsProvider)3 AzureProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.azure.AzureProvider)3 DCOSProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSProvider)3 DockerRegistryProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.dockerRegistry.DockerRegistryProvider)3 GoogleProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.google.GoogleProvider)3 KubernetesProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesProvider)3 OpenstackProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.openstack.OpenstackProvider)3 OracleBMCSProvider (com.netflix.spinnaker.halyard.config.model.v1.providers.oraclebmcs.OracleBMCSProvider)3 GcsArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.artifacts.gcs.GcsArtifactProvider)2 GitHubArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.artifacts.github.GitHubArtifactProvider)2 HttpArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.artifacts.http.HttpArtifactProvider)2 ArtifactProvider (com.netflix.spinnaker.halyard.config.model.v1.node.ArtifactProvider)2