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 }} PROXY_MEDIA: {{ .Values.s3.proxy | quote }}
{{- end }} {{- end }}
{{- with .Values.extraEnv -}} {{- with .Values.extraEnv }}
{{- toYaml . | nindent 2 }} {{- toYaml . | nindent 2 }}
{{- end -}} {{- end -}}

View file

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

View file

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

View file

@ -30,10 +30,15 @@ spec:
- sh - sh
- -c - -c
- | - |
set -x
cp -r frontend/* /frontend/ 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: volumeMounts:
- mountPath: /frontend - mountPath: /frontend
name: frontend name: frontend
- mountPath: /static
name: static
resources: resources:
limits: limits:
cpu: 50m cpu: 50m
@ -47,6 +52,7 @@ spec:
- -c - -c
- | - |
envsubst "`env | awk -F = '{printf \" $%s\", $1}'`" < /etc/nginx/funkwhale.template > /etc/nginx/conf.d/default.conf 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;' nginx -g 'daemon off;'
envFrom: envFrom:
- configMapRef: - configMapRef:
@ -64,8 +70,12 @@ spec:
volumeMounts: volumeMounts:
- mountPath: /frontend - mountPath: /frontend
name: frontend name: frontend
- mountPath: /srv/funkwhale/data/static/
name: static
{{- if .Values.persistence.enabled }}
- mountPath: /srv/funkwhale/data - mountPath: /srv/funkwhale/data
name: data name: data
{{- end }}
- mountPath: /etc/nginx/funkwhale_proxy.conf - mountPath: /etc/nginx/funkwhale_proxy.conf
name: config name: config
subPath: proxy.conf subPath: proxy.conf
@ -89,9 +99,13 @@ spec:
volumes: volumes:
- name: frontend - name: frontend
emptyDir: {} emptyDir: {}
- name: static
emptyDir: {}
{{- if .Values.persistence.enabled }}
- name: data - name: data
persistentVolumeClaim: persistentVolumeClaim:
claimName: {{ include "funkwhale.fullname" . }} claimName: {{ include "funkwhale.fullname" . }}
{{- end }}
- name: config - name: config
configMap: configMap:
name: {{ include "funkwhale.fullname" . }}-front name: {{ include "funkwhale.fullname" . }}-front

View file

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

View file

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