Skip to content

Commit

Permalink
enable configuring plugin discovery via environment (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
edaniszewski committed Jul 6, 2018
1 parent 9afd410 commit 7beb7d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 12 additions & 0 deletions docs/source/user/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,18 @@ using label matching. Below is an example Kubernetes configuration that will cre
Deployment for Synse Server and the Emulator Plugin. Synse Server is configured to discover the
plugin using endpoint labels, specifically the ``app=synse`` and ``component=plugin`` labels.

In the example below, Synse Server is configured for plugin discovery via a mounted ConfigMap. It
can also be configured via environment variable, e.g.

.. code-block:: none
SYNSE_PLUGIN_DISCOVER_KUBERNETES_ENDPOINTS_LABELS_APP=synse
SYNSE_PLUGIN_DISCOVER_KUBERNETES_ENDPOINTS_LABELS_COMPONENT=plugin
Where ``SYNSE_PLUGIN_DISCOVER_KUBERNETES_ENDPOINTS_LABELS`` is the key prefix for discovery using
kubernetes endpoint labels, ``APP`` and ``COMPONENT`` (the last elements of the ENV variable name)
are the label keys, and the env variable values are the values for those keys.

.. code-block:: yaml
apiVersion: v1
Expand Down
8 changes: 4 additions & 4 deletions synse/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
DictOption('plugin', default={}, scheme=Scheme(
ListOption('tcp', default=[], member_type=str, bind_env=True),
ListOption('unix', default=[], member_type=str, bind_env=True),
DictOption('discover', default={}, scheme=Scheme(
DictOption('kubernetes', default={}, scheme=Scheme(
DictOption('endpoints', default={}, scheme=Scheme(
DictOption('labels', default={}, scheme=None)
DictOption('discover', default={}, bind_env=True, scheme=Scheme(
DictOption('kubernetes', default={}, bind_env=True, scheme=Scheme(
DictOption('endpoints', default={}, bind_env=True, scheme=Scheme(
DictOption('labels', default={}, bind_env=True, scheme=None)
)),
))
)),
Expand Down

0 comments on commit 7beb7d5

Please sign in to comment.