Skip to content

Commit

Permalink
Create PVCs for back & transcoder (#734)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelinkio authored Dec 23, 2024
2 parents 8655c2c + d142189 commit 6151a61
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 33 deletions.
20 changes: 0 additions & 20 deletions chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -74,14 +64,4 @@ extraObjects:
resources:
requests:
storage: "3Gi"
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: transcoder-storage
spec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: "3Gi"
```
17 changes: 16 additions & 1 deletion chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/}}
Expand Down Expand Up @@ -111,4 +119,11 @@ Create the name of the transcoder service account to use
{{- else -}}
{{ default "default" .Values.transcoder.serviceAccount.name }}
{{- end -}}
{{- end -}}
{{- 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 -}}
15 changes: 15 additions & 0 deletions chart/templates/back/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,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 }}
Expand All @@ -191,6 +195,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 }}
Expand Down
25 changes: 25 additions & 0 deletions chart/templates/back/pvc.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 15 additions & 0 deletions chart/templates/transcoder/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,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 }}
Expand All @@ -125,6 +129,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 }}
Expand Down
25 changes: 25 additions & 0 deletions chart/templates/transcoder/pvc.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
35 changes: 23 additions & 12 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ global:
imagePullPolicy: IfNotPresent
imagePullSecrets: []
deploymentAnnotations: {}
persistentVolumeClaimAnnotations: {}
podAnnotations: {}
podLabels: {}
extraEnv: []
Expand Down Expand Up @@ -220,13 +221,8 @@ back:
image:
repository: ~
tag: ~
volumeMounts:
- mountPath: /metadata
name: back-storage
volumes:
- name: back-storage
persistentVolumeClaim:
claimName: back-storage
volumeMounts: []
volumes: []
replicaCount: 1
# default to recreate for better user experience with ReadWriteOnce volumes
updateStrategy:
Expand All @@ -247,6 +243,16 @@ back:
extraContainers: []
extraInitContainers: []
extraVolumes: []
# backmetadata
# user profile pictures
persistence:
enabled: true
size: 3Gi
annotations: {}
storageClass: ""
accessModes:
- ReadWriteOnce
existingClaim: ""

# front deployment configuration
front:
Expand Down Expand Up @@ -364,14 +370,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
Expand All @@ -394,6 +395,16 @@ transcoder:
extraContainers: []
extraInitContainers: []
extraVolumes: []
# transcodermetadata
# thumbnail images & subtiles
persistence:
enabled: true
size: 3Gi
annotations: {}
storageClass: ""
accessModes:
- ReadWriteOnce
existingClaim: ""

ingress:
enabled: false
Expand Down

0 comments on commit 6151a61

Please sign in to comment.