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

add github datasource #584

Merged
merged 4 commits into from
Oct 28, 2021
Merged

add github datasource #584

merged 4 commits into from
Oct 28, 2021

Conversation

vmanley
Copy link
Contributor

@vmanley vmanley commented Oct 27, 2021

Description

Allows Operator to support GitHub datasources by creating a GrafanaDataSource.

Relevant issues/tickets

Fixes #570

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • This change requires a documentation update
  • I have added tests that prove my fix is effective or that my feature works
  • I have added a test case that will be used to verify my changes
  • Verified independently on a cluster by reviewer

Verification steps

Verifying locally by CRC

  1. Create the following resources to be applied
  • Secret to install GitHub plugin
apiVersion: v1
kind: Secret
metadata:
  name: grafana-env
stringData:
  GF_INSTALL_PLUGINS: grafana-github-datasource 1.0.6
type: Opaque
  • Grafana CR for GitHub plugin
apiVersion: integreatly.org/v1alpha1
kind: Grafana
metadata:
  name: example-grafana
spec:
  client:
    preferService: false
  deployment:
    envFrom:
      - secretRef:
          name: grafana-env
  ingress:
    enabled: True
  config:
    log:
      mode: "console"
      level: "warn"
    auth:
      disable_login_form: False
      disable_signout_menu: True
    auth.anonymous:
      enabled: True
  dashboardLabelSelector:
    - matchExpressions:
        - { key: app, operator: In, values: [ grafana ] }
  • GitHub dashboard (using sample dashboard found here)
apiVersion: integreatly.org/v1alpha1
kind: GrafanaDashboard
metadata:
  name: github-dashboard
  labels:
    app: grafana
spec:
  json:
    ""
  url: https://raw.githubusercontent.com/grafana/github-datasource/master/src/dashboards/dashboard.json
  datasources:
    - inputName: "DS_GITHUB"
      datasourceName: GitHub
  plugins:
    - name: "grafana-github-datasource"
      version: "1.0.6"
  • GitHub Datasource (this example can also be found here)
apiVersion: integreatly.org/v1alpha1
kind: GrafanaDataSource
metadata:
  name: github-grafanadatasource
spec:
  name: github-grafanadatasource.yaml
  datasources:
    - name: GitHub
      type: grafana-github-datasource
      access: proxy
      jsonData:
        githubUrl: ""
      secureJsonData:
        accessToken: <github-token>

Note: The GitHub token provided must have the following permissions:
For all repositories:

  • public_repo
  • repo:status
  • repo_deployment
  • read:packages
  • user:read
  • user:email

An extra setting is required for private repositories

  • repo (Full control of private repositories)
  1. Run the Operator locally using this branch.
  2. Apply the resources to a namespace.
  3. WIth CRC, a Grafana route should be created. Open the route location to open Grafana UI.
  4. Navigate to the dashboard titled GitHub Default (Found under Dashboards/Manage in the side bar)
  5. Dashboard should display data from https://github.com/grafana/grafana by default. Different repos can be chosen by editting the Organization and Repository fields in the UI.

@pb82 pb82 self-assigned this Oct 27, 2021
@HVBE
Copy link
Collaborator

HVBE commented Oct 27, 2021

Trying to verify, it might take a while since I forgot my GitHub password, so I successfully prevented myself from generating a new access key :), looks great so far though! thanks @vmanley

Copy link
Collaborator

@HVBE HVBE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for addressing this @vmanley, works great 👍
image

@HVBE HVBE merged commit 32b3285 into grafana:master Oct 28, 2021
HVBE added a commit to HVBE/grafana-operator that referenced this pull request Oct 29, 2021
* add github datasource

* update api.md

Co-authored-by: Hubert Stefanski <35736504+HubertStefanski@users.noreply.github.com>
HVBE added a commit that referenced this pull request Nov 3, 2021
* docs: update readme

* fix: broken images in markdown table

* chore: fix lint issues

* chore: address typo

* add github datasource (#584)

* add github datasource

* update api.md

Co-authored-by: Hubert Stefanski <35736504+HubertStefanski@users.noreply.github.com>

* docs: update readme.md

Co-authored-by: Vincent Manley <vmanley@redhat.com>
@vmanley vmanley deleted the add-github-datasource branch November 4, 2021 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add datasource Github
3 participants