diff --git a/charts/node/Chart.yaml b/charts/node/Chart.yaml index 2d21154..55930a0 100644 --- a/charts/node/Chart.yaml +++ b/charts/node/Chart.yaml @@ -10,6 +10,6 @@ maintainers: type: application -version: 0.1.0 +version: 0.1.1 appVersion: "0.8.7" diff --git a/charts/node/templates/engine-statefulset.yaml b/charts/node/templates/engine-statefulset.yaml index 0e3569d..efc3bc4 100644 --- a/charts/node/templates/engine-statefulset.yaml +++ b/charts/node/templates/engine-statefulset.yaml @@ -98,6 +98,12 @@ spec: path: signing_key_file - key: ethereum-key path: ethereum_key_file + {{- if .Values.engine.persistence.existingClaim }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.engine.persistence.existingClaim }} + {{- end }} + {{- if eq .Values.engine.persistence.existingClaim "" }} volumeClaimTemplates: - apiVersion: v1 kind: PersistentVolumeClaim @@ -116,4 +122,5 @@ spec: resources: requests: storage: "{{ .Values.engine.persistence.size }}" + {{- end }} {{- end }} \ No newline at end of file diff --git a/charts/node/templates/node-statefulset.yaml b/charts/node/templates/node-statefulset.yaml index e1616f4..2e21e60 100644 --- a/charts/node/templates/node-statefulset.yaml +++ b/charts/node/templates/node-statefulset.yaml @@ -138,6 +138,12 @@ spec: - key: ethereum-key path: {{ .Values.common.keys.ethereumKeyFileName }} {{- end }} + {{- if .Values.node.persistence.existingClaim }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.node.persistence.existingClaim }} + {{- end }} + {{- if eq .Values.node.persistence.existingClaim "" }} volumeClaimTemplates: - apiVersion: v1 kind: PersistentVolumeClaim @@ -155,4 +161,5 @@ spec: {{- end }} resources: requests: - storage: "{{ .Values.node.persistence.size }}" \ No newline at end of file + storage: "{{ .Values.node.persistence.size }}" + {{- end }} diff --git a/charts/node/tests/engine_test.yaml b/charts/node/tests/engine_test.yaml new file mode 100644 index 0000000..a914370 --- /dev/null +++ b/charts/node/tests/engine_test.yaml @@ -0,0 +1,17 @@ +suite: chainflip-node tests +templates: + - engine-statefulset.yaml +tests: + - it: should template the node statefulset + asserts: + - isKind: + of: StatefulSet + - equal: + path: spec.template.spec.containers[0].image + value: chainfliplabs/chainflip-engine:perseverance + - it: should not create a pvc if supplying an existing claim + set: + engine.persistence.existingClaim: "test" + asserts: + - notExists: + path: spec.volumeClaimTemplates \ No newline at end of file diff --git a/charts/node/tests/node_test.yaml b/charts/node/tests/node_test.yaml index 05fa8f4..62b5c59 100644 --- a/charts/node/tests/node_test.yaml +++ b/charts/node/tests/node_test.yaml @@ -8,4 +8,10 @@ tests: of: StatefulSet - equal: path: spec.template.spec.containers[0].image - value: chainfliplabs/chainflip-node:perseverance \ No newline at end of file + value: chainfliplabs/chainflip-node:perseverance + - it: should not create a pvc if supplying an existing claim + set: + node.persistence.existingClaim: "test" + asserts: + - notExists: + path: spec.volumeClaimTemplates \ No newline at end of file diff --git a/charts/node/values.yaml b/charts/node/values.yaml index 3d98687..418a8e0 100644 --- a/charts/node/values.yaml +++ b/charts/node/values.yaml @@ -105,6 +105,9 @@ node: # -- enable chaindata persistence enabled: true + # -- reference an existing PVC + existingClaim: "" + # -- chaindata volume size size: 100Gi @@ -169,6 +172,9 @@ engine: # -- enable chainflip-engine persistence enabled: true + # -- reference an existing PVC + existingClaim: "" + # -- chainflip-engine volume size size: 5Gi