Cleanup CR deletion.
This commit is contained in:
parent
84ac4bb28c
commit
db7fbe2b7c
1 changed files with 10 additions and 16 deletions
|
|
@ -119,11 +119,6 @@ public class VmMonitor extends
|
||||||
V1ObjectMeta metadata = response.object.getMetadata();
|
V1ObjectMeta metadata = response.object.getMetadata();
|
||||||
VmChannel channel = channelManager.channelGet(metadata.getName());
|
VmChannel channel = channelManager.channelGet(metadata.getName());
|
||||||
|
|
||||||
// Remove from channel manager if deleted
|
|
||||||
if (ResponseType.valueOf(response.type) == ResponseType.DELETED) {
|
|
||||||
channelManager.remove(metadata.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get full definition and associate with channel as backup
|
// Get full definition and associate with channel as backup
|
||||||
var vmModel = response.object;
|
var vmModel = response.object;
|
||||||
if (vmModel.data() == null) {
|
if (vmModel.data() == null) {
|
||||||
|
|
@ -151,17 +146,16 @@ public class VmMonitor extends
|
||||||
|
|
||||||
// Create and fire changed event. Remove channel from channel
|
// Create and fire changed event. Remove channel from channel
|
||||||
// manager on completion.
|
// manager on completion.
|
||||||
channel.pipeline()
|
VmDefChanged chgEvt
|
||||||
.fire(Event.onCompletion(
|
= new VmDefChanged(ResponseType.valueOf(response.type),
|
||||||
new VmDefChanged(ResponseType.valueOf(response.type),
|
channel.setGeneration(response.object.getMetadata()
|
||||||
channel.setGeneration(response.object.getMetadata()
|
.getGeneration()),
|
||||||
.getGeneration()),
|
vmDef);
|
||||||
vmDef),
|
if (ResponseType.valueOf(response.type) == ResponseType.DELETED) {
|
||||||
e -> {
|
chgEvt = Event.onCompletion(chgEvt,
|
||||||
if (e.type() == ResponseType.DELETED) {
|
e -> channelManager.remove(e.vmDefinition().name()));
|
||||||
channelManager.remove(e.vmDefinition().name());
|
}
|
||||||
}
|
channel.pipeline().fire(chgEvt, channel);
|
||||||
}), channel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private VmDefinitionModel getModel(K8sClient client,
|
private VmDefinitionModel getModel(K8sClient client,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue