From 745eb7d22d2ac00fcc1f7d034d91d3669b53e486 Mon Sep 17 00:00:00 2001 From: "graphops-renovate[bot]" <135047802+graphops-renovate[bot]@users.noreply.github.com> Date: Tue, 2 Sep 2025 10:07:26 +0000 Subject: [PATCH 1/8] feat(deps): update heimdall-v2 dependencies | datasource | package | from | to | | ---------- | --------------------- | ------ | ----- | | docker | 0xpolygon/heimdall-v2 | 0.2.17 | 0.3.0 | --- charts/heimdall-v2/Chart.yaml | 2 +- charts/heimdall-v2/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/heimdall-v2/Chart.yaml b/charts/heimdall-v2/Chart.yaml index d2b69454..bb7abcce 100644 --- a/charts/heimdall-v2/Chart.yaml +++ b/charts/heimdall-v2/Chart.yaml @@ -22,4 +22,4 @@ version: 0.0.4 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. # renovate: image=0xpolygon/heimdall-v2 -appVersion: "0.2.17" +appVersion: "0.3.0" diff --git a/charts/heimdall-v2/README.md b/charts/heimdall-v2/README.md index c5fcd456..ad0f87d7 100644 --- a/charts/heimdall-v2/README.md +++ b/charts/heimdall-v2/README.md @@ -2,7 +2,7 @@ Deploy and scale [Heimdall-v2](https://github.com/0xPolygon/heimdall-v2) inside Kubernetes with ease -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.0.4](https://img.shields.io/badge/Version-0.0.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.2.17](https://img.shields.io/badge/AppVersion-0.2.17-informational?style=flat-square) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.0.4](https://img.shields.io/badge/Version-0.0.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.3.0](https://img.shields.io/badge/AppVersion-0.3.0-informational?style=flat-square) ## Features From c9f5307de9b0d9dbbca13527744dd7fd7c15e791 Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Fri, 5 Sep 2025 14:22:21 +0100 Subject: [PATCH 2/8] feat(heimdall-v2): add LoadBalancer support --- charts/heimdall-v2/README.md | 6 ++ charts/heimdall-v2/README.md.gotmpl | 1 + charts/heimdall-v2/templates/_helpers.tpl | 56 +++++++++++++++++-- .../templates/heimdall/service.yaml | 34 ++++++++++- .../templates/heimdall/statefulset.yaml | 4 +- charts/heimdall-v2/values.yaml | 19 +++++++ 6 files changed, 112 insertions(+), 8 deletions(-) diff --git a/charts/heimdall-v2/README.md b/charts/heimdall-v2/README.md index ad0f87d7..d2a478c5 100644 --- a/charts/heimdall-v2/README.md +++ b/charts/heimdall-v2/README.md @@ -12,6 +12,7 @@ Deploy and scale [Heimdall-v2](https://github.com/0xPolygon/heimdall-v2) inside - Readiness checks to ensure traffic only hits `Pod`s that are healthy and ready to serve requests - Support for `PodMonitor`s to configure Prometheus to scrape metrics ([prometheus-operator](https://github.com/prometheus-operator/prometheus-operator)) - Support for configuring Grafana dashboards for polygon ([grafana](https://github.com/grafana/helm-charts/tree/main/charts/grafana)) + - P2P exposure via NodePort or LoadBalancer with matching container ports ## Quickstart @@ -72,6 +73,11 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | heimdall.image.repository | Image for Heimdall | string | `"0xpolygon/heimdall-v2"` | | heimdall.image.tag | Overrides the image tag | string | Chart.appVersion | | heimdall.nodeSelector | | object | `{}` | + | heimdall.p2p.port | P2P listen port used by BOTH the container and the P2P Service (regardless of Service type). Notes: - LoadBalancer: the Service exposes this port and targets the container on the same port - NodePort: the Service uses this value as the nodePort; ensure it is allowed by cluster policy and available - Choose a value in your cluster’s NodePort range (typically 30000–32767) | int | `31000` | + | heimdall.p2p.service.annotations | Annotations to add to the P2P Service (useful for cloud LBs) | object | `{}` | + | heimdall.p2p.service.enabled | Enable creation of a P2P Service | bool | `false` | + | heimdall.p2p.service.externalTrafficPolicy | External traffic policy for NodePort/LoadBalancer | string | `"Local"` | + | heimdall.p2p.service.type | Service type for P2P exposure (NodePort or LoadBalancer) | string | `"NodePort"` | | heimdall.p2pNodePort.enabled | Expose P2P port via NodePort | bool | `false` | | heimdall.p2pNodePort.initContainer.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` | | heimdall.p2pNodePort.initContainer.image.repository | Container image to fetch nodeport information | string | `"lachlanevenson/k8s-kubectl"` | diff --git a/charts/heimdall-v2/README.md.gotmpl b/charts/heimdall-v2/README.md.gotmpl index 510cd094..c6556bab 100644 --- a/charts/heimdall-v2/README.md.gotmpl +++ b/charts/heimdall-v2/README.md.gotmpl @@ -12,6 +12,7 @@ - Readiness checks to ensure traffic only hits `Pod`s that are healthy and ready to serve requests - Support for `PodMonitor`s to configure Prometheus to scrape metrics ([prometheus-operator](https://github.com/prometheus-operator/prometheus-operator)) - Support for configuring Grafana dashboards for polygon ([grafana](https://github.com/grafana/helm-charts/tree/main/charts/grafana)) + - P2P exposure via NodePort or LoadBalancer with matching container ports ## Quickstart diff --git a/charts/heimdall-v2/templates/_helpers.tpl b/charts/heimdall-v2/templates/_helpers.tpl index 4ad14749..81d98bb8 100644 --- a/charts/heimdall-v2/templates/_helpers.tpl +++ b/charts/heimdall-v2/templates/_helpers.tpl @@ -160,6 +160,51 @@ invalid network {{- end }} {{- end }} +{{/* +P2P helpers +*/}} +{{- define "heimdall.p2p.nodePortBase" -}} +{{- $v := . -}} +{{- if and $v.p2p $v.p2p.port -}} + {{- $v.p2p.port -}} +{{- else if and $v.p2pNodePort $v.p2pNodePort.port -}} + {{- $v.p2pNodePort.port -}} +{{- end -}} +{{- end -}} + +{{- define "heimdall.p2p.containerPort" -}} +{{- $v := . -}} +{{- if (include "heimdall.p2p.isNodePort" $v | trim | eq "true") -}} +{{- include "heimdall.p2p.nodePortBase" $v -}} +{{- else if and $v.p2p $v.p2p.port -}} +{{- $v.p2p.port -}} +{{- end -}} +{{- end -}} + +{{- define "heimdall.p2p.isNodePort" -}} +{{- $v := . -}} +{{- if and $v.p2p $v.p2p.service $v.p2p.service.enabled -}} + {{- if eq (default "NodePort" $v.p2p.service.type) "NodePort" -}} +true + {{- else -}} +false + {{- end -}} +{{- else if and $v.p2pNodePort $v.p2pNodePort.enabled -}} +true +{{- else -}} +false +{{- end -}} +{{- end -}} + +{{- define "heimdall.p2p.isLoadBalancer" -}} +{{- $v := . -}} +{{- if and $v.p2p $v.p2p.service $v.p2p.service.enabled (eq (default "" $v.p2p.service.type) "LoadBalancer") -}} +true +{{- else -}} +false +{{- end -}} +{{- end -}} + {{/* Generate the array of options for heimdall */}} @@ -167,10 +212,13 @@ Generate the array of options for heimdall {{- $args := list "--home=\"/storage\"" }} -{{- $args = concat $args (list (print "--rpc.laddr=" ( print "tcp://127.0.0.1:" ( index .service.ports "http-rpc" ) | quote ))) }} -{{- $args = concat $args (list (print "--api.address=" ( print "tcp://127.0.0.1:" ( index .service.ports "http-api" ) | quote ))) }} -{{- if .p2pNodePort.enabled }} -{{- $args = concat $args (list (print "--p2p.laddr=" ( print "tcp://0.0.0.0:" .p2pNodePort.port | quote ))) }} +{{- $args = concat $args (list (print "--rpc.laddr=" ( print "tcp://0.0.0.0:" ( index .service.ports "http-rpc" ) | quote ))) }} +{{- $args = concat $args (list (print "--api.address=" ( print "tcp://0.0.0.0:" ( index .service.ports "http-api" ) | quote ))) }} +{{- if (include "heimdall.p2p.isNodePort" . | trim | eq "true") }} +{{- $args = concat $args (list (print "--p2p.laddr=" ( print "tcp://0.0.0.0:" ( include "heimdall.p2p.nodePortBase" . ) | quote ))) }} +{{- $args = concat $args (list (print "--seeds=" ( include "heimdall.seeds" . | quote ) )) }} +{{- else if (include "heimdall.p2p.isLoadBalancer" . | trim | eq "true") }} +{{- $args = concat $args (list (print "--p2p.laddr=" ( print "tcp://0.0.0.0:" ( include "heimdall.p2p.containerPort" . ) | quote ))) }} {{- $args = concat $args (list (print "--seeds=" ( include "heimdall.seeds" . | quote ) )) }} {{- end }} {{- with .config }} diff --git a/charts/heimdall-v2/templates/heimdall/service.yaml b/charts/heimdall-v2/templates/heimdall/service.yaml index b73cf94d..49ce11fc 100644 --- a/charts/heimdall-v2/templates/heimdall/service.yaml +++ b/charts/heimdall-v2/templates/heimdall/service.yaml @@ -51,8 +51,9 @@ spec: {{- include "heimdall.selectorLabels" . | nindent 4 }} {{- $componentLabel | nindent 4 }} {{- end }} -{{- if $values.p2pNodePort.enabled }} -{{- $port := $values.p2pNodePort.port }} +{{/* P2P Service: NodePort (legacy or new style) */}} +{{- if (include "heimdall.p2p.isNodePort" $values | trim | eq "true") }} +{{- $port := (include "heimdall.p2p.nodePortBase" $values) | int }} --- apiVersion: v1 kind: Service @@ -76,3 +77,32 @@ spec: {{- include "heimdall.selectorLabels" . | nindent 4 }} statefulset.kubernetes.io/pod-name: "{{ include "heimdall.fullname" $ }}-{{ $componentName }}-0" {{- end }} + +{{/* P2P Service: LoadBalancer */}} +{{- if (include "heimdall.p2p.isLoadBalancer" $values | trim | eq "true") }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "heimdall.fullname" . }}-{{ $componentName }}-p2p + labels: + {{- include "heimdall.labels" . | nindent 4 }} + {{- $componentLabel | nindent 4 }} + {{- with $values.p2p.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + type: LoadBalancer + {{- if $values.p2p.service.externalTrafficPolicy }} + externalTrafficPolicy: {{ $values.p2p.service.externalTrafficPolicy }} + {{- end }} + ports: + - name: tcp-p2p + port: {{ include "heimdall.p2p.containerPort" $values }} + protocol: TCP + targetPort: tcp-p2p + selector: + {{- include "heimdall.selectorLabels" . | nindent 4 }} + {{- $componentLabel | nindent 4 }} +{{- end }} diff --git a/charts/heimdall-v2/templates/heimdall/statefulset.yaml b/charts/heimdall-v2/templates/heimdall/statefulset.yaml index 5b8dc643..12d7ec25 100644 --- a/charts/heimdall-v2/templates/heimdall/statefulset.yaml +++ b/charts/heimdall-v2/templates/heimdall/statefulset.yaml @@ -217,9 +217,9 @@ spec: - name: http-metrics containerPort: {{ index $values.service.ports "http-metrics" }} protocol: TCP - {{- if $values.p2pNodePort.enabled }} + {{- if or (include "heimdall.p2p.isNodePort" $values | trim | eq "true") (include "heimdall.p2p.isLoadBalancer" $values | trim | eq "true") }} - name: tcp-p2p - containerPort: {{ $values.p2pNodePort.port }} + containerPort: {{ include "heimdall.p2p.containerPort" $values }} protocol: TCP {{- end }} volumeMounts: diff --git a/charts/heimdall-v2/values.yaml b/charts/heimdall-v2/values.yaml index d1cd4041..2e1d39ac 100644 --- a/charts/heimdall-v2/values.yaml +++ b/charts/heimdall-v2/values.yaml @@ -154,5 +154,24 @@ heimdall: # -- Container pull policy pullPolicy: IfNotPresent + # P2P configuration (supersedes p2pNodePort) + p2p: + # -- P2P listen port used by BOTH the container and the P2P Service (regardless of Service type). + # Notes: + # - LoadBalancer: the Service exposes this port and targets the container on the same port + # - NodePort: the Service uses this value as the nodePort; ensure it is allowed by cluster policy and available + # - Choose a value in your cluster’s NodePort range (typically 30000–32767) + port: 31000 + service: + # -- Enable creation of a P2P Service + enabled: false + # -- Service type for P2P exposure (NodePort or LoadBalancer) + type: NodePort + # -- Annotations to add to the P2P Service (useful for cloud LBs) + annotations: {} + # -- External traffic policy for NodePort/LoadBalancer + externalTrafficPolicy: Local + # (No separate nodePort field; `p2p.port` is used for both Service and container.) + # -- Enable a readiness probe that checks if heimdall is synced readyAfterSync: false From 6082a7585532d82346fbd756a77b93834db4e05f Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Fri, 5 Sep 2025 18:38:04 +0100 Subject: [PATCH 3/8] feat: allow specifying IP --- charts/heimdall-v2/README.md | 3 +++ charts/heimdall-v2/templates/_helpers.tpl | 3 +++ .../heimdall-v2/templates/heimdall/service.yaml | 15 +++++++++++++++ .../templates/heimdall/statefulset.yaml | 13 +++++++++++++ charts/heimdall-v2/values.yaml | 7 ++++++- 5 files changed, 40 insertions(+), 1 deletion(-) diff --git a/charts/heimdall-v2/README.md b/charts/heimdall-v2/README.md index d2a478c5..620dd308 100644 --- a/charts/heimdall-v2/README.md +++ b/charts/heimdall-v2/README.md @@ -76,7 +76,10 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | heimdall.p2p.port | P2P listen port used by BOTH the container and the P2P Service (regardless of Service type). Notes: - LoadBalancer: the Service exposes this port and targets the container on the same port - NodePort: the Service uses this value as the nodePort; ensure it is allowed by cluster policy and available - Choose a value in your cluster’s NodePort range (typically 30000–32767) | int | `31000` | | heimdall.p2p.service.annotations | Annotations to add to the P2P Service (useful for cloud LBs) | object | `{}` | | heimdall.p2p.service.enabled | Enable creation of a P2P Service | bool | `false` | + | heimdall.p2p.service.externalIPs | Fixed external IPs to bind the Service to (works for NodePort or LoadBalancer; requires upstream routing) | list | `[]` | | heimdall.p2p.service.externalTrafficPolicy | External traffic policy for NodePort/LoadBalancer | string | `"Local"` | + | heimdall.p2p.service.loadBalancerIP | When using a LoadBalancer and your cloud supports it, set a specific LB IP | string | `""` | + | heimdall.p2p.service.loadBalancerSourceRanges | Restrict which source ranges can access the LoadBalancer (CIDRs) | list | `[]` | | heimdall.p2p.service.type | Service type for P2P exposure (NodePort or LoadBalancer) | string | `"NodePort"` | | heimdall.p2pNodePort.enabled | Expose P2P port via NodePort | bool | `false` | | heimdall.p2pNodePort.initContainer.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` | diff --git a/charts/heimdall-v2/templates/_helpers.tpl b/charts/heimdall-v2/templates/_helpers.tpl index 81d98bb8..b2099f52 100644 --- a/charts/heimdall-v2/templates/_helpers.tpl +++ b/charts/heimdall-v2/templates/_helpers.tpl @@ -220,6 +220,9 @@ Generate the array of options for heimdall {{- else if (include "heimdall.p2p.isLoadBalancer" . | trim | eq "true") }} {{- $args = concat $args (list (print "--p2p.laddr=" ( print "tcp://0.0.0.0:" ( include "heimdall.p2p.containerPort" . ) | quote ))) }} {{- $args = concat $args (list (print "--seeds=" ( include "heimdall.seeds" . | quote ) )) }} + {{- if and .p2p .p2p.service .p2p.service.loadBalancerIP }} + {{- $args = concat $args (list (print "--p2p.external_address=" ( print (printf "tcp://%s:%v" .p2p.service.loadBalancerIP (include "heimdall.p2p.containerPort" .)) | quote ))) }} + {{- end }} {{- end }} {{- with .config }} {{- $args = concat $args (list (print "--chain=" ( print .network | quote ) )) }} diff --git a/charts/heimdall-v2/templates/heimdall/service.yaml b/charts/heimdall-v2/templates/heimdall/service.yaml index 49ce11fc..c799c20f 100644 --- a/charts/heimdall-v2/templates/heimdall/service.yaml +++ b/charts/heimdall-v2/templates/heimdall/service.yaml @@ -67,6 +67,10 @@ metadata: spec: type: NodePort externalTrafficPolicy: Local + {{- with $values.p2p.service.externalIPs }} + externalIPs: + {{- toYaml . | nindent 2 }} + {{- end }} ports: - name: tcp-p2p port: {{ $port }} @@ -97,6 +101,17 @@ spec: {{- if $values.p2p.service.externalTrafficPolicy }} externalTrafficPolicy: {{ $values.p2p.service.externalTrafficPolicy }} {{- end }} + {{- with $values.p2p.service.loadBalancerIP }} + loadBalancerIP: {{ . }} + {{- end }} + {{- with $values.p2p.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{- toYaml . | nindent 2 }} + {{- end }} + {{- with $values.p2p.service.externalIPs }} + externalIPs: + {{- toYaml . | nindent 2 }} + {{- end }} ports: - name: tcp-p2p port: {{ include "heimdall.p2p.containerPort" $values }} diff --git a/charts/heimdall-v2/templates/heimdall/statefulset.yaml b/charts/heimdall-v2/templates/heimdall/statefulset.yaml index 12d7ec25..987839e4 100644 --- a/charts/heimdall-v2/templates/heimdall/statefulset.yaml +++ b/charts/heimdall-v2/templates/heimdall/statefulset.yaml @@ -129,6 +129,15 @@ spec: else sed -iE "s#^prometheus[[:space:]]*=.*#prometheus = false#" config.toml fi + + # Set external_address to advertise if provided + if [ -n "${EXTERNAL_P2P_ADDRESS:-}" ]; then + if grep -q "^external_address" config.toml; then + sed -iE "s#^external_address[[:space:]]*=.*#external_address = \"${EXTERNAL_P2P_ADDRESS}\"#" config.toml + else + printf '\nexternal_address = "%s"\n' "${EXTERNAL_P2P_ADDRESS}" >> config.toml + fi + fi volumeMounts: - name: storage mountPath: /storage @@ -147,6 +156,10 @@ spec: {{- else }} value: {{ .Release.Name }} {{- end }} + {{- if and $values.p2p $values.p2p.service (eq $values.p2p.service.type "LoadBalancer") $values.p2p.service.loadBalancerIP }} + - name: EXTERNAL_P2P_ADDRESS + value: {{ printf "tcp://%s:%v" $values.p2p.service.loadBalancerIP (include "heimdall.p2p.containerPort" $values) | quote }} + {{- end }} {{- if $values.config.downloadGenesis.enabled }} - name: GENESIS value: "true" diff --git a/charts/heimdall-v2/values.yaml b/charts/heimdall-v2/values.yaml index 2e1d39ac..e2a42d0b 100644 --- a/charts/heimdall-v2/values.yaml +++ b/charts/heimdall-v2/values.yaml @@ -171,7 +171,12 @@ heimdall: annotations: {} # -- External traffic policy for NodePort/LoadBalancer externalTrafficPolicy: Local - # (No separate nodePort field; `p2p.port` is used for both Service and container.) + # -- Fixed external IPs to bind the Service to (works for NodePort or LoadBalancer; requires upstream routing) + externalIPs: [] + # -- When using a LoadBalancer and your cloud supports it, set a specific LB IP + loadBalancerIP: "" + # -- Restrict which source ranges can access the LoadBalancer (CIDRs) + loadBalancerSourceRanges: [] # -- Enable a readiness probe that checks if heimdall is synced readyAfterSync: false From 51c13adc71039f34ec00a9d98fe3efd101d1eec3 Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Fri, 5 Sep 2025 21:05:35 +0100 Subject: [PATCH 4/8] feat: add labels to LoadBalancer service --- charts/heimdall-v2/README.md | 1 + charts/heimdall-v2/templates/heimdall/service.yaml | 6 ++++++ charts/heimdall-v2/values.yaml | 2 ++ 3 files changed, 9 insertions(+) diff --git a/charts/heimdall-v2/README.md b/charts/heimdall-v2/README.md index 620dd308..e73c9f64 100644 --- a/charts/heimdall-v2/README.md +++ b/charts/heimdall-v2/README.md @@ -78,6 +78,7 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | heimdall.p2p.service.enabled | Enable creation of a P2P Service | bool | `false` | | heimdall.p2p.service.externalIPs | Fixed external IPs to bind the Service to (works for NodePort or LoadBalancer; requires upstream routing) | list | `[]` | | heimdall.p2p.service.externalTrafficPolicy | External traffic policy for NodePort/LoadBalancer | string | `"Local"` | + | heimdall.p2p.service.labels | Additional labels to add to the P2P Service | object | `{}` | | heimdall.p2p.service.loadBalancerIP | When using a LoadBalancer and your cloud supports it, set a specific LB IP | string | `""` | | heimdall.p2p.service.loadBalancerSourceRanges | Restrict which source ranges can access the LoadBalancer (CIDRs) | list | `[]` | | heimdall.p2p.service.type | Service type for P2P exposure (NodePort or LoadBalancer) | string | `"NodePort"` | diff --git a/charts/heimdall-v2/templates/heimdall/service.yaml b/charts/heimdall-v2/templates/heimdall/service.yaml index c799c20f..ac5b5771 100644 --- a/charts/heimdall-v2/templates/heimdall/service.yaml +++ b/charts/heimdall-v2/templates/heimdall/service.yaml @@ -64,6 +64,9 @@ metadata: {{- $componentLabel | nindent 4 }} pod: {{ include "heimdall.fullname" . }}-{{ $componentName }}-0 type: p2p # this label is used by the initContainer to select this service + {{- with $values.p2p.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} spec: type: NodePort externalTrafficPolicy: Local @@ -92,6 +95,9 @@ metadata: labels: {{- include "heimdall.labels" . | nindent 4 }} {{- $componentLabel | nindent 4 }} + {{- with $values.p2p.service.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} {{- with $values.p2p.service.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/charts/heimdall-v2/values.yaml b/charts/heimdall-v2/values.yaml index e2a42d0b..59b40bb9 100644 --- a/charts/heimdall-v2/values.yaml +++ b/charts/heimdall-v2/values.yaml @@ -169,6 +169,8 @@ heimdall: type: NodePort # -- Annotations to add to the P2P Service (useful for cloud LBs) annotations: {} + # -- Additional labels to add to the P2P Service + labels: {} # -- External traffic policy for NodePort/LoadBalancer externalTrafficPolicy: Local # -- Fixed external IPs to bind the Service to (works for NodePort or LoadBalancer; requires upstream routing) From 6c4681e53553d3be2179a5a0599a11f8f6767b8b Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Fri, 5 Sep 2025 21:15:23 +0100 Subject: [PATCH 5/8] fix: wrong flag --- charts/heimdall-v2/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/heimdall-v2/templates/_helpers.tpl b/charts/heimdall-v2/templates/_helpers.tpl index b2099f52..988fefc2 100644 --- a/charts/heimdall-v2/templates/_helpers.tpl +++ b/charts/heimdall-v2/templates/_helpers.tpl @@ -221,7 +221,7 @@ Generate the array of options for heimdall {{- $args = concat $args (list (print "--p2p.laddr=" ( print "tcp://0.0.0.0:" ( include "heimdall.p2p.containerPort" . ) | quote ))) }} {{- $args = concat $args (list (print "--seeds=" ( include "heimdall.seeds" . | quote ) )) }} {{- if and .p2p .p2p.service .p2p.service.loadBalancerIP }} - {{- $args = concat $args (list (print "--p2p.external_address=" ( print (printf "tcp://%s:%v" .p2p.service.loadBalancerIP (include "heimdall.p2p.containerPort" .)) | quote ))) }} + {{- $args = concat $args (list (print "--p2p.external-address=" ( print (printf "tcp://%s:%v" .p2p.service.loadBalancerIP (include "heimdall.p2p.containerPort" .)) | quote ))) }} {{- end }} {{- end }} {{- with .config }} From 6e4296fff49f2bfc2e93fc6cad768f362b90e3a2 Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Fri, 5 Sep 2025 21:46:30 +0100 Subject: [PATCH 6/8] feat: separate different IPs --- charts/heimdall-v2/README.md | 1 + charts/heimdall-v2/templates/_helpers.tpl | 10 +++++++--- charts/heimdall-v2/templates/heimdall/statefulset.yaml | 7 ++++++- charts/heimdall-v2/values.yaml | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/charts/heimdall-v2/README.md b/charts/heimdall-v2/README.md index e73c9f64..33e18706 100644 --- a/charts/heimdall-v2/README.md +++ b/charts/heimdall-v2/README.md @@ -74,6 +74,7 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | heimdall.image.tag | Overrides the image tag | string | Chart.appVersion | | heimdall.nodeSelector | | object | `{}` | | heimdall.p2p.port | P2P listen port used by BOTH the container and the P2P Service (regardless of Service type). Notes: - LoadBalancer: the Service exposes this port and targets the container on the same port - NodePort: the Service uses this value as the nodePort; ensure it is allowed by cluster policy and available - Choose a value in your cluster’s NodePort range (typically 30000–32767) | int | `31000` | + | heimdall.p2p.service.advertiseIP | IP address to explicitly advertise on the P2P network (overrides autodetection and LB IP) | string | `""` | | heimdall.p2p.service.annotations | Annotations to add to the P2P Service (useful for cloud LBs) | object | `{}` | | heimdall.p2p.service.enabled | Enable creation of a P2P Service | bool | `false` | | heimdall.p2p.service.externalIPs | Fixed external IPs to bind the Service to (works for NodePort or LoadBalancer; requires upstream routing) | list | `[]` | diff --git a/charts/heimdall-v2/templates/_helpers.tpl b/charts/heimdall-v2/templates/_helpers.tpl index 988fefc2..24a21ac1 100644 --- a/charts/heimdall-v2/templates/_helpers.tpl +++ b/charts/heimdall-v2/templates/_helpers.tpl @@ -220,9 +220,13 @@ Generate the array of options for heimdall {{- else if (include "heimdall.p2p.isLoadBalancer" . | trim | eq "true") }} {{- $args = concat $args (list (print "--p2p.laddr=" ( print "tcp://0.0.0.0:" ( include "heimdall.p2p.containerPort" . ) | quote ))) }} {{- $args = concat $args (list (print "--seeds=" ( include "heimdall.seeds" . | quote ) )) }} - {{- if and .p2p .p2p.service .p2p.service.loadBalancerIP }} - {{- $args = concat $args (list (print "--p2p.external-address=" ( print (printf "tcp://%s:%v" .p2p.service.loadBalancerIP (include "heimdall.p2p.containerPort" .)) | quote ))) }} - {{- end }} +{{- end }} + +{{- /* Prefer an explicit advertiseIP over LB IP for external-address */ -}} +{{- if and .p2p .p2p.service .p2p.service.advertiseIP }} +{{- $args = concat $args (list (print "--p2p.external-address=" ( print (printf "tcp://%s:%v" .p2p.service.advertiseIP (include "heimdall.p2p.containerPort" .)) | quote ))) }} +{{- else if and .p2p .p2p.service (eq .p2p.service.type "LoadBalancer") .p2p.service.loadBalancerIP }} +{{- $args = concat $args (list (print "--p2p.external-address=" ( print (printf "tcp://%s:%v" .p2p.service.loadBalancerIP (include "heimdall.p2p.containerPort" .)) | quote ))) }} {{- end }} {{- with .config }} {{- $args = concat $args (list (print "--chain=" ( print .network | quote ) )) }} diff --git a/charts/heimdall-v2/templates/heimdall/statefulset.yaml b/charts/heimdall-v2/templates/heimdall/statefulset.yaml index 987839e4..ae798aab 100644 --- a/charts/heimdall-v2/templates/heimdall/statefulset.yaml +++ b/charts/heimdall-v2/templates/heimdall/statefulset.yaml @@ -156,9 +156,14 @@ spec: {{- else }} value: {{ .Release.Name }} {{- end }} - {{- if and $values.p2p $values.p2p.service (eq $values.p2p.service.type "LoadBalancer") $values.p2p.service.loadBalancerIP }} + {{- if and $values.p2p $values.p2p.service }} + {{- if $values.p2p.service.advertiseIP }} + - name: EXTERNAL_P2P_ADDRESS + value: {{ printf "tcp://%s:%v" $values.p2p.service.advertiseIP (include "heimdall.p2p.containerPort" $values) | quote }} + {{- else if and (eq $values.p2p.service.type "LoadBalancer") $values.p2p.service.loadBalancerIP }} - name: EXTERNAL_P2P_ADDRESS value: {{ printf "tcp://%s:%v" $values.p2p.service.loadBalancerIP (include "heimdall.p2p.containerPort" $values) | quote }} + {{- end }} {{- end }} {{- if $values.config.downloadGenesis.enabled }} - name: GENESIS diff --git a/charts/heimdall-v2/values.yaml b/charts/heimdall-v2/values.yaml index 59b40bb9..fc6e438b 100644 --- a/charts/heimdall-v2/values.yaml +++ b/charts/heimdall-v2/values.yaml @@ -173,6 +173,8 @@ heimdall: labels: {} # -- External traffic policy for NodePort/LoadBalancer externalTrafficPolicy: Local + # -- IP address to explicitly advertise on the P2P network (overrides autodetection and LB IP) + advertiseIP: "" # -- Fixed external IPs to bind the Service to (works for NodePort or LoadBalancer; requires upstream routing) externalIPs: [] # -- When using a LoadBalancer and your cloud supports it, set a specific LB IP From 7243203d59fa546e3e42ed1a9477c9b2ce6674c4 Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Sat, 6 Sep 2025 23:40:52 +0100 Subject: [PATCH 7/8] feat: support grafanadashboard CRD --- charts/heimdall-v2/README.md | 8 +++ .../templates/dashboards-operator.yaml | 52 +++++++++++++++++++ charts/heimdall-v2/values.yaml | 22 ++++++++ 3 files changed, 82 insertions(+) create mode 100644 charts/heimdall-v2/templates/dashboards-operator.yaml diff --git a/charts/heimdall-v2/README.md b/charts/heimdall-v2/README.md index 33e18706..860d6694 100644 --- a/charts/heimdall-v2/README.md +++ b/charts/heimdall-v2/README.md @@ -48,6 +48,14 @@ We do not recommend that you upgrade the application by overriding `image.tag`. | grafana.dashboards | Enable creation of Grafana dashboards. [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart) must be configured to search this namespace, see `sidecar.dashboards.searchNamespace` | bool | `false` | | grafana.dashboardsConfigMapLabel | Must match `sidecar.dashboards.label` value for the [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart) | string | `"grafana_dashboard"` | | grafana.dashboardsConfigMapLabelValue | Must match `sidecar.dashboards.labelValue` value for the [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart) | string | `""` | + | grafana.operatorDashboards | Create GrafanaDashboard CRDs via Grafana Operator from files in `dashboards/` | object | `{"allowCrossNamespaceImport":false,"annotations":{},"enabled":false,"extraSpec":{},"folder":"","folderUID":"","instanceSelector":{"matchLabels":{}},"labels":{},"namespace":"","resyncPeriod":"","suspend":false,"uid":""}` | + | grafana.operatorDashboards.allowCrossNamespaceImport | Allow matching Grafana instances outside current namespace | bool | `false` | + | grafana.operatorDashboards.extraSpec | Additional spec fields to merge into GrafanaDashboard.spec | object | `{}` | + | grafana.operatorDashboards.folder | Optional folder metadata | string | `""` | + | grafana.operatorDashboards.instanceSelector | Selector to match Grafana instances managed by the operator | object | `{"matchLabels":{}}` | + | grafana.operatorDashboards.labels | Extra labels and annotations on the GrafanaDashboard resources | object | `{}` | + | grafana.operatorDashboards.namespace | Optional target namespace for the GrafanaDashboard CRDs (defaults to release namespace) | string | `""` | + | grafana.operatorDashboards.resyncPeriod | Operator sync behavior | string | `""` | | heimdall.affinity | | object | `{}` | | heimdall.affinityPresets.antiAffinityByHostname | Configure anti-affinity rules to prevent multiple Heimdall instances on the same host | bool | `true` | | heimdall.config.borRpcUrl | Bor RPC address | string | `""` | diff --git a/charts/heimdall-v2/templates/dashboards-operator.yaml b/charts/heimdall-v2/templates/dashboards-operator.yaml new file mode 100644 index 00000000..900ec303 --- /dev/null +++ b/charts/heimdall-v2/templates/dashboards-operator.yaml @@ -0,0 +1,52 @@ +{{- $g := $.Values.grafana -}} +{{- if and $g.operatorDashboards $g.operatorDashboards.enabled -}} +{{- $op := $g.operatorDashboards -}} +{{- $files := .Files.Glob "dashboards/*" -}} +{{- range $path, $_ := $files }} +--- +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + name: {{ include "heimdall.fullname" $ }}-{{ base $path | replace "." "-" | trunc 63 | trimSuffix "-" }} + {{- with $op.namespace }} + {{- if . }} + namespace: {{ . }} + {{- end }} + {{- end }} + labels: + {{- include "heimdall.labels" $ | nindent 4 }} + {{- with $op.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $op.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + allowCrossNamespaceImport: {{ default false $op.allowCrossNamespaceImport }} + {{- with $op.instanceSelector }} + instanceSelector: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with $op.folder }} + folder: {{ . }} + {{- end }} + {{- with $op.folderUID }} + folderUID: {{ . }} + {{- end }} + {{- with $op.uid }} + uid: {{ . }} + {{- end }} + {{- with $op.resyncPeriod }} + resyncPeriod: {{ . }} + {{- end }} + {{- if hasKey $op "suspend" }} + suspend: {{ $op.suspend }} + {{- end }} + {{- with $op.extraSpec }} + {{- toYaml . | nindent 2 }} + {{- end }} + json: | + {{- $.Files.Get $path | nindent 4 }} +{{- end }} +{{- end }} diff --git a/charts/heimdall-v2/values.yaml b/charts/heimdall-v2/values.yaml index fc6e438b..13c0e680 100644 --- a/charts/heimdall-v2/values.yaml +++ b/charts/heimdall-v2/values.yaml @@ -29,6 +29,28 @@ grafana: dashboardsConfigMapLabel: grafana_dashboard # -- Must match `sidecar.dashboards.labelValue` value for the [Grafana chart](https://github.com/grafana/helm-charts/tree/main/charts/grafana#grafana-helm-chart) dashboardsConfigMapLabelValue: "" + # -- Create GrafanaDashboard CRDs via Grafana Operator from files in `dashboards/` + operatorDashboards: + enabled: false + # -- Optional target namespace for the GrafanaDashboard CRDs (defaults to release namespace) + namespace: "" + # -- Extra labels and annotations on the GrafanaDashboard resources + labels: {} + annotations: {} + # -- Selector to match Grafana instances managed by the operator + instanceSelector: + matchLabels: {} + # -- Allow matching Grafana instances outside current namespace + allowCrossNamespaceImport: false + # -- Optional folder metadata + folder: "" + folderUID: "" + uid: "" + # -- Operator sync behavior + resyncPeriod: "" + suspend: false + # -- Additional spec fields to merge into GrafanaDashboard.spec + extraSpec: {} heimdall: From 9f67e8d6b1b2926d80c0b10afdee96aa934b6e54 Mon Sep 17 00:00:00 2001 From: Carlos Jorge Date: Tue, 16 Sep 2025 13:33:14 +0100 Subject: [PATCH 8/8] chore(heimdall-v2): bump version --- charts/heimdall-v2/Chart.yaml | 2 +- charts/heimdall-v2/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/heimdall-v2/Chart.yaml b/charts/heimdall-v2/Chart.yaml index bb7abcce..cf31a4df 100644 --- a/charts/heimdall-v2/Chart.yaml +++ b/charts/heimdall-v2/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.0.4 +version: 0.0.5 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/heimdall-v2/README.md b/charts/heimdall-v2/README.md index 860d6694..2748b258 100644 --- a/charts/heimdall-v2/README.md +++ b/charts/heimdall-v2/README.md @@ -2,7 +2,7 @@ Deploy and scale [Heimdall-v2](https://github.com/0xPolygon/heimdall-v2) inside Kubernetes with ease -[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.0.4](https://img.shields.io/badge/Version-0.0.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.3.0](https://img.shields.io/badge/AppVersion-0.3.0-informational?style=flat-square) +[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.0.5](https://img.shields.io/badge/Version-0.0.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.3.0](https://img.shields.io/badge/AppVersion-0.3.0-informational?style=flat-square) ## Features