Skip to content
Snippets Groups Projects
Commit de88c67b authored by Lukasz Lopatowski's avatar Lukasz Lopatowski
Browse files

Added remote cluster availability check for new app deployments

parent 32682ccb
No related branches found
No related tags found
2 merge requests!273Release 1.8.0 update,!245Added remote cluster availability check for new app deployments
Pipeline #94885 passed
package net.geant.nmaas.nmservice.deployment; package net.geant.nmaas.nmservice.deployment;
import net.geant.nmaas.externalservices.kubernetes.RemoteClusterManager; import net.geant.nmaas.externalservices.kubernetes.RemoteClusterManager;
import net.geant.nmaas.externalservices.kubernetes.RemoteClusterMonitoringService;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.KubernetesRepositoryManager; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.KubernetesRepositoryManager;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.*; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.HelmChartRepositoryEmbeddable;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.KubernetesChart;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.KubernetesNmServiceInfo;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.KubernetesTemplate;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ServiceAccessMethodType;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ServiceStorageVolumeType;
import net.geant.nmaas.nmservice.deployment.exceptions.NmServiceRequestVerificationException; import net.geant.nmaas.nmservice.deployment.exceptions.NmServiceRequestVerificationException;
import net.geant.nmaas.orchestration.Identifier; import net.geant.nmaas.orchestration.Identifier;
import net.geant.nmaas.orchestration.entities.AppAccessMethod; import net.geant.nmaas.orchestration.entities.AppAccessMethod;
...@@ -15,6 +21,7 @@ import org.junit.jupiter.api.Test; ...@@ -15,6 +21,7 @@ import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.Collections; import java.util.Collections;
...@@ -25,7 +32,6 @@ import static org.hamcrest.Matchers.equalTo; ...@@ -25,7 +32,6 @@ import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.hamcrest.core.IsNull.notNullValue; import static org.hamcrest.core.IsNull.notNullValue;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ExtendWith(SpringExtension.class) @ExtendWith(SpringExtension.class)
...@@ -38,9 +44,12 @@ class ServiceDeploymentWithKubernetesTest { ...@@ -38,9 +44,12 @@ class ServiceDeploymentWithKubernetesTest {
@Autowired @Autowired
private KubernetesRepositoryManager repositoryManager; private KubernetesRepositoryManager repositoryManager;
@Autowired @MockitoBean
private RemoteClusterManager remoteClusterManager; private RemoteClusterManager remoteClusterManager;
@MockitoBean
private RemoteClusterMonitoringService remoteClusterMonitoringService;
private static final Identifier deploymentId = Identifier.newInstance(1L); private static final Identifier deploymentId = Identifier.newInstance(1L);
@AfterEach @AfterEach
...@@ -57,7 +66,32 @@ class ServiceDeploymentWithKubernetesTest { ...@@ -57,7 +66,32 @@ class ServiceDeploymentWithKubernetesTest {
@Test @Test
void shouldConfirmSupportForDeploymentOnKubernetes() { void shouldConfirmSupportForDeploymentOnKubernetes() {
AppDeploymentSpec appDeploymentSpec = new AppDeploymentSpec(); AppDeploymentSpec appDeploymentSpec = new AppDeploymentSpec();
AppDeployment appDeployment = appDeployment(); AppDeployment appDeployment = appDeployment(null);
appDeploymentSpec.setSupportedDeploymentEnvironments(Collections.singletonList(AppDeploymentEnv.KUBERNETES));
appDeploymentSpec.setKubernetesTemplate(new KubernetesTemplate(
null,
new KubernetesChart(null, "test", "0.0.0"),
"archive",
null,
new HelmChartRepositoryEmbeddable("test", "http://test")
));
appDeploymentSpec.setStorageVolumes(Collections.singleton(new AppStorageVolume(ServiceStorageVolumeType.MAIN, 2, null)));
appDeploymentSpec.setAccessMethods(Collections.singleton(new AppAccessMethod(ServiceAccessMethodType.DEFAULT, "name", "tag", null)));
orchestrator.verifyDeploymentEnvironmentSupportAndBuildNmServiceInfo(Identifier.newInstance(1L), appDeployment, appDeploymentSpec);
KubernetesNmServiceInfo info = repositoryManager.loadService(deploymentId);
assertThat(info, is(notNullValue()));
assertThat(info.getDeploymentId(), equalTo(appDeployment.getDeploymentId()));
assertThat(info.getDeploymentName(), equalTo(appDeployment.getDeploymentName()));
assertThat(info.getDomain(), equalTo(appDeployment.getDomain()));
assertThat(info.getDescriptiveDeploymentId().getValue(), equalTo("domain-appname-100"));
}
@Test
void shouldConfirmSupportForDeploymentOnKubernetesRemoteCluster() {
AppDeploymentSpec appDeploymentSpec = new AppDeploymentSpec();
AppDeployment appDeployment = appDeployment(1L);
appDeploymentSpec.setSupportedDeploymentEnvironments(Collections.singletonList(AppDeploymentEnv.KUBERNETES)); appDeploymentSpec.setSupportedDeploymentEnvironments(Collections.singletonList(AppDeploymentEnv.KUBERNETES));
appDeploymentSpec.setKubernetesTemplate(new KubernetesTemplate( appDeploymentSpec.setKubernetesTemplate(new KubernetesTemplate(
null, null,
...@@ -68,6 +102,8 @@ class ServiceDeploymentWithKubernetesTest { ...@@ -68,6 +102,8 @@ class ServiceDeploymentWithKubernetesTest {
)); ));
appDeploymentSpec.setStorageVolumes(Collections.singleton(new AppStorageVolume(ServiceStorageVolumeType.MAIN, 2, null))); appDeploymentSpec.setStorageVolumes(Collections.singleton(new AppStorageVolume(ServiceStorageVolumeType.MAIN, 2, null)));
appDeploymentSpec.setAccessMethods(Collections.singleton(new AppAccessMethod(ServiceAccessMethodType.DEFAULT, "name", "tag", null))); appDeploymentSpec.setAccessMethods(Collections.singleton(new AppAccessMethod(ServiceAccessMethodType.DEFAULT, "name", "tag", null)));
when(remoteClusterManager.clusterExists(1L)).thenReturn(Boolean.TRUE);
when(remoteClusterMonitoringService.clusterAvailable(1L)).thenReturn(Boolean.TRUE);
orchestrator.verifyDeploymentEnvironmentSupportAndBuildNmServiceInfo(Identifier.newInstance(1L), appDeployment, appDeploymentSpec); orchestrator.verifyDeploymentEnvironmentSupportAndBuildNmServiceInfo(Identifier.newInstance(1L), appDeployment, appDeploymentSpec);
KubernetesNmServiceInfo info = repositoryManager.loadService(deploymentId); KubernetesNmServiceInfo info = repositoryManager.loadService(deploymentId);
...@@ -81,16 +117,16 @@ class ServiceDeploymentWithKubernetesTest { ...@@ -81,16 +117,16 @@ class ServiceDeploymentWithKubernetesTest {
@Test @Test
void shouldNotifyIncompatibilityForDeploymentOnKubernetes() { void shouldNotifyIncompatibilityForDeploymentOnKubernetes() {
AppDeploymentSpec appDeploymentSpec = new AppDeploymentSpec();
AppDeployment appDeployment = appDeployment(null);
appDeploymentSpec.setSupportedDeploymentEnvironments(Collections.emptyList());
appDeploymentSpec.setKubernetesTemplate(new KubernetesTemplate());
assertThrows(NmServiceRequestVerificationException.class, () -> { assertThrows(NmServiceRequestVerificationException.class, () -> {
AppDeploymentSpec appDeploymentSpec = new AppDeploymentSpec();
AppDeployment appDeployment = appDeployment();
appDeploymentSpec.setSupportedDeploymentEnvironments(Collections.emptyList());
appDeploymentSpec.setKubernetesTemplate(new KubernetesTemplate());
orchestrator.verifyDeploymentEnvironmentSupportAndBuildNmServiceInfo(null, appDeployment, appDeploymentSpec); orchestrator.verifyDeploymentEnvironmentSupportAndBuildNmServiceInfo(null, appDeployment, appDeploymentSpec);
}); });
} }
private AppDeployment appDeployment() { private AppDeployment appDeployment(Long remoteClusterId) {
return AppDeployment.builder() return AppDeployment.builder()
.instanceId(100L) .instanceId(100L)
.deploymentId(deploymentId) .deploymentId(deploymentId)
...@@ -99,7 +135,7 @@ class ServiceDeploymentWithKubernetesTest { ...@@ -99,7 +135,7 @@ class ServiceDeploymentWithKubernetesTest {
.applicationId(Identifier.newInstance("appId")) .applicationId(Identifier.newInstance("appId"))
.deploymentName("deploy") .deploymentName("deploy")
.configFileRepositoryRequired(false) .configFileRepositoryRequired(false)
.remoteClusterId(1L) .remoteClusterId(remoteClusterId)
.appName("AppName").build(); .appName("AppName").build();
} }
......
...@@ -25,12 +25,23 @@ import static net.geant.nmaas.externalservices.kubernetes.RemoteClusterHelper.sa ...@@ -25,12 +25,23 @@ import static net.geant.nmaas.externalservices.kubernetes.RemoteClusterHelper.sa
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class RemoteClusterMonitor implements ClusterMonitoringService { public class RemoteClusterMonitor implements RemoteClusterMonitoringService {
private final KClusterRepository clusterRepository; private final KClusterRepository clusterRepository;
private final KubernetesApiService kubernetesApiService; private final KubernetesApiService kubernetesApiService;
private final RemoteClusterMailer mailer; private final RemoteClusterMailer mailer;
@Override
public boolean clusterAvailable(Long id) {
final KCluster cluster = clusterRepository.getReferenceById(id);
try {
kubernetesApiService.getKubernetesVersion(cluster);
return true;
} catch (Exception e) {
return false;
}
}
@Override @Override
public void updateAllClusterState() { public void updateAllClusterState() {
restoreKubeconfigFileIfMissing(); restoreKubeconfigFileIfMissing();
......
...@@ -10,14 +10,14 @@ import org.springframework.stereotype.Service; ...@@ -10,14 +10,14 @@ import org.springframework.stereotype.Service;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j @Slf4j
public class ClusterMonitoringJob implements Job { public class RemoteClusterMonitoringJob implements Job {
private final ClusterMonitoringService clusterMonitoringService; private final RemoteClusterMonitoringService remoteClusterMonitoringService;
@Override @Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("Triggering cluster health check..."); log.info("Triggering cluster health check...");
clusterMonitoringService.updateAllClusterState(); remoteClusterMonitoringService.updateAllClusterState();
} }
} }
package net.geant.nmaas.externalservices.kubernetes; package net.geant.nmaas.externalservices.kubernetes;
public interface ClusterMonitoringService { public interface RemoteClusterMonitoringService {
boolean clusterAvailable(Long id);
void updateAllClusterState(); void updateAllClusterState();
} }
...@@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor; ...@@ -5,6 +5,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.geant.nmaas.externalservices.kubernetes.KubernetesClusterIngressManager; import net.geant.nmaas.externalservices.kubernetes.KubernetesClusterIngressManager;
import net.geant.nmaas.externalservices.kubernetes.RemoteClusterManager; import net.geant.nmaas.externalservices.kubernetes.RemoteClusterManager;
import net.geant.nmaas.externalservices.kubernetes.RemoteClusterMonitoringService;
import net.geant.nmaas.externalservices.kubernetes.entities.IngressControllerConfigOption; import net.geant.nmaas.externalservices.kubernetes.entities.IngressControllerConfigOption;
import net.geant.nmaas.externalservices.kubernetes.entities.KCluster; import net.geant.nmaas.externalservices.kubernetes.entities.KCluster;
import net.geant.nmaas.gitlab.GitLabManager; import net.geant.nmaas.gitlab.GitLabManager;
...@@ -13,8 +14,6 @@ import net.geant.nmaas.nmservice.deployment.ContainerOrchestrator; ...@@ -13,8 +14,6 @@ import net.geant.nmaas.nmservice.deployment.ContainerOrchestrator;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.cluster.KClusterCheckException; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.cluster.KClusterCheckException;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.helm.HelmChartIngressVariable; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.helm.HelmChartIngressVariable;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.ingress.IngressControllerManipulationException; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.ingress.IngressControllerManipulationException;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.janitor.JanitorResponseException;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.janitor.JanitorService;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.KubernetesNmServiceInfo; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.KubernetesNmServiceInfo;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.KubernetesTemplate; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.KubernetesTemplate;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ParameterType; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ParameterType;
...@@ -22,6 +21,8 @@ import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.en ...@@ -22,6 +21,8 @@ import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.en
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ServiceAccessMethodView; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ServiceAccessMethodView;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ServiceStorageVolume; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.entities.ServiceStorageVolume;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.exceptions.KServiceManipulationException; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.exceptions.KServiceManipulationException;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.janitor.JanitorResponseException;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.janitor.JanitorService;
import net.geant.nmaas.nmservice.deployment.exceptions.ContainerCheckFailedException; import net.geant.nmaas.nmservice.deployment.exceptions.ContainerCheckFailedException;
import net.geant.nmaas.nmservice.deployment.exceptions.ContainerOrchestratorInternalErrorException; import net.geant.nmaas.nmservice.deployment.exceptions.ContainerOrchestratorInternalErrorException;
import net.geant.nmaas.nmservice.deployment.exceptions.CouldNotDeployNmServiceException; import net.geant.nmaas.nmservice.deployment.exceptions.CouldNotDeployNmServiceException;
...@@ -51,6 +52,7 @@ import java.util.HashMap; ...@@ -51,6 +52,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -85,6 +87,7 @@ public class KubernetesManager implements ContainerOrchestrator { ...@@ -85,6 +87,7 @@ public class KubernetesManager implements ContainerOrchestrator {
private final GitLabManager gitLabManager; private final GitLabManager gitLabManager;
private final JanitorService janitorService; private final JanitorService janitorService;
private final RemoteClusterManager remoteClusterManager; private final RemoteClusterManager remoteClusterManager;
private final RemoteClusterMonitoringService remoteClusterMonitoringService;
@Override @Override
@Loggable(LogLevel.INFO) @Loggable(LogLevel.INFO)
...@@ -100,7 +103,16 @@ public class KubernetesManager implements ContainerOrchestrator { ...@@ -100,7 +103,16 @@ public class KubernetesManager implements ContainerOrchestrator {
} catch (IllegalArgumentException iae) { } catch (IllegalArgumentException iae) {
throw new NmServiceRequestVerificationException(iae.getMessage()); throw new NmServiceRequestVerificationException(iae.getMessage());
} }
//todo
if (Objects.nonNull(appDeployment.getRemoteClusterId())) {
if (!remoteClusterManager.clusterExists(appDeployment.getRemoteClusterId())) {
throw new NmServiceRequestVerificationException(String.format("Remote cluster with id %s doesn't exist", appDeployment.getRemoteClusterId()));
} else {
if (!remoteClusterMonitoringService.clusterAvailable(appDeployment.getRemoteClusterId())) {
throw new NmServiceRequestVerificationException(String.format("Remote cluster with id %s is currently unavailable", appDeployment.getRemoteClusterId()));
}
}
}
KubernetesNmServiceInfo serviceInfo = new KubernetesNmServiceInfo( KubernetesNmServiceInfo serviceInfo = new KubernetesNmServiceInfo(
deploymentId, deploymentId,
...@@ -108,11 +120,9 @@ public class KubernetesManager implements ContainerOrchestrator { ...@@ -108,11 +120,9 @@ public class KubernetesManager implements ContainerOrchestrator {
appDeployment.getDomain(), appDeployment.getDomain(),
appDeployment.getDescriptiveDeploymentId() appDeployment.getDescriptiveDeploymentId()
); );
//verify cluster if (Objects.nonNull(appDeployment.getRemoteClusterId())) {
if (remoteClusterManager.clusterExists(appDeployment.getRemoteClusterId())) {
serviceInfo.setRemoteCluster(remoteClusterManager.getCluster(appDeployment.getRemoteClusterId())); serviceInfo.setRemoteCluster(remoteClusterManager.getCluster(appDeployment.getRemoteClusterId()));
} }
serviceInfo.setKubernetesTemplate(KubernetesTemplate.copy(appDeploymentSpec.getKubernetesTemplate())); serviceInfo.setKubernetesTemplate(KubernetesTemplate.copy(appDeploymentSpec.getKubernetesTemplate()));
serviceInfo.setStorageVolumes(generateTemplateStorageVolumes(appDeploymentSpec.getStorageVolumes())); serviceInfo.setStorageVolumes(generateTemplateStorageVolumes(appDeploymentSpec.getStorageVolumes()));
serviceInfo.setAccessMethods(generateTemplateAccessMethods(appDeploymentSpec.getAccessMethods())); serviceInfo.setAccessMethods(generateTemplateAccessMethods(appDeploymentSpec.getAccessMethods()));
......
...@@ -2,7 +2,7 @@ package net.geant.nmaas.scheduling; ...@@ -2,7 +2,7 @@ package net.geant.nmaas.scheduling;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.geant.nmaas.externalservices.kubernetes.ClusterMonitoringJob; import net.geant.nmaas.externalservices.kubernetes.RemoteClusterMonitoringJob;
import net.geant.nmaas.portal.service.ConfigurationManager; import net.geant.nmaas.portal.service.ConfigurationManager;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -18,17 +18,17 @@ public class ClusterHealthCheckScheduleInit implements InitializingBean { ...@@ -18,17 +18,17 @@ public class ClusterHealthCheckScheduleInit implements InitializingBean {
public static final String CLUSTER_HEALTH_CHECK = "ClusterHealthCheck"; public static final String CLUSTER_HEALTH_CHECK = "ClusterHealthCheck";
private final ClusterMonitoringJob clusterMonitoringJob; private final RemoteClusterMonitoringJob remoteClusterMonitoringJob;
private final ScheduleManager scheduleManager; private final ScheduleManager scheduleManager;
private final ConfigurationManager configurationManager; private final ConfigurationManager configurationManager;
private final String healthCheckJobCron; private final String healthCheckJobCron;
@Autowired @Autowired
public ClusterHealthCheckScheduleInit(ClusterMonitoringJob clusterMonitoringJob, public ClusterHealthCheckScheduleInit(RemoteClusterMonitoringJob remoteClusterMonitoringJob,
ScheduleManager scheduleManager, ScheduleManager scheduleManager,
ConfigurationManager configurationManager, ConfigurationManager configurationManager,
@Value("${nmaas.service.health-check.cron}") String healthCheckJobCron) { @Value("${nmaas.service.health-check.cron}") String healthCheckJobCron) {
this.clusterMonitoringJob = clusterMonitoringJob; this.remoteClusterMonitoringJob = remoteClusterMonitoringJob;
this.scheduleManager = scheduleManager; this.scheduleManager = scheduleManager;
this.configurationManager = configurationManager; this.configurationManager = configurationManager;
this.healthCheckJobCron = healthCheckJobCron; this.healthCheckJobCron = healthCheckJobCron;
...@@ -40,13 +40,13 @@ public class ClusterHealthCheckScheduleInit implements InitializingBean { ...@@ -40,13 +40,13 @@ public class ClusterHealthCheckScheduleInit implements InitializingBean {
final String healthCheckJobCronFromDb = configurationManager.getConfiguration().getHealthCheckJobCron(); final String healthCheckJobCronFromDb = configurationManager.getConfiguration().getHealthCheckJobCron();
if (!Strings.isNullOrEmpty(healthCheckJobCronFromDb)) { if (!Strings.isNullOrEmpty(healthCheckJobCronFromDb)) {
log.debug("Scheduling cluster health check job based on cron loaded from the database"); log.debug("Scheduling cluster health check job based on cron loaded from the database");
this.scheduleManager.createJob(clusterMonitoringJob, CLUSTER_HEALTH_CHECK, healthCheckJobCronFromDb); this.scheduleManager.createJob(remoteClusterMonitoringJob, CLUSTER_HEALTH_CHECK, healthCheckJobCronFromDb);
log.error("Adding new job for health check cluster ..."); log.error("Adding new job for health check cluster ...");
} else if (Strings.isNullOrEmpty(healthCheckJobCron)) { } else if (Strings.isNullOrEmpty(healthCheckJobCron)) {
log.warn("Cluster health check cron expression not provided"); log.warn("Cluster health check cron expression not provided");
} else { } else {
log.debug("Scheduling cluster health check job based on cron loaded from properties"); log.debug("Scheduling cluster health check job based on cron loaded from properties");
this.scheduleManager.createJob(clusterMonitoringJob, CLUSTER_HEALTH_CHECK, healthCheckJobCron); this.scheduleManager.createJob(remoteClusterMonitoringJob, CLUSTER_HEALTH_CHECK, healthCheckJobCron);
} }
} }
......
...@@ -3,6 +3,7 @@ package net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes; ...@@ -3,6 +3,7 @@ package net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import net.geant.nmaas.externalservices.kubernetes.KubernetesClusterIngressManager; import net.geant.nmaas.externalservices.kubernetes.KubernetesClusterIngressManager;
import net.geant.nmaas.externalservices.kubernetes.RemoteClusterManager; import net.geant.nmaas.externalservices.kubernetes.RemoteClusterManager;
import net.geant.nmaas.externalservices.kubernetes.RemoteClusterMonitoringService;
import net.geant.nmaas.externalservices.kubernetes.entities.IngressControllerConfigOption; import net.geant.nmaas.externalservices.kubernetes.entities.IngressControllerConfigOption;
import net.geant.nmaas.gitlab.GitLabManager; import net.geant.nmaas.gitlab.GitLabManager;
import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.cluster.DefaultKClusterValidator; import net.geant.nmaas.nmservice.deployment.containerorchestrators.kubernetes.components.cluster.DefaultKClusterValidator;
...@@ -71,6 +72,7 @@ public class KubernetesManagerTest { ...@@ -71,6 +72,7 @@ public class KubernetesManagerTest {
private final GitLabManager gitLabManager = mock(GitLabManager.class); private final GitLabManager gitLabManager = mock(GitLabManager.class);
private final JanitorService janitorService = mock(JanitorService.class); private final JanitorService janitorService = mock(JanitorService.class);
private final RemoteClusterManager remoteClusterManager = mock(RemoteClusterManager.class); private final RemoteClusterManager remoteClusterManager = mock(RemoteClusterManager.class);
private final RemoteClusterMonitoringService remoteClusterMonitoringService = mock(RemoteClusterMonitoringService.class);
private final KubernetesDeploymentRemoteClusterParametersProvider remoteClusterParametersProvider = mock(KubernetesDeploymentRemoteClusterParametersProvider.class); private final KubernetesDeploymentRemoteClusterParametersProvider remoteClusterParametersProvider = mock(KubernetesDeploymentRemoteClusterParametersProvider.class);
private static final Identifier DEPLOYMENT_ID = Identifier.newInstance("deploymentId"); private static final Identifier DEPLOYMENT_ID = Identifier.newInstance("deploymentId");
...@@ -87,7 +89,8 @@ public class KubernetesManagerTest { ...@@ -87,7 +89,8 @@ public class KubernetesManagerTest {
ingressManager, ingressManager,
gitLabManager, gitLabManager,
janitorService, janitorService,
remoteClusterManager remoteClusterManager,
remoteClusterMonitoringService
); );
@BeforeEach @BeforeEach
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment