Plenty of fixes

- Adds replicaCount to api
- Allows disabling persistence
- Adds a working resolver to nginx front
- Collects statics for nginx front correctly
This commit is contained in:
Alexander Olofsson 2019-05-20 13:37:00 +02:00
parent 8de88b4368
commit 62645909da
No known key found for this signature in database
GPG key ID: D439C9470CB04C73
6 changed files with 33 additions and 2 deletions

View file

@ -39,6 +39,6 @@ data:
PROXY_MEDIA: {{ .Values.s3.proxy | quote }}
{{- end }}
{{- with .Values.extraEnv -}}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 2 }}
{{- end -}}

View file

@ -9,7 +9,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
audio.funkwhale/component: api
spec:
replicas: 1
replicas: {{ .Values.api.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "funkwhale.name" . }}
@ -42,14 +42,18 @@ spec:
readinessProbe:
tcpSocket:
port: api
{{- if or .Values.persistence.enabled .Values.api.extraVolumeMounts }}
volumeMounts:
{{- if .Values.persistence.enabled }}
- name: data
mountPath: /srv/funkwhale/data
{{- end }}
{{- range .Values.api.extraVolumeMounts }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
readOnly: {{ .readOnly }}
{{- end }}
{{- end }}
resources:
{{- toYaml .Values.api.resources | nindent 12 }}
{{- with .Values.api.nodeSelector }}
@ -64,12 +68,16 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if or .Values.persistence.enabled .Values.api.extraVolumeMounts }}
volumes:
{{- if .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}
{{- end }}
{{- range .Values.api.extraVolumeMounts }}
- name: {{ .name }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- end }}
{{- end }}

View file

@ -39,9 +39,11 @@ spec:
name: {{ include "funkwhale.fullname" . }}
- secretRef:
name: {{ include "funkwhale.fullname" . }}
{{- if .Values.persistence.enabled }}
volumeMounts:
- mountPath: /srv/funkwhale/data
name: data
{{- end }}
resources:
{{- toYaml .Values.celery.worker.resources | nindent 12 }}
{{- with .Values.celery.worker.nodeSelector }}
@ -57,9 +59,11 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
{{- if .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}
{{- end }}
- name: config
configMap:
name: {{ include "funkwhale.fullname" . }}-front

View file

@ -30,10 +30,15 @@ spec:
- sh
- -c
- |
set -x
cp -r frontend/* /frontend/
cp -r /usr/lib/python3.6/site-packages/django/contrib/admin/static/* /static/
cp -r /app/funkwhale_api/static/* /static/
volumeMounts:
- mountPath: /frontend
name: frontend
- mountPath: /static
name: static
resources:
limits:
cpu: 50m
@ -47,6 +52,7 @@ spec:
- -c
- |
envsubst "`env | awk -F = '{printf \" $%s\", $1}'`" < /etc/nginx/funkwhale.template > /etc/nginx/conf.d/default.conf
echo "resolver $(grep nameserver /etc/resolv.conf | head -n1 | awk '{print $2}');" > /etc/nginx/conf.d/resolver.conf
nginx -g 'daemon off;'
envFrom:
- configMapRef:
@ -64,8 +70,12 @@ spec:
volumeMounts:
- mountPath: /frontend
name: frontend
- mountPath: /srv/funkwhale/data/static/
name: static
{{- if .Values.persistence.enabled }}
- mountPath: /srv/funkwhale/data
name: data
{{- end }}
- mountPath: /etc/nginx/funkwhale_proxy.conf
name: config
subPath: proxy.conf
@ -89,9 +99,13 @@ spec:
volumes:
- name: frontend
emptyDir: {}
- name: static
emptyDir: {}
{{- if .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }}
{{- end }}
- name: config
configMap:
name: {{ include "funkwhale.fullname" . }}-front

View file

@ -1,3 +1,4 @@
{{- if .Values.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
@ -20,3 +21,4 @@ spec:
storageClassName: "{{ .Values.persistence.storageClass }}"
{{- end }}
{{- end }}
{{- end }}

View file

@ -71,6 +71,7 @@ extraSecret: {}
# DEFAULT_FROM_EMAIL: funkwhale@example.com
persistence:
enabled: false
size: 1Gi
storageClass: "-"
@ -86,6 +87,8 @@ s3:
# url: http://s3.example.com
api:
replicaCount: 1
# Additional mounts to add to the API pod
extraVolumeMounts: []
# - name: extra-music-data