Skip to content

Commit

Permalink
Add support for ephemeral storage (#52)
Browse files Browse the repository at this point in the history
Co-authored-by: salvadorcruz <salvador.gonzalez@gumgum.com>
  • Loading branch information
Lowess and salgum10 authored Sep 26, 2023
1 parent 0014027 commit 6d23f63
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
25 changes: 11 additions & 14 deletions charts/monochart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,7 @@ spec:
{{- end }}
{{- if .Values.persistence.enabled }}
- mountPath: {{ .Values.persistence.mountPath | quote }}
name: storage
{{- else if .Values.deployment.ephemeral.enabled }}
- mountPath: {{ .Values.deployment.ephemeral.mountPath | quote }}
name: scratch
name: {{ .Values.persistence.storageName }}
{{- end }}
{{- include "monochart.files.volumeMounts" . | nindent 8 }}
{{- end }}
Expand All @@ -182,29 +179,29 @@ spec:
{{- if .Values.deployment.volumes }}
{{- toYaml .Values.deployment.volumes | nindent 6 }}
{{- end }}
{{- if .Values.deployment.ephemeral.enabled }}
- name: scratch
{{- if .Values.persistence }}
{{- if .Values.persistence.enabled }}
- name: {{ .Values.persistence.storageName }}
{{- if and (hasKey .Values.persistence "ephemeral") .Values.persistence.ephemeral }}
ephemeral:
volumeClaimTemplate:
metadata:
labels:
type: {{ include "common.name" . }}
spec:
accessModes: [ {{ .Values.deployment.ephemeral.accessMode | quote }} ]
storageClassName: {{ .Values.deployment.ephemeral.storageClassName | quote }}
accessModes: [ {{ .Values.persistence.accessMode | quote }} ]
storageClassName: {{ .Values.persistence.storageClass | quote }}
resources:
requests:
storage: {{ .Values.deployment.ephemeral.size }}
{{- end }}
{{- if .Values.persistence.enabled }}
- name: storage
{{- if .Values.persistence.enabled }}
storage: {{ .Values.persistence.size }}
{{- else }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "common.fullname" .) }}
{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- end }}
{{- include "monochart.files.volumes" . | nindent 6 }}
{{- end }}
{{- include "monochart.files.volumes" . | nindent 6 }}
{{- end -}}
2 changes: 1 addition & 1 deletion charts/monochart/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- if .Values.persistence -}}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) (not .Values.persistence.ephemeral) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand Down
17 changes: 10 additions & 7 deletions charts/monochart/values.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,6 @@ deployment:
nginx.version: 1.15.3
labels:
component: nginx
ephemeral:
enabled: true
accessMode: ReadWriteOnce
mountPath: /tmp
storageClassName: scratch-storage-class
size: 8Gi

pod:
annotations: {}
Expand Down Expand Up @@ -131,7 +125,16 @@ deployment:
- key: Name
operator: In
values:
- va-verity-eks--stage-vng-public
- custom-worker-group

persistence:
enabled: true
storageName: ephemeral-storage
ephemeral: true
mountPath: /tmp
accessMode: ReadWriteOnce
size: 30Gi
storageClass: gp3

rollout:
enabled: false
Expand Down
1 change: 1 addition & 0 deletions charts/monochart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ resources: {}
## Persistence and volumes
persistence:
enabled: false
ephemeral: false
storageName: storage
mountPath: /data
accessMode: ReadWriteOnce
Expand Down

0 comments on commit 6d23f63

Please sign in to comment.