Merge branch 'main' into testing
This commit is contained in:
commit
16b1101b45
1 changed files with 26 additions and 0 deletions
|
|
@ -33,10 +33,12 @@ import org.jdrupes.vmoperator.common.Constants.Crd;
|
||||||
import org.jdrupes.vmoperator.common.Constants.Status;
|
import org.jdrupes.vmoperator.common.Constants.Status;
|
||||||
import org.jdrupes.vmoperator.common.K8sClient;
|
import org.jdrupes.vmoperator.common.K8sClient;
|
||||||
import org.jdrupes.vmoperator.common.K8sDynamicStub;
|
import org.jdrupes.vmoperator.common.K8sDynamicStub;
|
||||||
|
import org.jdrupes.vmoperator.common.K8sObserver.ResponseType;
|
||||||
import org.jdrupes.vmoperator.common.VmDefinitionStub;
|
import org.jdrupes.vmoperator.common.VmDefinitionStub;
|
||||||
import org.jdrupes.vmoperator.manager.events.ChannelManager;
|
import org.jdrupes.vmoperator.manager.events.ChannelManager;
|
||||||
import org.jdrupes.vmoperator.manager.events.Exit;
|
import org.jdrupes.vmoperator.manager.events.Exit;
|
||||||
import org.jdrupes.vmoperator.manager.events.ModifyVm;
|
import org.jdrupes.vmoperator.manager.events.ModifyVm;
|
||||||
|
import org.jdrupes.vmoperator.manager.events.PodChanged;
|
||||||
import org.jdrupes.vmoperator.manager.events.UpdateAssignment;
|
import org.jdrupes.vmoperator.manager.events.UpdateAssignment;
|
||||||
import org.jdrupes.vmoperator.manager.events.VmChannel;
|
import org.jdrupes.vmoperator.manager.events.VmChannel;
|
||||||
import org.jdrupes.vmoperator.manager.events.VmDefChanged;
|
import org.jdrupes.vmoperator.manager.events.VmDefChanged;
|
||||||
|
|
@ -248,4 +250,28 @@ public class Controller extends Component {
|
||||||
}
|
}
|
||||||
event.setResult(false);
|
event.setResult(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove runner version from status when pod is deleted
|
||||||
|
*
|
||||||
|
* @param event the event
|
||||||
|
* @param channel the channel
|
||||||
|
* @throws ApiException the api exception
|
||||||
|
*/
|
||||||
|
@Handler
|
||||||
|
public void onPodChange(PodChanged event, VmChannel channel)
|
||||||
|
throws ApiException {
|
||||||
|
if (event.type() == ResponseType.DELETED) {
|
||||||
|
// Remove runner info from status
|
||||||
|
var vmDef = channel.vmDefinition();
|
||||||
|
var vmStub = VmDefinitionStub.get(channel.client(),
|
||||||
|
new GroupVersionKind(Crd.GROUP, "", Crd.KIND_VM),
|
||||||
|
vmDef.namespace(), vmDef.name());
|
||||||
|
vmStub.updateStatus(from -> {
|
||||||
|
JsonObject status = from.statusJson();
|
||||||
|
status.remove(Status.RUNNER_VERSION);
|
||||||
|
return status;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue