62645909da
- Adds replicaCount to api - Allows disabling persistence - Adds a working resolver to nginx front - Collects statics for nginx front correctly
116 lines
3.9 KiB
YAML
116 lines
3.9 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "funkwhale.fullname" . }}-front
|
|
labels:
|
|
app.kubernetes.io/name: {{ include "funkwhale.name" . }}
|
|
helm.sh/chart: {{ include "funkwhale.chart" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
audio.funkwhale/component: front
|
|
spec:
|
|
replicas: {{ .Values.front.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: {{ include "funkwhale.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
audio.funkwhale/component: front
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: {{ include "funkwhale.name" . }}
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
audio.funkwhale/component: front
|
|
spec:
|
|
initContainers:
|
|
- name: front
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
command:
|
|
- 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
|
|
memory: 50Mi
|
|
containers:
|
|
- name: nginx
|
|
image: "{{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}"
|
|
imagePullPolicy: {{ .Values.front.image.pullPolicy }}
|
|
command:
|
|
- sh
|
|
- -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:
|
|
name: {{ include "funkwhale.fullname" . }}
|
|
ports:
|
|
- name: http
|
|
containerPort: 80
|
|
protocol: TCP
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: http
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: http
|
|
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
|
|
- mountPath: /etc/nginx/funkwhale.template
|
|
name: config
|
|
subPath: nginx.conf
|
|
resources:
|
|
{{- toYaml .Values.front.resources | nindent 12 }}
|
|
{{- with .Values.front.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.front.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.front.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
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
|
|
{{- range .Values.front.extraVolumeMounts }}
|
|
- name: {{ .name }}
|
|
persistentVolumeClaim:
|
|
claimName: {{ .existingClaim }}
|
|
{{- end }}
|