martin-g commented on code in PR #20498: URL: https://github.com/apache/flink/pull/20498#discussion_r990945324
########## flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/KubernetesJobManagerSpecification.java: ########## @@ -30,10 +30,15 @@ public class KubernetesJobManagerSpecification { private List<HasMetadata> accompanyingResources; + private List<HasMetadata> prePreparedResources; Review Comment: ```suggestion private final List<HasMetadata> prePreparedResources; ``` ########## flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/Fabric8FlinkKubeClientTest.java: ########## @@ -630,4 +630,37 @@ private KubernetesConfigMap buildTestingConfigMap() { .withData(data) .build()); } + + @Test + void testMockPrePreparedResources() throws Exception { + // regenerate a test JM spec + Deployment testDeployment = kubernetesJobManagerSpecification.getDeployment(); + List<HasMetadata> testAccompanyingResources = + kubernetesJobManagerSpecification.getAccompanyingResources(); + List<HasMetadata> mockPrePreparedResources = new ArrayList<>(); + for (int i = 0; i < 3; i++) { + Pod mockPod = + new PodBuilder() + .editOrNewMetadata() + .withName(String.format("mock-pod-preprepared-resource%d", i)) Review Comment: ```suggestion .withName("mock-pod-preprepared-resource-" + i) ``` ########## flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/factory/KubernetesJobManagerFactoryTest.java: ########## @@ -468,4 +468,15 @@ void testSetJobManagerDeploymentReplicas() throws Exception { assertThat(kubernetesJobManagerSpecification.getDeployment().getSpec().getReplicas()) .isEqualTo(JOBMANAGER_REPLICAS); } + + @Test + void testPrePreparedResourcesWontAffectOriginalProcess() throws IOException { + kubernetesJobManagerSpecification = + KubernetesJobManagerFactory.buildKubernetesJobManagerSpecification( + flinkPod, kubernetesJobManagerParameters); + final List<HasMetadata> prePreparedResources = + this.kubernetesJobManagerSpecification.getPrePreparedResources(); + assertThat(prePreparedResources).hasSize(0); + assertThat(prePreparedResources).isEmpty(); Review Comment: No need of the second assertion. ########## flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/Fabric8FlinkKubeClientTest.java: ########## @@ -630,4 +630,37 @@ private KubernetesConfigMap buildTestingConfigMap() { .withData(data) .build()); } + + @Test + void testMockPrePreparedResources() throws Exception { + // regenerate a test JM spec + Deployment testDeployment = kubernetesJobManagerSpecification.getDeployment(); + List<HasMetadata> testAccompanyingResources = + kubernetesJobManagerSpecification.getAccompanyingResources(); + List<HasMetadata> mockPrePreparedResources = new ArrayList<>(); + for (int i = 0; i < 3; i++) { + Pod mockPod = + new PodBuilder() + .editOrNewMetadata() + .withName(String.format("mock-pod-preprepared-resource%d", i)) + .endMetadata() + .editOrNewSpec() + .endSpec() + .build(); + mockPrePreparedResources.add(mockPod); + } + KubernetesJobManagerSpecification testKubernetesJobManagerSpecification = + new KubernetesJobManagerSpecification( + testDeployment, testAccompanyingResources, mockPrePreparedResources); + flinkKubeClient.createJobManagerComponent(testKubernetesJobManagerSpecification); + + // check the preprepared resources had been created. + final List<Pod> resultPods = kubeClient.pods().inNamespace(NAMESPACE).list().getItems(); + assertThat(resultPods).hasSize(3); Review Comment: Shouldn't this be at least 4 pods ? 1 pod for the JM itself and 3 `mock-pod-preprepared-resource-**`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org