Search in sources :

Example 1 with Profile

use of org.eclipse.jkube.kit.profile.Profile in project jkube by eclipse.

the class DefaultResourceService method generateProfiledResourcesFromSubdirectories.

private List<HasMetadata> generateProfiledResourcesFromSubdirectories(PlatformMode platformMode, EnricherManager enricherManager) throws IOException {
    final List<HasMetadata> ret = new ArrayList<>();
    final File resourceDir = resourceServiceConfig.getResourceDir();
    File[] profileDirs = resourceDir.listFiles(File::isDirectory);
    if (profileDirs != null) {
        for (File profileDir : profileDirs) {
            Profile foundProfile = ProfileUtil.findProfile(profileDir.getName(), resourceDir);
            ProcessorConfig enricherConfig = foundProfile.getEnricherConfig();
            File[] resourceFiles = listResourceFragments(profileDir);
            final File[] processedResources = processResourceFiles(resourceFiles);
            if (processedResources.length > 0) {
                KubernetesListBuilder profileBuilder = readResourceFragments(platformMode, processedResources);
                enricherManager.createDefaultResources(platformMode, enricherConfig, profileBuilder);
                enricherManager.enrich(platformMode, enricherConfig, profileBuilder);
                ret.addAll(profileBuilder.buildItems());
            }
        }
    }
    return ret;
}
Also used : KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) ArrayList(java.util.ArrayList) File(java.io.File) Profile(org.eclipse.jkube.kit.profile.Profile) ProcessorConfig(org.eclipse.jkube.kit.config.resource.ProcessorConfig)

Aggregations

HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)1 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ProcessorConfig (org.eclipse.jkube.kit.config.resource.ProcessorConfig)1 Profile (org.eclipse.jkube.kit.profile.Profile)1