Skip to content

Commit

Permalink
Fix Nuclio function invocations when deployed via the Helm chart (#5917)
Browse files Browse the repository at this point in the history
The `CVAT_NUCLIO_FUNCTION_NAMESPACE` needs to be defined consistently in
order for Nuclio integration to work. Currently, it's set to `cvat` for
the main CVAT server process, but not for any other CVAT process (which
means it defaults to `nuclio` in those processes). Since it's the
annotation worker process that actually invokes the Nuclio functions,
the invocation fails.

Fix it by synchronizing the Nuclio environment variables across all
backend deployments. Technically, I think only the server and annotation
worker deployments need these variables, but since they're accessed by
`cvat/settings/base.py` in every process that loads Django, define them
everywhere to be sure.

Fixes #5626.
  • Loading branch information
SpecLad committed Mar 24, 2023
1 parent 960b4c0 commit 7b7b5b4
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 33 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Empty list of export formats for a project without tasks (<https://github.com/opencv/cvat/pull/5899>)
- Downgrade NumPy used by HRNet because `np.int` is no longer available (<https://github.com/opencv/cvat/pull/5574>)
- Make empty previews responsive to page resize <https://github.com/opencv/cvat/pull/5925>
- Nuclio function invocations when deployed via the Helm chart
(<https://github.com/opencv/cvat/issues/5626>)

### Security
- TDB
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/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: 0.7.1
version: 0.7.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
11 changes: 11 additions & 0 deletions helm-chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{- define "cvat.nuclioEnv" }}
{{- if .Values.nuclio.enabled }}
- name: CVAT_SERVERLESS
value: "1"
- name: CVAT_NUCLIO_HOST
value: "{{ .Release.Name }}-nuclio-dashboard"
- name: CVAT_NUCLIO_FUNCTION_NAMESPACE
value: "{{ .Release.Namespace }}"
{{- end }}
{{- end }}
9 changes: 1 addition & 8 deletions helm-chart/templates/cvat_backend/server/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,7 @@ spec:
secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: password
{{- if .Values.nuclio.enabled }}
- name: CVAT_SERVERLESS
value: "1"
- name: CVAT_NUCLIO_HOST
value: "{{ .Release.Name }}-nuclio-dashboard"
- name: CVAT_NUCLIO_FUNCTION_NAMESPACE
value: "{{ .Release.Namespace }}"
{{- end }}
{{ include "cvat.nuclioEnv" . | indent 10 }}
{{- if .Values.analytics.enabled}}
- name: CVAT_ANALYTICS
value: "1"
Expand Down
7 changes: 1 addition & 6 deletions helm-chart/templates/cvat_backend/utils/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ spec:
secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: password
{{- if .Values.nuclio }}
- name: CVAT_SERVERLESS
value: "1"
- name: CVAT_NUCLIO_HOST
value: "{{ .Release.Name }}-nuclio-dashboard"
{{- end }}
{{ include "cvat.nuclioEnv" . | indent 10 }}
{{- if .Values.analytics.enabled}}
- name: CVAT_ANALYTICS
value: "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ spec:
secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: password
{{- if .Values.nuclio }}
- name: CVAT_SERVERLESS
value: "1"
- name: CVAT_NUCLIO_HOST
value: "{{ .Release.Name }}-nuclio-dashboard"
{{- end }}
{{ include "cvat.nuclioEnv" . | indent 10 }}
{{- if .Values.analytics.enabled}}
- name: CVAT_ANALYTICS
value: "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ spec:
secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: password
{{- if .Values.nuclio }}
- name: CVAT_SERVERLESS
value: "1"
- name: CVAT_NUCLIO_HOST
value: "{{ .Release.Name }}-nuclio-dashboard"
{{- end }}
{{ include "cvat.nuclioEnv" . | indent 10 }}
{{- if .Values.analytics.enabled}}
- name: CVAT_ANALYTICS
value: "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@ spec:
secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: password
{{- if .Values.nuclio }}
- name: CVAT_SERVERLESS
value: "1"
- name: CVAT_NUCLIO_HOST
value: "{{ .Release.Name }}-nuclio-dashboard"
{{- end }}
{{ include "cvat.nuclioEnv" . | indent 10 }}
{{- if .Values.analytics.enabled}}
- name: CVAT_ANALYTICS
value: "1"
Expand Down

0 comments on commit 7b7b5b4

Please sign in to comment.