@Test public void testUnmarshalYAMLTemplate() throws IOException { Template t = new OperationSupport().unmarshal(getClass().getResourceAsStream("/test-template.yml"), Template.class); assertEquals("eap6-basic-sti", t.getMetadata().getName()); }
@Test public void testUnmarshalJSONTemplate() throws IOException { Template t = new OperationSupport().unmarshal(getClass().getResourceAsStream("/test-template.json"), Template.class); assertEquals("eap6-basic-sti", t.getMetadata().getName()); }
public static void main(String[] args) throws IOException { try (OpenShiftClient client = new DefaultOpenShiftClient()) { try { client.namespaces().createNew().withNewMetadata().withName("thisisatest").endMetadata().done(); Template t = client.templates().load(TemplateExample.class.getResourceAsStream("/test-template.yml")).get(); for (Parameter p : t.getParameters()) { System.out.println(p.getName()); } t = client.templates().load(TemplateExample.class.getResourceAsStream("/test-template.yml")).get(); t = client.templates().inNamespace("thisisatest").load(TemplateExample.class.getResourceAsStream("/test-template.yml")).create(); t = client.templates().inNamespace("thisisatest").withName("eap6-basic-sti").get(); System.out.println(t.getMetadata().getName()); KubernetesList l = client.templates().inNamespace("thisisatest").withName("eap6-basic-sti").process(); System.out.println(l.getItems().size()); l = client.lists().load(TemplateExample.class.getResourceAsStream("/test-list.yml")).get(); System.out.println(l.getItems().size()); l = client.lists().inNamespace("thisisatest").load(TemplateExample.class.getResourceAsStream("/test-list.yml")).create(); } finally { // And finally clean up the namespace client.namespaces().withName("thisisatest").delete(); logger.info("Deleted namespace"); } } } }
public KubernetesList processLocally(Map<String, String> valuesMap) { String namespace = getItem() != null ? getItem().getMetadata().getNamespace() : getNamespace(); if (namespace == null) { namespace = getConfig().getNamespace(); String name = getItem() != null ? getItem().getMetadata().getName() : getName();
private static Template createTemplateWithObjects(KubernetesList kubernetesResources, Template template) { List<io.fabric8.openshift.api.model.Parameter> parameters = template.getParameters(); List<HasMetadata> items = kubernetesResources.getItems(); Template tempTemplate = null; if (parameters != null && parameters.size() > 0 && items != null && items.size() > 0) { tempTemplate = new Template(); tempTemplate.setMetadata(template.getMetadata()); tempTemplate.setParameters(parameters); tempTemplate.setObjects(items); } return tempTemplate; }
public KubernetesList processLocally(Map<String, String> valuesMap) { String namespace = getItem() != null ? getItem().getMetadata().getNamespace() : getNamespace(); if (namespace == null) { namespace = getConfig().getNamespace(); String name = getItem() != null ? getItem().getMetadata().getName() : getName();
Map<String,String> descriptions = new HashMap<String,String>(); for(Template template : templateList.getItems()) { String name = template.getMetadata().getName(); for (String annotation : template.getMetadata().getAnnotations().keySet()) { if (annotation.contains("summary")) { String description = template.getMetadata().getAnnotations().get(annotation); descriptions.put(name, description);
public TemplateFluentImpl(Template instance){ this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withLabels(instance.getLabels()); this.withMetadata(instance.getMetadata()); this.withObjects(instance.getObjects()); this.withParameters(instance.getParameters()); }
public TemplateBuilder(Template instance,Boolean validationEnabled){ this.fluent = this; this.withApiVersion(instance.getApiVersion()); this.withKind(instance.getKind()); this.withLabels(instance.getLabels()); this.withMetadata(instance.getMetadata()); this.withObjects(instance.getObjects()); this.withParameters(instance.getParameters()); this.validationEnabled = validationEnabled; }
public TemplateBuilder(TemplateFluent<?> fluent,Template instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withApiVersion(instance.getApiVersion()); fluent.withKind(instance.getKind()); fluent.withLabels(instance.getLabels()); fluent.withMetadata(instance.getMetadata()); fluent.withObjects(instance.getObjects()); fluent.withParameters(instance.getParameters()); this.validationEnabled = validationEnabled; } public TemplateBuilder(Template instance){