Updated documentation "How to use preexisting secrets for external DB and Redis" (#5505)

main
Andrey Zhavoronkov 3 years ago committed by GitHub
parent af65707eee
commit aeef8276c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -11,9 +11,9 @@ INSTALLED_APPS += [
] ]
NUCLIO['HOST'] = os.getenv('CVAT_NUCLIO_HOST', 'nuclio') NUCLIO['HOST'] = os.getenv('CVAT_NUCLIO_HOST', 'nuclio')
for key in RQ_QUEUES: for key in RQ_QUEUES:
RQ_QUEUES[key]['HOST'] = os.getenv('CVAT_REDIS_HOST', 'cvat_redis') RQ_QUEUES[key]['HOST'] = os.getenv('CVAT_REDIS_HOST', 'cvat_redis')
RQ_QUEUES[key]['PASSWORD'] = os.getenv('CVAT_REDIS_PASSWORD', '')
# Django-sendfile: # Django-sendfile:
# https://github.com/moggers87/django-sendfile2 # https://github.com/moggers87/django-sendfile2

@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes # 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. # to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/) # Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.4.5 version: 0.5.0
# This is the version number of the application being deployed. This version number should be # 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 # incremented each time you make changes to the application. Versions are not expected to
@ -26,12 +26,12 @@ appVersion: latest
dependencies: dependencies:
- name: redis - name: redis
version: "16.13.*" version: "17.3.*"
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
condition: redis.enabled condition: redis.enabled
- name: postgresql - name: postgresql
version: "10.16.*" version: "12.1.*"
repository: https://charts.bitnami.com/bitnami repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled condition: postgresql.enabled

@ -8,10 +8,9 @@ metadata:
{{- include "cvat.labels" . | nindent 4 }} {{- include "cvat.labels" . | nindent 4 }}
type: generic type: generic
stringData: stringData:
postgresql-hostname: "{{ .Release.Name }}-postgresql" database: {{ .Values.postgresql.auth.database }}
postgresql-database: {{ .Values.postgresql.postgresqlDatabase }} username: {{ .Values.postgresql.auth.username }}
postgresql-username: {{ .Values.postgresql.postgresqlUsername }} password: {{ .Values.postgresql.secret.password }}
postgresql-password: {{ .Values.postgresql.secret.password }} postgres-password: {{ .Values.postgresql.secret.postgres_password }}
postgresql-postgres-password: {{ .Values.postgresql.secret.postgres_password }} replication-password: {{ .Values.postgresql.secret.replication_password }}
postgresql-replication-password: {{ .Values.postgresql.secret.replication_password }}
{{- end }} {{- end }}

@ -0,0 +1,12 @@
{{- if .Values.redis.secret.create }}
apiVersion: v1
kind: Secret
metadata:
name: "{{ tpl (.Values.redis.secret.name) . }}"
namespace: {{ .Release.Namespace }}
labels:
{{- include "cvat.labels" . | nindent 4 }}
type: generic
stringData:
redis-password: {{ .Values.redis.secret.password }}
{{- end }}

@ -59,39 +59,37 @@ spec:
- name: CVAT_REDIS_HOST - name: CVAT_REDIS_HOST
value: "{{ .Values.redis.external.host }}" value: "{{ .Values.redis.external.host }}"
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} - name: CVAT_REDIS_PASSWORD
- name: CVAT_POSTGRES_HOST
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.redis.secret.name) . }}"
key: postgresql-hostname key: redis-password
{{- if .Values.postgresql.enabled }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Release.Name }}-postgresql"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.service.ports.postgresql }}"
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
- name: CVAT_POSTGRES_USER - name: CVAT_POSTGRES_USER
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-username key: username
- name: CVAT_POSTGRES_DBNAME - name: CVAT_POSTGRES_DBNAME
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-database key: database
- name: CVAT_POSTGRES_PASSWORD - name: CVAT_POSTGRES_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-password key: password
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_USER
value: "{{ .Values.postgresql.external.user }}"
- name: CVAT_POSTGRES_DBNAME
value: "{{ .Values.postgresql.external.dbname }}"
- name: CVAT_POSTGRES_PASSWORD
value: "{{ .Values.postgresql.external.password }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
{{- with .Values.cvat.backend.worker.webhooks.additionalEnv }} {{- with .Values.cvat.backend.worker.webhooks.additionalEnv }}
{{- toYaml . | nindent 10 }} {{- toYaml . | nindent 10 }}
{{- end }} {{- end }}

@ -89,39 +89,37 @@ spec:
- name: CVAT_REDIS_HOST - name: CVAT_REDIS_HOST
value: "{{ .Values.redis.external.host }}" value: "{{ .Values.redis.external.host }}"
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} - name: CVAT_REDIS_PASSWORD
- name: CVAT_POSTGRES_HOST
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.redis.secret.name) . }}"
key: postgresql-hostname key: redis-password
{{- if .Values.postgresql.enabled }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Release.Name }}-postgresql"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.service.ports.postgresql }}"
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
- name: CVAT_POSTGRES_USER - name: CVAT_POSTGRES_USER
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-username key: username
- name: CVAT_POSTGRES_DBNAME - name: CVAT_POSTGRES_DBNAME
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-database key: database
- name: CVAT_POSTGRES_PASSWORD - name: CVAT_POSTGRES_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-password key: password
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_USER
value: "{{ .Values.postgresql.external.user }}"
- name: CVAT_POSTGRES_DBNAME
value: "{{ .Values.postgresql.external.dbname }}"
- name: CVAT_POSTGRES_PASSWORD
value: "{{ .Values.postgresql.external.password }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
{{- if .Values.nuclio.enabled }} {{- if .Values.nuclio.enabled }}
- name: CVAT_SERVERLESS - name: CVAT_SERVERLESS
value: "1" value: "1"

@ -60,39 +60,37 @@ spec:
- name: CVAT_REDIS_HOST - name: CVAT_REDIS_HOST
value: "{{ .Values.redis.external.host }}" value: "{{ .Values.redis.external.host }}"
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} - name: CVAT_REDIS_PASSWORD
- name: CVAT_POSTGRES_HOST
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.redis.secret.name) . }}"
key: postgresql-hostname key: redis-password
{{- if .Values.postgresql.enabled }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Release.Name }}-postgresql"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.service.ports.postgresql }}"
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
- name: CVAT_POSTGRES_USER - name: CVAT_POSTGRES_USER
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-username key: username
- name: CVAT_POSTGRES_DBNAME - name: CVAT_POSTGRES_DBNAME
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-database key: database
- name: CVAT_POSTGRES_PASSWORD - name: CVAT_POSTGRES_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-password key: password
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_USER
value: "{{ .Values.postgresql.external.user }}"
- name: CVAT_POSTGRES_DBNAME
value: "{{ .Values.postgresql.external.dbname }}"
- name: CVAT_POSTGRES_PASSWORD
value: "{{ .Values.postgresql.external.password }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
{{- if .Values.nuclio }} {{- if .Values.nuclio }}
- name: CVAT_SERVERLESS - name: CVAT_SERVERLESS
value: "1" value: "1"

@ -59,39 +59,37 @@ spec:
- name: CVAT_REDIS_HOST - name: CVAT_REDIS_HOST
value: "{{ .Values.redis.external.host }}" value: "{{ .Values.redis.external.host }}"
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} - name: CVAT_REDIS_PASSWORD
- name: CVAT_POSTGRES_HOST
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.redis.secret.name) . }}"
key: postgresql-hostname key: redis-password
{{- if .Values.postgresql.enabled }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Release.Name }}-postgresql"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.service.ports.postgresql }}"
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
- name: CVAT_POSTGRES_USER - name: CVAT_POSTGRES_USER
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-username key: username
- name: CVAT_POSTGRES_DBNAME - name: CVAT_POSTGRES_DBNAME
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-database key: database
- name: CVAT_POSTGRES_PASSWORD - name: CVAT_POSTGRES_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-password key: password
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_USER
value: "{{ .Values.postgresql.external.user }}"
- name: CVAT_POSTGRES_DBNAME
value: "{{ .Values.postgresql.external.dbname }}"
- name: CVAT_POSTGRES_PASSWORD
value: "{{ .Values.postgresql.external.password }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
{{- if .Values.nuclio }} {{- if .Values.nuclio }}
- name: CVAT_SERVERLESS - name: CVAT_SERVERLESS
value: "1" value: "1"

@ -59,39 +59,37 @@ spec:
- name: CVAT_REDIS_HOST - name: CVAT_REDIS_HOST
value: "{{ .Values.redis.external.host }}" value: "{{ .Values.redis.external.host }}"
{{- end }} {{- end }}
{{- if .Values.postgresql.enabled }} - name: CVAT_REDIS_PASSWORD
- name: CVAT_POSTGRES_HOST
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.redis.secret.name) . }}"
key: postgresql-hostname key: redis-password
{{- if .Values.postgresql.enabled }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Release.Name }}-postgresql"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.service.ports.postgresql }}"
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
- name: CVAT_POSTGRES_USER - name: CVAT_POSTGRES_USER
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-username key: username
- name: CVAT_POSTGRES_DBNAME - name: CVAT_POSTGRES_DBNAME
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-database key: database
- name: CVAT_POSTGRES_PASSWORD - name: CVAT_POSTGRES_PASSWORD
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: "{{ tpl (.Values.postgresql.secret.name) . }}" name: "{{ tpl (.Values.postgresql.secret.name) . }}"
key: postgresql-password key: password
{{- else }}
- name: CVAT_POSTGRES_HOST
value: "{{ .Values.postgresql.external.host }}"
- name: CVAT_POSTGRES_USER
value: "{{ .Values.postgresql.external.user }}"
- name: CVAT_POSTGRES_DBNAME
value: "{{ .Values.postgresql.external.dbname }}"
- name: CVAT_POSTGRES_PASSWORD
value: "{{ .Values.postgresql.external.password }}"
- name: CVAT_POSTGRES_PORT
value: "{{ .Values.postgresql.external.port }}"
{{- end }}
{{- if .Values.nuclio }} {{- if .Values.nuclio }}
- name: CVAT_SERVERLESS - name: CVAT_SERVERLESS
value: "1" value: "1"

@ -185,23 +185,20 @@ postgresql:
external: external:
host: 127.0.0.1 host: 127.0.0.1
port: 5432 port: 5432
user: postgres
password: postgres
dbname: cvat
# If not external following config will be applied by default # If not external following config will be applied by default
global: auth:
postgresql: existingSecret: "{{ .Release.Name }}-postgres-secret"
existingSecret: "{{ .Release.Name }}-postgres-secret" username: cvat
database: cvat
service:
ports:
postgresql: 5432
secret: secret:
create: true create: true
name: "{{ .Release.Name }}-postgres-secret" name: "{{ .Release.Name }}-postgres-secret"
password: cvat_postgresql password: cvat_postgresql
postgres_password: cvat_postgresql_postgres postgres_password: cvat_postgresql_postgres
replication_password: cvat_postgresql_replica replication_password: cvat_postgresql_replica
postgresqlDatabase: cvat
postgresqlUsername: cvat
service:
port: 5432
redis: redis:
#See https://github.com/bitnami/charts/blob/master/bitnami/redis/ for more info #See https://github.com/bitnami/charts/blob/master/bitnami/redis/ for more info
@ -209,7 +206,11 @@ redis:
external: external:
host: 127.0.0.1 host: 127.0.0.1
auth: auth:
enabled: false existingSecret: "{{ .Release.Name }}-redis-secret"
secret:
create: true
name: "{{ .Release.Name }}-redis-secret"
password: cvat_redis
cluster: cluster:
enabled: false enabled: false

@ -226,9 +226,85 @@ See <https://helm.sh/>
``` ```
### How to understand what diff will be inflicted by 'helm upgrade'? ### How to understand what diff will be inflicted by 'helm upgrade'?
You can use <https://github.com/databus23/helm-diff#install> for that You can use <https://github.com/databus23/helm-diff#install> for that
### I want to use my own postgresql/redis with your chart. ### I want to use my own postgresql with your chart.
Just set `postgresql.enabled` or `redis.enabled` to `false`, as described below. Just set `postgresql.enabled` to `false` in the override file, then put the parameters of your database
Then - put your instance params to "external" field instance in the `external` field.
You may also need to configure `username`, `database` and `password` fields
to connect to your own database:
```yml
postgresql:
enabled: false
external:
host: postgresql.default.svc.cluster.local
port: 5432
auth:
username: cvat
database: cvat
secret:
password: cvat_postgresql
```
In example above corresponding secret will be created automatically, but if you want to use existing secret change `secret.create` to `false` and set `name` of existing secret:
```yml
postgresql:
enabled: false
external:
host: postgresql.default.svc.cluster.local
port: 5432
secret:
create: false
name: "my-postgresql-secret"
```
The secret must contain the `database`, `username` and `password`
keys to access to the database
like:
```yml
apiVersion: v1
kind: Secret
metadata:
name: "my-postgresql-secret"
namespace: default
type: generic
stringData:
database: cvat
username: cvat
password: secretpassword
```
### I want to use my own redis with your chart.
Just set `redis.enabled` to `false` in the override file, then put the parameters of your Redis
instance in the `external` field.
You may also need to configure `password` field to connect to your own Redis:
```yml
redis:
enabled: false
external:
host: redis.hostname.local
secret:
password: cvat_redis
```
In the above example the corresponding secret will be created automatically, but if you want to use an existing secret
change `secret.create` to `false` and set `name` of the existing secret:
```yml
redis:
enabled: false
external:
host: redis.hostname.local
secret:
create: false
name: "my-redis-secret"
```
The secret must contain the `redis-password` key like:
```yml
apiVersion: v1
kind: Secret
metadata:
name: "my-redis-secret"
namespace: default
type: generic
stringData:
redis-password: secretpassword
```
### I want to override some settings in values.yaml. ### I want to override some settings in values.yaml.
Just create file `values.override.yaml` and place your changes here, using same structure as in `values.yaml`. Just create file `values.override.yaml` and place your changes here, using same structure as in `values.yaml`.
Then reference it in helm update/install command using `-f` flag Then reference it in helm update/install command using `-f` flag

@ -30,7 +30,7 @@ numprocs=1
[program:rqscheduler] [program:rqscheduler]
command=%(ENV_HOME)s/wait-for-it.sh %(ENV_CVAT_REDIS_HOST)s:6379 -t 0 -- bash -ic \ command=%(ENV_HOME)s/wait-for-it.sh %(ENV_CVAT_REDIS_HOST)s:6379 -t 0 -- bash -ic \
"python3 /opt/venv/bin/rqscheduler --host %(ENV_CVAT_REDIS_HOST)s -i 30" "python3 /opt/venv/bin/rqscheduler --host %(ENV_CVAT_REDIS_HOST)s --password %(ENV_CVAT_REDIS_PASSWORD)s -i 30"
environment=SSH_AUTH_SOCK="/tmp/ssh-agent.sock" environment=SSH_AUTH_SOCK="/tmp/ssh-agent.sock"
numprocs=1 numprocs=1

Loading…
Cancel
Save