Class Reconciler

java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jdrupes.vmoperator.manager.Reconciler
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 Reconciler extends org.jgrapes.core.Component
Adapts Kubenetes resources for instances of the Runner application (the VMs) to changes in VM definitions (the CRs).

In particular, the reconciler generates and updates:

  • A PVC for storage used by all VMs as a common repository for CDROM images.

  • A ConfigMap that defines the configuration file for the runner.

  • A PVC for 1 MiB of persistent storage used by the Runner (referred to as the “runnerDataPvc”)

  • The PVCs for the VM’s disks.

  • A Pod with the runner instance1.

  • (Optional) A load balancer Service that allows the user to access a VM’s console without knowing which node it runs on.

The reconciler is part of the Controller component. It’s configuration properties are therefore defined in

"/Manager":
  "/Controller":
    "/Reconciler":
      ...

The reconciler supports the following configuration properties:

  • runnerDataPvc.storageClassName: The storage class name to be used for the “runnerDataPvc” (the small volume used by the runner for information such as the EFI variables). By default, no storageClassName is generated, which causes Kubernetes to use storage from the default storage class. Define this if you want to use a specific storage class.

  • cpuOvercommit: The amount by which the current cpu count from the VM definition is divided when generating the resources properties for the VM (defaults to 2).

  • ramOvercommit: The amount by which the current ram size from the VM definition is divided when generating the resources properties for the VM (defaults to 1.25).

  • loadBalancerService: If defined, causes a load balancer service to be created. This property may be a boolean or YAML that defines additional labels or annotations to be merged into the service defintion. Here’s an example for using MetalLb as “internal load balancer”:

    loadBalancerService:
      annotations:
        metallb.universe.tf/loadBalancerIPs: 192.168.168.1
        metallb.universe.tf/ip-allocated-from-pool: single-common
        metallb.universe.tf/allow-shared-ip: single-common
    

    This makes all VM consoles available at IP address 192.168.168.1 with the port numbers from the VM definitions.

  • loggingProperties: If defined, specifies the default logging properties to be used by the runners managed by the controller. This property is a string that holds the content of a logging.properties file.


  1. Before version 3.4, the operator created a StatefulSet that created the pod.

See Also:
  • Nested Class Summary

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

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

    Fields
    Modifier and Type
    Field
    Description
    protected static final com.fasterxml.jackson.databind.ObjectMapper
    The Constant mapper.

    Fields inherited from class org.jgrapes.core.Component

    logger

    Fields inherited from interface org.jgrapes.core.Channel

    BROADCAST, SELF
  • Constructor Summary

    Constructors
    Constructor
    Description
    Reconciler(org.jgrapes.core.Channel componentChannel)
    Instantiates a new reconciler.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onConfigurationUpdate(org.jgrapes.util.events.ConfigurationUpdate event)
    Configures the component.
    void
    onResetVm(ResetVm event, VmChannel channel)
    Reset the VM by incrementing the reset count and doing a partial reconcile (configmap only).
    void
    Handles the change 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

    Methods inherited from interface org.jgrapes.core.Manager

    stream
  • Field Details

    • mapper

      protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
      The Constant mapper.
  • Constructor Details

    • Reconciler

      public Reconciler(org.jgrapes.core.Channel componentChannel)
      Instantiates a new reconciler.
      Parameters:
      componentChannel - the component channel
  • Method Details

    • onConfigurationUpdate

      @Handler public void onConfigurationUpdate(org.jgrapes.util.events.ConfigurationUpdate event)
      Configures the component.
      Parameters:
      event - the event
    • onVmResourceChanged

      @Handler public void onVmResourceChanged(VmResourceChanged event, VmChannel channel) throws io.kubernetes.client.openapi.ApiException, freemarker.template.TemplateException, IOException
      Handles the change event.
      Parameters:
      event - the event
      channel - the channel
      Throws:
      io.kubernetes.client.openapi.ApiException - the api exception
      freemarker.template.TemplateException - the template exception
      IOException - Signals that an I/O exception has occurred.
    • onResetVm

      @Handler public void onResetVm(ResetVm event, VmChannel channel) throws io.kubernetes.client.openapi.ApiException, IOException, freemarker.template.TemplateException
      Reset the VM by incrementing the reset count and doing a partial reconcile (configmap only).
      Parameters:
      event - the event
      channel - the channel
      Throws:
      IOException
      io.kubernetes.client.openapi.ApiException
      freemarker.template.TemplateException