Skip to content

Commit

Permalink
Added support for ephemeral volumes
Browse files Browse the repository at this point in the history
  • Loading branch information
xy795 committed Jan 8, 2025
1 parent e041bb4 commit 1d1ccb5
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/common/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ type: library
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.7.0
version: 0.8.0
11 changes: 2 additions & 9 deletions charts/common/templates/_pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- define "common.pvc.tpl" -}}
{{- range .Values.volumes }}
{{- if not (or .existingClaim .hostPath .fileName .emptyDir .existingConfigMap) }}
{{- if not (or .existingClaim .hostPath .fileName .emptyDir .existingConfigMap .ephemeral) }}
{{- $robustName := include "common.robustName" $.Release.Name }}
---
apiVersion: v1
Expand All @@ -13,14 +13,7 @@ metadata:
{{- toYaml .pvcAnnotations | nindent 4 }}
{{- end }}
spec:
accessModes:
- {{ .accessMode | default "ReadWriteOnce" }}
{{- if .storageClass }}
storageClassName: {{ .storageClass }}
{{- end }}
resources:
requests:
storage: {{ .size | default "1Gi" }}
{{- include "common.volumeClaimSpec.tpl" . | nindent 2 }}
{{- end }}
{{- end }}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/common/templates/_volumeSpec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- define "common.volumeClaimSpec.tpl" -}}
accessModes:
- {{ .accessMode | default "ReadWriteOnce" }}
{{- with .storageClass }}
storageClassName: {{ . }}
{{- end }}
resources:
requests:
storage: {{ .size | default "1Gi" }}
{{- with .volumeMode }}
volumeMode: {{ . }}
{{- end }}
{{- end -}}
5 changes: 5 additions & 0 deletions charts/common/templates/_volumesRef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ volumes:
{{- if .hostPath.type }}
type: {{ .hostPath.type }}
{{- end }}
{{- else if .ephemeral }}
ephemeral:
volumeClaimTemplate:
spec:
{{- include "common.volumeClaimSpec.tpl" . | nindent 10 }}
{{- else }}
persistentVolumeClaim:
{{- if .existingClaim }}
Expand Down
6 changes: 3 additions & 3 deletions charts/onechart/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
dependencies:
- name: common
repository: file://../common
version: 0.7.0
digest: sha256:a97ffdc0ab67ba57b6fb03ab3f98bbbc488f0630f2160b75e937c27d19a2fa08
generated: "2024-09-09T08:36:50.067911383Z"
version: 0.8.0
digest: sha256:ffc064a8d35b9d9d6e48490b41d0caef00096b0c8f9d1b773dfd9380efdff440
generated: "2025-01-08T18:33:43.774360305+01:00"
4 changes: 2 additions & 2 deletions charts/onechart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.74.0
version: 0.75.0

dependencies:
- name: common
version: 0.7.0
version: 0.8.0
repository: file://../common
Binary file removed charts/onechart/charts/common-0.7.0.tgz
Binary file not shown.
Binary file added charts/onechart/charts/common-0.8.0.tgz
Binary file not shown.

0 comments on commit 1d1ccb5

Please sign in to comment.