Skip to content

Commit

Permalink
Merge pull request #1508 from porter-dev/ym/multiple_efs_mount_points
Browse files Browse the repository at this point in the history
chore: allow mounting several efs volumes from one efs filesystem
  • Loading branch information
yosefmih authored Feb 24, 2025
2 parents 603d099 + 10dbee3 commit a3727af
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
12 changes: 12 additions & 0 deletions applications/web/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,16 @@ Otherwise, use the default path /data/efs/<fullname>
{{- else -}}
{{- printf "/data/efs/%s" .fullname -}}
{{- end -}}
{{- end -}}
{{/*
Get the EFS resource name. If index is 0, don't append it to the name.
*/}}
{{- define "docker-template.efsName" -}}
{{- $name := printf "efs-%s" .fullname -}}
{{- if ne (.index | int) 0 -}}
{{- printf "%s-%d" $name (.index | int) -}}
{{- else -}}
{{- $name -}}
{{- end -}}
{{- end -}}
10 changes: 5 additions & 5 deletions applications/web/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ spec:
{{ end }}
{{ if .Values.awsEfsStorage }}
volumeMounts:
{{- range $v := .Values.awsEfsStorage }}
- name: efs-{{ $.Values.fullnameOverride }}
{{- range $index, $v := .Values.awsEfsStorage }}
- name: {{ include "docker-template.efsName" (dict "fullname" $.Values.fullnameOverride "index" $index) }}
mountPath: {{ include "docker-template.efsMountPath" (dict "mountPath" $v.mountPath "fullname" $.Values.fullnameOverride) }}
{{ end }}
{{ end }}
Expand Down Expand Up @@ -538,10 +538,10 @@ spec:
{{- toYaml .Values.emptyDir.volumeOptions | nindent 12 }}
{{ end }}
{{ if .Values.awsEfsStorage }}
{{- range $v := .Values.awsEfsStorage }}
- name: efs-{{ $.Values.fullnameOverride }}
{{- range $index, $v := .Values.awsEfsStorage }}
- name: {{ include "docker-template.efsName" (dict "fullname" $.Values.fullnameOverride "index" $index) }}
persistentVolumeClaim:
claimName: efs-{{ $.Values.fullnameOverride }}
claimName: {{ include "docker-template.efsName" (dict "fullname" $.Values.fullnameOverride "index" $index) }}
{{ end }}
{{ end }}
{{ if .Values.fileSecretMounts.enabled }}
Expand Down
9 changes: 5 additions & 4 deletions applications/web/templates/efs-storage-class.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{ if .Values.awsEfsStorage }}
{{- range $v := .Values.awsEfsStorage }}
{{- range $index, $v := .Values.awsEfsStorage }}
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: efs-{{ $.Values.fullnameOverride }}
name: {{ include "docker-template.efsName" (dict "fullname" $.Values.fullnameOverride "index" $index) }}
provisioner: efs.csi.aws.com
parameters:
provisioningMode: efs-ap
Expand All @@ -14,13 +14,14 @@ parameters:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: efs-{{ $.Values.fullnameOverride }}
name: {{ include "docker-template.efsName" (dict "fullname" $.Values.fullnameOverride "index" $index) }}
spec:
accessModes:
- ReadWriteMany
storageClassName: efs-{{ $.Values.fullnameOverride }}
storageClassName: {{ include "docker-template.efsName" (dict "fullname" $.Values.fullnameOverride "index" $index) }}
resources:
requests:
storage: 5Gi
---
{{- end }}
{{- end }}

0 comments on commit a3727af

Please sign in to comment.