Skip to content

Commit

Permalink
[node] incorrect value for --public-addr if service type is LoadBalan…
Browse files Browse the repository at this point in the history
…cer (#356)

fix p2p port for loadbalancer
  • Loading branch information
BulatSaif authored Aug 26, 2024
1 parent ac8461e commit 67f3163
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 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.13.0
version: 5.13.1
maintainers:
- name: Parity
url: https://github.com/paritytech/helm-charts
Expand Down
2 changes: 1 addition & 1 deletion 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.13.0](https://img.shields.io/badge/Version-5.13.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 5.13.1](https://img.shields.io/badge/Version-5.13.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

## Overview
The Polkadot Helm Chart provides a convenient way to deploy and manage a Polkadot blockchain node in a Kubernetes cluster.
Expand Down
18 changes: 9 additions & 9 deletions charts/node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ spec:
- mountPath: /keystore
name: chain-keystore
{{- end }}
{{- if or (eq .Values.node.perNodeServices.relayP2pService.type "NodePort") (eq .Values.node.perNodeServices.paraP2pService.type "NodePort") .Values.node.perNodeServices.setPublicAddressToExternalIp.enabled }}
{{- if or (has .Values.node.perNodeServices.relayP2pService.type (list "NodePort" "LoadBalancer")) (has .Values.node.perNodeServices.paraP2pService.type (list "NodePort" "LoadBalancer")) .Values.node.perNodeServices.setPublicAddressToExternalIp.enabled }}
- name: retrieve-service-info
image: {{ .Values.initContainers.retrieveServiceInfo.image.repository }}:{{ .Values.initContainers.retrieveServiceInfo.image.tag }}
command: [ "/bin/sh" ]
Expand All @@ -441,7 +441,7 @@ spec:
- |
set -eu -o pipefail {{ if .Values.initContainers.retrieveServiceInfo.debug }}-x{{ end }}
POD_INDEX="${HOSTNAME##*-}"
{{- if and .Values.node.perNodeServices.relayP2pService.enabled (include "node.hasRelaychain" .) (eq .Values.node.perNodeServices.relayP2pService.type "NodePort") }}
{{- if and .Values.node.perNodeServices.relayP2pService.enabled (include "node.hasRelaychain" .) (has .Values.node.perNodeServices.relayP2pService.type (list "NodePort" "LoadBalancer") ) }}
RELAY_CHAIN_P2P_PORT="$(kubectl --namespace {{ .Release.Namespace }} get service {{ $fullname }}-${POD_INDEX}-relay-chain-p2p -o jsonpath='{.spec.ports[?(@.name=="p2p")].nodePort}')"
{{- if .Values.node.perNodeServices.relayP2pService.ws.enabled }}
RELAY_CHAIN_P2P_PORT_WS="$(kubectl --namespace {{ .Release.Namespace }} get service {{ $fullname }}-${POD_INDEX}-relay-chain-p2p -o jsonpath='{.spec.ports[?(@.name=="ws")].nodePort}')"
Expand All @@ -452,7 +452,7 @@ spec:
echo "Retrieved Kubernetes service node port from {{ $fullname }}-${POD_INDEX}-relay-chain-p2p"
echo "Saved ${RELAY_CHAIN_P2P_PORT} to /chain-data/relay_chain_p2p_port"
{{- end }}
{{- if and .Values.node.isParachain .Values.node.perNodeServices.paraP2pService.enabled (eq .Values.node.perNodeServices.paraP2pService.type "NodePort") }}
{{- if and .Values.node.isParachain .Values.node.perNodeServices.paraP2pService.enabled (has .Values.node.perNodeServices.paraP2pService.type (list "NodePort" "LoadBalancer")) }}
PARA_CHAIN_P2P_PORT="$(kubectl --namespace {{ .Release.Namespace }} get service {{ $fullname }}-${POD_INDEX}-para-chain-p2p -o jsonpath='{.spec.ports[0].nodePort}')"
echo "${PARA_CHAIN_P2P_PORT}" > /chain-data/para_chain_p2p_port
echo "Retrieved Kubernetes service node port from {{ $fullname }}-${POD_INDEX}-para-chain-p2p, saved ${PARA_CHAIN_P2P_PORT} to /chain-data/para_chain_p2p_port"
Expand Down Expand Up @@ -491,16 +491,16 @@ spec:
echo "EXTERNAL_IP=${EXTERNAL_IP}"
{{- end }}
{{- if (include "node.hasRelaychain" .) }}
{{- if and .Values.node.perNodeServices.relayP2pService.enabled (eq .Values.node.perNodeServices.relayP2pService.type "NodePort") }}
{{- /* For NodePort services, set the p2p port to the value saved in the retrieve-service-info init container */}}
{{- if and .Values.node.perNodeServices.relayP2pService.enabled (has .Values.node.perNodeServices.relayP2pService.type (list "NodePort" "LoadBalancer")) }}
{{- /* For NodePort and LoadBalancer services, set the p2p port to the value saved in the retrieve-service-info init container */}}
RELAY_CHAIN_P2P_PORT="$(cat /chain-data/relay_chain_p2p_port)"
echo "RELAY_CHAIN_P2P_PORT=${RELAY_CHAIN_P2P_PORT}"
{{- if .Values.node.perNodeServices.relayP2pService.ws.enabled }}
RELAY_CHAIN_P2P_PORT_WS="$(cat /chain-data/relay_chain_p2p_port_ws)"
echo "RELAY_CHAIN_P2P_PORT_WS=${RELAY_CHAIN_P2P_PORT_WS}"
{{- end }}
{{- else }}
{{- /* For non NodePort services, set the p2p port to value configured in `relayP2pService.port`*/}}
{{- /* For non NodePort/LoadBalancer services, set the p2p port to value configured in `relayP2pService.port`*/}}
RELAY_CHAIN_P2P_PORT={{ $.Values.node.perNodeServices.relayP2pService.port | quote }}
echo "RELAY_CHAIN_P2P_PORT=${RELAY_CHAIN_P2P_PORT}"
{{- if .Values.node.perNodeServices.relayP2pService.ws.enabled }}
Expand All @@ -510,16 +510,16 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.node.isParachain }}
{{- if and .Values.node.perNodeServices.paraP2pService.enabled (eq .Values.node.perNodeServices.paraP2pService.type "NodePort") }}
{{- /* For NodePort services, set the p2p port to the value saved in the retrieve-service-info init container */}}
{{- if and .Values.node.perNodeServices.paraP2pService.enabled (has .Values.node.perNodeServices.paraP2pService.type (list "NodePort" "LoadBalancer")) }}
{{- /* For NodePort and LoadBalancer services, set the p2p port to the value saved in the retrieve-service-info init container */}}
PARA_CHAIN_P2P_PORT="$(cat /chain-data/para_chain_p2p_port)"
echo "PARA_CHAIN_P2P_PORT=${PARA_CHAIN_P2P_PORT}"
{{- if .Values.node.perNodeServices.paraP2pService.ws.enabled }}
PARA_CHAIN_P2P_PORT_WS="$(cat /chain-data/para_chain_p2p_port_ws)"
echo "PARA_CHAIN_P2P_PORT_WS=${PARA_CHAIN_P2P_PORT_WS}"
{{- end }}
{{- else }}
{{- /* For non NodePort services, set the p2p port to value configured in `paraP2pService.port` */}}
{{- /* For non NodePort/LoadBalancer services, set the p2p port to value configured in `paraP2pService.port` */}}
PARA_CHAIN_P2P_PORT={{ $.Values.node.perNodeServices.paraP2pService.port | quote }}
echo "PARA_CHAIN_P2P_PORT=${PARA_CHAIN_P2P_PORT}"
{{- if .Values.node.perNodeServices.paraP2pService.ws.enabled }}
Expand Down

0 comments on commit 67f3163

Please sign in to comment.