Skip to content
Snippets Groups Projects
Commit 6bff48cf authored by kbeyro's avatar kbeyro
Browse files

remote cluster change domainnames

parent 83265091
Branches
No related tags found
1 merge request!211Update webhooks update
Pipeline #94378 passed
...@@ -151,11 +151,7 @@ public class RemoteClusterManager implements ClusterMonitoringService { ...@@ -151,11 +151,7 @@ public class RemoteClusterManager implements ClusterMonitoringService {
.state(KClusterState.UNKNOWN) .state(KClusterState.UNKNOWN)
.contactEmail(view.getContactEmail()) .contactEmail(view.getContactEmail())
.currentStateSince(OffsetDateTime.now()) .currentStateSince(OffsetDateTime.now())
.domains(!view.getDomainNames().isEmpty() ? view.getDomainNames().stream().map(d -> { .domains(prepareList(view))
Optional<Domain> dom = domainService.findDomain(d);
return dom.orElse(null);
}
).toList() : Collections.emptyList())
.build(), .build(),
file); file);
...@@ -170,6 +166,17 @@ public class RemoteClusterManager implements ClusterMonitoringService { ...@@ -170,6 +166,17 @@ public class RemoteClusterManager implements ClusterMonitoringService {
return null; return null;
} }
private List<Domain> prepareList(RemoteClusterView view) {
if (view == null || view.getDomainNames() == null) {
return Collections.emptyList();
}
return view.getDomainNames().stream().map(d -> {
Optional<Domain> dom = domainService.findDomain(d);
return dom.orElse(null);
}
).toList();
}
public RemoteClusterView updateCluster(RemoteClusterView cluster, Long id) { public RemoteClusterView updateCluster(RemoteClusterView cluster, Long id) {
Optional<KCluster> entity = clusterRepository.findById(id); Optional<KCluster> entity = clusterRepository.findById(id);
...@@ -332,7 +339,7 @@ public class RemoteClusterManager implements ClusterMonitoringService { ...@@ -332,7 +339,7 @@ public class RemoteClusterManager implements ClusterMonitoringService {
public void removeCluster(Long id) { public void removeCluster(Long id) {
try { try {
if(clusterRepository.existsById(id)) { if (clusterRepository.existsById(id)) {
this.clusterRepository.deleteById(id); this.clusterRepository.deleteById(id);
} }
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment