Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

feat: add medium and limitSize options for emptyDir #128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion charts/common/templates/_volumesRef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,16 @@
volumes:
{{- range .Values.volumes }}
- name: {{ .name }}
{{- if .emptyDir }}
{{- if and (and (not .emptyDir.medium) (not .emptyDir.sizeLimit)) .emptyDir.enabled }}
emptyDir: {}
{{- else if and (or (.emptyDir.medium) (.emptyDir.sizeLimit)) .emptyDir.enabled }}
emptyDir:
{{- if .emptyDir.medium }}
medium: {{ .emptyDir.medium }}
{{- end }}
{{- if .emptyDir.sizeLimit }}
sizeLimit: {{ .emptyDir.sizeLimit }}
{{- end }}
{{- else if .existingConfigMap }}
configMap:
name: {{ .existingConfigMap }}
Expand Down
29 changes: 25 additions & 4 deletions charts/onechart/tests/deployment_volumes_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ tests:
- name: data
persistentVolumeClaim:
claimName: my-static-claim
- it: Should use emptyDir
- it: Should use the default emptyDir
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
emptyDir: true
emptyDir:
enabled: true
asserts:
- template: deployment.yaml
documentIndex: 0
Expand All @@ -100,6 +101,25 @@ tests:
value:
- name: data
emptyDir: {}
- it: Should use emptyDir with custom params
set:
volumes:
- name: data
path: /var/lib/1clickinfra/data
emptyDir:
enabled: true
sizeLimit: 500Mi
medium: Memory
asserts:
- template: deployment.yaml
documentIndex: 0
equal:
path: spec.template.spec.volumes
value:
- name: data
emptyDir:
sizeLimit: 500Mi
medium: Memory
- it: Should use hostPath
set:
volumes:
Expand Down Expand Up @@ -134,12 +154,13 @@ tests:
- name: data
hostPath:
path: /somewhere/over/the/rainbow
- it: Should use emptyDir
- it: Should use default emptyDir
set:
volumes:
- name: myScratchDisk
path: /randomPath
emptyDir: true
emptyDir:
enabled: true
asserts:
- template: deployment.yaml
documentIndex: 0
Expand Down
18 changes: 16 additions & 2 deletions charts/onechart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1034,10 +1034,24 @@
"default": "ephemeral-volume"
},
"emptyDir": {
"type": "boolean",
"type": "object",
"title": "ephemeral volume (emptyDir)",
"description": "Enable to use a non-persistent disk",
"default": true
"properties": {
"enabled": {
"type": "boolean",
"title": "enabled",
"default": true
},
"sizeLimit": {
"type": "string",
"title": "Size Limit"
},
"medium": {
"type": "string",
"title": "enabled"
}
}
},
"path": {
"type": "string",
Expand Down
Loading