Skip to content

Container with Grafana plugins for deployment Grafana in isolated environments

License

Notifications You must be signed in to change notification settings

Netcracker/qubership-grafana-plugins-init

Overview

Build Check Links Super-Linter

This init container is intended for grafana customization with predefined list of plugins.

All the plugins listed in plugins list file will be added to grafana while appropriate grafana pod start in Kubernetes.

These plugins are downloaded while this image build instead of init container runtime.

Plugins list

How to it work

During build grafana-plugin-init container all plugins download from https://grafana.com/api/plugins (User interface available by link https://grafana.com/grafana/plugins/) and add into Docker image.

When operator create or update Grafana deployment it create deployment with two containers:

  • grafana-plugins-init - initContainer which run with volume grafana-plugins (mount to /opt/plugins) in which it copy all plugins
  • grafana - container with Grafana which also has volume grafana-plugins (mount to /var/lib/grafana/plugins)

When pod grafana-deployment start with init container, it always run first and execute initialize actions. So when initContainer start it copy all plugins from image to mounted volume grafana-plugins.

Next it complete it work and grafana container start also with volume grafana-plugins.

Structure of init image:

/
└── entrypoint.sh
└── etc
    └── grafana
        └── plugins
            ├── NeoCat-grafana-cal-heatmap-panel-d7d3579
            ├── Vonage-Grafana_Status_panel-ca77e0d
            ├── algenty-grafana-flowcharting-276ca4a
            ├── black-mirror-1-singlestat-math-0aca146
            ├── briangann-gauge-panel
            ├── ...
            └── vertamedia-clickhouse-datasource

How to add plugin

There is file plugins.list which contains plugin name and plugin version specified via space separator. Currently plugins can be download only from:

https://grafana.com/api/plugins

Format:

<plugin_name> <version>

For example for include plugin which store on artifactory by link:

https://grafana.com/api/plugins/briangann-gauge-panel/versions/2.0.1/download

need specify:

briangann-gauge-panel 2.0.1

How to add plugin manually

In some cases it may be necessary add plugin which was downloaded manually from Grafana.com or from any other source.

For build this image locally with custom plugins need:

  1. Edit download_plugins.sh and comment step for remove directory /tmp/plugins

    echo "=> Remove directories from pervious build..."
    
    rm -rf ${DESTINATION_PATH}
    mkdir -p ${DESTINATION_PATH}
  2. Download and extract folder with plugin to /tmp/plugins. For example:

    /tmp
    └── /plugins
        └── /<manually-downloaded-plugin-1>
            └── <plugin-content>
        └── /<manually-downloaded-plugin-2>
            └── <plugin-content>
  3. Run

    docker build .

During build script docker build download all plugins as ZIP files into /tmp/downloads. Then it unarchive all plugins into /tmp/plugins.

And during build Docker image Docker will copy all files from /tmp/plugins to /etc/grafana/plugins/.

About

Container with Grafana plugins for deployment Grafana in isolated environments

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 9