Fix pod watching manner to prevent events from other pods to cancel the waiting

7.28.x
Max Shaposhnik 2021-02-24 10:46:24 +02:00 committed by GitHub
parent aecad798ac
commit 674ca25d1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -197,6 +197,9 @@ public class KubernetesDeployments {
.create(workspaceId)
.pods()
.inNamespace(namespace)
.withLabels(
Map.of(
CHE_WORKSPACE_ID_LABEL, workspaceId, CHE_DEPLOYMENT_NAME_LABEL, deploymentName))
.watch(new CreateWatcher(createFuture, workspaceId, deploymentName));
try {
clientFactory
@ -1096,9 +1099,7 @@ public class KubernetesDeployments {
@Override
public void eventReceived(Action action, Pod resource) {
Map<String, String> labels = resource.getMetadata().getLabels();
if (workspaceId.equals(labels.get(CHE_WORKSPACE_ID_LABEL))
&& deploymentName.equals(labels.get(CHE_DEPLOYMENT_NAME_LABEL))) {
if (action == Action.ADDED) {
future.complete(resource);
}
}