Skip to content

Commit

Permalink
[node] Add additional ports on Per-Node Services (#301)
Browse files Browse the repository at this point in the history
* add extraPorts

* add targetPort name

* bump helm chart version
  • Loading branch information
BulatSaif authored Sep 22, 2023
1 parent 02c747b commit 743b34a
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: node
description: A Helm chart to deploy Substrate/Polkadot nodes
type: application
version: 5.3.2
version: 5.4.0
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
Expand Down
13 changes: 8 additions & 5 deletions charts/node/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.3.2](https://img.shields.io/badge/Version-5.3.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 5.4.0](https://img.shields.io/badge/Version-5.4.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

## Maintainers

Expand Down Expand Up @@ -299,7 +299,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","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":true,"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"},"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"]},"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 |
Expand Down Expand Up @@ -382,7 +382,7 @@ If you're running a collator node:
| node.keys | object | `{}` | Keys to use by the node. ref: https://wiki.polkadot.network/docs/learn-keys |
| node.legacyRpcFlags | bool | `false` | Use deprecated ws/rpc flags. ref: https://github.com/paritytech/substrate/pull/13384 |
| node.logLevels | list | `[]` | Log level |
| node.perNodeServices | object | `{"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"}}` | Configuration of individual services of the node |
| node.perNodeServices | object | `{"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"}}` | Configuration of individual services of the node |
| node.perNodeServices.apiService.annotations | object | `{}` | Annotations to add to the Service |
| node.perNodeServices.apiService.enabled | bool | `true` | If enabled, generic service to expose common node APIs |
| node.perNodeServices.apiService.externalDns | object | `{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300}` | External DNS configuration ref: https://github.com/kubernetes-sigs/external-dns |
Expand All @@ -391,13 +391,14 @@ If you're running a collator node:
| node.perNodeServices.apiService.externalDns.hostname | string | `"example.com"` | External DNS hostname |
| node.perNodeServices.apiService.externalDns.ttl | int | `300` | DNS record TTL |
| node.perNodeServices.apiService.externalTrafficPolicy | string | `"Cluster"` | Traffic policy |
| node.perNodeServices.apiService.extraPorts | list | `[]` | Additional ports on per node Services |
| node.perNodeServices.apiService.httpPort | int | `9933` | deprecated, use rpcPort |
| node.perNodeServices.apiService.prometheusPort | int | `9615` | Prometheus port |
| node.perNodeServices.apiService.relayChainPrometheusPort | int | `9625` | Relay chains Prometheus port |
| node.perNodeServices.apiService.rpcPort | int | `9944` | Port of the RPC endpoint |
| node.perNodeServices.apiService.type | string | `"ClusterIP"` | Service type |
| node.perNodeServices.apiService.wsPort | int | `9955` | deprecated, use rpcPort |
| node.perNodeServices.paraP2pService | object | `{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","port":30334,"type":"NodePort","ws":{"enabled":false,"port":30335}}` | If enabled, create service to expose parachain P2P |
| node.perNodeServices.paraP2pService | object | `{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"port":30334,"type":"NodePort","ws":{"enabled":false,"port":30335}}` | If enabled, create service to expose parachain P2P |
| node.perNodeServices.paraP2pService.annotations | object | `{}` | Annotations to add to the Service |
| node.perNodeServices.paraP2pService.enabled | bool | `false` | Enable exposing parachain P2P Service |
| node.perNodeServices.paraP2pService.externalDns | object | `{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300}` | External DNS configuration ref: https://github.com/kubernetes-sigs/external-dns |
Expand All @@ -406,18 +407,20 @@ If you're running a collator node:
| node.perNodeServices.paraP2pService.externalDns.hostname | string | `"example.com"` | External DNS hostname |
| node.perNodeServices.paraP2pService.externalDns.ttl | int | `300` | DNS record TTL |
| node.perNodeServices.paraP2pService.externalTrafficPolicy | string | `"Cluster"` | Traffic policy |
| node.perNodeServices.paraP2pService.extraPorts | list | `[]` | Additional ports on per node Services |
| node.perNodeServices.paraP2pService.port | int | `30334` | Port of the P2P endpoint (parachain) |
| node.perNodeServices.paraP2pService.type | string | `"NodePort"` | Service type |
| node.perNodeServices.paraP2pService.ws.enabled | bool | `false` | If enabled, additionally expose WebSocket port. Useful for bootnodes |
| node.perNodeServices.paraP2pService.ws.port | int | `30335` | WS port |
| node.perNodeServices.relayP2pService | object | `{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","port":30333,"type":"NodePort","ws":{"enabled":false,"port":30334}}` | If enabled, create service to expose relay chain P2P |
| node.perNodeServices.relayP2pService | object | `{"annotations":{},"enabled":false,"externalDns":{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300},"externalTrafficPolicy":"Cluster","extraPorts":[],"port":30333,"type":"NodePort","ws":{"enabled":false,"port":30334}}` | If enabled, create service to expose relay chain P2P |
| node.perNodeServices.relayP2pService.annotations | object | `{}` | Annotations to add to the Service |
| node.perNodeServices.relayP2pService.externalDns | object | `{"customPrefix":"","enabled":false,"hostname":"example.com","ttl":300}` | External DNS configuration ref: https://github.com/kubernetes-sigs/external-dns |
| node.perNodeServices.relayP2pService.externalDns.customPrefix | string | `""` | Custom prefix to use instead of prefixing the hostname with the name of the Pod |
| node.perNodeServices.relayP2pService.externalDns.enabled | bool | `false` | Enable External DNS |
| node.perNodeServices.relayP2pService.externalDns.hostname | string | `"example.com"` | External DNS hostname |
| node.perNodeServices.relayP2pService.externalDns.ttl | int | `300` | DNS record TTL |
| node.perNodeServices.relayP2pService.externalTrafficPolicy | string | `"Cluster"` | Traffic policy |
| node.perNodeServices.relayP2pService.extraPorts | list | `[]` | Additional ports on per node Services |
| node.perNodeServices.relayP2pService.port | int | `30333` | Port of the P2P endpoint (relay chain) |
| node.perNodeServices.relayP2pService.type | string | `"NodePort"` | Service type |
| node.perNodeServices.relayP2pService.ws.enabled | bool | `false` | If enabled, additionally expose WebSocket port. Useful for bootnodes |
Expand Down
30 changes: 26 additions & 4 deletions charts/node/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ spec:
{{- if $.Values.node.substrateApiSidecar.enabled }}
- port: 8080
name: api-sidecar
targetPort: api-sidecar
{{- end }}
{{- if $.Values.node.legacyRpcFlags }}
- port: 9933
name: http-rpc
targetPort: http-rpc
- port: 9944
name: websocket-rpc
targetPort: websocket-rpc
{{- else }}
- port: {{ $.Values.node.perNodeServices.apiService.rpcPort | int }}
name: rpc
targetPort: rpc
{{- /* Legacy RPC port, to be removed in the next major chart version */}}
- port: {{ $.Values.node.perNodeServices.apiService.httpPort | int }}
name: http-rpc
Expand All @@ -41,14 +45,17 @@ spec:
{{- if and $.Values.node.serviceMonitor.enabled (not $.Values.node.perNodeServices.apiService.enabled) }}
- port: {{ .Values.node.prometheus.port | int }}
name: prometheus
targetPort: prometheus
{{- end }}
{{- if and $.Values.node.collatorRelayChain.prometheus.enabled (not $.Values.node.perNodeServices.apiService.enabled) }}
- port: {{ $.Values.node.perNodeServices.apiService.relayChainPrometheusPort | int }}
name: prom-relaychain
targetPort: prom-relaychain
{{- end }}
{{- if or .Values.node.enableSidecarReadinessProbe .Values.node.enableSidecarLivenessProbe }}
- port: 8001
name: http-ws-health-exporter
targetPort: http-ws-health-exporter
{{- end }}
---
{{range $i := until (max .Values.autoscaling.maxReplicas .Values.node.replicas | int) }}
Expand Down Expand Up @@ -91,11 +98,14 @@ spec:
{{- if $.Values.node.legacyRpcFlags }}
- port: 9933
name: http-rpc
targetPort: http-rpc
- port: 9944
name: websocket-rpc
targetPort: websocket-rpc
{{- else }}
- port: {{ $.Values.node.perNodeServices.apiService.rpcPort | int }}
name: rpc
targetPort: rpc
{{- /* Legacy RPC port, to be removed in the next major chart version */}}
- port: {{ $.Values.node.perNodeServices.apiService.httpPort | int }}
name: http-rpc
Expand All @@ -107,13 +117,19 @@ spec:
{{- end }}
- port: {{ $.Values.node.perNodeServices.apiService.prometheusPort | int }}
name: prometheus
targetPort: prometheus
{{- if $.Values.node.collatorRelayChain.prometheus.enabled }}
- port: {{ $.Values.node.perNodeServices.apiService.relayChainPrometheusPort | int }}
name: prom-relaychain
targetPort: prom-relaychain
{{- end }}
{{- if $.Values.substrateApiSidecar.metrics.enabled }}
- port: {{ $.Values.substrateApiSidecar.metrics.port | int }}
name: prom-sidecar
targetPort: prom-sidecar
{{- end }}
{{- with $.Values.node.perNodeServices.apiService.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
---
Expand Down Expand Up @@ -152,11 +168,14 @@ spec:
ports:
- name: p2p
port: {{ $.Values.node.perNodeServices.relayP2pService.port | int }}
targetPort: 30333
targetPort: p2p
{{- if $.Values.node.perNodeServices.relayP2pService.ws.enabled }}
- name: ws
port: {{ $.Values.node.perNodeServices.relayP2pService.ws.port | int }}
targetPort: 30334
targetPort: p2p-ws
{{- end }}
{{- with $.Values.node.perNodeServices.relayP2pService.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
---
Expand Down Expand Up @@ -195,11 +214,14 @@ spec:
ports:
- name: p2p
port: {{ $.Values.node.perNodeServices.paraP2pService.port | int }}
targetPort: 30334
targetPort: para-p2p
{{- if $.Values.node.perNodeServices.paraP2pService.ws.enabled }}
- name: ws
port: {{ $.Values.node.perNodeServices.paraP2pService.ws.port | int }}
targetPort: 30335
targetPort: para-p2p-ws
{{- end }}
{{- with $.Values.node.perNodeServices.paraP2pService.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
---
Expand Down
Loading

0 comments on commit 743b34a

Please sign in to comment.