Search in sources :

Example 41 with FlinkPod

use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.

the class FlinkConfMountDecoratorTest method testWhetherPodOrContainerIsDecorated.

@Test
public void testWhetherPodOrContainerIsDecorated() {
    final FlinkPod resultFlinkPod = flinkConfMountDecorator.decorateFlinkPod(baseFlinkPod);
    assertNotEquals(baseFlinkPod.getPodWithoutMainContainer(), resultFlinkPod.getPodWithoutMainContainer());
    assertNotEquals(baseFlinkPod.getMainContainer(), resultFlinkPod.getMainContainer());
}
Also used : FlinkPod(org.apache.flink.kubernetes.kubeclient.FlinkPod) Test(org.junit.Test)

Example 42 with FlinkPod

use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.

the class FlinkConfMountDecoratorTest method testDecoratedFlinkPodWithLogback.

@Test
public void testDecoratedFlinkPodWithLogback() throws IOException {
    KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, CONFIG_FILE_LOGBACK_NAME);
    final FlinkPod resultFlinkPod = flinkConfMountDecorator.decorateFlinkPod(baseFlinkPod);
    final List<KeyToPath> expectedKeyToPaths = Arrays.asList(new KeyToPathBuilder().withKey(CONFIG_FILE_LOGBACK_NAME).withPath(CONFIG_FILE_LOGBACK_NAME).build(), new KeyToPathBuilder().withKey(FLINK_CONF_FILENAME).withPath(FLINK_CONF_FILENAME).build());
    final List<Volume> expectedVolumes = Collections.singletonList(new VolumeBuilder().withName(Constants.FLINK_CONF_VOLUME).withNewConfigMap().withName(getFlinkConfConfigMapName(CLUSTER_ID)).withItems(expectedKeyToPaths).endConfigMap().build());
    assertEquals(expectedVolumes, resultFlinkPod.getPodWithoutMainContainer().getSpec().getVolumes());
}
Also used : KeyToPath(io.fabric8.kubernetes.api.model.KeyToPath) FlinkPod(org.apache.flink.kubernetes.kubeclient.FlinkPod) Volume(io.fabric8.kubernetes.api.model.Volume) KeyToPathBuilder(io.fabric8.kubernetes.api.model.KeyToPathBuilder) VolumeBuilder(io.fabric8.kubernetes.api.model.VolumeBuilder) Test(org.junit.Test)

Example 43 with FlinkPod

use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.

the class InitJobManagerDecoratorAccountTest method onSetup.

@Override
protected void onSetup() throws Exception {
    super.onSetup();
    final InitJobManagerDecorator initJobManagerDecorator = new InitJobManagerDecorator(this.kubernetesJobManagerParameters);
    final FlinkPod resultFlinkPod = initJobManagerDecorator.decorateFlinkPod(this.baseFlinkPod);
    this.resultPod = resultFlinkPod.getPodWithoutMainContainer();
}
Also used : FlinkPod(org.apache.flink.kubernetes.kubeclient.FlinkPod)

Example 44 with FlinkPod

use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.

the class InitTaskManagerDecoratorTest method onSetup.

@Override
protected void onSetup() throws Exception {
    super.onSetup();
    final InitTaskManagerDecorator initTaskManagerDecorator = new InitTaskManagerDecorator(kubernetesTaskManagerParameters);
    final FlinkPod resultFlinkPod = initTaskManagerDecorator.decorateFlinkPod(this.baseFlinkPod);
    this.resultPod = resultFlinkPod.getPodWithoutMainContainer();
    this.resultMainContainer = resultFlinkPod.getMainContainer();
}
Also used : FlinkPod(org.apache.flink.kubernetes.kubeclient.FlinkPod)

Example 45 with FlinkPod

use of org.apache.flink.kubernetes.kubeclient.FlinkPod in project flink by apache.

the class KubernetesFactoryWithPodTemplateTestBase method onSetup.

@Override
public final void onSetup() throws Exception {
    final FlinkPod podTemplate = KubernetesUtils.loadPodFromTemplateFile(flinkKubeClient, KubernetesPodTemplateTestUtils.getPodTemplateFile(), KubernetesPodTemplateTestUtils.TESTING_MAIN_CONTAINER_NAME);
    this.resultPod = getResultPod(podTemplate);
}
Also used : FlinkPod(org.apache.flink.kubernetes.kubeclient.FlinkPod)

Aggregations

FlinkPod (org.apache.flink.kubernetes.kubeclient.FlinkPod)54 Test (org.junit.Test)35 Container (io.fabric8.kubernetes.api.model.Container)15 List (java.util.List)14 Constants (org.apache.flink.kubernetes.utils.Constants)13 HashMap (java.util.HashMap)12 Collectors (java.util.stream.Collectors)12 KubernetesConfigOptions (org.apache.flink.kubernetes.configuration.KubernetesConfigOptions)12 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)11 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)10 Volume (io.fabric8.kubernetes.api.model.Volume)10 IOException (java.io.IOException)10 Collections (java.util.Collections)10 Map (java.util.Map)10 KubernetesJobManagerSpecification (org.apache.flink.kubernetes.kubeclient.KubernetesJobManagerSpecification)9 KubernetesJobManagerTestBase (org.apache.flink.kubernetes.kubeclient.KubernetesJobManagerTestBase)9 FlinkConfMountDecorator (org.apache.flink.kubernetes.kubeclient.decorators.FlinkConfMountDecorator)9 HadoopConfMountDecorator (org.apache.flink.kubernetes.kubeclient.decorators.HadoopConfMountDecorator)9 KerberosMountDecorator (org.apache.flink.kubernetes.kubeclient.decorators.KerberosMountDecorator)9 Assert.assertEquals (org.junit.Assert.assertEquals)9