Skip to content

Commit 62ee201

Browse files
authored
Merge pull request #267 from akash4sh/main
Add postgres support for grafana
2 parents 25c6bf4 + fc1e6de commit 62ee201

File tree

5 files changed

+131
-2
lines changed

5 files changed

+131
-2
lines changed

charts/client/Chart.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.1.7
18+
version: 1.1.8
1919

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

charts/client/templates/configmap-clickhouse-datasource.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,23 @@ data:
1313
type: grafana-clickhouse-datasource
1414
jsonData:
1515
port: 9000
16+
{{- if .Values.clickhouse.enabled }}
1617
server: {{ include "client.fullname" . }}-clickhouse
18+
{{- else }}
19+
server: {{ .Values.existingClickhouse.host }}
1720
tlsSkipVerify: true
21+
{{- if not .Values.clickhouse.enabled }}
22+
{{- if not .Values.existingClickhouse.secret }}
23+
username: {{ .Values.existingClickhouse.username }}
24+
{{- else }}
25+
username: $CLICKHOUSE_USERNAME
26+
{{- end }}
27+
secureJsonData:
28+
{{- if not .Values.existingClickhouse.secret }}
29+
password: {{ .Values.existingClickhouse.password }}
30+
{{- else }}
31+
password: $CLICKHOUSE_PASSWORD
32+
{{- end }}
33+
{{- end }}
34+
{{- end }}
1835
{{- end }}

charts/client/templates/configmap-vertamedia-datasource.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,24 @@ data:
1111
datasources:
1212
- name: vertamedia-clickhouse-datasource
1313
type: vertamedia-clickhouse-datasource
14+
{{- if .Values.clickhouse.enabled }}
1415
url: {{ include "client.fullname" . }}-clickhouse:8123
16+
{{- else }}
17+
url: {{ .Values.existingClickhouse.host }}:8123
1518
access: proxy
19+
{{- if not .Values.clickhouse.enabled }}
20+
basicAuth: true
21+
{{- if not .Values.existingClickhouse.secret }}
22+
basicAuthUser: {{ .Values.existingClickhouse.username }}
23+
{{- else }}
24+
basicAuthUser: $CLICKHOUSE_USERNAME
25+
{{- end }}
26+
secureJsonData:
27+
{{- if not .Values.existingClickhouse.secret }}
28+
basicAuthPassword: {{ .Values.existingClickhouse.password }}
29+
{{- else }}
30+
basicAuthPassword: $CLICKHOUSE_PASSWORD
31+
{{- end }}
32+
{{- end }}
33+
{{- end }}
1634
{{- end }}

charts/client/templates/deployment.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,35 @@ spec:
4040
- name: SCHEMA_PATH
4141
value : {{ .Values.migration.schema.path }}
4242
- name: DB_ADDRESS
43+
{{- if .Values.clickhouse.enabled }}
4344
value: {{ include "client.fullname" . }}-clickhouse
45+
{{- else }}
46+
value: {{ .Values.existingClickhouse.host }}
47+
- name: CLICKHOUSE_USERNAME
48+
{{- if not .Values.existingClickhouse.secret }}
49+
value: {{ .Values.existingClickhouse.username }}
50+
{{- else }}
51+
valueFrom:
52+
secretKeyRef:
53+
name: {{ .Values.existingClickhouse.secret.name }}
54+
key: {{ .Values.existingClickhouse.secret.usernamekey }}
55+
{{- end }}
56+
- name: CLICKHOUSE_PASSWORD
57+
{{- if not .Values.existingClickhouse.secret }}
58+
value: {{ .Values.existingClickhouse.password }}
59+
{{- else }}
60+
valueFrom:
61+
secretKeyRef:
62+
name: {{ .Values.existingClickhouse.secret.name }}
63+
key: {{ .Values.existingClickhouse.secret.passwordkey }}
64+
{{- end }}
65+
{{- end }}
4466
- name: DB_PORT
4567
value: "9000"
68+
- name: TTL_INTERVAL
69+
value: "{{ .Values.ttl.ttlInterval }}"
70+
- name: TTL_UNIT
71+
value: {{ .Values.ttl.ttlUnit }}
4672
containers:
4773
- name: {{ .Chart.Name }}
4874
securityContext:
@@ -74,9 +100,35 @@ spec:
74100
- name: NATS_ADDRESS
75101
value: {{ include "client.fullname" . }}-nats
76102
- name: DB_ADDRESS
103+
{{- if .Values.clickhouse.enabled }}
77104
value: {{ include "client.fullname" . }}-clickhouse
105+
{{- else }}
106+
value: {{ .Values.existingClickhouse.host }}
107+
- name: CLICKHOUSE_USERNAME
108+
{{- if not .Values.existingClickhouse.secret }}
109+
value: {{ .Values.existingClickhouse.username }}
110+
{{- else }}
111+
valueFrom:
112+
secretKeyRef:
113+
name: {{ .Values.existingClickhouse.secret.name }}
114+
key: {{ .Values.existingClickhouse.secret.usernamekey }}
115+
{{- end }}
116+
- name: CLICKHOUSE_PASSWORD
117+
{{- if not .Values.existingClickhouse.secret }}
118+
value: {{ .Values.existingClickhouse.password }}
119+
{{- else }}
120+
valueFrom:
121+
secretKeyRef:
122+
name: {{ .Values.existingClickhouse.secret.name }}
123+
key: {{ .Values.existingClickhouse.secret.passwordkey }}
124+
{{- end }}
125+
{{- end }}
78126
- name: DB_PORT
79127
value: "9000"
128+
- name: TTL_INTERVAL
129+
value: "{{ .Values.ttl.ttlInterval }}"
130+
- name: TTL_UNIT
131+
value: {{ .Values.ttl.ttlUnit }}
80132
resources:
81133
{{- toYaml .Values.resources | nindent 12 }}
82134
{{- with .Values.nodeSelector }}

charts/client/values.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,49 @@ clickhouse:
9898
clickhouse:
9999
replicas: "1"
100100

101+
existingClickhouse:
102+
host: clickhouse
103+
# Use username and password if you want to provide the token via Helm Values
104+
username: ""
105+
password: ""
106+
# Use a secret reference if you want to get a username and password from a secret
107+
secret: {}
108+
# name: ""
109+
# usernamekey: ""
110+
# passwordkey: ""
111+
101112
grafana:
102113
enabled: false
103114
plugins:
104115
- vertamedia-clickhouse-datasource
105116
- grafana-clickhouse-datasource
106117
- volkovlabs-echarts-panel
118+
sidecar:
119+
dashboards:
120+
provider:
121+
allowUiUpdates: true
122+
postgresql:
123+
enabled: false
124+
database:
125+
type: postgres
126+
host: kubviz-client-postgresql:5432
127+
name: postgres
128+
ssl_mode: disable
129+
user: postgres
130+
password: $__file{/etc/secrets/postgresql/postgres-password}
131+
secretMount:
132+
name: postgresql-mount
133+
mountPath: /etc/secrets/postgresql
134+
secretName: kubviz-client-postgresql
135+
readOnly: true
136+
clickhouse:
137+
enabled: false
138+
username: ""
139+
password: ""
140+
existingSecret: {}
141+
# name: ""
142+
# usernamekey: ""
143+
# passwordkey: ""
107144

108145
dashboards:
109146
enabled: true
@@ -124,3 +161,7 @@ migration:
124161
tag: "v1.1.3"
125162
schema:
126163
path: "/sql"
164+
165+
ttl:
166+
ttlInterval: "1"
167+
ttlUnit: MONTH

0 commit comments

Comments
 (0)