Skip to content

Commit

Permalink
Merge pull request #267 from akash4sh/main
Browse files Browse the repository at this point in the history
Add postgres support for grafana
  • Loading branch information
jebjohns authored Nov 9, 2023
2 parents 25c6bf4 + fc1e6de commit 62ee201
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 2 deletions.
5 changes: 3 additions & 2 deletions charts/client/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.7
version: 1.1.8

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand All @@ -33,5 +33,6 @@ dependencies:
repository: https://intelops.github.io/kubviz/
- name: grafana
condition: grafana.enabled
version: 1.0.3
version: 1.0.5
repository: https://kube-tarian.github.io/helmrepo-supporting-tools/

17 changes: 17 additions & 0 deletions charts/client/templates/configmap-clickhouse-datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ data:
type: grafana-clickhouse-datasource
jsonData:
port: 9000
{{- if .Values.clickhouse.enabled }}
server: {{ include "client.fullname" . }}-clickhouse
{{- else }}
server: {{ .Values.existingClickhouse.host }}
tlsSkipVerify: true
{{- if not .Values.clickhouse.enabled }}
{{- if not .Values.existingClickhouse.secret }}
username: {{ .Values.existingClickhouse.username }}
{{- else }}
username: $CLICKHOUSE_USERNAME
{{- end }}
secureJsonData:
{{- if not .Values.existingClickhouse.secret }}
password: {{ .Values.existingClickhouse.password }}
{{- else }}
password: $CLICKHOUSE_PASSWORD
{{- end }}
{{- end }}
{{- end }}
{{- end }}
18 changes: 18 additions & 0 deletions charts/client/templates/configmap-vertamedia-datasource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ data:
datasources:
- name: vertamedia-clickhouse-datasource
type: vertamedia-clickhouse-datasource
{{- if .Values.clickhouse.enabled }}
url: {{ include "client.fullname" . }}-clickhouse:8123
{{- else }}
url: {{ .Values.existingClickhouse.host }}:8123
access: proxy
{{- if not .Values.clickhouse.enabled }}
basicAuth: true
{{- if not .Values.existingClickhouse.secret }}
basicAuthUser: {{ .Values.existingClickhouse.username }}
{{- else }}
basicAuthUser: $CLICKHOUSE_USERNAME
{{- end }}
secureJsonData:
{{- if not .Values.existingClickhouse.secret }}
basicAuthPassword: {{ .Values.existingClickhouse.password }}
{{- else }}
basicAuthPassword: $CLICKHOUSE_PASSWORD
{{- end }}
{{- end }}
{{- end }}
{{- end }}
52 changes: 52 additions & 0 deletions charts/client/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,35 @@ spec:
- name: SCHEMA_PATH
value : {{ .Values.migration.schema.path }}
- name: DB_ADDRESS
{{- if .Values.clickhouse.enabled }}
value: {{ include "client.fullname" . }}-clickhouse
{{- else }}
value: {{ .Values.existingClickhouse.host }}
- name: CLICKHOUSE_USERNAME
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.username }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.usernamekey }}
{{- end }}
- name: CLICKHOUSE_PASSWORD
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.password }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.passwordkey }}
{{- end }}
{{- end }}
- name: DB_PORT
value: "9000"
- name: TTL_INTERVAL
value: "{{ .Values.ttl.ttlInterval }}"
- name: TTL_UNIT
value: {{ .Values.ttl.ttlUnit }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down Expand Up @@ -74,9 +100,35 @@ spec:
- name: NATS_ADDRESS
value: {{ include "client.fullname" . }}-nats
- name: DB_ADDRESS
{{- if .Values.clickhouse.enabled }}
value: {{ include "client.fullname" . }}-clickhouse
{{- else }}
value: {{ .Values.existingClickhouse.host }}
- name: CLICKHOUSE_USERNAME
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.username }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.usernamekey }}
{{- end }}
- name: CLICKHOUSE_PASSWORD
{{- if not .Values.existingClickhouse.secret }}
value: {{ .Values.existingClickhouse.password }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.existingClickhouse.secret.name }}
key: {{ .Values.existingClickhouse.secret.passwordkey }}
{{- end }}
{{- end }}
- name: DB_PORT
value: "9000"
- name: TTL_INTERVAL
value: "{{ .Values.ttl.ttlInterval }}"
- name: TTL_UNIT
value: {{ .Values.ttl.ttlUnit }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down
41 changes: 41 additions & 0 deletions charts/client/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,49 @@ clickhouse:
clickhouse:
replicas: "1"

existingClickhouse:
host: clickhouse
# Use username and password if you want to provide the token via Helm Values
username: ""
password: ""
# Use a secret reference if you want to get a username and password from a secret
secret: {}
# name: ""
# usernamekey: ""
# passwordkey: ""

grafana:
enabled: false
plugins:
- vertamedia-clickhouse-datasource
- grafana-clickhouse-datasource
- volkovlabs-echarts-panel
sidecar:
dashboards:
provider:
allowUiUpdates: true
postgresql:
enabled: false
database:
type: postgres
host: kubviz-client-postgresql:5432
name: postgres
ssl_mode: disable
user: postgres
password: $__file{/etc/secrets/postgresql/postgres-password}
secretMount:
name: postgresql-mount
mountPath: /etc/secrets/postgresql
secretName: kubviz-client-postgresql
readOnly: true
clickhouse:
enabled: false
username: ""
password: ""
existingSecret: {}
# name: ""
# usernamekey: ""
# passwordkey: ""

dashboards:
enabled: true
Expand All @@ -124,3 +161,7 @@ migration:
tag: "v1.1.3"
schema:
path: "/sql"

ttl:
ttlInterval: "1"
ttlUnit: MONTH

0 comments on commit 62ee201

Please sign in to comment.