use of io.fabric8.kubernetes.api.KubernetesHelper.toItemList in project fabric8-maven-plugin by fabric8io.
the class KubernetesResourceUtil method loadResources.
public static Set<HasMetadata> loadResources(File manifest) throws IOException {
Object dto = KubernetesHelper.loadYaml(manifest, KubernetesResource.class);
if (dto == null) {
throw new IllegalStateException("Cannot load kubernetes YAML: " + manifest);
}
if (dto instanceof Template) {
Template template = (Template) dto;
boolean failOnMissingParameterValue = false;
dto = Templates.processTemplatesLocally(template, failOnMissingParameterValue);
}
Set<KubernetesResource<?>> resources = new LinkedHashSet<>();
Set<HasMetadata> entities = new TreeSet<>(new HasMetadataComparator());
for (KubernetesResource<?> resource : resources) {
entities.addAll(KubernetesHelper.toItemList(resource));
}
entities.addAll(KubernetesHelper.toItemList(dto));
return entities;
}
Aggregations