Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Commit

Permalink
zalando PGO integration
Browse files Browse the repository at this point in the history
  • Loading branch information
kervel committed Nov 20, 2021
1 parent a0fd3d2 commit 7c4c3bf
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 13 deletions.
2 changes: 1 addition & 1 deletion charts/cvat-helm/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.1.4
version: 0.1.5

# 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
4 changes: 4 additions & 0 deletions charts/cvat-helm/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Simple helm chart for CVAT

Features:
* creates a superuser and store it in a secret for integration with other kubernetes resources
* optionally uses zalando's postgres operator (see [here](zalando-pgo.md))


# Values

Expand Down
22 changes: 22 additions & 0 deletions charts/cvat-helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{ define "cvat-helm.postgres-env" }}
{{ if .Values.database.create }}
- name: CVAT_POSTGRES_HOST
value: 'cvat-db'
{{ end }}
{{ if .Values.database.zalando.enable }}
- name: CVAT_POSTGRES_HOST
value: {{ .Values.database.zalando.databaseCluster }}
- name: CVAT_POSTGRES_DBNAME
value: {{ .Values.database.zalando.databaseName }}
- name: CVAT_POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.database.zalando.databaseUser }}.{{ .Values.database.zalando.databaseCluster }}.credentials.postgresql.acid.zalan.do
key: username
- name: CVAT_POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.database.zalando.databaseUser }}.{{ .Values.database.zalando.databaseCluster }}.credentials.postgresql.acid.zalan.do
key: password
{{ end }}
{{ end }}
3 changes: 1 addition & 2 deletions charts/cvat-helm/templates/cvat-init-create-users.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ spec:
- name: cvat
image: openvino/cvat_server:v{{ .Chart.AppVersion }}
env:
{{ template "cvat-helm.postgres-env" . }}
- name: "CVAT_REDIS_HOST"
value: 'cvat-redis'
- name: CVAT_POSTGRES_HOST
value: 'cvat-db'
- name: GENERATED_USERNAME
valueFrom:
secretKeyRef:
Expand Down
23 changes: 17 additions & 6 deletions charts/cvat-helm/templates/cvat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ spec:
- name: cvat
image: openvino/cvat_server:v{{ .Chart.AppVersion }}
env:
{{ template "cvat-helm.postgres-env" . }}
- name: "DJANGO_MODWSGI_EXTRA_ARGS"
value: ''
- name: "ALLOWED_HOSTS"
value: '*'
- name: "CVAT_REDIS_HOST"
value: 'cvat-redis'
- name: CVAT_POSTGRES_HOST
value: 'cvat-db'
- name: ADAPTIVE_AUTO_ANNOTATION
value: 'false'
- name: CVAT_SHARE_URL
Expand Down Expand Up @@ -80,42 +79,54 @@ spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
{{ if .Values.volume.data.storageClassName }}
storageClassName: {{ .Values.volume.data.storageClassName }}
{{ end }}
resources:
requests:
storage: 6Gi
storage: {{ .Values.volume.data.size }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cvat-keys
spec:
{{ if .Values.volume.keys.storageClassName }}
storageClassName: {{ .Values.volume.keys.storageClassName }}
{{ end }}
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 1Gi
storage: {{ .Values.volume.keys.size }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cvat-logs
spec:
{{ if .Values.volume.logs.storageClassName }}
storageClassName: {{ .Values.volume.logs.storageClassName }}
{{ end }}
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 1Gi
storage: {{ .Values.volume.logs.size }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: cvat-share
spec:
{{ if .Values.volume.share.storageClassName }}
storageClassName: {{ .Values.volume.share.storageClassName }}
{{ end }}
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 4Gi
storage: {{ .Values.volume.share.size }}
11 changes: 7 additions & 4 deletions charts/cvat-helm/templates/postgres.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{ if .Values.database.create }}
apiVersion: apps/v1
kind: StatefulSet
metadata:
Expand All @@ -23,7 +24,7 @@ spec:
- mountPath: "/var/lib/postgresql/data"
name: cvat-db
env:
{{ if .Values.volume.createSubdir }}
{{ if .Values.database.createSubdir }}
- name: PGDATA
value: /var/lib/postgresql/data/db-files/
{{ end }}
Expand Down Expand Up @@ -58,12 +59,14 @@ kind: PersistentVolumeClaim
metadata:
name: cvat-db
spec:
{{ if .Values.volume.storageClassName }}
storageClassName: {{ .Values.volume.storageClassName }}
{{ if .Values.database.storageClassName }}
storageClassName: {{ .Values.database.storageClassName }}
{{ end }}
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: {{ .Values.volume.size }}
storage: {{ .Values.database.size }}

{{ end }}
25 changes: 25 additions & 0 deletions charts/cvat-helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,32 @@ ingress:
clusterIssuer: selfsigned-ca-issuer

volume:
data:
size: 6Gi
#storageClassName: gp2
keys:
size: 1Gi
#storageClassName: gp2
logs:
size: 1Gi
#storageClassName: gp2
share:
size: 4Gi
#storageClassName: gp2

database:
create: true
# when using a block type volume you must mount postgres data in a subdir otherwise postgres will fail to start.
# set this to false for upgrades from old release of this chart
createSubdir: true
# storageClassName: gp2

size: 2Gi
# for zalando integration set create to false
zalando:
# integrate with zalando postgres operator
enable: false
databaseUser: cvat
databaseCluster: cvat-db
databaseName: cvat

42 changes: 42 additions & 0 deletions charts/cvat-helm/zalando-pgo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Integrating with zalando postgres operator

First install zalando's postgres operator.
Then, create a database cluster with a database for cvat (maybe others) and a user for cvat (maybe others).
Example configuration:

```yaml
apiVersion: "acid.zalan.do/v1"
kind: postgresql
metadata:
name: cvat-db
spec:
teamId: "cvat"
volume:
size: 10Gi
numberOfInstances: 2
users:
cvatuser:
- superuser
- createdb
databases:
cvat: cvatuser
postgresql:
version: "14"
parameters:
shared_buffers: "32MB"
max_connections: "40"
```
Then, install this helm chart with the following values:
```yaml
database:
create: false
zalando:
enable: true
databaseUser: cvatuser
databaseName: cvat
databaseCluster: cvat-db
```
The password will be extracted from the secret created by zalando PGO.

0 comments on commit 7c4c3bf

Please sign in to comment.