From 9fe1c9ec4959e7f69a63373325b1d65e2ab68b5d Mon Sep 17 00:00:00 2001 From: Bulat Saifullin Date: Mon, 25 Mar 2024 19:02:24 +0300 Subject: [PATCH] [node] add tpl to init containers (#333) * add tpl to init containers * add option to use own chainspec * update README.md * add examples/local-rococo --- charts/node/Chart.yaml | 2 +- charts/node/README.md | 10 ++- charts/node/examples/local-rococo/README.md | 56 +++++++++++++ .../node/examples/local-rococo/asset-hub.yaml | 76 +++++++++++++++++ .../node/examples/local-rococo/bootnode.yaml | 81 +++++++++++++++++++ .../local-rococo/validators-alice-bob.yaml | 51 ++++++++++++ charts/node/templates/service.yaml | 3 + charts/node/templates/statefulset.yaml | 10 +-- charts/node/values.yaml | 10 ++- 9 files changed, 288 insertions(+), 11 deletions(-) create mode 100644 charts/node/examples/local-rococo/README.md create mode 100644 charts/node/examples/local-rococo/asset-hub.yaml create mode 100644 charts/node/examples/local-rococo/bootnode.yaml create mode 100644 charts/node/examples/local-rococo/validators-alice-bob.yaml diff --git a/charts/node/Chart.yaml b/charts/node/Chart.yaml index f728fa35..10979eca 100644 --- a/charts/node/Chart.yaml +++ b/charts/node/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: node description: A Helm chart to deploy Substrate/Polkadot nodes type: application -version: 5.6.2 +version: 5.6.3 maintainers: - name: Parity url: https://github.com/paritytech/helm-charts diff --git a/charts/node/README.md b/charts/node/README.md index 046a0d16..89f744a2 100644 --- a/charts/node/README.md +++ b/charts/node/README.md @@ -18,7 +18,7 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch # Substrate/Polkadot node Helm chart -![Version: 5.6.2](https://img.shields.io/badge/Version-5.6.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 5.6.3](https://img.shields.io/badge/Version-5.6.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ## Maintainers @@ -298,7 +298,7 @@ If you're running a collator node: | jaegerAgent.ports.samplingPort | HTTP | `5778` | serve configs, sampling strategies | | jaegerAgent.resources | object | `{}` | Resource limits & requests | | nameOverride | string | `""` | Provide a name in place of node for `app:` labels | -| node | object | `{"allowUnsafeRpcMethods":false,"chain":"polkadot","chainData":{"annotations":{},"chainPath":null,"chainSnapshot":{"enabled":false,"filelistName":"files.txt","method":"gcs","url":""},"database":"rocksdb","kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"pruning":1000,"storageClass":"","volumeSize":"100Gi"},"chainKeystore":{"accessModes":["ReadWriteOnce"],"annotations":{},"kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"mountInMemory":{"enabled":false,"sizeLimit":null},"storageClass":"","volumeSize":"10Mi"},"collatorExternalRelayChain":{"enabled":false,"relayChainRpcUrls":[]},"collatorLightClient":{"enabled":false,"relayChain":"","relayChainCustomChainspecPath":"/chain-data/relay_chain_chainspec.json","relayChainCustomChainspecUrl":null},"collatorRelayChain":{"chain":"polkadot","chainData":{"annotations":{},"chainPath":"","chainSnapshot":{"enabled":false,"filelistName":"files.txt","method":"gcs","url":""},"database":"rocksdb","kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"pruning":1000,"storageClass":"","volumeSize":"100Gi"},"chainKeystore":{"accessModes":["ReadWriteOnce"],"annotations":{},"kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"mountInMemory":{"enabled":false,"sizeLimit":null},"storageClass":"","volumeSize":"10Mi"},"customChainspecPath":"/relaychain-data/relay_chain_chainspec.json","customChainspecUrl":null,"flags":[],"prometheus":{"enabled":false,"port":9625}},"command":"polkadot","customChainspecPath":"/chain-data/chainspec.json","customChainspecUrl":null,"customNodeKey":null,"enableOffchainIndexing":false,"enableSidecarLivenessProbe":false,"enableSidecarReadinessProbe":false,"enableStartupProbe":true,"existingSecrets":{"keys":[],"nodeKey":{}},"extraConfigmapMounts":[],"extraEnvVars":[],"extraSecretMounts":[],"flags":[],"forceDownloadChainspec":false,"isParachain":false,"keys":{},"legacyRpcFlags":false,"logLevels":[],"perNodeServices":{"apiService":{"annotations":{},"enabled":true,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"httpPort":9933,"prometheusPort":9615,"relayChainPrometheusPort":9625,"rpcPort":9944,"type":"ClusterIP","wsPort":9955},"paraP2pService":{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"port":30334,"type":"NodePort","ws":{"enabled":false,"port":30335}},"relayP2pService":{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"port":30333,"type":"NodePort","ws":{"enabled":false,"port":30334}},"setPublicAddressToExternalIp":{"enabled":false,"ipRetrievalServiceUrl":"https://ifconfig.io"}},"persistGeneratedNodeKey":false,"persistentVolumeClaimRetentionPolicy":null,"podManagementPolicy":null,"prometheus":{"enabled":true,"port":9615},"replicas":1,"resources":{},"role":"full","serviceAnnotations":{},"serviceMonitor":{"enabled":false,"interval":"30s","metricRelabelings":[],"namespace":null,"relabelings":[],"scrapeTimeout":"10s","targetLabels":["node"]},"startupProbeFailureThreshold":30,"substrateApiSidecar":{"enabled":false},"telemetryUrls":[],"tracing":{"enabled":false},"updateStrategy":{"enabled":false,"maxUnavailable":1,"type":"RollingUpdate"},"vault":{"authConfigServiceAccount":null,"authConfigType":null,"authPath":null,"authRole":null,"authType":null,"keys":{},"nodeKey":{}},"wasmRuntimeOverridesPath":"/chain-data/runtimes","wasmRuntimeUrl":""}` | Deploy a substrate node. ref: https://docs.substrate.io/tutorials/v3/private-network/ | +| node | object | `{"allowUnsafeRpcMethods":false,"chain":"polkadot","chainData":{"annotations":{},"chainPath":null,"chainSnapshot":{"enabled":false,"filelistName":"files.txt","method":"gcs","url":""},"database":"rocksdb","kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"pruning":1000,"storageClass":"","volumeSize":"100Gi"},"chainKeystore":{"accessModes":["ReadWriteOnce"],"annotations":{},"kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"mountInMemory":{"enabled":false,"sizeLimit":null},"storageClass":"","volumeSize":"10Mi"},"collatorExternalRelayChain":{"enabled":false,"relayChainRpcUrls":[]},"collatorLightClient":{"enabled":false,"relayChain":"","relayChainCustomChainspec":false,"relayChainCustomChainspecPath":"/chain-data/relay_chain_chainspec.json","relayChainCustomChainspecUrl":null},"collatorRelayChain":{"chain":"polkadot","chainData":{"annotations":{},"chainPath":"","chainSnapshot":{"enabled":false,"filelistName":"files.txt","method":"gcs","url":""},"database":"rocksdb","kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"pruning":1000,"storageClass":"","volumeSize":"100Gi"},"chainKeystore":{"accessModes":["ReadWriteOnce"],"annotations":{},"kubernetesVolumeSnapshot":null,"kubernetesVolumeToClone":null,"mountInMemory":{"enabled":false,"sizeLimit":null},"storageClass":"","volumeSize":"10Mi"},"customChainspec":false,"customChainspecPath":"/relaychain-data/relay_chain_chainspec.json","customChainspecUrl":null,"flags":[],"prometheus":{"enabled":false,"port":9625}},"command":"polkadot","customChainspec":false,"customChainspecPath":"/chain-data/chainspec.json","customChainspecUrl":null,"customNodeKey":null,"enableOffchainIndexing":false,"enableSidecarLivenessProbe":false,"enableSidecarReadinessProbe":false,"enableStartupProbe":true,"existingSecrets":{"keys":[],"nodeKey":{}},"extraConfigmapMounts":[],"extraEnvVars":[],"extraSecretMounts":[],"flags":[],"forceDownloadChainspec":false,"isParachain":false,"keys":{},"legacyRpcFlags":false,"logLevels":[],"perNodeServices":{"apiService":{"annotations":{},"enabled":true,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"httpPort":9933,"prometheusPort":9615,"relayChainPrometheusPort":9625,"rpcPort":9944,"type":"ClusterIP","wsPort":9955},"paraP2pService":{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"port":30334,"type":"NodePort","ws":{"enabled":false,"port":30335}},"relayP2pService":{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"port":30333,"type":"NodePort","ws":{"enabled":false,"port":30334}},"setPublicAddressToExternalIp":{"enabled":false,"ipRetrievalServiceUrl":"https://ifconfig.io"}},"persistGeneratedNodeKey":false,"persistentVolumeClaimRetentionPolicy":null,"podManagementPolicy":null,"prometheus":{"enabled":true,"port":9615},"replicas":1,"resources":{},"role":"full","serviceAnnotations":{},"serviceExtraPorts":[],"serviceMonitor":{"enabled":false,"interval":"30s","metricRelabelings":[],"namespace":null,"relabelings":[],"scrapeTimeout":"10s","targetLabels":["node"]},"startupProbeFailureThreshold":30,"substrateApiSidecar":{"enabled":false},"telemetryUrls":[],"tracing":{"enabled":false},"updateStrategy":{"enabled":false,"maxUnavailable":1,"type":"RollingUpdate"},"vault":{"authConfigServiceAccount":null,"authConfigType":null,"authPath":null,"authRole":null,"authType":null,"keys":{},"nodeKey":{}},"wasmRuntimeOverridesPath":"/chain-data/runtimes","wasmRuntimeUrl":""}` | Deploy a substrate node. ref: https://docs.substrate.io/tutorials/v3/private-network/ | | node.allowUnsafeRpcMethods | bool | `false` | Allow executing unsafe RPC methods | | node.chain | string | `"polkadot"` | Name of the chain | | node.chainData.annotations | object | `{}` | Annotations to add to the volumeClaimTemplates | @@ -327,9 +327,10 @@ If you're running a collator node: | node.collatorExternalRelayChain | object | `{"enabled":false,"relayChainRpcUrls":[]}` | EXPERIMENTAL!!! Run the collator node without a relay chain via external relay chain ref: https://github.com/paritytech/cumulus#external-relay-chain-node Enabling this option will disable the values of collatorRelayChain | | node.collatorExternalRelayChain.enabled | bool | `false` | Enable deployment of the external collator | | node.collatorExternalRelayChain.relayChainRpcUrls | list | `[]` | List of Relay Chain RPCs to connect | -| node.collatorLightClient | object | `{"enabled":false,"relayChain":"","relayChainCustomChainspecPath":"/chain-data/relay_chain_chainspec.json","relayChainCustomChainspecUrl":null}` | EXPERIMENTAL!!! Run the collator node without a relay chain via light client ref: https://github.com/paritytech/cumulus/pull/2270 Enabling this option will disable the values of collatorRelayChain | +| node.collatorLightClient | object | `{"enabled":false,"relayChain":"","relayChainCustomChainspec":false,"relayChainCustomChainspecPath":"/chain-data/relay_chain_chainspec.json","relayChainCustomChainspecUrl":null}` | EXPERIMENTAL!!! Run the collator node without a relay chain via light client ref: https://github.com/paritytech/cumulus/pull/2270 Enabling this option will disable the values of collatorRelayChain | | node.collatorLightClient.enabled | bool | `false` | Enable deployment of the external collator | | node.collatorLightClient.relayChain | string | `""` | Name of the Relay Chain to connect | +| node.collatorLightClient.relayChainCustomChainspec | bool | `false` | Use the file defined in `collatorLightClient.relayChainCustomChainspecPath` as the chainspec. Ensure that the file is either mounted or generated with an init container. | | node.collatorLightClient.relayChainCustomChainspecPath | string | `"/chain-data/relay_chain_chainspec.json"` | Path to the file containing the chainspec of the collator relay-chain | | node.collatorLightClient.relayChainCustomChainspecUrl | string | `nil` | URL to retrive custom chain spec | | node.collatorRelayChain.chain | string | `"polkadot"` | Name of the Relay Chain to connect | @@ -355,6 +356,7 @@ If you're running a collator node: | node.collatorRelayChain.chainKeystore.mountInMemory.sizeLimit | string | `nil` | Size limit of the emptyDir holding a keystore. Requires K8s >=1.22 | | node.collatorRelayChain.chainKeystore.storageClass | string | `""` | Storage class to use for persistent volume | | node.collatorRelayChain.chainKeystore.volumeSize | string | `"10Mi"` | Size of the volume | +| node.collatorRelayChain.customChainspec | bool | `false` | Use the file defined in `collatorRelayChain.customChainspecPath` as the chainspec. Ensure that the file is either mounted or generated with an init container. | | node.collatorRelayChain.customChainspecPath | string | `"/relaychain-data/relay_chain_chainspec.json"` | Path to the file containing the chainspec of the collator relay-chain Set to /relaychain-data to use additional volume | | node.collatorRelayChain.customChainspecUrl | string | `nil` | URL to retrive custom chain spec | | node.collatorRelayChain.flags | list | `[]` | Flags to add to the Polkadot binary | @@ -362,6 +364,7 @@ If you're running a collator node: | node.collatorRelayChain.prometheus.enabled | bool | `false` | Expose Prometheus metrics | | node.collatorRelayChain.prometheus.port | int | `9625` | The port for exposed Prometheus metrics | | node.command | string | `"polkadot"` | Command to run within the container | +| node.customChainspec | bool | `false` | Use the file defined in `node.customChainspecPath` as the chainspec. Ensure that the file is either mounted or generated with an init container. | | node.customChainspecPath | string | `"/chain-data/chainspec.json"` | Node may require custom name for chainspec file. ref: moonbeam https://github.com/PureStake/moonbeam/issues/1104#issuecomment-996787548 Note: path should start with /chain-data/ since this folder mount in init container download-chainspec. | | node.customChainspecUrl | string | `nil` | URL to retrive custom chain spec | | node.customNodeKey | string | `nil` | Name of the secret containig the key | @@ -436,6 +439,7 @@ If you're running a collator node: | node.resources | object | `{}` | Resource limits & requests | | node.role | string | `"full"` | Type of the node. One of: full, authority, validator, collator, light | | node.serviceAnnotations | object | `{}` | Annotations to add to the Service | +| node.serviceExtraPorts | list | `[]` | Additional ports on main Service | | node.serviceMonitor | object | `{"enabled":false,"interval":"30s","metricRelabelings":[],"namespace":null,"relabelings":[],"scrapeTimeout":"10s","targetLabels":["node"]}` | Service Monitor of Prometheus-Operator ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md#include-servicemonitors | | node.serviceMonitor.enabled | bool | `false` | Enables Service Monitor | | node.serviceMonitor.interval | string | `"30s"` | Scrape interval | diff --git a/charts/node/examples/local-rococo/README.md b/charts/node/examples/local-rococo/README.md new file mode 100644 index 00000000..63d6555f --- /dev/null +++ b/charts/node/examples/local-rococo/README.md @@ -0,0 +1,56 @@ +# Relaychain +## Install relaychain +```shell +helm upgrade --install bootnode . -f examples/local-rococo/bootnode.yaml +kubectl wait --for=condition=Ready pod bootnode-0 --timeout=90s +helm upgrade --install validators . -f examples/local-rococo/validators-alice-bob.yaml + +``` + +## Access to relaychain RPC +```shell +kubectl port-forward bootnode-0 9944:9944 +``` +open: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer + +# Parachain +## Install parachain +```shell +helm upgrade --install parachain . -f examples/local-rococo/asset-hub.yaml +``` + +## Onboard parachain +1. Find the para_id and Genesis state +```shell +kubectl logs --tail 10 -f parachain-node-0 dump-state-and-wasm +# Parachain Id: +# "para_id": 1000, +# Genesis head: +# 0x00000000000000000000000000000000000000000000000000000000000000000061dc4546910e4a874f59af705dd079344ecb7759f526cf86cf21db67473d0b4f03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400 +``` +2. Download genesis-wasm +```shell +kubectl cp parachain-node-0:/chain-data/genesis-wasm genesis-wasm +``` +3. On relaychain RPC submit following call: +https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/sudo +```shell +parasSudoWrapper.sudoScheduleParaInitialize(id, genesis) +id = 1000 +genesisHead = 0x00000000000000000000000000000000000000000000000000000000000000000061dc4546910e4a874f59af705dd079344ecb7759f526cf86cf21db67473d0b4f03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400 +validationCode = file upload(genesis-wasm) +paraKind = Yes +``` +4. Check onboarding progress here: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains/parathreads + +## Access to parachain RPC +```shell +kubectl port-forward parachain-node-0 9945:9944 +``` +open: https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9945#/explorer + +## Cleanup +```shell +helm delete bootnode validators parachain +# clean pvc kubectl delete pvc --all +``` \ No newline at end of file diff --git a/charts/node/examples/local-rococo/asset-hub.yaml b/charts/node/examples/local-rococo/asset-hub.yaml new file mode 100644 index 00000000..58609684 --- /dev/null +++ b/charts/node/examples/local-rococo/asset-hub.yaml @@ -0,0 +1,76 @@ +image: + repository: parity/polkadot-parachain + tag: latest + pullPolicy: Always + +node: + chain: asset-hub-rococo-local + command: polkadot-parachain + role: collator + replicas: 2 + chainData: + pruning: 1000 + storageClass: "" + chainKeystore: + storageClass: "" + keys: + # This is Alice seed + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: aura + scheme: sr25519 + # ${HOSTNAME##*-} will be evaluated as the pod index, pod-0: //Alice, pod-1: //Bob + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + isParachain: true + collatorRelayChain: + chain: rococo-local + customChainspecUrl: http://bootnode:8080/chainspec.json + forceDownloadChainspec: true + chainData: + storageClass: "" + flags: + - "--allow-private-ipv4" + - "--discover-local" +ingress: + enabled: false + annotations: + kubernetes.io/ingress.class: TODO + external-dns.alpha.kubernetes.io/target: TODO + cert-manager.io/cluster-issuer: TODO + rules: + - host: parachain.example.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: parachain-node + port: + number: 9944 + tls: + - secretName: parachain.example.com + hosts: + - parachain.example.com + +extraInitContainers: + - name: dump-state-and-wasm + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: "{{ .Values.image.pullPolicy }}" + command: [ "/bin/bash" ] + args: + - -c + - | + if [ "${HOSTNAME##*-}" = "0" ]; then + echo "Parachain Id:" + {{ .Values.node.command }} build-spec --chain {{ .Values.node.chain }} | grep -E 'para_id|parachainId' + echo "Genesis head:" + {{ .Values.node.command }} export-genesis-state --chain {{ .Values.node.chain }} + echo "" + echo "Genesis wasm (validationCode) stored in /chain-data/genesis-wasm" + {{ .Values.node.command }} export-genesis-wasm --chain {{ .Values.node.chain }} > /chain-data/genesis-wasm + else + echo "Genesis head and wasm are in pod ${HOSTNAME%-*}-0" + fi + volumeMounts: + - mountPath: /chain-data + name: chain-data \ No newline at end of file diff --git a/charts/node/examples/local-rococo/bootnode.yaml b/charts/node/examples/local-rococo/bootnode.yaml new file mode 100644 index 00000000..4ccf826c --- /dev/null +++ b/charts/node/examples/local-rococo/bootnode.yaml @@ -0,0 +1,81 @@ +fullnameOverride: bootnode + +image: + repository: parity/polkadot + tag: latest + pullPolicy: Always + +node: + chain: rococo-local + customChainspec: true # see extraInitContainers, chainspec-generator + role: full + replicas: 1 + chainData: + pruning: archive + storageClass: "" + chainKeystore: + mountInMemory: + enabled: true + perNodeServices: + relayP2pService: + enabled: true + # to generate new key run: docker run parity/polkadot key generate-node-key + # 12D3KooWRpzRTivvJ5ySvgbFnPeEE6rDhitQKL1fFJvvBGhnenSk + customNodeKey: 80c30ac6ba927c6e5c0c9681aa9674f1d181d180853bcd3485cee9d18e931238 + flags: + - "--allow-private-ipv4" + - "--discover-local" + +ingress: + enabled: false + annotations: + kubernetes.io/ingress.class: TODO + external-dns.alpha.kubernetes.io/target: TODO + cert-manager.io/cluster-issuer: TODO + rules: + - host: local-rococo.example.com + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: bootnode + port: + number: 9944 + tls: + - secretName: local-rococo.example.com + hosts: + - local-rococo.example.com + +# Generate chainspec, and expose it as url +extraInitContainers: + - name: chainspec-generator + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + securityContext: + runAsUser: 0 + command: [ "/bin/bash" ] + args: + - -c + - | + apt update && apt install -y jq + {{ .Values.node.command }} build-spec --chain {{ .Values.node.chain }} > base.json + echo '{"bootNodes":["/dns/bootnode-0/tcp/30333/p2p/12D3KooWRpzRTivvJ5ySvgbFnPeEE6rDhitQKL1fFJvvBGhnenSk"]}' > override1.json + jq -s '.[0] * .[1]' base.json override1.json | sed 's/1e+18/1000000000000000000/' > plain.json + cut -c -256 plain.json + {{ .Values.node.command }} build-spec --chain plain.json --raw > chainspec.json + cp chainspec.json {{ .Values.node.customChainspecPath }} + volumeMounts: + - mountPath: /chain-data + name: chain-data +extraContainers: + - name: chainspec + image: nginxinc/nginx-unprivileged:stable + ports: + - containerPort: 8080 + name: web + volumeMounts: + - name: chain-data + subPath: chainspec.json + mountPath: /usr/share/nginx/html/chainspec.json + readOnly: true diff --git a/charts/node/examples/local-rococo/validators-alice-bob.yaml b/charts/node/examples/local-rococo/validators-alice-bob.yaml new file mode 100644 index 00000000..ef3db98d --- /dev/null +++ b/charts/node/examples/local-rococo/validators-alice-bob.yaml @@ -0,0 +1,51 @@ +image: + repository: parity/polkadot + tag: latest + pullPolicy: Always + +node: + chain: rococo-local + customChainspecUrl: http://bootnode:8080/chainspec.json + forceDownloadChainspec: true + role: authority + replicas: 2 + chainData: + pruning: 1000 + storageClass: "" + chainKeystore: + storageClass: "" + keys: + # This is Alice seed + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: gran + scheme: ed25519 + # ${HOSTNAME##*-} will be evaluated as the pod index, pod-0: //Alice, pod-1: //Bob + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: babe + scheme: sr25519 + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: imon + scheme: sr25519 + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: para + scheme: sr25519 + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: asgn + scheme: sr25519 + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: audi + scheme: sr25519 + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + - seed: "bottom drive obey lake curtain smoke basket hold race lonely fit walk" + type: beef + scheme: ecdsa + extraDerivation: '$([ "${HOSTNAME##*-}" = "0" ] && echo "//Alice" || echo "//Bob")' + flags: + - "--allow-private-ipv4" + - "--discover-local" + diff --git a/charts/node/templates/service.yaml b/charts/node/templates/service.yaml index 1d687a4a..48ff08cc 100644 --- a/charts/node/templates/service.yaml +++ b/charts/node/templates/service.yaml @@ -57,6 +57,9 @@ spec: name: http-ws-he targetPort: http-ws-he {{- end }} + {{- with .Values.node.serviceExtraPorts }} + {{- toYaml . | nindent 4 }} + {{- end }} --- {{range $i := until (max .Values.autoscaling.maxReplicas .Values.node.replicas | int) }} {{- if $.Values.node.perNodeServices.apiService.enabled }} diff --git a/charts/node/templates/statefulset.yaml b/charts/node/templates/statefulset.yaml index 8d2104d0..27d04b08 100644 --- a/charts/node/templates/statefulset.yaml +++ b/charts/node/templates/statefulset.yaml @@ -468,7 +468,7 @@ spec: name: chain-data {{- end }} {{- with .Values.extraInitContainers }} - {{- toYaml . | nindent 8 }} + {{- (tpl (toYaml .) $) | nindent 8 }} {{- end }} containers: - name: {{ .Values.node.chain | replace "_" "-" }} @@ -526,7 +526,7 @@ spec: --name=${POD_NAME} \ --base-path=/chain-data \ --keystore-path=/keystore \ - --chain={{ if .Values.node.customChainspecUrl }}{{ .Values.node.customChainspecPath }}{{ else }}${CHAIN}{{ end }} \ + --chain={{ if or .Values.node.customChainspecUrl .Values.node.customChainspec }}{{ .Values.node.customChainspecPath }}{{ else }}${CHAIN}{{ end }} \ {{- if or (eq .Values.node.role "authority") (eq .Values.node.role "validator") }} --validator \ {{- end }} @@ -621,8 +621,8 @@ spec: {{- if and .Values.node.isParachain (not .Values.node.collatorExternalRelayChain.enabled ) }} -- \ {{- if .Values.node.collatorLightClient.enabled }} - --chain={{ if .Values.node.collatorLightClient.relayChainCustomChainspecUrl }}{{ .Values.node.collatorLightClient.relayChainCustomChainspecPath }}{{ else }}{{.Values.node.collatorLightClient.relayChain}}{{ end }} - {{- else if .Values.node.collatorRelayChain.customChainspecUrl }} + --chain={{ if or .Values.node.collatorLightClient.relayChainCustomChainspecUrl .Values.node.collatorLightClient.relayChainCustomChainspec }}{{ .Values.node.collatorLightClient.relayChainCustomChainspecPath }}{{ else }}{{.Values.node.collatorLightClient.relayChain}}{{ end }} + {{- else if or .Values.node.collatorRelayChain.customChainspecUrl .Values.node.collatorRelayChain.customChainspec }} --chain={{ .Values.node.collatorRelayChain.customChainspecPath }} \ {{- end }} {{- if not .Values.node.collatorLightClient.enabled }} @@ -849,7 +849,7 @@ spec: {{- end }} {{- end }} {{- with .Values.extraContainers }} - {{- toYaml . | nindent 8 }} + {{- (tpl (toYaml .) $) | nindent 8 }} {{- end}} serviceAccountName: {{ $serviceAccountName }} securityContext: diff --git a/charts/node/values.yaml b/charts/node/values.yaml index 5c081637..1ef9726d 100644 --- a/charts/node/values.yaml +++ b/charts/node/values.yaml @@ -168,7 +168,8 @@ node: # -- Can be an int or a % maxUnavailable: 1 - + # -- Use the file defined in `node.customChainspecPath` as the chainspec. Ensure that the file is either mounted or generated with an init container. + customChainspec: false # -- Node may require custom name for chainspec file. # ref: moonbeam https://github.com/PureStake/moonbeam/issues/1104#issuecomment-996787548 # Note: path should start with /chain-data/ since this folder mount in init container download-chainspec. @@ -258,6 +259,8 @@ node: enabled: false # -- Name of the Relay Chain to connect relayChain: "" + # -- Use the file defined in `collatorLightClient.relayChainCustomChainspecPath` as the chainspec. Ensure that the file is either mounted or generated with an init container. + relayChainCustomChainspec: false # -- Path to the file containing the chainspec of the collator relay-chain relayChainCustomChainspecPath: "/chain-data/relay_chain_chainspec.json" # -- (string) URL to retrive custom chain spec @@ -267,6 +270,8 @@ node: # -- Name of the Relay Chain to connect chain: polkadot + # -- Use the file defined in `collatorRelayChain.customChainspecPath` as the chainspec. Ensure that the file is either mounted or generated with an init container. + customChainspec: false # -- Path to the file containing the chainspec of the collator relay-chain # Set to /relaychain-data to use additional volume customChainspecPath: "/relaychain-data/relay_chain_chainspec.json" @@ -440,7 +445,8 @@ node: # -- Annotations to add to the Service serviceAnnotations: {} - + # -- Additional ports on main Service + serviceExtraPorts: [] # -- Use deprecated ws/rpc flags. # ref: https://github.com/paritytech/substrate/pull/13384 legacyRpcFlags: false