Skip to content

Commit

Permalink
Add cvat helm chart proto
Browse files Browse the repository at this point in the history
  • Loading branch information
Keramblock committed Apr 19, 2021
1 parent 4048bd0 commit 9d3c95a
Show file tree
Hide file tree
Showing 23 changed files with 327 additions and 496 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,8 @@ yarn-error.log*
/tests/cypress/fixtures
/tests/cypress/screenshots
.idea/

#Ignore helm-related files
/helm-chart/Chart.lock
/helm-chart/values.override.yaml
/helm-chart/charts/*
File renamed without changes.
10 changes: 10 additions & 0 deletions kubernetes-templates/cvat/Chart.yaml → helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ version: 0.1.0
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"

dependencies:
- name: redis
version: "12.9.*"
repository: https://charts.bitnami.com/bitnami
condition: redis.enabled
- name: postgresql
version: "10.3.*"
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
File renamed without changes.
17 changes: 17 additions & 0 deletions helm-chart/templates/cvat-postgres-secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.postgresql.secret.create }}
apiVersion: v1
kind: Secret
metadata:
name: "{{ .Release.Name }}-{{ .Values.postgresql.secret.name }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
type: generic
stringData:
postgresql-hostname: "{{ .Release.Name }}-postgresql"
postgresql-database: {{ .Values.postgresql.postgresqlDatabase }}
postgresql-username: {{ .Values.postgresql.postgresqlUsername }}
postgresql-password: {{ .Values.postgresql.secret.password }}
postgresql-postgres-password: {{ .Values.postgresql.secret.postgres_password }}
postgresql-replication-password: {{ .Values.postgresql.secret.replication_password }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,61 +4,74 @@ metadata:
name: {{ .Release.Name }}-backend
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
app: cvat-app
tier: backend
spec:
replicas: 1
replicas: {{ .Values.cvat.backend.replicas }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cvat.labels" . | nindent 6 }}
app: cvat-app
tier: backend
template:
metadata:
labels:
app: cvat-app
tier: backend
{{- include "cvat.labels" . | nindent 8 }}
{{- with .Values.cvat.backend.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: cvat-backend-app-container
image: openvino/cvat_server:v1.2.0
imagePullPolicy: Always
image: {{ .Values.cvat.backend.image }}:{{ .Values.cvat.backend.tag }}
{{- with .Values.cvat.backend.resources }}
resources:
requests:
cpu: 10m
memory: 100Mi
{{- toYaml . | nindent 12 }}
{{- end }}
env:
- name: DJANGO_MODWSGI_EXTRA_ARGS
value: ""
- name: UI_PORT
value: "80"
- name: UI_HOST
value: "cvat-frontend-service"
value: "{{ .Release.Name }}-frontend-service"
- name: ALLOWED_HOSTS
value: "*"
{{- if .Values.redis.enabled }}
- name: CVAT_REDIS_HOST
value: "cvat-redis-service"
value: "{{ .Release.Name }}-redis-master"
{{- end }}
{{- if .Values.redis.enabled }}
- name: CVAT_POSTGRES_HOST
value: "cvat-postgres-service"
valueFrom:
secretKeyRef:
name: "{{ .Release.Name }}-{{ .Values.postgresql.secret.name }}"
key: postgresql-hostname
- name: CVAT_POSTGRES_USER
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_USER
name: "{{ .Release.Name }}-{{ .Values.postgresql.secret.name }}"
key: postgresql-username
- name: CVAT_POSTGRES_DBNAME
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_DB
name: "{{ .Release.Name }}-{{ .Values.postgresql.secret.name }}"
key: postgresql-database
- name: CVAT_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: cvat-postgres-secret
key: POSTGRES_PASSWORD
name: "{{ .Release.Name }}-{{ .Values.postgresql.secret.name }}"
key: postgresql-password
{{- with .Values.cvat.backend.additionalEnv }}
{{- toYaml . | nindent 10 }}
{{- end }}
ports:
- containerPort: 8080
Expand All @@ -75,10 +88,17 @@ spec:
- mountPath: /home/django/models
name: cvat-backend-data
subPath: models
{{- with .Values.cvat.backend.additionalVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
initContainers:
- name: user-data-permission-fix
image: busybox
command: ["/bin/chmod", "-R", "777", "/home/django"]
{{- with .Values.cvat.backend.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- mountPath: /home/django/data
name: cvat-backend-data
Expand All @@ -92,10 +112,20 @@ spec:
- mountPath: /home/django/models
name: cvat-backend-data
subPath: models
{{- with .Values.cvat.backend.additionalVolumeMounts }}
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.cvat.frontend.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: cvat-backend-data
persistentVolumeClaim:
claimName: cvat-backend-data
claimName: "{{ .Release.Name }}-backend-data"
{{- with .Values.cvat.backend.additionalVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{{- if .Values.database.enabled -}}
{{- if .Values.postgresql.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: cvat-backend-service
name: {{ .Release.Name }}-backend-service
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
app: cvat-app
tier: backend
spec:
type: ClusterIP
selector:
{{- include "cvat.labels" . | nindent 6 }}
app: cvat-app
tier: backend
ports:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cvat-backend-data
name: {{ .Release.Name }}-backend-data
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
app: cvat-app
tier: backend
spec:
accessModes:
- ReadWriteOnce
Expand Down
61 changes: 61 additions & 0 deletions helm-chart/templates/cvat_frontend/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-frontend
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
app: cvat-app
tier: frontend
spec:
replicas: {{ .Values.cvat.frontend.replicas }}
strategy:
type: Recreate
selector:
matchLabels:
{{- include "cvat.labels" . | nindent 6 }}
app: cvat-app
tier: frontend
template:
metadata:
labels:
{{- include "cvat.labels" . | nindent 8 }}
app: cvat-app
tier: frontend
{{- with .Values.cvat.backend.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.backend.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: cvat-frontend-app-container
image: {{ .Values.cvat.frontend.image }}:{{ .Values.cvat.frontend.tag }}
{{- with .Values.cvat.frontend.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- containerPort: 80
{{- with .Values.cvat.frontend.additionalEnv }}
env:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.cvat.frontend.additionalVolumeMounts }}
volumeMounts:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.cvat.frontend.additionalVolumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.cvat.frontend.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: cvat-frontend-service
name: {{ .Release.Name }}-frontend-service
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
app: cvat-app
tier: frontend
spec:
type: ClusterIP
selector:
{{- include "cvat.labels" . | nindent 6 }}
app: cvat-app
tier: frontend
ports:
Expand Down
41 changes: 41 additions & 0 deletions helm-chart/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "cvat.fullname" . -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .match }}
backend:
serviceName: {{ .service.name }}
servicePort: {{ .service.port }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit 9d3c95a

Please sign in to comment.