Search in sources :

Example 1 with CONFIG_FILE_LOGBACK_NAME

use of org.apache.flink.kubernetes.utils.Constants.CONFIG_FILE_LOGBACK_NAME in project flink by apache.

the class KubernetesJobManagerFactoryTest method testFlinkConfConfigMap.

@Test
public void testFlinkConfConfigMap() throws IOException {
    kubernetesJobManagerSpecification = KubernetesJobManagerFactory.buildKubernetesJobManagerSpecification(flinkPod, kubernetesJobManagerParameters);
    final ConfigMap resultConfigMap = (ConfigMap) this.kubernetesJobManagerSpecification.getAccompanyingResources().stream().filter(x -> x instanceof ConfigMap && x.getMetadata().getName().equals(FlinkConfMountDecorator.getFlinkConfConfigMapName(CLUSTER_ID))).collect(Collectors.toList()).get(0);
    assertEquals(2, resultConfigMap.getMetadata().getLabels().size());
    final Map<String, String> resultDatas = resultConfigMap.getData();
    assertEquals(3, resultDatas.size());
    assertEquals("some data", resultDatas.get(CONFIG_FILE_LOG4J_NAME));
    assertEquals("some data", resultDatas.get(CONFIG_FILE_LOGBACK_NAME));
    assertTrue(resultDatas.get(FLINK_CONF_FILENAME).contains(KubernetesConfigOptionsInternal.ENTRY_POINT_CLASS.key() + ": " + ENTRY_POINT_CLASS));
}
Also used : Quantity(io.fabric8.kubernetes.api.model.Quantity) SecurityOptions(org.apache.flink.configuration.SecurityOptions) KubernetesTestUtils(org.apache.flink.kubernetes.KubernetesTestUtils) KubernetesJobManagerTestBase(org.apache.flink.kubernetes.kubeclient.KubernetesJobManagerTestBase) CONFIG_FILE_LOG4J_NAME(org.apache.flink.kubernetes.utils.Constants.CONFIG_FILE_LOG4J_NAME) Map(java.util.Map) ExternalServiceDecorator(org.apache.flink.kubernetes.kubeclient.decorators.ExternalServiceDecorator) DeploymentSpec(io.fabric8.kubernetes.api.model.apps.DeploymentSpec) KubernetesUtils(org.apache.flink.kubernetes.utils.KubernetesUtils) KubernetesConfigOptions(org.apache.flink.kubernetes.configuration.KubernetesConfigOptions) FlinkPod(org.apache.flink.kubernetes.kubeclient.FlinkPod) HasMetadata(io.fabric8.kubernetes.api.model.HasMetadata) Collectors(java.util.stream.Collectors) Base64(java.util.Base64) List(java.util.List) Assert.assertFalse(org.junit.Assert.assertFalse) Matchers.equalTo(org.hamcrest.Matchers.equalTo) Secret(io.fabric8.kubernetes.api.model.Secret) Matchers.is(org.hamcrest.Matchers.is) Constants(org.apache.flink.kubernetes.utils.Constants) Container(io.fabric8.kubernetes.api.model.Container) KubernetesConfigOptionsInternal(org.apache.flink.kubernetes.configuration.KubernetesConfigOptionsInternal) HashMap(java.util.HashMap) OwnerReference(io.fabric8.kubernetes.api.model.OwnerReference) KubernetesHaServicesFactory(org.apache.flink.kubernetes.highavailability.KubernetesHaServicesFactory) PodSpec(io.fabric8.kubernetes.api.model.PodSpec) DeploymentOptions(org.apache.flink.configuration.DeploymentOptions) FlinkConfMountDecorator(org.apache.flink.kubernetes.kubeclient.decorators.FlinkConfMountDecorator) Service(io.fabric8.kubernetes.api.model.Service) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) KubernetesDeploymentTarget(org.apache.flink.kubernetes.configuration.KubernetesDeploymentTarget) FLINK_CONF_FILENAME(org.apache.flink.configuration.GlobalConfiguration.FLINK_CONF_FILENAME) InternalServiceDecorator(org.apache.flink.kubernetes.kubeclient.decorators.InternalServiceDecorator) Assert.assertNotNull(org.junit.Assert.assertNotNull) KubernetesJobManagerSpecification(org.apache.flink.kubernetes.kubeclient.KubernetesJobManagerSpecification) Matchers(org.hamcrest.Matchers) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) IOException(java.io.IOException) KubernetesSessionClusterEntrypoint(org.apache.flink.kubernetes.entrypoint.KubernetesSessionClusterEntrypoint) HadoopConfMountDecorator(org.apache.flink.kubernetes.kubeclient.decorators.HadoopConfMountDecorator) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap) KerberosMountDecorator(org.apache.flink.kubernetes.kubeclient.decorators.KerberosMountDecorator) Assert.assertNull(org.junit.Assert.assertNull) HeadlessClusterIPService(org.apache.flink.kubernetes.kubeclient.services.HeadlessClusterIPService) CONFIG_FILE_LOGBACK_NAME(org.apache.flink.kubernetes.utils.Constants.CONFIG_FILE_LOGBACK_NAME) Deployment(io.fabric8.kubernetes.api.model.apps.Deployment) Collections(java.util.Collections) HighAvailabilityOptions(org.apache.flink.configuration.HighAvailabilityOptions) Assert.assertEquals(org.junit.Assert.assertEquals) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap) Test(org.junit.Test)

Aggregations

ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)1 Container (io.fabric8.kubernetes.api.model.Container)1 HasMetadata (io.fabric8.kubernetes.api.model.HasMetadata)1 OwnerReference (io.fabric8.kubernetes.api.model.OwnerReference)1 PodSpec (io.fabric8.kubernetes.api.model.PodSpec)1 Quantity (io.fabric8.kubernetes.api.model.Quantity)1 Secret (io.fabric8.kubernetes.api.model.Secret)1 Service (io.fabric8.kubernetes.api.model.Service)1 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)1 DeploymentSpec (io.fabric8.kubernetes.api.model.apps.DeploymentSpec)1 IOException (java.io.IOException)1 Base64 (java.util.Base64)1 Collections (java.util.Collections)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 DeploymentOptions (org.apache.flink.configuration.DeploymentOptions)1 FLINK_CONF_FILENAME (org.apache.flink.configuration.GlobalConfiguration.FLINK_CONF_FILENAME)1 HighAvailabilityOptions (org.apache.flink.configuration.HighAvailabilityOptions)1