Run pause/resume handling regardless of HA configuration
package com.epam.pipeline.event;
-import com.epam.pipeline.manager.cluster.KubernetesManager;
import com.epam.pipeline.manager.docker.DockerRegistryManager;
import com.epam.pipeline.manager.pipeline.PipelineRunDockerOperationManager;
import com.epam.pipeline.manager.region.CloudRegionManager;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
@@ -34,20 +32,14 @@ import java.util.Objects;
public class StartupApplicationListener {
private final DockerRegistryManager dockerRegistryManager;
private final CloudRegionManager cloudRegionManager;
- private final KubernetesManager kubernetesManager;
private final PipelineRunDockerOperationManager pipelineRunDockerOperationManager;
- private final boolean haEnabled;
public StartupApplicationListener(final DockerRegistryManager dockerRegistryManager,
final CloudRegionManager cloudRegionManager,
- final KubernetesManager kubernetesManager,
- final PipelineRunDockerOperationManager pipelineRunDockerOperationManager,
- final @Value("${ha.deploy.enabled:false}") boolean haEnabled) {
+ final PipelineRunDockerOperationManager pipelineRunDockerOperationManager) {
this.dockerRegistryManager = dockerRegistryManager;
this.cloudRegionManager = cloudRegionManager;
- this.kubernetesManager = kubernetesManager;
this.pipelineRunDockerOperationManager = pipelineRunDockerOperationManager;
- this.haEnabled = haEnabled;
}
@EventListener
@@ -56,16 +48,10 @@ public class StartupApplicationListener {
if (Objects.isNull(event.getApplicationContext().getParent())) {
dockerRegistryManager.checkDockerSecrets();
cloudRegionManager.refreshCloudRegionCredKubeSecret();
- if (isMasterHost()) {
pipelineRunDockerOperationManager.rerunPauseAndResume();
}
- }
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
-
- private boolean isMasterHost() {
- return !haEnabled || kubernetesManager.isMasterHost();
- }
}
