From 938aedc636f8c4baec73f952a55f54609a5617c9 Mon Sep 17 00:00:00 2001 From: Pierre Besson Date: Wed, 5 Jul 2023 11:30:22 +0200 Subject: [PATCH 1/4] add pvc retention policy config to node helm-chart --- charts/node/templates/statefulset.yaml | 4 ++++ charts/node/values.yaml | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/charts/node/templates/statefulset.yaml b/charts/node/templates/statefulset.yaml index 32e0641e..d16fe768 100644 --- a/charts/node/templates/statefulset.yaml +++ b/charts/node/templates/statefulset.yaml @@ -15,6 +15,10 @@ spec: matchLabels: {{- $selectorLabels | nindent 6 }} podManagementPolicy: {{ default "OrderedReady" .Values.node.podManagementPolicy }} + {{- if .Values.node.persistentVolumeClaimRetentionPolicy }} + persistentVolumeClaimRetentionPolicy: + {{- toYaml .Values.node.persistentVolumeClaimRetentionPolicy | nindent 4 }} + {{- end }} {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.node.replicas | int }} {{- end }} diff --git a/charts/node/values.yaml b/charts/node/values.yaml index e311812b..8a230ea1 100644 --- a/charts/node/values.yaml +++ b/charts/node/values.yaml @@ -524,7 +524,11 @@ node: # -- Pod management policy of stateful set. # ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies podManagementPolicy: - + # -- Persistent volume claim retention policy of stateful set (ie. whether to retain or delete the attached PVCs when scaling down or deleting the stateful set). + # ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention + persistentVolumeClaimRetentionPolicy: +# whenDeleted: Delete +# whenScaled: Delete tracing: # -- Enable Jaeger Agent as a sidecar enabled: false From e33727c1f0c408ae3cf6c1b8869b11ce2c7f829d Mon Sep 17 00:00:00 2001 From: Pierre Besson Date: Wed, 5 Jul 2023 11:40:07 +0200 Subject: [PATCH 2/4] add statefulset options to CI tests --- .github/workflows/pr.yaml | 5 +++-- chart-testing/kind-config.yaml | 5 +++++ charts/node/ci/kind-values.yaml | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 chart-testing/kind-config.yaml diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 8c0ad56a..a6d838ca 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -57,9 +57,10 @@ jobs: if: steps.list-changed.outputs.changed - name: Create kind cluster - uses: helm/kind-action@v1.4.0 + uses: helm/kind-action@v1.7.0 with: - node_image: kindest/node:v1.21.10 + node_image: kindest/node:v1.27.3 + config: chart-testing/kind-config.yaml if: steps.list-changed.outputs.changed - name: Replace secrets in Helm charts diff --git a/chart-testing/kind-config.yaml b/chart-testing/kind-config.yaml new file mode 100644 index 00000000..f7f7da16 --- /dev/null +++ b/chart-testing/kind-config.yaml @@ -0,0 +1,5 @@ +# https://kind.sigs.k8s.io/docs/user/configuration/ +kind: Cluster +apiVersion: kind.x-k8s.io/v1alpha4 +featureGates: + StatefulSetAutoDeletePVC: true diff --git a/charts/node/ci/kind-values.yaml b/charts/node/ci/kind-values.yaml index 618b4b8e..28c0bdff 100644 --- a/charts/node/ci/kind-values.yaml +++ b/charts/node/ci/kind-values.yaml @@ -9,5 +9,9 @@ node: storageClass: standard chainKeystore: storageClass: standard + podManagementPolicy: Parallel + persistentVolumeClaimRetentionPolicy: + whenDeleted: Delete + whenScaled: Delete image: tag: v0.9.43 From 2d122e0887e23f6e19d450105506d5b4c92c9b97 Mon Sep 17 00:00:00 2001 From: Pierre Besson Date: Wed, 5 Jul 2023 12:11:27 +0200 Subject: [PATCH 3/4] bump node chart version --- charts/node/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/node/Chart.yaml b/charts/node/Chart.yaml index ea86f877..a558c67e 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.0.1 +version: 5.1.0 maintainers: - name: Parity url: https://github.com/paritytech/helm-charts From b66b7f3893b8f8c3f2cf5413dfec7e3c724dd52b Mon Sep 17 00:00:00 2001 From: Pierre Besson Date: Wed, 5 Jul 2023 14:40:24 +0200 Subject: [PATCH 4/4] regenerate readme with helm-docs --- charts/node/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/charts/node/README.md b/charts/node/README.md index 2309fdc7..d89bcabb 100644 --- a/charts/node/README.md +++ b/charts/node/README.md @@ -13,7 +13,7 @@ This is intended behaviour. Make sure to run `git add -A` once again to stage ch # Substrate/Polkadot node helm chart -![Version: 5.0.1](https://img.shields.io/badge/Version-5.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 5.1.0](https://img.shields.io/badge/Version-5.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ## Maintainers @@ -290,7 +290,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"},"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":{}},"externalRelayChain":{"enabled":false,"relayChainRpcUrls":[]},"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","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","port":30334,"type":"NodePort","ws":{"enabled":false,"port":30335}},"relayP2pService":{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","port":30333,"type":"NodePort","ws":{"enabled":false,"port":30334}},"setPublicAddressToExternalIp":{"enabled":false,"ipRetrievalServiceUrl":"https://ifconfig.io"}},"persistGeneratedNodeKey":false,"podManagementPolicy":null,"prometheus":{"enabled":false,"port":9615},"replicas":1,"resources":{},"role":"full","serviceAnnotations":{},"serviceMonitor":{"enabled":false,"interval":"30s","metricRelabelings":[],"namespace":null,"relabelings":[],"scrapeTimeout":"10s","targetLabels":["node"]},"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"},"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":{}},"externalRelayChain":{"enabled":false,"relayChainRpcUrls":[]},"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","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","port":30334,"type":"NodePort","ws":{"enabled":false,"port":30335}},"relayP2pService":{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","port":30333,"type":"NodePort","ws":{"enabled":false,"port":30334}},"setPublicAddressToExternalIp":{"enabled":false,"ipRetrievalServiceUrl":"https://ifconfig.io"}},"persistGeneratedNodeKey":false,"persistentVolumeClaimRetentionPolicy":null,"podManagementPolicy":null,"prometheus":{"enabled":false,"port":9615},"replicas":1,"resources":{},"role":"full","serviceAnnotations":{},"serviceMonitor":{"enabled":false,"interval":"30s","metricRelabelings":[],"namespace":null,"relabelings":[],"scrapeTimeout":"10s","targetLabels":["node"]},"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 | @@ -411,6 +411,7 @@ If you're running a collator node: | node.perNodeServices.setPublicAddressToExternalIp.enabled | bool | `false` | If enabled, set `--public-addr` flag to be the NodePort p2p services external address | | node.perNodeServices.setPublicAddressToExternalIp.ipRetrievalServiceUrl | string | `"https://ifconfig.io"` | Web service to use for public IP retrieval | | node.persistGeneratedNodeKey | bool | `false` | If enabled, generate a persistent volume to use for the keys | +| node.persistentVolumeClaimRetentionPolicy | string | `nil` | Persistent volume claim retention policy of stateful set (ie. whether to retain or delete the attached PVCs when scaling down or deleting the stateful set). ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention | | node.podManagementPolicy | string | `nil` | Pod management policy of stateful set. ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#pod-management-policies | | node.prometheus | object | `{"enabled":false,"port":9615}` | Expose metrics via Prometheus format in /metrics endpoint. Passes the following args to the Polkadot binary: - "--prometheus-external" \ - "--prometheus-port {{ .Values.node.prometheus.port }}" | | node.prometheus.enabled | bool | `false` | Expose Prometheus metrics |