From 64f67e7ef7b18d0ee5d98c4b44d9a16f6ffc462b Mon Sep 17 00:00:00 2001 From: Arlan Lloyd Date: Sun, 22 Dec 2024 09:24:24 +0000 Subject: [PATCH] create pvcs needed for back/transcoder --- chart/README.md | 20 ------------- chart/templates/_helpers.tpl | 17 ++++++++++- chart/templates/back/deployment.yaml | 15 ++++++++++ chart/templates/back/pvc.yaml | 25 ++++++++++++++++ chart/templates/transcoder/deployment.yaml | 15 ++++++++++ chart/templates/transcoder/pvc.yaml | 25 ++++++++++++++++ chart/values.yaml | 35 ++++++++++++++-------- 7 files changed, 119 insertions(+), 33 deletions(-) create mode 100644 chart/templates/back/pvc.yaml create mode 100644 chart/templates/transcoder/pvc.yaml diff --git a/chart/README.md b/chart/README.md index 664487fe9..901cbca91 100644 --- a/chart/README.md +++ b/chart/README.md @@ -54,16 +54,6 @@ extraObjects: rabbitmq_user: kyoo_all rabbitmq_password: youAreAmazing2 rabbitmq_cookie: mmmGoodCookie - - kind: PersistentVolumeClaim - apiVersion: v1 - metadata: - name: back-storage - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "3Gi" - kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -74,14 +64,4 @@ extraObjects: resources: requests: storage: "3Gi" - - kind: PersistentVolumeClaim - apiVersion: v1 - metadata: - name: transcoder-storage - spec: - accessModes: - - "ReadWriteOnce" - resources: - requests: - storage: "3Gi" ``` \ No newline at end of file diff --git a/chart/templates/_helpers.tpl b/chart/templates/_helpers.tpl index 86a16a6e6..a8b62d96f 100644 --- a/chart/templates/_helpers.tpl +++ b/chart/templates/_helpers.tpl @@ -41,6 +41,14 @@ Create the name of the back service account to use {{- end -}} {{- end -}} +{{/* +Create kyoo back-metadata name +*/}} +{{- define "kyoo.backmetadata.fullname" -}} +{{- printf "%s-%s%s" (include "kyoo.fullname" .) .Values.back.name "metadata" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + {{/* Create kyoo front name */}} @@ -111,4 +119,11 @@ Create the name of the transcoder service account to use {{- else -}} {{ default "default" .Values.transcoder.serviceAccount.name }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} + +{{/* +Create kyoo transcoder-metadata name +*/}} +{{- define "kyoo.transcodermetadata.fullname" -}} +{{- printf "%s-%s%s" (include "kyoo.fullname" .) .Values.transcoder.name "metadata" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/chart/templates/back/deployment.yaml b/chart/templates/back/deployment.yaml index 5eb0593fd..60fead136 100644 --- a/chart/templates/back/deployment.yaml +++ b/chart/templates/back/deployment.yaml @@ -177,6 +177,10 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: + {{- if .Values.back.persistence.enabled }} + - name: backmetadata + mountPath: /metadata + {{- end }} {{- with .Values.back.kyoo_back.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} @@ -187,6 +191,17 @@ spec: {{- tpl (toYaml .) $ | nindent 8 }} {{- end }} volumes: + {{- if .Values.back.persistence.enabled }} + {{- if .Values.back.persistence.existingClaim }} + - name: backmetadata + persistentVolumeClaim: + claimName: {{ .Values.back.persistence.existingClaim }} + {{- else }} + - name: backmetadata + persistentVolumeClaim: + claimName: {{ include "kyoo.backmetadata.fullname" . }} + {{- end }} + {{- end }} {{- with .Values.back.volumes }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/chart/templates/back/pvc.yaml b/chart/templates/back/pvc.yaml new file mode 100644 index 000000000..191ea7264 --- /dev/null +++ b/chart/templates/back/pvc.yaml @@ -0,0 +1,25 @@ +{{- if and .Values.back.persistence.enabled (not .Values.back.persistence.existingClaim) }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "kyoo.backmetadata.fullname" . }} + labels: + {{- include "kyoo.labels" (dict "context" . "component" .Values.back.name "name" .Values.back.name) | nindent 4 }} + {{- with (mergeOverwrite (deepCopy .Values.global.persistentVolumeClaimAnnotations) .Values.back.persistence.annotations) }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} +spec: + accessModes: + {{- range .Values.back.persistence.accessModes }} + - {{ . }} + {{- end }} + resources: + requests: + storage: {{ .Values.back.persistence.size }} + {{- if .Values.back.persistence.storageClass }} + storageClassName: {{ .Values.back.persistence.storageClass }} + {{- end }} +{{- end }} diff --git a/chart/templates/transcoder/deployment.yaml b/chart/templates/transcoder/deployment.yaml index f7d2d0f63..8123a47aa 100644 --- a/chart/templates/transcoder/deployment.yaml +++ b/chart/templates/transcoder/deployment.yaml @@ -104,6 +104,10 @@ spec: {{- with .Values.media.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} + {{- if .Values.back.persistence.enabled }} + - name: transcodermetadata + mountPath: /metadata + {{- end }} {{- with .Values.transcoder.kyoo_transcoder.volumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} @@ -121,6 +125,17 @@ spec: {{- with .Values.media.volumes }} {{- toYaml . | nindent 8 }} {{- end }} + {{- if .Values.transcoder.persistence.enabled }} + {{- if .Values.transcoder.persistence.existingClaim }} + - name: transcodermetadata + persistentVolumeClaim: + claimName: {{ .Values.transcoder.persistence.existingClaim }} + {{- else }} + - name: transcodermetadata + persistentVolumeClaim: + claimName: {{ include "kyoo.transcodermetadata.fullname" . }} + {{- end }} + {{- end }} {{- with .Values.transcoder.volumes }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/chart/templates/transcoder/pvc.yaml b/chart/templates/transcoder/pvc.yaml new file mode 100644 index 000000000..143b3b820 --- /dev/null +++ b/chart/templates/transcoder/pvc.yaml @@ -0,0 +1,25 @@ +{{- if and .Values.transcoder.persistence.enabled (not .Values.transcoder.persistence.existingClaim) }} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "kyoo.transcodermetadata.fullname" . }} + labels: + {{- include "kyoo.labels" (dict "context" . "component" .Values.transcoder.name "name" .Values.transcoder.name) | nindent 4 }} + {{- with (mergeOverwrite (deepCopy .Values.global.persistentVolumeClaimAnnotations) .Values.transcoder.persistence.annotations) }} + annotations: + {{- range $key, $value := . }} + {{ $key }}: {{ $value | quote }} + {{- end }} + {{- end }} +spec: + accessModes: + {{- range .Values.transcoder.persistence.accessModes }} + - {{ . }} + {{- end }} + resources: + requests: + storage: {{ .Values.transcoder.persistence.size }} + {{- if .Values.transcoder.persistence.storageClass }} + storageClassName: {{ .Values.transcoder.persistence.storageClass }} + {{- end }} +{{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index 6e07bbd7b..5b0144663 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -9,6 +9,7 @@ global: imagePullPolicy: IfNotPresent imagePullSecrets: [] deploymentAnnotations: {} + persistentVolumeClaimAnnotations: {} podAnnotations: {} podLabels: {} extraEnv: [] @@ -219,13 +220,8 @@ back: image: repository: ~ tag: ~ - volumeMounts: - - mountPath: /metadata - name: back-storage - volumes: - - name: back-storage - persistentVolumeClaim: - claimName: back-storage + volumeMounts: [] + volumes: [] replicaCount: 1 podLabels: {} deploymentAnnotations: {} @@ -243,6 +239,16 @@ back: extraContainers: [] extraInitContainers: [] extraVolumes: [] + # backmetadata + # user profile pictures + persistence: + enabled: true + size: 3Gi + annotations: {} + storageClass: "" + accessModes: + - ReadWriteOnce + existingClaim: "" # front deployment configuration front: @@ -357,14 +363,9 @@ transcoder: repository: ~ tag: ~ volumeMounts: - - mountPath: /metadata - name: transcoder-storage - mountPath: /cache name: cache volumes: - - name: transcoder-storage - persistentVolumeClaim: - claimName: transcoder-storage - name: cache emptyDir: {} replicaCount: 1 @@ -384,6 +385,16 @@ transcoder: extraContainers: [] extraInitContainers: [] extraVolumes: [] + # transcodermetadata + # thumbnail images & subtiles + persistence: + enabled: true + size: 3Gi + annotations: {} + storageClass: "" + accessModes: + - ReadWriteOnce + existingClaim: "" ingress: enabled: false