You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/10/23 02:54:09 UTC

[GitHub] [flink] SteNicholas opened a new pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

SteNicholas opened a new pull request #13755:
URL: https://github.com/apache/flink/pull/13755


   ## What is the purpose of the change
   
   *Currently, the Kubernetes Client in `KubernetesResourceManagerDriver` is using a dedicated thread pool through calling `KubeClientFactory::createThreadPoolForAsyncIO` to create fixed thread pool. `KubernetesResourceManagerDriver` could get the io executor and eliminate the redundant thread pool. `KubeClientFactory` uses `KubeClientFactory::createThreadPoolForAsyncIO` by default.*
   
   ## Brief change log
   
     - *`KubernetesResourceManagerDriver` adds constructor with creating `FlinkKubeClient ` through `KubeClientFactory#fromConfiguration(flinkConfig, ioExecutor)` to reuse the io executor of `AbstractResourceManagerDriver`.*
   
   ## Verifying this change
   
     - *`TestingResourceManagerDriver` updates `initialize()` with `ExecutorService` type parameter to verify the `AbstractResourceManagerDriver` whether to work.*
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / **no**)
     - If yes, how is the feature documented? (**not applicable** / docs / JavaDocs / not documented)


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] xintongsong commented on a change in pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
xintongsong commented on a change in pull request #13755:
URL: https://github.com/apache/flink/pull/13755#discussion_r510580616



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -85,10 +86,20 @@
 
 	public KubernetesResourceManagerDriver(
 			Configuration flinkConfig,
-			FlinkKubeClient kubeClient,
 			KubernetesResourceManagerDriverConfiguration configuration) {
 		super(flinkConfig, GlobalConfiguration.loadConfiguration());
+		this.clusterId = Preconditions.checkNotNull(configuration.getClusterId());
+		this.podCreationRetryInterval = Preconditions.checkNotNull(configuration.getPodCreationRetryInterval());
+		this.kubeClient = KubeClientFactory.fromConfiguration(flinkConfig, getIoExecutor());

Review comment:
       I'm afraid this would not work.
   
   `AbstractResourceManagerDriver#ioExecutor` is `null` until the driver is initialized. The constructor is executed before the initialization, thus `getIoExecutor` should throw `IllegalStateException`.
   
   I think this also exposes the shortcoming for using different constructors for production and testing. The `getIoExecutor` in the constructor is not covered by any test.

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/kubeclient/KubeClientFactory.java
##########
@@ -71,7 +74,8 @@ public static FlinkKubeClient fromConfiguration(Configuration flinkConfig) {
 
 		final KubernetesClient client = new DefaultKubernetesClient(config);
 
-		return new Fabric8FlinkKubeClient(flinkConfig, client, KubeClientFactory::createThreadPoolForAsyncIO);
+		return new Fabric8FlinkKubeClient(flinkConfig, client, ioExecutor == null ?
+				KubeClientFactory::createThreadPoolForAsyncIO : () -> ioExecutor);

Review comment:
       Might be better to derive `ioExecutor` in `fromConfiguration(Configuration flinkConfig)`.
   Benefits are:
   - Avoid passing null value arguments.
   - Improves readability that `fromConfiguration(Configuration flinkConfig)` itself shows which executor will be used when the user does not specify one.

##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/component/DefaultDispatcherResourceManagerComponentFactory.java
##########
@@ -69,7 +69,7 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;

Review comment:
       I'm not sure about replacing `Executor` with `ExecutorService` for all these places.
   
   Looking into `Fabric8FlinkKubeClient`, I think the only reason `FlinkKubeClient` uses `ExecutorService` rather than `Executor` is that, it will shutdown and release the thread pool in `close`. That is because the client uses a dedicated thread pool, and if it does not shutdown the thread pool, other components won't do that either.
   
   Since now the client uses a shared IO executor, it should no longer shutdown the executor on close. Otherwise, all the other components using that IO executor would be affected. That means we can replace `ExecutorService` with `Executor` for `FlinkKubeClient`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e31a8a6b6e3c8628503b4534c2bdff345365c1e0 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142) 
   * 6e6f684752fae0918f17c60a7e30b4140bef61a0 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e31a8a6b6e3c8628503b4534c2bdff345365c1e0 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142) 
   * 6e6f684752fae0918f17c60a7e30b4140bef61a0 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e31a8a6b6e3c8628503b4534c2bdff345365c1e0 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "CANCELED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199",
       "triggerID" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 6e6f684752fae0918f17c60a7e30b4140bef61a0 Azure: [CANCELED](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174) 
   * 1eb20b18a9b1ae6275017a84427a12357cad5598 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] SteNicholas commented on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-715237435


   > Thanks for preparing this PR, @SteNicholas.
   > I'm afraid the changes won't work. Please see my comments. The e2e failures on AZP also confirmed my concern.
   
   @xintongsong , thanks for your detailed comments. I have followed your comments mentioned above. Please help to review again if you are available.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199",
       "triggerID" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1eb20b18a9b1ae6275017a84427a12357cad5598 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] SteNicholas commented on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714875554


   @xintongsong @wangyang0918, could you please help to review the pull request if you are available?


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] xintongsong commented on a change in pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
xintongsong commented on a change in pull request #13755:
URL: https://github.com/apache/flink/pull/13755#discussion_r512363656



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesClusterClientFactory.java
##########
@@ -41,6 +42,8 @@
 
 	private static final String CLUSTER_ID_PREFIX = "flink-cluster-";
 
+	private static final KubeClientFactory kubeClientFactory = DefaultKubeClientFactory.getInstance();

Review comment:
       minor: this can be a local variable

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -75,7 +80,7 @@
 	/** Current max pod index. When creating a new pod, it should increase one. */
 	private long currentMaxPodId = 0;
 
-	private KubernetesWatch podsWatch;
+	private Optional<KubernetesWatch> podsWatch;

Review comment:
       The `podsWatch` related changes should be in a separate commit. They are hotfix for exist codes and is unrelated to the purpose of this PR. 

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -158,7 +165,9 @@ public void deregisterApplication(ApplicationStatus finalStatus, @Nullable Strin
 		// In case of pod creation failures, we should wait for an interval before trying to create new pods.
 		// Otherwise, ActiveResourceManager will always re-requesting the worker, which keeps the main thread busy.
 		final CompletableFuture<Void> createPodFuture =
-				podCreationCoolDown.thenCompose((ignore) -> kubeClient.createTaskManagerPod(taskManagerPod));
+				podCreationCoolDown.thenCompose((ignore) -> kubeClient
+						.map(client -> client.createTaskManagerPod(taskManagerPod))
+						.orElse(CompletableFuture.completedFuture(null)));

Review comment:
       Since we are expecting the client to be non-empty, I think we should fail explicitly for the empty case. 
   Same for the other occurrences.

##########
File path: flink-kubernetes/src/test/java/org/apache/flink/kubernetes/kubeclient/TestingKubeClientFactory.java
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.kubernetes.kubeclient;
+
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.runtime.util.ExecutorThreadFactory;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+
+/**
+ * Testing implementation of {@link KubeClientFactory}.
+ */
+public class TestingKubeClientFactory implements KubeClientFactory {
+
+	private TestingFlinkKubeClient.Builder flinkKubeClientBuilder;

Review comment:
       Should be `final`.

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/cli/KubernetesSessionCli.java
##########
@@ -64,6 +65,8 @@
 		"stop - stop the kubernetes cluster\n" +
 		"quit - quit attach mode";
 
+	private final KubeClientFactory kubeClientFactory = DefaultKubeClientFactory.getInstance();

Review comment:
       minor: this can be a local variable




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] xintongsong commented on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
xintongsong commented on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-716941855


   @SteNicholas 
   I've updated the PR:
   - Rebased onto latest `master` branch
   - Your original changes are squashed into one main commit.
   - My new changes are in the hotfix and fixup commits.
   
   Please take a look at the changes. It there's no objections, I'll merge this once AZP gives green light.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] xintongsong closed pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
xintongsong closed pull request #13755:
URL: https://github.com/apache/flink/pull/13755


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199",
       "triggerID" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1eb20b18a9b1ae6275017a84427a12357cad5598 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199) 
   * 8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199",
       "triggerID" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8313",
       "triggerID" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8313) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199",
       "triggerID" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8313",
       "triggerID" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "triggerType" : "PUSH"
     }, {
       "hash" : "04e4ab123cfd0a95dc6ebc2a5316d35fb8f65e65",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "04e4ab123cfd0a95dc6ebc2a5316d35fb8f65e65",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8313) 
   * 04e4ab123cfd0a95dc6ebc2a5316d35fb8f65e65 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e31a8a6b6e3c8628503b4534c2bdff345365c1e0 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] SteNicholas commented on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
SteNicholas commented on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-716902870


   > Thanks @SteNicholas. I think the changes should work now.
   > I have a few more comments concerning the maintainability and testability. Please take a look.
   
   @xintongsong Please help to review the pull request again. Sorry for trouble you again.


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] xintongsong commented on a change in pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
xintongsong commented on a change in pull request #13755:
URL: https://github.com/apache/flink/pull/13755#discussion_r510812845



##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -64,7 +65,7 @@
 
 	private final Time podCreationRetryInterval;
 
-	private final FlinkKubeClient kubeClient;
+	private FlinkKubeClient kubeClient;

Review comment:
       ```suggestion
   	private Optional<FlinkKubeClient> kubeClientOpt;
   ```
   The client is used a lot in this driver. I would suggest to use `Optional` here to force a existence check whenever it is used.

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -85,23 +86,31 @@
 
 	public KubernetesResourceManagerDriver(
 			Configuration flinkConfig,
-			FlinkKubeClient kubeClient,
 			KubernetesResourceManagerDriverConfiguration configuration) {
 		super(flinkConfig, GlobalConfiguration.loadConfiguration());
-
 		this.clusterId = Preconditions.checkNotNull(configuration.getClusterId());
 		this.podCreationRetryInterval = Preconditions.checkNotNull(configuration.getPodCreationRetryInterval());
-		this.kubeClient = Preconditions.checkNotNull(kubeClient);
 		this.requestResourceFutures = new HashMap<>();
 		this.podCreationCoolDown = FutureUtils.completedVoidFuture();
 	}
 
+	public KubernetesResourceManagerDriver(
+			Configuration flinkConfig,
+			FlinkKubeClient kubeClient,
+			KubernetesResourceManagerDriverConfiguration configuration) {
+		this(flinkConfig, configuration);
+		this.kubeClient = Preconditions.checkNotNull(kubeClient);
+	}

Review comment:
       Instead of introducing another constructor, I think we can have only one constructor that takes `KubeClientFactory` as an argument. We would also need to make `KubeClientFactory` and interface and provide a singleton implementation.
   In this way, the tests can provide a testing factory implementation, without needing to have a separate code path in the production codes.

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -85,23 +86,31 @@
 
 	public KubernetesResourceManagerDriver(
 			Configuration flinkConfig,
-			FlinkKubeClient kubeClient,
 			KubernetesResourceManagerDriverConfiguration configuration) {
 		super(flinkConfig, GlobalConfiguration.loadConfiguration());
-
 		this.clusterId = Preconditions.checkNotNull(configuration.getClusterId());
 		this.podCreationRetryInterval = Preconditions.checkNotNull(configuration.getPodCreationRetryInterval());
-		this.kubeClient = Preconditions.checkNotNull(kubeClient);
 		this.requestResourceFutures = new HashMap<>();
 		this.podCreationCoolDown = FutureUtils.completedVoidFuture();
 	}
 
+	public KubernetesResourceManagerDriver(
+			Configuration flinkConfig,
+			FlinkKubeClient kubeClient,
+			KubernetesResourceManagerDriverConfiguration configuration) {
+		this(flinkConfig, configuration);
+		this.kubeClient = Preconditions.checkNotNull(kubeClient);
+	}
+
 	// ------------------------------------------------------------------------
 	//  ResourceManagerDriver
 	// ------------------------------------------------------------------------
 
 	@Override
 	protected void initializeInternal() throws Exception {
+		if (kubeClient == null) {
+			kubeClient = KubeClientFactory.fromConfiguration(flinkConfig, getIoExecutor());

Review comment:
       Currently this line of code cannot be covered by the unit tests, due to usage of a different constructor.

##########
File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManagerDriver.java
##########
@@ -64,7 +65,7 @@
 
 	private final Time podCreationRetryInterval;
 
-	private final FlinkKubeClient kubeClient;
+	private FlinkKubeClient kubeClient;

Review comment:
       Actually, we should also have such protection for `podsWatch`. But it is not a problem of this PR.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e31a8a6b6e3c8628503b4534c2bdff345365c1e0 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142) 
   * 6e6f684752fae0918f17c60a7e30b4140bef61a0 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174) 
   * 1eb20b18a9b1ae6275017a84427a12357cad5598 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * e31a8a6b6e3c8628503b4534c2bdff345365c1e0 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714883306


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8142",
       "triggerID" : "e31a8a6b6e3c8628503b4534c2bdff345365c1e0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "status" : "DELETED",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8174",
       "triggerID" : "6e6f684752fae0918f17c60a7e30b4140bef61a0",
       "triggerType" : "PUSH"
     }, {
       "hash" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "status" : "SUCCESS",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199",
       "triggerID" : "1eb20b18a9b1ae6275017a84427a12357cad5598",
       "triggerType" : "PUSH"
     }, {
       "hash" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8313",
       "triggerID" : "8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 1eb20b18a9b1ae6275017a84427a12357cad5598 Azure: [SUCCESS](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8199) 
   * 8fffb4f4aeb5080f0ed028bfa744ff5f9acaf5ca Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=8313) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #13755: [FLINK-19700][k8s] Make Kubernetes Client in KubernetesResourceManagerDriver use io executor

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #13755:
URL: https://github.com/apache/flink/pull/13755#issuecomment-714876068


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit e31a8a6b6e3c8628503b4534c2bdff345365c1e0 (Fri Oct 23 02:56:47 UTC 2020)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org