Class DisplaySecretReconciler

java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jdrupes.vmoperator.manager.DisplaySecretReconciler
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 DisplaySecretReconciler extends org.jgrapes.core.Component
The properties of the display secret do not only depend on the VM definition, but also on events that occur during runtime.

The reconciler for the display secret is therefore a separate component.

The reconciler supports the following configuration properties:

  • passwordValidity: the validity of the random password in seconds. Used to calculate the password expiry time in the generated secret.
  • 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 final Logger
     

    Fields inherited from interface org.jgrapes.core.Channel

    BROADCAST, SELF
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    void
    onConfigurationUpdate(org.jgrapes.util.events.ConfigurationUpdate event)
    On configuration update.
    void
    Prepares access to the console for the user from the event.
    void
    onVmResourceChanged(VmResourceChanged event, org.jgrapes.core.Channel channel)
    On vm def changed.
    void
    reconcile(VmDefinition vmDef, Map<String,Object> model, VmChannel channel, boolean specChanged)
    Reconcile.

    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

  • Constructor Details

    • DisplaySecretReconciler

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

    • onConfigurationUpdate

      @Handler public void onConfigurationUpdate(org.jgrapes.util.events.ConfigurationUpdate event)
      On configuration update.
      Parameters:
      event - the event
    • reconcile

      public void reconcile(VmDefinition vmDef, Map<String,Object> model, VmChannel channel, boolean specChanged) throws IOException, freemarker.template.TemplateException, io.kubernetes.client.openapi.ApiException
      Reconcile.

      If the configuration prevents generating a secret or the secret already exists, do nothing. Else generate a new secret with a random password and immediate expiration, thus preventing access to the display.

      Parameters:
      vmDef - the VM definition
      model - the model
      channel - the channel
      specChanged - the spec changed
      Throws:
      IOException - Signals that an I/O exception has occurred.
      freemarker.template.TemplateException - the template exception
      io.kubernetes.client.openapi.ApiException - the api exception
    • onGetDisplaySecret

      @Handler public void onGetDisplaySecret(GetDisplaySecret event, VmChannel channel) throws io.kubernetes.client.openapi.ApiException
      Prepares access to the console for the user from the event.

      Generates a new password and sends it to the runner. Requests the VM (via the runner) to login the user if specified in the event.

      Parameters:
      event - the event
      channel - the channel
      Throws:
      io.kubernetes.client.openapi.ApiException - the api exception
    • onVmResourceChanged

      @Handler public void onVmResourceChanged(VmResourceChanged event, org.jgrapes.core.Channel channel)
      On vm def changed.
      Parameters:
      event - the event
      channel - the channel