Skip to content

Commit

Permalink
feat: pvc as resource (#25)
Browse files Browse the repository at this point in the history
Signed-off-by: Smuu <[email protected]>
  • Loading branch information
smuu authored Aug 22, 2024
1 parent d769d18 commit d370c14
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 26 deletions.
28 changes: 28 additions & 0 deletions charts/celestia-node/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.persistence.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "common.names.fullname" . }}-data
{{- if or .Values.persistence.annotations .Values.commonAnnotations }}
{{- $claimAnnotations := include "common.tplvalues.merge" (dict "values" .Values.persistence.annotations .Values.commonAnnotations "context" .) | fromYaml }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $claimAnnotations "context" $ ) | nindent 2 }}
{{- end }}
{{- if .Values.commonLabels }}
labels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 2 }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 2 }}
{{- end }}
{{- if .Values.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.dataSource "context" $) | nindent 2 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 2 }}
{{- end }}
34 changes: 8 additions & 26 deletions charts/celestia-node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -370,33 +370,15 @@ spec:
items:
- key: config.yaml
path: config.yaml
{{- if .Values.persistence.enabled }}
- name: data
persistentVolumeClaim:
claimName: {{ template "common.names.fullname" . }}-data
{{- else }}
- name: data
emptyDir: {}
{{- end }}
{{- if .Values.node.extraVolumes }}
{{- include "common.tplvalues.render" (dict "value" .Values.node.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- if .Values.persistence.enabled }}
volumeClaimTemplates:
- metadata:
name: data
{{- if or .Values.persistence.annotations .Values.commonAnnotations }}
{{- $claimAnnotations := include "common.tplvalues.merge" (dict "values" .Values.persistence.annotations .Values.commonAnnotations "context" .) | fromYaml }}
annotations: {{- include "common.tplvalues.render" ( dict "value" $claimAnnotations "context" $ ) | nindent 10 }}
{{- end }}
{{- if .Values.commonLabels }}
labels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 10 }}
{{- end }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.selector }}
selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 10 }}
{{- end }}
{{- if .Values.persistence.dataSource }}
dataSource: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.dataSource "context" $) | nindent 10 }}
{{- end }}
{{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) | nindent 8 }}
{{- end }}

0 comments on commit d370c14

Please sign in to comment.