Skip to content

Commit

Permalink
Updated helm configuration to allow use of an external clickhouse ins…
Browse files Browse the repository at this point in the history
…tance
  • Loading branch information
azhavoro committed Jun 19, 2024
1 parent ca2f232 commit 1af98b3
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/analytics/vector/vector.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ table = "events"
auth.strategy = "basic"
auth.user = "${CLICKHOUSE_USER}"
auth.password = "${CLICKHOUSE_PASSWORD}"
endpoint = "http://${CLICKHOUSE_HOST}:8123"
endpoint = "http://${CLICKHOUSE_HOST}:${CLICKHOUSE_PORT}"
request.concurrency = "adaptive"
encoding.only_fields = [
"scope",
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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: 0.13.1
version: 0.13.2

# 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 Down
32 changes: 30 additions & 2 deletions helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ The name of the service account to use for backend pods
value: "{{ .Release.Name }}-vector"
- name: DJANGO_LOG_SERVER_PORT
value: "80"
- name: CLICKHOUSE_HOST
value: "{{ .Release.Name }}-clickhouse"
{{- end }}

- name: SMOKESCREEN_OPTS
Expand All @@ -141,3 +139,33 @@ The name of the service account to use for backend pods
value: "{{ .Release.Namespace }}"
{{- end }}
{{- end }}

{{- define "cvat.sharedClickhouseEnv" }}
{{- if .Values.analytics.enabled}}
- name: CLICKHOUSE_HOST
valueFrom:
secretKeyRef:
name: cvat-analytics-secret
key: CLICKHOUSE_HOST
- name: CLICKHOUSE_PORT
valueFrom:
secretKeyRef:
name: cvat-analytics-secret
key: CLICKHOUSE_PORT
- name: CLICKHOUSE_DB
valueFrom:
secretKeyRef:
name: cvat-analytics-secret
key: CLICKHOUSE_DB
- name: CLICKHOUSE_USER
valueFrom:
secretKeyRef:
name: cvat-analytics-secret
key: CLICKHOUSE_USER
- name: CLICKHOUSE_PASSWORD
valueFrom:
secretKeyRef:
name: cvat-analytics-secret
key: CLICKHOUSE_PASSWORD
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions helm-chart/templates/analytics/cvat-analytics-secret.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ stringData:
CLICKHOUSE_USER: {{ .Values.analytics.clickhouseUser }}
CLICKHOUSE_PASSWORD: {{ .Values.analytics.clickhousePassword }}
CLICKHOUSE_HOST: {{ tpl (.Values.analytics.clickhouseHost) . }}
CLICKHOUSE_PORT: {{ .Values.analytics.clickhousePort | quote }}
{{- end }}
1 change: 1 addition & 0 deletions helm-chart/templates/cvat_backend/server/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ spec:
- name: ALLOWED_HOSTS
value: {{ $localValues.envs.ALLOWED_HOSTS | squote}}
{{ include "cvat.sharedBackendEnv" . | indent 10 }}
{{ include "cvat.sharedClickhouseEnv" . | indent 10 }}
{{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
args: ["run", "worker.analytics_reports"]
env:
{{ include "cvat.sharedBackendEnv" . | indent 10 }}
{{ include "cvat.sharedClickhouseEnv" . | indent 10 }}
{{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
args: ["run", "worker.export"]
env:
{{ include "cvat.sharedBackendEnv" . | indent 10 }}
{{ include "cvat.sharedClickhouseEnv" . | indent 10 }}
{{- with concat .Values.cvat.backend.additionalEnv $localValues.additionalEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
Expand Down
13 changes: 8 additions & 5 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ analytics:
clickhouseUser: user
clickhousePassword: user
clickhouseHost: "{{ .Release.Name }}-clickhouse"
clickhousePort: 8123

vector:
envFrom:
Expand Down Expand Up @@ -360,6 +361,7 @@ clickhouse:
enabled: false

grafana:
envFromSecret: cvat-analytics-secret
datasources:
datasources.yaml:
apiVersion: 1
Expand All @@ -368,13 +370,14 @@ grafana:
type: 'grafana-clickhouse-datasource'
isDefault: true
jsonData:
defaultDatabase: cvat
port: 9000
server: "{{ .Release.Name }}-clickhouse"
username: user
defaultDatabase: ${CLICKHOUSE_DB}
port: ${CLICKHOUSE_PORT}
server: ${CLICKHOUSE_HOST}
username: ${CLICKHOUSE_USER}
tlsSkipVerify: false
protocol: http
secureJsonData:
password: user
password: ${CLICKHOUSE_PASSWORD}
editable: false
dashboardProviders:
dashboardproviders.yaml:
Expand Down

0 comments on commit 1af98b3

Please sign in to comment.