Search in sources :

Example 11 with DeploymentSpec

use of io.fabric8.kubernetes.api.model.apps.DeploymentSpec in project flink by apache.

the class KubernetesJobManagerFactoryTest method testDeploymentSpec.

@Test
public void testDeploymentSpec() throws IOException {
    kubernetesJobManagerSpecification = KubernetesJobManagerFactory.buildKubernetesJobManagerSpecification(flinkPod, kubernetesJobManagerParameters);
    final DeploymentSpec resultDeploymentSpec = this.kubernetesJobManagerSpecification.getDeployment().getSpec();
    assertEquals(1, resultDeploymentSpec.getReplicas().intValue());
    final Map<String, String> expectedLabels = new HashMap<>(getCommonLabels());
    expectedLabels.put(Constants.LABEL_COMPONENT_KEY, Constants.LABEL_COMPONENT_JOB_MANAGER);
    assertEquals(expectedLabels, resultDeploymentSpec.getSelector().getMatchLabels());
    expectedLabels.putAll(userLabels);
    assertEquals(expectedLabels, resultDeploymentSpec.getTemplate().getMetadata().getLabels());
    assertThat(resultDeploymentSpec.getTemplate().getMetadata().getAnnotations(), equalTo(userAnnotations));
    assertNotNull(resultDeploymentSpec.getTemplate().getSpec());
}
Also used : DeploymentSpec(io.fabric8.kubernetes.api.model.apps.DeploymentSpec) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

DeploymentSpec (io.fabric8.kubernetes.api.model.extensions.DeploymentSpec)9 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)7 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)4 PodSpec (io.fabric8.kubernetes.api.model.PodSpec)4 PodTemplateSpec (io.fabric8.kubernetes.api.model.PodTemplateSpec)4 ReplicationController (io.fabric8.kubernetes.api.model.ReplicationController)4 ReplicationControllerSpec (io.fabric8.kubernetes.api.model.ReplicationControllerSpec)4 ReplicaSet (io.fabric8.kubernetes.api.model.extensions.ReplicaSet)4 ReplicaSetSpec (io.fabric8.kubernetes.api.model.extensions.ReplicaSetSpec)4 DeploymentConfig (io.fabric8.openshift.api.model.DeploymentConfig)4 DeploymentConfigSpec (io.fabric8.openshift.api.model.DeploymentConfigSpec)4 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)3 HashMap (java.util.HashMap)3 Controller (io.fabric8.kubernetes.api.Controller)2 Container (io.fabric8.kubernetes.api.model.Container)2 ObjectMeta (io.fabric8.kubernetes.api.model.ObjectMeta)2 PodSpecBuilder (io.fabric8.kubernetes.api.model.PodSpecBuilder)2 DeploymentBuilder (io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder)2 StatefulSetSpec (io.fabric8.kubernetes.api.model.extensions.StatefulSetSpec)2 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)2