From a8804f8a196771ee5d8bc209b704b5f7d0ed35e6 Mon Sep 17 00:00:00 2001 From: Enderson Maia Date: Thu, 28 Sep 2023 11:55:26 +0100 Subject: [PATCH] feat: add chainID and network to labels --- charts/rollups-node/Chart.yaml | 2 +- charts/rollups-node/templates/_helpers.tpl | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/charts/rollups-node/Chart.yaml b/charts/rollups-node/Chart.yaml index 643fcce..75654e2 100644 --- a/charts/rollups-node/Chart.yaml +++ b/charts/rollups-node/Chart.yaml @@ -13,7 +13,7 @@ maintainers: url: https://github.com/oap75 type: application -version: 1.0.2-1 +version: 1.0.2-2 dependencies: - name: redis diff --git a/charts/rollups-node/templates/_helpers.tpl b/charts/rollups-node/templates/_helpers.tpl index f30a298..f2ce793 100644 --- a/charts/rollups-node/templates/_helpers.tpl +++ b/charts/rollups-node/templates/_helpers.tpl @@ -75,6 +75,8 @@ TODO: diff between query and validator {{- if not .Values.localnode.enabled -}} dapp.cartesi.io/contract-address: {{ required "A valid .Values.dapp.contractAddress is required" .Values.dapp.contractAddress | lower | quote }} {{end -}} +dapp.cartesi.io/chain-id: {{ include "dapp.chainID" . | quote }} +dapp.cartesi.io/network: {{ include "dapp.network" . | quote }} app.kubernetes.io/name: {{ include "validator.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} @@ -176,14 +178,23 @@ Usage: {{- end -}} {{/* -Return the chainID based on the network +Return the network name */}} -{{- define "dapp.chainID" -}} -{{- $networkIDs := dict "mainnet" "1" "optimism" "10" "optimism-goerli" "420" "arbitrum" "42161" "arbitrum-goerli" "421613" "localhost" "31337" "sepolia" "11155111" -}} -{{- $network := .Values.dapp.network }} +{{- define "dapp.network" -}} +{{- $network := "" }} {{- if .Values.localnode.enabled }} {{- $network = "localhost" }} +{{- else }} + {{- $network = .Values.dapp.network }} {{- end }} -{{- $chainID := index $networkIDs $network }} +{{- $network }} +{{- end -}} + +{{/* +Return the chainID based on the network +*/}} +{{- define "dapp.chainID" -}} +{{- $networkIDs := dict "mainnet" "1" "optimism" "10" "optimism-goerli" "420" "arbitrum" "42161" "arbitrum-goerli" "421613" "localhost" "31337" "sepolia" "11155111" -}} +{{- $chainID := index $networkIDs (include "dapp.network" .) }} {{- $chainID }} {{- end -}}