Skip to content

Commit 0183dba

Browse files
authored
Merge pull request #368 from stackhpc/INFRA-908-grafana-plugin-logic
INFRA-908 Change logic for plugins in grafana image build
2 parents c15fd54 + 8a6e083 commit 0183dba

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

doc/source/admin/image-building.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,23 @@ To remove a package from that list, say ``locales``, one would do:
298298
# Horizon
299299
{% set horizon_packages_remove = ['locales'] %}
300300
301+
An example of this is the Grafana plugins, which are mentioned in the next
302+
section.
303+
304+
Grafana plugins
305+
^^^^^^^^^^^^^^^
306+
307+
Additional Grafana plugins can be installed by adding the plugin name to the
308+
``grafana_plugins_append`` list. Plugins can also be removed by adding the
309+
plugin name to the ``grafana_plugins_remove`` list. Additionally the entire
310+
list can be overridden by setting the ``grafana_plugins_override`` variable.
311+
312+
.. code-block:: ini
313+
314+
grafana_plugins_append:
315+
- grafana-piechart-panel
316+
- vonage-status-panel
317+
301318
Python packages build options
302319
-----------------------------
303320

@@ -401,6 +418,7 @@ Some of these plugins used to be enabled by default but, due to
401418
their release characteristic, have been excluded from the default builds.
402419
Please read the included ``README.rst`` to learn how to apply them.
403420

421+
404422
Additions functionality
405423
-----------------------
406424

docker/grafana/Dockerfile.j2

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ COPY extend_start.sh /usr/local/bin/kolla_extend_start
2222

2323
{% block grafana_plugins_install %}
2424

25-
RUN grafana-cli plugins install gnocchixyz-gnocchi-datasource \
26-
&& grafana-cli plugins install grafana-opensearch-datasource
25+
{% set grafana_default_plugins = ['grafana-opensearch-datasource'] %}
26+
{% set grafana_plugins = grafana_default_plugins | customizable("plugins") %}
2727

28+
{% if grafana_plugins | length > 0 %}
29+
RUN {{ (['grafana-cli plugins install %s'] * grafana_plugins | length ) | join(' && ') | format(*grafana_plugins) }}
30+
{% endif %}
2831
{% endblock %}
2932

3033
RUN chmod 750 /etc/sudoers.d \
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
New logic for installing grafana plugins. When building you can pass a
5+
variable ``grafana_plugins_append`` that contains a list of plugins you
6+
want to install. This will be appended to the default list of plugins. The
7+
existing method of overwriting the ``grafana_plugins_install`` block still
8+
works.

0 commit comments

Comments
 (0)