use of io.fabric8.kubernetes.api.model.apps.DaemonSet in project fabric8-maven-plugin by fabric8io.
the class ImageEnricherTest method checkEnrichDaemonSet.
@Test
public void checkEnrichDaemonSet() throws Exception {
KubernetesListBuilder builder = new KubernetesListBuilder().addToItems(new DaemonSetBuilder().build());
imageEnricher.create(PlatformMode.kubernetes, builder);
assertCorrectlyGeneratedResources(builder.build(), "DaemonSet");
}
use of io.fabric8.kubernetes.api.model.apps.DaemonSet in project fabric8-maven-plugin by fabric8io.
the class TriggersAnnotationEnricherTest method testDaemonSetEnrichment.
@Test
public void testDaemonSetEnrichment() throws IOException {
KubernetesListBuilder builder = new KubernetesListBuilder().addToItems(new DaemonSetBuilder().withNewMetadata().addToAnnotations("annkey", "annvalue").endMetadata().withNewSpec().withNewTemplate().withNewSpec().withContainers(createContainers("c1", "iss:1.1.0", "c2", "docker.io/a-docker-user/is:latest")).endSpec().endTemplate().endSpec().build());
TriggersAnnotationEnricher enricher = new TriggersAnnotationEnricher(context);
enricher.enrich(PlatformMode.kubernetes, builder);
DaemonSet res = (DaemonSet) builder.build().getItems().get(0);
String triggers = res.getMetadata().getAnnotations().get("image.openshift.io/triggers");
assertNotNull(triggers);
List<ImageChangeTrigger> triggerList = OBJECT_MAPPER.readValue(triggers, OBJECT_MAPPER.getTypeFactory().constructCollectionType(List.class, ImageChangeTrigger.class));
assertEquals(1, triggerList.size());
ImageChangeTrigger trigger = triggerList.get(0);
assertEquals("ImageStreamTag", trigger.getFrom().getKind());
assertEquals("iss:1.1.0", trigger.getFrom().getName());
assertTrue(trigger.getAdditionalProperties().containsKey("fieldPath"));
assertEquals("annvalue", res.getMetadata().getAnnotations().get("annkey"));
}
Aggregations