diff --git a/charts/funkwhale/charts/redis-7.1.1.tgz b/charts/funkwhale/charts/redis-7.1.1.tgz new file mode 100644 index 0000000..2efbd47 Binary files /dev/null and b/charts/funkwhale/charts/redis-7.1.1.tgz differ diff --git a/charts/funkwhale/requirements.lock b/charts/funkwhale/requirements.lock new file mode 100644 index 0000000..0181fb2 --- /dev/null +++ b/charts/funkwhale/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: redis + repository: https://kubernetes-charts.storage.googleapis.com/ + version: 7.1.1 +digest: sha256:5a2449433325c0e819134bdcd7bd7ab463975b9b529c8516a9ff030547140bf6 +generated: 2019-05-18T10:14:13.270735156+02:00 diff --git a/charts/funkwhale/requirements.yaml b/charts/funkwhale/requirements.yaml new file mode 100644 index 0000000..62f4546 --- /dev/null +++ b/charts/funkwhale/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: redis + version: 7.1.1 + repository: https://kubernetes-charts.storage.googleapis.com/ diff --git a/charts/funkwhale/templates/_helpers.tpl b/charts/funkwhale/templates/_helpers.tpl index 42b080b..823c721 100644 --- a/charts/funkwhale/templates/_helpers.tpl +++ b/charts/funkwhale/templates/_helpers.tpl @@ -6,6 +6,14 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "funkwhale.dbUrl" -}} +postgres://{{ .Values.database.user}}:{{ .Values.database.password }}@{{ .Values.database.host }}:{{ .Values.database.port }}/{{ .Values.database.database }} +{{- end -}} + +{{- define "funkwhale.redisUrl" -}} +redis://:{{ .Values.redis.password }}@{{ template "funkwhale.fullname" . }}-redis-master:{{ .Values.redis.redisPort }}/0 +{{- end -}} + {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). diff --git a/charts/funkwhale/templates/configmap-front.yaml b/charts/funkwhale/templates/configmap-front.yaml index 4124b66..b092d47 100644 --- a/charts/funkwhale/templates/configmap-front.yaml +++ b/charts/funkwhale/templates/configmap-front.yaml @@ -11,7 +11,7 @@ metadata: data: nginx.conf: | upstream funkwhale-api { - server {{ include "funkwhale.fullname" . }}-api.{{ .Release.Namespace }}.svc:5000; + server {{ include "funkwhale.fullname" . }}-api:5000; } map $http_upgrade $connection_upgrade { diff --git a/charts/funkwhale/templates/configmap.yaml b/charts/funkwhale/templates/configmap.yaml index 1b9e7ca..b0f5660 100644 --- a/charts/funkwhale/templates/configmap.yaml +++ b/charts/funkwhale/templates/configmap.yaml @@ -8,35 +8,37 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} data: - DJANGO_SETTINGS_MODULE: config.settings.production FUNKWHALE_API_IP: 0.0.0.0 FUNKWHALE_API_PORT: "5000" - FUNKWHALE_FRONTEND_PATH: /srv/funkwhale/front/dist - MEDIA_ROOT: /srv/funkwhale/data/media - NGINX_MAX_BODY_SIZE: 30M - REVERSE_PROXY_TYPE: nginx - STATIC_ROOT: /srv/funkwhale/data/static - - DJANGO_ALLOWED_HOSTS: {{ .Values.ingress.host }} FUNKWHALE_HOSTNAME: {{ .Values.ingress.host }} FUNKWHALE_PROTOCOL: {{ .Values.ingress.protocol }} + REVERSE_PROXY_TYPE: nginx + MEDIA_ROOT: /srv/funkwhale/data/media + STATIC_ROOT: /srv/funkwhale/data/static + MUSIC_DIRECTORY_PATH: /srv/funkwhale/data/music + MUSIC_DIRECTORY_SERVE_PATH: /srv/funkwhale/data/music + DJANGO_SETTINGS_MODULE: config.settings.production + FUNKWHALE_FRONTEND_PATH: /srv/funkwhale/front/dist + NGINX_MAX_BODY_SIZE: 500M -{{- if .Values.s3.enabled }} + DJANGO_ALLOWED_HOSTS: '*' + +{{- if .Values.s3.enabled -}} AWS_ACCESS_KEY_ID: {{ .Values.s3.accessKey }} AWS_SECRET_ACCESS_KEY: {{ .Values.s3.secretKey }} AWS_STORAGE_BUCKET_NAME: {{ .Values.s3.bucket }} - {{- if .Values.s3.region }} + {{- if .Values.s3.region -}} AWS_S3_REGION_NAME: {{ .Values.s3.region }} - {{- end }} - {{- if .Values.s3.location }} + {{- end -}} + {{- if .Values.s3.location -}} AWS_LOCATION: {{ .Values.s3.location }} - {{- end }} - {{- if .Values.s3.url }} + {{- end -}} + {{- if .Values.s3.url -}} AWS_S3_ENDPOINT_URL: {{ .Values.s3.url }} - {{- end }} + {{- end -}} PROXY_MEDIA: {{ .Values.s3.proxy | quote }} -{{- end }} +{{- end -}} -{{- with .Values.extraEnv }} +{{- with .Values.extraEnv -}} {{- toYaml . | nindent 2 }} -{{- end }} +{{- end -}} diff --git a/charts/funkwhale/templates/deployment-api.yaml b/charts/funkwhale/templates/deployment-api.yaml index fae8e7c..104ba1b 100644 --- a/charts/funkwhale/templates/deployment-api.yaml +++ b/charts/funkwhale/templates/deployment-api.yaml @@ -41,7 +41,7 @@ spec: # port: http readinessProbe: tcpSocket: - port: http + port: api volumeMounts: - name: data mountPath: /srv/funkwhale/data @@ -67,9 +67,9 @@ spec: volumes: - name: data persistentVolumeClaim: - claimName: {{ include "funkwhale.fullname" . }}-data + claimName: {{ include "funkwhale.fullname" . }} {{- range .Values.api.extraVolumeMounts }} - name: {{ .name }} persistentVolumeClaim: claimName: {{ .existingClaim }} - {{- end }} + {{- end }} diff --git a/charts/funkwhale/templates/deployment-celerybeat.yaml b/charts/funkwhale/templates/deployment-celerybeat.yaml index 880df89..eb6645b 100644 --- a/charts/funkwhale/templates/deployment-celerybeat.yaml +++ b/charts/funkwhale/templates/deployment-celerybeat.yaml @@ -22,7 +22,7 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} audio.funkwhale/component: celery-beat spec: - initContainers: + containers: - name: celery-beat image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} diff --git a/charts/funkwhale/templates/deployment-celeryworker.yaml b/charts/funkwhale/templates/deployment-celeryworker.yaml index 25de6c5..6704fcf 100644 --- a/charts/funkwhale/templates/deployment-celeryworker.yaml +++ b/charts/funkwhale/templates/deployment-celeryworker.yaml @@ -26,11 +26,11 @@ spec: - name: worker image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" imagePullPolicy: {{ .Values.image.pullPolicy }} - commands: + command: - sh - -c - | - celery -A funkwhale_api.taskapp worder -l INFO + celery -A funkwhale_api.taskapp worker -l INFO env: - name: C_FORCE_ROOT value: "true" @@ -56,15 +56,15 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - volumes: - - name: data - persistentVolumeClaim: - claimName: {{ include "funkwhale.fullname" . }}-data - - name: config - configMap: - name: {{ include "funkwhale.fullname" . }}-front - {{- range .Values.celery.worker.extraVolumeMounts }} - - name: {{ .name }} - persistentVolumeClaim: - claimName: {{ .existingClaim }} - {{- end }} + volumes: + - name: data + persistentVolumeClaim: + claimName: {{ include "funkwhale.fullname" . }} + - name: config + configMap: + name: {{ include "funkwhale.fullname" . }}-front + {{- range .Values.celery.worker.extraVolumeMounts }} + - name: {{ .name }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- end }} diff --git a/charts/funkwhale/templates/deployment-front.yaml b/charts/funkwhale/templates/deployment-front.yaml index 727f34f..26474fb 100644 --- a/charts/funkwhale/templates/deployment-front.yaml +++ b/charts/funkwhale/templates/deployment-front.yaml @@ -42,7 +42,7 @@ spec: - name: nginx image: "{{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}" imagePullPolicy: {{ .Values.front.image.pullPolicy }} - commands: + command: - sh - -c - | @@ -86,17 +86,17 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} - volumes: - - name: frontend - emptyDir: {} - - name: data - persistentVolumeClaim: - claimName: {{ include "funkwhale.fullname" . }}-data - - name: config - configMap: - name: {{ include "funkwhale.fullname" . }}-front - {{- range .Values.front.extraVolumeMounts }} - - name: {{ .name }} - persistentVolumeClaim: - claimName: {{ .existingClaim }} - {{- end }} + volumes: + - name: frontend + emptyDir: {} + - name: data + persistentVolumeClaim: + claimName: {{ include "funkwhale.fullname" . }} + - name: config + configMap: + name: {{ include "funkwhale.fullname" . }}-front + {{- range .Values.front.extraVolumeMounts }} + - name: {{ .name }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- end }} diff --git a/charts/funkwhale/templates/ingress.yaml b/charts/funkwhale/templates/ingress.yaml index fac7647..cee5848 100644 --- a/charts/funkwhale/templates/ingress.yaml +++ b/charts/funkwhale/templates/ingress.yaml @@ -25,15 +25,11 @@ spec: {{- end }} {{- end }} rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} + - host: {{ .Values.ingress.host | quote }} http: paths: - {{- range .paths }} - - path: {{ . }} + - path: backend: serviceName: {{ $fullName }}-front servicePort: http - {{- end }} - {{- end }} {{- end }} diff --git a/charts/funkwhale/templates/pvc.yaml b/charts/funkwhale/templates/pvc.yaml new file mode 100644 index 0000000..9b0bf41 --- /dev/null +++ b/charts/funkwhale/templates/pvc.yaml @@ -0,0 +1,22 @@ +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "funkwhale.fullname" . }} + 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 }} +spec: + accessModes: + - ReadWriteMany + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} diff --git a/charts/funkwhale/templates/secret.yaml b/charts/funkwhale/templates/secret.yaml index f0e9905..eaab21e 100644 --- a/charts/funkwhale/templates/secret.yaml +++ b/charts/funkwhale/templates/secret.yaml @@ -8,6 +8,10 @@ metadata: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} data: - CACHE_URL: {{ .Values.redisUrl | b64enc }} - DATABASE_URL: {{ .Values.dbUrl | b64enc }} + CACHE_URL: {{ include "funkwhale.redisUrl" . | b64enc }} + DATABASE_URL: {{ include "funkwhale.dbUrl" . | b64enc }} DJANGO_SECRET_KEY: {{ .Values.djangoSecret | b64enc }} + +{{- range $key, $val := .Values.extraSecret -}} + {{ $key }}: {{ $val | b64enc }} +{{- end -}} diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index 6805553..4a07328 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -16,7 +16,8 @@ service: ingress: enabled: false - annotations: {} + annotations: + nginx.ingress.kubernetes.io/proxy-body-size: 500m # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" host: chart-example.local @@ -27,19 +28,51 @@ ingress: # hosts: # - chart-example.local -dbUrl: '' -redisUrl: '' +database: + ## Database host + host: + + ## Database port + port: 5432 + + ## Database user + user: funkwhale + + ## Database password + password: + + ## Database name + database: funkwhale + +redis: + cluster: + enabled: false + master: + persistence: + enabled: false + slave: + persistence: + enabled: false + password: funkwhale + redisPort: 6379 + djangoSecret: '' -extraEnv: [] +extraEnv: {} # LDAP_ENABLED: "True" # LDAP_ROOT_DN: dc=example,dc=com # LDAP_SEARCH_FILTER: (|(uid={0})(mail={0})) # LDAP_SERVER_URI: ldaps://ldap.example.com # LDAP_START_TLS: "True" # MEDIA_ROOT: /srv/funkwhale/data/media - # MUSIC_DIRECTORY_PATH: /srv/funkwhale/data/music - # MUSIC_DIRECTORY_SERVE_PATH: /srv/funkwhale/data/music + +extraSecret: {} + # EMAIL_CONFIG: smtp:// + # DEFAULT_FROM_EMAIL: funkwhale@example.com + +persistence: + size: 1Gi + storageClass: "-" s3: enabled: false @@ -48,7 +81,7 @@ s3: accessKey: '' secretKey: '' bucket: funkwhale - # region: us-1 + # region: eu-west-2 # location: /funkwhale # url: http://s3.example.com @@ -113,17 +146,13 @@ front: celery: beat: - resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 10m + memory: 75Mi nodeSelector: {} @@ -132,7 +161,7 @@ celery: affinity: {} worker: - replicaCount: 1 + replicaCount: 2 # Additional mounts to add to the frontend pod extraVolumeMounts: []