Plugin Interfaces¶
Interface definitions for Gordon Janitor Plugins.
Please see Gordon Janitor’s Plugin System for more information on writing a plugin for the Gordon Janitor service.
-
interface
gordon_janitor.interfaces.
IAuthority
(config, rrset_channel, metrics=None)[source]¶ Scan source of truth(s) of hosts and emit messages to Reconciler.
The purpose of this client is to consult a source of truth, for example, the list instances APIs in Google Compute Engine or AWS EC2, or consulting one’s own database of hosts. A message per DNS zone with every instance record (per service owner’s own requirements) will then be put onto the
rrset_channel
queue for a Reconciler to - you guessed it - reconcile.Parameters: - config (dict) – Authority-specific configuration.
- rrset_channel (asyncio.Queue) – queue to put record set messages for later validation.
- metrics (obj) – Optional object to emit Authority-specific metrics.
-
run
()¶ Start plugin in the main event loop.
Once required work is all processed,
cleanup()
needs to be called.
-
cleanup
()¶ Cleanup once plugin-specific work is cleanup.
Cleanup work might include allowing outstanding asynchronous Python tasks to finish, cancelling them if they extend beyond a desired timeout, and/or closing HTTP sessions.
-
interface
gordon_janitor.interfaces.
IGenericPlugin
(config, **plugin_kwargs)[source]¶ Do not implement this interface directly.
Use
IAuthority
,IReconciler
, orIPublisher
instead.Parameters: -
run
()¶ Start plugin in the main event loop.
Once required work is all processed,
cleanup()
needs to be called.
-
cleanup
()¶ Cleanup once plugin-specific work is cleanup.
Cleanup work might include allowing outstanding asynchronous Python tasks to finish, cancelling them if they extend beyond a desired timeout, and/or closing HTTP sessions.
-
-
interface
gordon_janitor.interfaces.
IPublisher
(config, changes_channel, metrics=None)[source]¶ Publish change messages to the pub/sub Gordon consumes.
Clients that implement
IPublisher
will consume from thechanges_channel
queue and publish the message to the configured pub/sub for which Gordon subscribes.Parameters: - config (dict) – Publisher-specific configuration.
- changes_channel (asyncio.Queue) – queue to consume the corrective messages needing to be published.
- metrics (obj) – Optional object to emit Publisher-specific metrics.
-
run
()¶ Start plugin in the main event loop.
Once required work is all processed,
cleanup()
needs to be called.
-
cleanup
()¶ Cleanup once plugin-specific work is cleanup.
Cleanup work might include allowing outstanding asynchronous Python tasks to finish, cancelling them if they extend beyond a desired timeout, and/or closing HTTP sessions.
-
interface
gordon_janitor.interfaces.
IReconciler
(config, rrset_channel, changes_channel, metrics=None)[source]¶ Validate current records in DNS against desired Authority.
Clients that implement
IReconciler
will create a change message for the configuredIPublisher
client plugin to consume if there is a discrepancy between records in DNS and the desired state.Once validation is done, the
IReconciler
client will need to emit aNone
message to thechanges_channel
queue, signalling to anIPublisher
client to publish the message to a pub/sub to which Gordon subscribes.Parameters: - config (dict) – Reconciler-specific configuration.
- rrset_channel (asyncio.Queue) – queue from which to consume record set messages to validate.
- changes_channel (asyncio.Queue) – queue to publish corrective messages to be published.
- metrics (obj) – Optional object to emit Reconciler-specific metrics.
-
run
()¶ Start plugin in the main event loop.
Once required work is all processed,
cleanup()
needs to be called.
-
cleanup
()¶ Cleanup once plugin-specific work is cleanup.
Cleanup work might include allowing outstanding asynchronous Python tasks to finish, cancelling them if they extend beyond a desired timeout, and/or closing HTTP sessions.