Add console access to VM management.
This commit is contained in:
parent
5cd4edcec1
commit
af41c78c07
14 changed files with 561 additions and 124 deletions
|
|
@ -30,6 +30,7 @@ import java.util.ArrayList;
|
|||
import java.util.Comparator;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import static org.jdrupes.vmoperator.common.Constants.VM_OP_GROUP;
|
||||
|
|
@ -125,7 +126,12 @@ public class VmMonitor extends
|
|||
protected void handleChange(K8sClient client,
|
||||
Watch.Response<VmDefinitionModel> response) {
|
||||
V1ObjectMeta metadata = response.object.getMetadata();
|
||||
VmChannel channel = channelManager.channelGet(metadata.getName());
|
||||
AtomicBoolean toBeAdded = new AtomicBoolean(false);
|
||||
VmChannel channel = channelManager.channel(metadata.getName())
|
||||
.orElseGet(() -> {
|
||||
toBeAdded.set(true);
|
||||
return channelManager.createChannel(metadata.getName());
|
||||
});
|
||||
|
||||
// Get full definition and associate with channel as backup
|
||||
var vmModel = response.object;
|
||||
|
|
@ -151,6 +157,9 @@ public class VmMonitor extends
|
|||
+ response.object.getMetadata());
|
||||
return;
|
||||
}
|
||||
if (toBeAdded.get()) {
|
||||
channelManager.put(vmDef.name(), channel);
|
||||
}
|
||||
|
||||
// Create and fire changed event. Remove channel from channel
|
||||
// manager on completion.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue