Search in sources :

Example 11 with DeploymentSpec

use of io.fabric8.kubernetes.api.model.extensions.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)

Example 12 with DeploymentSpec

use of io.fabric8.kubernetes.api.model.extensions.DeploymentSpec in project fabric8 by fabric8io.

the class DeploymentPodsAssert method pods.

@Override
public PodSelectionAssert pods() {
    spec().isNotNull().selector().isNotNull();
    DeploymentSpec spec = this.actual.getSpec();
    Integer replicas = spec.getReplicas();
    LabelSelector selector = spec.getSelector();
    Map<String, String> matchLabels = selector.getMatchLabels();
    List<LabelSelectorRequirement> matchExpressions = selector.getMatchExpressions();
    return new PodSelectionAssert(client, replicas, matchLabels, matchExpressions, "DeploymentConfig " + KubernetesHelper.getName(actual));
}
Also used : DeploymentSpec(io.fabric8.kubernetes.api.model.extensions.DeploymentSpec) LabelSelector(io.fabric8.kubernetes.api.model.LabelSelector) LabelSelectorRequirement(io.fabric8.kubernetes.api.model.LabelSelectorRequirement)

Aggregations

DeploymentSpec (io.fabric8.kubernetes.api.model.extensions.DeploymentSpec)10 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)7 LabelSelector (io.fabric8.kubernetes.api.model.LabelSelector)5 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 LabelSelectorRequirement (io.fabric8.kubernetes.api.model.LabelSelectorRequirement)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