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;
}
Aggregations