From 08431eff422abca56e9785945a2309633d5b3e4d Mon Sep 17 00:00:00 2001 From: inkvi <374203+Inkvi@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:42:31 -0700 Subject: [PATCH 1/2] Support persistent volumes in Cosmos chains --- .../templates/chains/cosmos/genesis.yaml | 22 +++++++++++++++++++ charts/devnet/values.schema.json | 6 +++++ tests/e2e/configs/one-chain.yaml | 2 ++ 3 files changed, 30 insertions(+) diff --git a/charts/devnet/templates/chains/cosmos/genesis.yaml b/charts/devnet/templates/chains/cosmos/genesis.yaml index d874019be..0fba9c731 100644 --- a/charts/devnet/templates/chains/cosmos/genesis.yaml +++ b/charts/devnet/templates/chains/cosmos/genesis.yaml @@ -51,6 +51,14 @@ spec: spec: {{- include "imagePullSecrets" $chain | indent 6 }} initContainers: + {{- if hasKey $chain "storage" }} + - name: init-chmod-data + image: busybox + command: ['sh', '-c', 'chmod -R 0777 {{ $chain.home }}'] + volumeMounts: + - name: node + mountPath: {{ $chain.home }} + {{- end }} {{- if $toBuild }} - name: init-build-images image: ghcr.io/cosmology-tech/starship/builder:latest @@ -310,8 +318,10 @@ spec: {{- end }} {{- end }} volumes: + {{- if not (hasKey $chain "storage") }} - name: node emptyDir: { } + {{- end }} - name: addresses configMap: name: keys @@ -327,6 +337,18 @@ spec: - name: faucet emptyDir: { } {{- end }} + {{- if hasKey $chain "storage" }} + volumeClaimTemplates: + - metadata: + name: node + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: {{ $chain.storageClassName }} + resources: + requests: + storage: {{ $chain.storage }} + {{- end }} + --- {{- end }} {{- end }} diff --git a/charts/devnet/values.schema.json b/charts/devnet/values.schema.json index 02efc3c6d..a39f80cf0 100644 --- a/charts/devnet/values.schema.json +++ b/charts/devnet/values.schema.json @@ -170,6 +170,12 @@ "repo": { "type": "string" }, + "storage": { + "type": "string" + }, + "storageClassName": { + "type": "string" + }, "upgrade": { "type": "object", "properties": { diff --git a/tests/e2e/configs/one-chain.yaml b/tests/e2e/configs/one-chain.yaml index 5d2c015ba..f779bd7f1 100644 --- a/tests/e2e/configs/one-chain.yaml +++ b/tests/e2e/configs/one-chain.yaml @@ -2,6 +2,8 @@ chains: - name: osmosis-1 type: osmosis numValidators: 1 + storageClassName: standard-rwo + storage: 1Gi ports: rest: 1313 rpc: 26653 From 2298fdd3977fd115291f02d7e3d55185864dc19f Mon Sep 17 00:00:00 2001 From: inkvi <374203+Inkvi@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:51:49 -0700 Subject: [PATCH 2/2] Add storage support to the validators --- .../devnet/templates/chains/cosmos/validator.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/charts/devnet/templates/chains/cosmos/validator.yaml b/charts/devnet/templates/chains/cosmos/validator.yaml index 6c42309b3..216d49861 100644 --- a/charts/devnet/templates/chains/cosmos/validator.yaml +++ b/charts/devnet/templates/chains/cosmos/validator.yaml @@ -225,14 +225,28 @@ spec: - mountPath: /configs name: addresses volumes: + {{- if not (hasKey $chain "storage") }} - name: node emptyDir: { } + {{- end }} - name: addresses configMap: name: keys - name: scripts configMap: name: setup-scripts-{{- include "devnet.chain.name" $chain.name }} + {{- if hasKey $chain "storage" }} + volumeClaimTemplates: + - metadata: + name: node + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: {{ $chain.storageClassName }} + resources: + requests: + storage: {{ $chain.storage }} + {{- end }} + --- {{- end }} {{- end }}