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

[Helm] Update configuration to allow use of an external clickhouse instance #8048

Merged
merged 5 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" }}
SpecLad marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.analytics.enabled}}
Copy link
Contributor

Choose a reason for hiding this comment

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

So how do you actually switch to an external instance? In Chart.yml, the Clickhouse subchart is enabled if analytics.enabled is true, so there's no way to disable the internal instance without disabling analytics altogether.

- 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
Loading