Skip to content

Allow emptyDir type volume mounts #6803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2024
Merged
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
5 changes: 4 additions & 1 deletion ci/helm-chart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,12 @@ spec:
{{- if .existingClaim }}
persistentVolumeClaim:
claimName: {{ .existingClaim }}
{{- else }}
{{- else if .hostPath }}
hostPath:
path: {{ .hostPath }}
type: Directory
{{- else }}
emptyDir:
{{- toYaml .emptyDir | nindent 10 }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not too familiar with Helm, but if emptyDir is not specified then will this error? Should we do {{- else if .emptyDir }} or make emptyDir default to {}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When emptyDir and all other configuration fields(hostPath etc.) are not set, the generated yaml would be emptyDir: null. I just tested that if such yaml is applied it would be transformed to emptyDir: {} by k8s.

I am not sure if it is the intended behaviour tho. I'd imagine that one of existingClaim|hostPath|emptyDir has to be set. Now it effectively defaults to emptyDir if not set. Would it be more desirable if an error is thrown when none of the fields above is set?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh that makes sense, thank you!

I am not sure either; I could see arguments for either way. Hmm I vote we keep it as is it currently is.

{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions ci/helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ extraVolumeMounts: []
# readOnly: true
# existingClaim: volume-claim
# hostPath: ""
# emptyDir: {}

extraConfigmapMounts: []
# - name: certs-configmap
Expand Down
Loading