Package org.jdrupes.vmoperator.manager
Class Controller
java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jdrupes.vmoperator.manager.Controller
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
Implements a controller as defined in the
Operator Whitepaper.
The implementation splits the controller in two components. The
VmMonitor
and the Reconciler
. The former watches
the VM definitions (CRs) and generates VmResourceChanged
events
when they change. The latter handles the changes and reconciles the
resources in the cluster.
The controller itself supports a single configuration property:
"/Manager":
"/Controller":
namespace: vmop-dev
This may only be set when running the Manager (and thus the Controller) outside a container during development.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapes.core.Channel
Channel.Default
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
onAssignVm
(AssignVm event) Assign a VM if not already assigned.void
Configure the component.void
Returns the VM data.void
onHandlingError
(HandlingError event) Special handling ofApiException
thrown by handlers.void
onPodChange
(PodChanged event, VmChannel channel) Remove runner version from status when pod is deletedvoid
onPoolChanged
(VmPoolChanged event) When s pool is deleted, remove all related assignments.void
Handle the start event.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
-
Controller
Creates a new instance.
-
-
Method Details
-
onHandlingError
Special handling ofApiException
thrown by handlers.- Parameters:
event
- the event
-
onConfigurationUpdate
Configure the component.- Parameters:
event
- the event
-
onStart
@Handler(priority=100) public void onStart(Start event) throws IOException, io.kubernetes.client.openapi.ApiException Handle the start event.Has higher priority because it configures the default Kubernetes client.
- Parameters:
event
- the event- Throws:
IOException
io.kubernetes.client.openapi.ApiException
-
onGetVms
Returns the VM data.- Parameters:
event
- the event
-
onAssignVm
@Handler public void onAssignVm(AssignVm event) throws io.kubernetes.client.openapi.ApiException, InterruptedException Assign a VM if not already assigned.- Parameters:
event
- the event- Throws:
io.kubernetes.client.openapi.ApiException
- the api exceptionInterruptedException
-
onPoolChanged
When s pool is deleted, remove all related assignments.- Parameters:
event
- the event- Throws:
InterruptedException
-
onPodChange
@Handler public void onPodChange(PodChanged event, VmChannel channel) throws io.kubernetes.client.openapi.ApiException Remove runner version from status when pod is deleted- Parameters:
event
- the eventchannel
- the channel- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-