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-chart: make backend templates more uniform #7127

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions changelog.d/20231113_174833_roman_refactor_values.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Changed

- \[Helm\] All backend-related deployments now use `cvat-app` as the value
for the `app` label
(<https://github.com/opencv/cvat/pull/7127>)
24 changes: 13 additions & 11 deletions helm-chart/templates/cvat_backend/initializer/job.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- $localValues := .Values.cvat.backend.initializer -}}

apiVersion: batch/v1
kind: Job
metadata:
Expand All @@ -12,10 +14,10 @@ metadata:
tier: backend
component: initializer
{{- include "cvat.labels" . | nindent 4 }}
{{- with .Values.cvat.backend.initializer.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.cvat.backend.initializer.annotations }}
{{- with $localValues.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
Expand All @@ -27,42 +29,42 @@ spec:
tier: backend
component: initializer
{{- include "cvat.labels" . | nindent 8 }}
{{- with .Values.cvat.backend.initializer.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.initializer.annotations }}
{{- with $localValues.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: cvat-app-backend-initializer-container
- name: cvat-backend
image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }}
imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }}
{{- with .Values.cvat.backend.initializer.resources }}
{{- with $localValues.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
args: ["init"]
env:
{{ include "cvat.sharedBackendEnv" . | indent 10 }}
{{- with .Values.cvat.backend.initializer.additionalEnv }}
{{- with $localValues.additionalEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.cvat.backend.initializer.additionalVolumeMounts }}
{{- with $localValues.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 10 }}
{{- end }}
restartPolicy: OnFailure
{{- with .Values.cvat.backend.initializer.affinity }}
{{- with $localValues.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.initializer.tolerations }}
{{- with $localValues.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.initializer.additionalVolumes }}
{{- with $localValues.additionalVolumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down
42 changes: 22 additions & 20 deletions helm-chart/templates/cvat_backend/server/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- $localValues := .Values.cvat.backend.server -}}

apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -8,21 +10,21 @@ metadata:
tier: backend
component: server
{{- include "cvat.labels" . | nindent 4 }}
{{- with .Values.cvat.backend.server.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.cvat.backend.server.annotations }}
{{- with $localValues.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.cvat.backend.server.replicas }}
replicas: {{ $localValues.replicas }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cvat.labels" . | nindent 6 }}
{{- with .Values.cvat.backend.server.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 6 }}
{{- end }}
app: cvat-app
Expand All @@ -35,40 +37,40 @@ spec:
tier: backend
component: server
{{- include "cvat.labels" . | nindent 8 }}
{{- with .Values.cvat.backend.server.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.server.annotations }}
{{- with $localValues.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: cvat-app-backend-server-container
- name: cvat-backend
image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }}
imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }}
{{- with .Values.cvat.backend.server.resources }}
{{- with $localValues.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
args: ["run", "server"]
env:
- name: ALLOWED_HOSTS
value: {{ .Values.cvat.backend.server.envs.ALLOWED_HOSTS | squote}}
value: {{ $localValues.envs.ALLOWED_HOSTS | squote}}
- name: DJANGO_MODWSGI_EXTRA_ARGS
value: {{ .Values.cvat.backend.server.envs.DJANGO_MODWSGI_EXTRA_ARGS}}
value: {{ $localValues.envs.DJANGO_MODWSGI_EXTRA_ARGS}}
- name: IAM_OPA_BUNDLE
value: "1"
{{ include "cvat.sharedBackendEnv" . | indent 10 }}
{{- with .Values.cvat.backend.server.additionalEnv }}
{{- with $localValues.additionalEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
ports:
- containerPort: 8080
volumeMounts:
{{- if not .Values.cvat.backend.disableDistinctCachePerService }}
- mountPath: /home/django/data/cache
name: cvat-server-backend-cache
name: cvat-backend-per-service-cache
{{- end }}
- mountPath: /home/django/data
name: cvat-backend-data
Expand All @@ -82,23 +84,23 @@ spec:
- mountPath: /home/django/models
name: cvat-backend-data
subPath: models
{{- with .Values.cvat.backend.server.additionalVolumeMounts }}
{{- with $localValues.additionalVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
initContainers:
{{- if .Values.cvat.backend.permissionFix.enabled }}
- name: user-data-permission-fix
image: busybox
command: ["/bin/chmod", "-R", "777", "/home/django"]
{{- with .Values.cvat.backend.server.resources }}
{{- with $localValues.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if .Values.cvat.backend.defaultStorage.enabled }}
{{- if not .Values.cvat.backend.disableDistinctCachePerService }}
- mountPath: /home/django/data/cache
name: cvat-server-backend-cache
name: cvat-backend-per-service-cache
{{- end }}
- mountPath: /home/django/data
name: cvat-backend-data
Expand All @@ -113,15 +115,15 @@ spec:
name: cvat-backend-data
subPath: models
{{- end }}
{{- with .Values.cvat.backend.server.additionalVolumeMounts }}
{{- with $localValues.additionalVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- with .Values.cvat.backend.server.affinity }}
{{- with $localValues.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.server.tolerations }}
{{- with $localValues.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -131,11 +133,11 @@ spec:
persistentVolumeClaim:
claimName: "{{ .Release.Name }}-backend-data"
{{- if not .Values.cvat.backend.disableDistinctCachePerService }}
- name: cvat-server-backend-cache
- name: cvat-backend-per-service-cache
emptyDir: {}
{{- end }}
{{- end }}
{{- with .Values.cvat.backend.server.additionalVolumes }}
{{- with $localValues.additionalVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
Expand Down
49 changes: 25 additions & 24 deletions helm-chart/templates/cvat_backend/utils/deployment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- $localValues := .Values.cvat.backend.utils -}}

apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -8,62 +10,62 @@ metadata:
tier: backend
component: utils
{{- include "cvat.labels" . | nindent 4 }}
{{- with .Values.cvat.backend.utils.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.cvat.backend.utils.annotations }}
{{- with $localValues.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.cvat.backend.utils.replicas }}
replicas: {{ $localValues.replicas }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cvat.labels" . | nindent 6 }}
{{- with .Values.cvat.backend.utils.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 6 }}
{{- end }}
app: cvat-app-utils
app: cvat-app
tier: backend
component: utils
template:
metadata:
labels:
app: cvat-app-utils
app: cvat-app
tier: backend
component: utils
{{- include "cvat.labels" . | nindent 8 }}
{{- with .Values.cvat.backend.utils.labels }}
{{- with $localValues.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.utils.annotations }}
{{- with $localValues.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: cvat-app-backend-utils-container
- name: cvat-backend
image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }}
imagePullPolicy: {{ .Values.cvat.backend.imagePullPolicy }}
{{- with .Values.cvat.backend.utils.resources }}
{{- with $localValues.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
args: ["run", "utils"]
env:
{{ include "cvat.sharedBackendEnv" . | indent 10 }}
{{- with .Values.cvat.backend.utils.additionalEnv }}
{{- with $localValues.additionalEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
ports:
- containerPort: 8080
volumeMounts:
{{- if not .Values.cvat.backend.disableDistinctCachePerService }}
{{- if not .Values.cvat.backend.disableDistinctCachePerService }}
- mountPath: /home/django/data/cache
name: cvat-utils-backend-cache
{{- end }}
name: cvat-backend-per-service-cache
{{- end }}
- mountPath: /home/django/data
name: cvat-backend-data
subPath: data
Expand All @@ -76,24 +78,24 @@ spec:
- mountPath: /home/django/models
name: cvat-backend-data
subPath: models
{{- with .Values.cvat.backend.utils.additionalVolumeMounts }}
{{- with $localValues.additionalVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
initContainers:
{{- if .Values.cvat.backend.permissionFix.enabled }}
- name: user-data-permission-fix
image: busybox
command: ["/bin/chmod", "-R", "777", "/home/django"]
{{- with .Values.cvat.backend.utils.resources }}
{{- with $localValues.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if .Values.cvat.backend.defaultStorage.enabled }}
{{- if not .Values.cvat.backend.disableDistinctCachePerService }}
- mountPath: /home/django/data/cache
name: cvat-utils-backend-cache
{{- end }}
name: cvat-backend-per-service-cache
{{- end }}
- mountPath: /home/django/data
name: cvat-backend-data
subPath: data
Expand All @@ -107,15 +109,15 @@ spec:
name: cvat-backend-data
subPath: models
{{- end }}
{{- with .Values.cvat.backend.utils.additionalVolumeMounts }}
{{- with $localValues.additionalVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- with .Values.cvat.backend.utils.affinity }}
{{- with $localValues.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.utils.tolerations }}
{{- with $localValues.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -124,13 +126,12 @@ spec:
- name: cvat-backend-data
persistentVolumeClaim:
claimName: "{{ .Release.Name }}-backend-data"

{{- if not .Values.cvat.backend.disableDistinctCachePerService }}
- name: cvat-utils-backend-cache
- name: cvat-backend-per-service-cache
emptyDir: {}
{{- end }}
{{- end }}
{{- with .Values.cvat.backend.utils.additionalVolumes }}
{{- with $localValues.additionalVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
Expand Down
Loading
Loading