Package org.jdrupes.vmoperator.manager
Class VmMonitor
java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jdrupes.vmoperator.manager.AbstractMonitor<VmDefinition,VmDefinitions,VmChannel>
org.jdrupes.vmoperator.manager.VmMonitor
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
Watches for changes of VM definitions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionVmMonitor
(Channel componentChannel, ChannelManager<String, VmChannel, ?> channelManager) Instantiates a new VM definition watcher. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
handleChange
(K8sClient client, io.kubernetes.client.util.Watch.Response<VmDefinition> response) Handle an observed change.void
onModifyVm
(ModifyVm event, VmChannel channel) On modify vm.void
onPodChanged
(PodChanged event, VmChannel channel) On pod changed.void
onUpdatedAssignment
(UpdateAssignment event, VmChannel channel) Attempt to Update the assignment information in the status of the VM CR.protected void
Invoked byAbstractMonitor.onStart(Start)
after the namespace has been configured and before starting the observer.Methods inherited from class org.jdrupes.vmoperator.manager.AbstractMonitor
client, client, context, context, namespace, namespace, onConfigurationUpdate, onStart, options, options
Methods inherited from class org.jgrapes.core.Component
channel, component, defaultCriterion, isEligibleFor, setName
Methods inherited from class org.jgrapes.core.internal.ComponentVertex
activeEventPipeline, addHandler, attach, channelReplacements, children, componentPath, componentVertex, detach, fire, initComponentsHandlers, iterator, name, newEventPipeline, newEventPipeline, parent, registerAsGenerator, root, toString, unregisterAsGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
VmMonitor
Instantiates a new VM definition watcher.- Parameters:
componentChannel
- the component channelchannelManager
- the channel manager
-
-
Method Details
-
prepareMonitoring
Description copied from class:AbstractMonitor
Invoked byAbstractMonitor.onStart(Start)
after the namespace has been configured and before starting the observer.This is the last opportunity to invoke
AbstractMonitor.context(APIResource)
.- Overrides:
prepareMonitoring
in classAbstractMonitor<VmDefinition,
VmDefinitions, VmChannel> - Throws:
IOException
- Signals that an I/O exception has occurred.io.kubernetes.client.openapi.ApiException
- the api exception
-
handleChange
protected void handleChange(K8sClient client, io.kubernetes.client.util.Watch.Response<VmDefinition> response) Description copied from class:AbstractMonitor
Handle an observed change.The method is invoked by the observer thread(s). It is the responsibility of the implementing class to fire derived events on the appropriate event pipeline.
- Specified by:
handleChange
in classAbstractMonitor<VmDefinition,
VmDefinitions, VmChannel> - Parameters:
client
- the clientresponse
- the change
-
onPodChanged
On pod changed.- Parameters:
event
- the eventchannel
- the channel
-
onModifyVm
@Handler public void onModifyVm(ModifyVm event, VmChannel channel) throws io.kubernetes.client.openapi.ApiException, IOException On modify vm.- Parameters:
event
- the event- Throws:
io.kubernetes.client.openapi.ApiException
- the api exceptionIOException
- Signals that an I/O exception has occurred.
-
onUpdatedAssignment
@Handler public void onUpdatedAssignment(UpdateAssignment event, VmChannel channel) throws io.kubernetes.client.openapi.ApiException Attempt to Update the assignment information in the status of the VM CR.Returns true if successful. The handler does not attempt retries, because in case of failure it will be necessary to re-evaluate the chosen VM.
- Parameters:
event
- the eventchannel
- the channel- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-