wangyang0918 commented on a change in pull request #11323: [FLINK-16439][k8s] Make KubernetesResourceManager starts workers using WorkerResourceSpec requested by SlotManager URL: https://github.com/apache/flink/pull/11323#discussion_r409968753
########## File path: flink-kubernetes/src/main/java/org/apache/flink/kubernetes/KubernetesResourceManager.java ########## @@ -189,15 +180,17 @@ public boolean stopWorker(final KubernetesWorkerNode worker) { public void onAdded(List<KubernetesPod> pods) { runAsync(() -> { for (KubernetesPod pod : pods) { - if (numPendingPodRequests > 0) { - numPendingPodRequests--; + WorkerResourceSpec workerResourceSpec = podWorkerResources.get(pod.getName()); + final int pendingNum = getNumPendingWorkersFor(workerResourceSpec); + if (pendingNum > 0) { Review comment: Recently i also realize that the `onAdded` for a same `Pod` may be called more that once here, e.g. some network problems cause the pod watcher reconnect, so it will be good to check the existence first. Otherwise, the `numPendingPodRequests` may be decreased wrongly. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services