Search in sources :

Example 6 with DockerRegistryReference

use of com.netflix.spinnaker.halyard.config.model.v1.providers.containers.DockerRegistryReference in project halyard by spinnaker.

the class KubernetesAccountValidator method validate.

@Override
public void validate(ConfigProblemSetBuilder psBuilder, KubernetesAccount account) {
    DeploymentConfiguration deploymentConfiguration;
    // 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;
    validateKindConfig(psBuilder, account);
    // TODO(lwander) validate all config with clouddriver's v2 creds
    switch(account.getProviderVersion()) {
        case V1:
            final List<String> dockerRegistryNames = account.getDockerRegistries().stream().map(DockerRegistryReference::getAccountName).collect(Collectors.toList());
            validateDockerRegistries(psBuilder, deploymentConfiguration, dockerRegistryNames, Provider.ProviderType.KUBERNETES);
            validateKubeconfig(psBuilder, account);
        case V2:
            break;
        default:
            throw new IllegalStateException("Unknown provider version " + account.getProviderVersion());
    }
}
Also used : Node(com.netflix.spinnaker.halyard.config.model.v1.node.Node) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Aggregations

DockerRegistryReference (com.netflix.spinnaker.halyard.config.model.v1.providers.containers.DockerRegistryReference)4 Parameter (com.beust.jcommander.Parameter)2 Parameters (com.beust.jcommander.Parameters)2 AbstractEditAccountCommand (com.netflix.spinnaker.halyard.cli.command.v1.config.providers.account.AbstractEditAccountCommand)2 Account (com.netflix.spinnaker.halyard.config.model.v1.node.Account)2 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)2 Node (com.netflix.spinnaker.halyard.config.model.v1.node.Node)2 DCOSAccount (com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSAccount)2 KubernetesAccount (com.netflix.spinnaker.halyard.config.model.v1.providers.kubernetes.KubernetesAccount)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 LocalFileConverter (com.netflix.spinnaker.halyard.cli.command.v1.converter.LocalFileConverter)1 Provider (com.netflix.spinnaker.halyard.config.model.v1.node.Provider)1 ClusterCredential (com.netflix.spinnaker.halyard.config.model.v1.providers.dcos.DCOSAccount.ClusterCredential)1