Skip to content

Commit

Permalink
add options for link sharing via mysql database (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
rekup authored Feb 11, 2021
1 parent 795db68 commit c5f191b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
4 changes: 2 additions & 2 deletions charts/promlens/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: promlens
version: 1.0.5
version: 1.0.6
appVersion: 0.11.0
description: This Chart installs and configures PromLens from PromLabs.
home: https://promlens.com
Expand All @@ -18,7 +18,7 @@ keywords:
- promql
annotations:
artifacthub.io/changes: |
- Update Chart to use PromLens v0.11.0
- Add options for link sharing via mysql database
artifacthub.io/images: |
- name: promlens
image: promlabs/promlens:v0.11.0
7 changes: 6 additions & 1 deletion charts/promlens/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PromLens

![Version: 1.0.5](https://img.shields.io/badge/Version-1.0.5-informational?style=flat-square) ![AppVersion: 0.11.0](https://img.shields.io/badge/AppVersion-0.11.0-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)
![Version: 1.0.6](https://img.shields.io/badge/Version-1.0.6-informational?style=flat-square) ![AppVersion: 0.11.0](https://img.shields.io/badge/AppVersion-0.11.0-informational?style=flat-square) ![Release Status](https://github.com/ricardo-ch/helm-charts/workflows/Release%20Charts/badge.svg) [![License](https://img.shields.io/github/license/ricardo-ch/helm-charts)](https://github.com/ricardo-ch/helm-charts/blob/main/LICENSE)

This chart installs [PromLens](https://promlens.com/) from [PromLabs](https://promlabs.com/).

Expand Down Expand Up @@ -32,6 +32,11 @@ Simply add this Chart repository to Helm:
| config.shared_links.gcs.bucket | string | `"promlens"` | Bucket Name in Storage Account |
| config.shared_links.gcs.enabled | bool | `true` | Enable Link Sharing via Google Storage Bucket |
| config.shared_links.gcs.storage_account | string | `nil` | Google Cloud Storage Account |
| config.shared_links.sql.create_tables | bool | `true` | Auto-create required tables in SQL database |
| config.shared_links.sql.driver | string | `"mysql"` | The SQL driver to use for storing shared links in a SQL database. Supported values: [mysql, sqlite3]. |
| config.shared_links.sql.dsn | string | `""` | SQL Data Source Name when using an SQL database to shared links (see https://github.com/go-sql-driver/mysql#dsn-data-source-name) for MySQL, https://github.com/mattn/go-sqlite3#dsn-examples for SQLite3). |
| config.shared_links.sql.enabled | bool | `false` | Enable Link Sharing via SQL database |
| config.shared_links.sql.retention | string | `"0"` | The maximum retention time for shared links when using a SQL database (e.g. '10m', '12h', '720h'). Set to 0 for infinite retention. |
| config.web.default_prometheus_url | string | `nil` | The default Prometheus URL to load PromLens with. |
| config.web.external_url | string | `nil` | The URL under which PromLens is externally reachable (for example, if PromLens is served via a reverse proxy). Used for generating relative and absolute links back to PromLens itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by PromLens. If omitted, relevant URL components will be derived automatically. |
| deployment.image | string | `"promlabs/promlens"` | PromLens Conatiner Image |
Expand Down
15 changes: 15 additions & 0 deletions charts/promlens/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ spec:
{{- if .Values.config.shared_links.gcs.enabled }}
- --shared-links.gcs.bucket={{ .Values.config.shared_links.gcs.bucket }}
{{- end }}
{{- if .Values.config.shared_links.sql.enabled }}
- --shared-links.sql.driver={{ .Values.config.shared_links.sql.driver }}
- --shared-links.sql.retention={{ .Values.config.shared_links.sql.retention }}
{{- if not .Values.config.shared_links.sql.create_tables }}
- --no-shared-links.sql.create-tables
{{- end }}
{{- end }}
{{- if .Values.config.grafana.enabled }}
- --grafana.url={{ .Values.config.grafana.url }}
- --grafana.api-token={{ .Values.config.grafana.api_token }}
Expand Down Expand Up @@ -51,3 +58,11 @@ spec:
defaultMode: 420
secretName: promlens-secrets
{{ end }}
{{ if .Values.config.shared_links.sql.enabled }}
env:
- name: PROMLENS_SHARED_LINKS_DSN
valueFrom:
secretKeyRef:
name: promlens-secrets
key: sql-dsn
{{ end }}
5 changes: 3 additions & 2 deletions charts/promlens/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.config.shared_links.gcs.enabled }}
{{- if or .Values.config.shared_links.gcs.enabled .Values.config.shared_links.sql.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -10,5 +10,6 @@ metadata:
heritage: {{ .Release.Service }}
type: Opaque
data:
gcs-cred.json: {{ .Values.config.shared_links.gcs.storage_account | quote }}
gcs-cred.json: {{ .Values.config.shared_links.gcs.storage_account | default "" | quote }}
sql-dsn: {{ .Values.config.shared_links.sql.dsn | b64enc | default "" | quote }}
{{- end}}
12 changes: 11 additions & 1 deletion charts/promlens/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,17 @@ config:
storage_account:
# -- Bucket Name in Storage Account
bucket: "promlens"

sql:
# -- Enable Link Sharing via SQL database
enabled: false
# -- The SQL driver to use for storing shared links in a SQL database. Supported values: [mysql, sqlite3].
driver: mysql
# -- SQL Data Source Name when using an SQL database to shared links (see https://github.com/go-sql-driver/mysql#dsn-data-source-name) for MySQL, https://github.com/mattn/go-sqlite3#dsn-examples for SQLite3).
dsn: ""
# -- Auto-create required tables in SQL database
create_tables: true
# -- The maximum retention time for shared links when using a SQL database (e.g. '10m', '12h', '720h'). Set to 0 for infinite retention.
retention: "0"
web:
# -- The URL under which PromLens is externally reachable (for example, if PromLens is served via a reverse proxy). Used for generating relative and absolute links back to PromLens itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by PromLens. If omitted, relevant URL components will be derived automatically.
external_url:
Expand Down

0 comments on commit c5f191b

Please sign in to comment.