Search in sources :

Example 11 with DaemonSet

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");
}
Also used : KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) DaemonSetBuilder(io.fabric8.kubernetes.api.model.apps.DaemonSetBuilder) Test(org.junit.Test)

Example 12 with 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"));
}
Also used : KubernetesListBuilder(io.fabric8.kubernetes.api.model.KubernetesListBuilder) DaemonSetBuilder(io.fabric8.kubernetes.api.model.apps.DaemonSetBuilder) DaemonSet(io.fabric8.kubernetes.api.model.apps.DaemonSet) ArrayList(java.util.ArrayList) List(java.util.List) ImageChangeTrigger(io.fabric8.openshift.api.model.ImageChangeTrigger) Test(org.junit.Test)

Aggregations

ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)7 DaemonSet (io.fabric8.kubernetes.api.model.apps.DaemonSet)6 DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)6 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)4 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)4 PersistentVolumeClaim (io.fabric8.kubernetes.api.model.PersistentVolumeClaim)4 Pod (io.fabric8.kubernetes.api.model.Pod)4 Secret (io.fabric8.kubernetes.api.model.Secret)4 Service (io.fabric8.kubernetes.api.model.Service)4 ServiceAccount (io.fabric8.kubernetes.api.model.ServiceAccount)4 DaemonSet (io.fabric8.kubernetes.api.model.extensions.DaemonSet)4 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)4 Ingress (io.fabric8.kubernetes.api.model.extensions.Ingress)4 ReplicaSet (io.fabric8.kubernetes.api.model.extensions.ReplicaSet)4 StatefulSet (io.fabric8.kubernetes.api.model.extensions.StatefulSet)4 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)4 IOException (java.io.IOException)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)3 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)3