Class PodMonitor

java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jdrupes.vmoperator.manager.AbstractMonitor<io.kubernetes.client.openapi.models.V1Pod,io.kubernetes.client.openapi.models.V1PodList,VmChannel>
org.jdrupes.vmoperator.manager.PodMonitor
All Implemented Interfaces:
Iterable<org.jgrapes.core.ComponentType>, org.jgrapes.core.Channel, org.jgrapes.core.ComponentType, org.jgrapes.core.Eligible, org.jgrapes.core.Manager

public class PodMonitor extends AbstractMonitor<io.kubernetes.client.openapi.models.V1Pod,io.kubernetes.client.openapi.models.V1PodList,VmChannel>
Watches for changes of pods that run VMs.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.jgrapes.core.Channel

    org.jgrapes.core.Channel.Default
  • Field Summary

    Fields inherited from class org.jgrapes.core.Component

    logger

    Fields inherited from interface org.jgrapes.core.Channel

    BROADCAST, SELF
  • Constructor Summary

    Constructors
    Constructor
    Description
    PodMonitor(org.jgrapes.core.Channel componentChannel, ChannelDictionary<String,VmChannel,?> channelDictionary)
    Instantiates a new pod monitor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    handleChange(K8sClient client, io.kubernetes.client.util.Watch.Response<io.kubernetes.client.openapi.models.V1Pod> change)
    Handle an observed change.
    void
    Check for pending changes.
    protected void
    Invoked by AbstractMonitor.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

    Methods inherited from interface org.jgrapes.core.Manager

    stream
  • Constructor Details

    • PodMonitor

      public PodMonitor(org.jgrapes.core.Channel componentChannel, ChannelDictionary<String,VmChannel,?> channelDictionary)
      Instantiates a new pod monitor.
      Parameters:
      componentChannel - the component channel
      channelDictionary - the channel dictionary
  • Method Details

    • prepareMonitoring

      protected void prepareMonitoring() throws IOException, io.kubernetes.client.openapi.ApiException
      Description copied from class: AbstractMonitor
      Invoked by AbstractMonitor.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 class AbstractMonitor<io.kubernetes.client.openapi.models.V1Pod,io.kubernetes.client.openapi.models.V1PodList,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<io.kubernetes.client.openapi.models.V1Pod> change)
      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 class AbstractMonitor<io.kubernetes.client.openapi.models.V1Pod,io.kubernetes.client.openapi.models.V1PodList,VmChannel>
      Parameters:
      client - the client
      change - the change
    • onVmResourceChanged

      @Handler public void onVmResourceChanged(VmResourceChanged event, VmChannel channel)
      Check for pending changes.
      Parameters:
      event - the event
      channel - the channel