Package org.jdrupes.vmoperator.manager
Class DisplaySecretReconciler
java.lang.Object
org.jgrapes.core.internal.ComponentVertex
org.jgrapes.core.Component
org.jdrupes.vmoperator.manager.DisplaySecretReconciler
- All Implemented Interfaces:
Iterable<ComponentType>
,Channel
,ComponentType
,Eligible
,Manager
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
Channel.Default
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDisplaySecretReconciler
(Channel componentChannel) Instantiates a new display secret reconciler. -
Method Summary
Modifier and TypeMethodDescriptionvoid
On configuration update.void
onPrepareConsole
(PrepareConsole event, VmChannel channel) Prepares access to the console for the user from the event.void
onVmDefChanged
(VmDefChanged event, Channel channel) On vm def changed.void
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
-
Field Details
-
logger
-
-
Constructor Details
-
DisplaySecretReconciler
Instantiates a new display secret reconciler.- Parameters:
componentChannel
- the component channel
-
-
Method Details
-
onConfigurationUpdate
On configuration update.- Parameters:
event
- the event
-
reconcile
public void reconcile(VmDefChanged event, Map<String, Object> model, VmChannel channel) throws IOException, TemplateException, io.kubernetes.client.openapi.ApiExceptionReconcile.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:
event
- the eventmodel
- the modelchannel
- the channel- Throws:
IOException
- Signals that an I/O exception has occurred.TemplateException
- the template exceptionio.kubernetes.client.openapi.ApiException
- the api exception
-
onPrepareConsole
@Handler public void onPrepareConsole(PrepareConsole 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 eventchannel
- the channel- Throws:
io.kubernetes.client.openapi.ApiException
- the api exception
-
onVmDefChanged
On vm def changed.- Parameters:
event
- the eventchannel
- the channel
-