Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-enable app plugins via operator. #1392

Open
guilhermeferreyra opened this issue Jan 29, 2024 · 4 comments
Open

Auto-enable app plugins via operator. #1392

guilhermeferreyra opened this issue Jan 29, 2024 · 4 comments
Labels
enhancement New feature or request triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@guilhermeferreyra
Copy link

I installed the Zabbix Plugin via the Dashboard Yaml file, but the plugin requires manual interaction to be enabled. It would be beneficial to automate the installation process by auto-enabling the plugin.

Here is the YAML that I used to install the plugin.

apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
  name: grafanadashboard-sample
  namespace: grafana
spec:
  resyncPeriod: 30s
  instanceSelector:
    matchLabels:
      dashboards: "grafana"
  plugins:
    - name: alexanderzobnin-zabbix-app
      version: 4.4.5
  json: >
    {
      "id": null,
      "title": "Simple Dashboard",
      "tags": [],
      "style": "dark",
      "timezone": "browser",
      "editable": true,
      "hideControls": false,
      "graphTooltip": 1,
      "panels": [],
      "time": {
        "from": "now-6h",
        "to": "now"
      },
      "timepicker": {
        "time_options": [],
        "refresh_intervals": []
      }...

300584617-2c81c57b-e742-4b7a-ad3a-99c2cf980fce

@guilhermeferreyra guilhermeferreyra added enhancement New feature or request needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 29, 2024
@Tualua
Copy link
Contributor

Tualua commented Jan 30, 2024

I use this ansible task. Works perfectly with plugin 4.4.5 and Grafana 10.1.6

---
- name: Add datasources
  hosts: master
  gather_facts: no
  become: yes
  tasks:
    - name: Add Zabbix datasource
      kubernetes.core.k8s:
        state: present
        definition:
          apiVersion: grafana.integreatly.org/v1beta1
          kind: GrafanaDatasource
          metadata:
            name: "{{ deployment_name }}-datasource-zabbix"
            namespace: "{{ namespace }}"
          spec:
            valuesFrom:
            - targetPath: "jsonData.username"
              valueFrom:
                secretKeyRef:
                  name: "{{ deployment_name }}-zabbix-account"
                  key: "GF_SECURITY_ZABBIX_USER"
            - targetPath: "secureJsonData.password"
              valueFrom:
                secretKeyRef:
                  name: "{{ deployment_name }}-zabbix-account"
                  key: "GF_SECURITY_ZABBIX_PASSWORD"
            instanceSelector:
              matchLabels:
                dashboards: "{{ deployment_name }}"
            plugins:
                - name: alexanderzobnin-zabbix-app
                  version: "{{ zabbix_plugin_version }}"
            datasource:
              uid: "DSZABBIX"
              name: my-zabbix
              type: "alexanderzobnin-zabbix-datasource"
              access: server
              url: https://my.zabbix.tld/api_jsonrpc.php
              isDefault: true
              jsonData:
                "authType": "userLogin"
                "dbConnectionDatasourceId": 1
                "dbConnectionEnable": true
                "disableDataAlignment": false
                "trends": true
                "trendsFrom": ""
                "trendsRange": ""
                "username": ${GF_SECURITY_ZABBIX_USER}
              secureJsonData:
                "password": ${GF_SECURITY_ZABBIX_PASSWORD}
              editable: true

I also use Postgresql connection deployed with provisioning

"dbConnectionDatasourceId": 1
"dbConnectionEnable": true

Just disable this if you don't need it

@hubeadmin
Copy link
Collaborator

@theSuess Will look into this, however, there should be a flag to do this automatically. Pending his investigation

@hubeadmin hubeadmin added triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 30, 2024
@theSuess
Copy link
Member

Alright, the difference is between app and datasource plugins. App plugins currently need to be enabled manually or using a provisioning file. This is something we should be able to implement by either using an init container or config map which will provide a plugin provisioning file like this:

apiVersion: 1

apps:
  - type: alexanderzobnin-zabbix-app
    disabled: false

@theSuess theSuess added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels Jan 31, 2024
@pb82
Copy link
Collaborator

pb82 commented Feb 6, 2024

@theSuess does this apply to all App plugins or only some of them?

@guilhermeferreyra guilhermeferreyra changed the title Auto-enable plugins via datasourse or dashboard yaml files. Auto-enable app plugins via operator. Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

5 participants