From b7d9935c618d58d94af28362af58c21f3f3ef4be Mon Sep 17 00:00:00 2001 From: Jinsoo Heo Date: Sat, 24 Oct 2026 16:13:35 +0900 Subject: [PATCH] feat(validator): read CFG_CHAIN_RPC_URLS from a Secret [sc-22327] Add ghost.rpcUrlSecret and vao.rpcUrlSecret {name, key}. When name is set, the container's CFG_CHAIN_RPC_URLS comes from valueFrom.secretKeyRef and the plain rpcUrl is ignored. VAO uses its own pair when vao.rpcUrlSecret.name or vao.rpcUrl is set, otherwise the ghost pair, the same fallback vao.rpcUrl has today. A name without a key fails the render. The new validator.rpcUrlEnvSource helper renders either form. With the values unset the render is unchanged apart from the chart label, which is not on the pod templates. ci/testnet-envs-values.yaml now reads the ghost URL from a Secret and VAO inherits it; ci/mainnet-envs-values.yaml keeps the plain path. Bump validator to 0.9.0. --- charts/validator/Chart.yaml | 2 +- charts/validator/README.md | 8 +++++--- charts/validator/ci/testnet-envs-values.yaml | 14 +++++++++++++- charts/validator/templates/_helpers.tpl | 18 ++++++++++++++++++ charts/validator/templates/deployment-vao.yaml | 9 +++++++-- charts/validator/templates/deployment.yaml | 2 +- charts/validator/values.yaml | 10 +++++++++- 7 files changed, 54 insertions(+), 9 deletions(-) diff --git a/charts/validator/Chart.yaml b/charts/validator/Chart.yaml index 4e72bfd6..d12040d9 100644 --- a/charts/validator/Chart.yaml +++ b/charts/validator/Chart.yaml @@ -20,7 +20,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.8.2" +version: "0.9.0" # 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/validator/README.md b/charts/validator/README.md index 3305d63b..6c9f9bcd 100644 --- a/charts/validator/README.md +++ b/charts/validator/README.md @@ -1,6 +1,6 @@ # validator -![Version: 0.8.2](https://img.shields.io/badge/Version-0.8.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.81.0](https://img.shields.io/badge/AppVersion-0.81.0-informational?style=flat-square) +![Version: 0.9.0](https://img.shields.io/badge/Version-0.9.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.81.0](https://img.shields.io/badge/AppVersion-0.81.0-informational?style=flat-square) A Helm chart for deploying Chronicle Validator on Kubernetes @@ -15,7 +15,7 @@ A Helm chart for deploying Chronicle Validator on Kubernetes | Key | Type | Default | Description | |-----|------|---------|-------------| | extraObjects | list | `[]` | Extra K8s manifests to deploy | -| ghost | object | `{"argsOverride":[],"commandOverride":[],"enabled":true,"env":{"normal":{},"raw":{}},"ethConfig":{},"image":{"repository":null,"tag":null},"rpcUrl":null,"service":{"annotations":{},"externalTrafficPolicy":"","loadBalancerClass":"","ports":{"libp2p":{"port":8000,"protocol":"TCP"}},"trafficDistribution":"","type":"LoadBalancer"},"watchdogConfigReg":"0x94Fea534aef6df5cF66C2DAE5CE0A05d10C068F3"}` | Values for Ghost | +| ghost | object | `{"argsOverride":[],"commandOverride":[],"enabled":true,"env":{"normal":{},"raw":{}},"ethConfig":{},"image":{"repository":null,"tag":null},"rpcUrl":null,"rpcUrlSecret":{"key":"","name":""},"service":{"annotations":{},"externalTrafficPolicy":"","loadBalancerClass":"","ports":{"libp2p":{"port":8000,"protocol":"TCP"}},"trafficDistribution":"","type":"LoadBalancer"},"watchdogConfigReg":"0x94Fea534aef6df5cF66C2DAE5CE0A05d10C068F3"}` | Values for Ghost | | ghost.argsOverride | list | `[]` | args override for the validator | | ghost.commandOverride | list | `[]` | command override for the validator | | ghost.enabled | bool | `true` | Whether to deploy the Ghost (defi) container/deployment. Set to `false` to run a single-container release (e.g. VAO-only). | @@ -23,6 +23,7 @@ A Helm chart for deploying Chronicle Validator on Kubernetes | ghost.env.normal | object | `{}` | un-encrypted env vars passed to the pod | | ghost.ethConfig | object | `{}` | Provide ETH keys from existing secrets : **NB** use only existing secret OR env vars, do not provide both | | ghost.image | object | `{"repository":null,"tag":null}` | Image tag for the validator (overrides global image if set) | +| ghost.rpcUrlSecret | object | `{"key":"","name":""}` | Read the Ghost container's CFG_CHAIN_RPC_URLS from an existing Secret instead of `ghost.rpcUrl`, for URLs that carry credentials such as an `api_key` query parameter. When `name` is set, `ghost.rpcUrl` is ignored and `key` is required. The VAO container inherits it when it sets neither `vao.rpcUrlSecret` nor `vao.rpcUrl`. | | ghost.service | object | `{"annotations":{},"externalTrafficPolicy":"","loadBalancerClass":"","ports":{"libp2p":{"port":8000,"protocol":"TCP"}},"trafficDistribution":"","type":"LoadBalancer"}` | Service type for the validator | | ghost.service.annotations | object | `{}` | Annotations to add to the service | | ghost.service.externalTrafficPolicy | string | `""` | Optional LoadBalancer traffic policy, for example Local. | @@ -78,7 +79,8 @@ A Helm chart for deploying Chronicle Validator on Kubernetes | vao.extraVolumes | list | `[]` | Extra volumes to mount (typically for secrets) | | vao.image | object | `{"repository":null,"tag":null}` | Image tag for the validator (overrides global image if set) | | vao.resources | object | `{}` | Resources constraints for the validator, CPU, Memory, etc. | -| vao.rpcUrl | string | `nil` | Chain RPC URL(s) for the VAO container's target chain. Falls back to `ghost.rpcUrl` when unset (pre-0.8.0 behavior). | +| vao.rpcUrl | string | `nil` | Chain RPC URL(s) for the VAO container's target chain. When neither this nor `vao.rpcUrlSecret` is set, the VAO container uses the Ghost settings, `ghost.rpcUrlSecret` then `ghost.rpcUrl` (pre-0.8.0 behavior). | +| vao.rpcUrlSecret | object | `{"key":"","name":""}` | Read the VAO container's CFG_CHAIN_RPC_URLS from an existing Secret instead of `vao.rpcUrl`. When `name` is set, `vao.rpcUrl` is ignored and `key` is required. | | vao.service | object | `{"annotations":{},"externalTrafficPolicy":"","loadBalancerClass":"","ports":{"libp2p":{"port":8001,"protocol":"TCP"}},"trafficDistribution":"","type":"LoadBalancer"}` | Service type for the validator | | vao.service.annotations | object | `{}` | Annotations to add to the service | | vao.service.externalTrafficPolicy | string | `""` | Optional LoadBalancer traffic policy, for example Local. | diff --git a/charts/validator/ci/testnet-envs-values.yaml b/charts/validator/ci/testnet-envs-values.yaml index 81c5cf7f..09c744b4 100644 --- a/charts/validator/ci/testnet-envs-values.yaml +++ b/charts/validator/ci/testnet-envs-values.yaml @@ -10,7 +10,12 @@ global: chainName: sep ghost: watchdogConfigReg: "0xE1CcD31f46F30A764DbACB4759E69d8799126941" - rpcUrl: https://0xrpc.io/sep + # CFG_CHAIN_RPC_URLS comes from the test-rpc Secret below, and VAO inherits it. + # mainnet-envs-values.yaml covers the plain rpcUrl path. + rpcUrl: "" + rpcUrlSecret: + name: test-rpc + key: CFG_CHAIN_RPC_URLS service: # -- Type of service for the validator, can also be `LoadBalancer` @@ -73,6 +78,13 @@ extraObjects: type: Opaque stringData: keyfile: "{}" + - apiVersion: v1 + kind: Secret + metadata: + name: test-rpc + type: Opaque + stringData: + CFG_CHAIN_RPC_URLS: https://0xrpc.io/sep - apiVersion: v1 kind: ConfigMap metadata: diff --git a/charts/validator/templates/_helpers.tpl b/charts/validator/templates/_helpers.tpl index f241bbd8..00e4f7b5 100644 --- a/charts/validator/templates/_helpers.tpl +++ b/charts/validator/templates/_helpers.tpl @@ -74,3 +74,21 @@ Create the name of the service account to use {{- default "default" .Values.global.serviceAccount.name }} {{- end }} {{- end }} + +{{/* +CFG_CHAIN_RPC_URLS source for one container: valueFrom.secretKeyRef when the +Secret ref has a name, else the plain URL. Takes a dict with "secret" (an +rpcUrlSecret map, may be nil), "url" (the plain rpcUrl) and "path" (the values +path, for the error message). +*/}} +{{- define "validator.rpcUrlEnvSource" -}} +{{- $secret := .secret | default dict -}} +{{- if $secret.name -}} +valueFrom: + secretKeyRef: + name: {{ $secret.name | quote }} + key: {{ required (printf "%s.key is required when %s.name is set" .path .path) $secret.key | quote }} +{{- else -}} +value: {{ .url | quote }} +{{- end -}} +{{- end }} diff --git a/charts/validator/templates/deployment-vao.yaml b/charts/validator/templates/deployment-vao.yaml index de423d79..e3b71829 100644 --- a/charts/validator/templates/deployment-vao.yaml +++ b/charts/validator/templates/deployment-vao.yaml @@ -105,8 +105,13 @@ spec: - name: CFG_CHAIN_ID value: {{ .Values.global.chainId | default "1" | quote }} - name: CFG_CHAIN_RPC_URLS - {{- /* vao.rpcUrl falls back to ghost.rpcUrl to preserve pre-0.8.0 behavior for releases that only set the ghost value */}} - value: {{ .Values.vao.rpcUrl | default .Values.ghost.rpcUrl | quote }} + {{- /* VAO uses its own rpcUrlSecret/rpcUrl when either is set, else the ghost pair (pre-0.8.0 behavior for releases that only set the ghost values). Within a pair the Secret wins. */}} + {{- $vaoRpcUrlSecret := .Values.vao.rpcUrlSecret | default dict }} + {{- $rpcSrc := dict "secret" .Values.ghost.rpcUrlSecret "url" .Values.ghost.rpcUrl "path" "ghost.rpcUrlSecret" }} + {{- if or $vaoRpcUrlSecret.name .Values.vao.rpcUrl }} + {{- $rpcSrc = dict "secret" $vaoRpcUrlSecret "url" .Values.vao.rpcUrl "path" "vao.rpcUrlSecret" }} + {{- end }} + {{- include "validator.rpcUrlEnvSource" $rpcSrc | nindent 14 }} {{- if .Values.global.chainTxType }} - name: CFG_CHAIN_TX_TYPE value: {{ .Values.global.chainTxType | default "eip1559" | quote }} diff --git a/charts/validator/templates/deployment.yaml b/charts/validator/templates/deployment.yaml index cd2fdeed..45aba3e1 100644 --- a/charts/validator/templates/deployment.yaml +++ b/charts/validator/templates/deployment.yaml @@ -107,7 +107,7 @@ spec: - name: CFG_CHAIN_ID value: {{ .Values.global.chainId | default "1" | quote }} - name: CFG_CHAIN_RPC_URLS - value: {{ .Values.ghost.rpcUrl | quote }} + {{- include "validator.rpcUrlEnvSource" (dict "secret" .Values.ghost.rpcUrlSecret "url" .Values.ghost.rpcUrl "path" "ghost.rpcUrlSecret") | nindent 14 }} {{- if .Values.global.chainTxType }} - name: CFG_CHAIN_TX_TYPE value: {{ .Values.global.chainTxType | default "eip1559" | quote }} diff --git a/charts/validator/values.yaml b/charts/validator/values.yaml index 068736da..275e9a03 100644 --- a/charts/validator/values.yaml +++ b/charts/validator/values.yaml @@ -149,6 +149,10 @@ ghost: tag: null # Deprecated: use `chainRpcUrl` instead - remove after FINSHED release rpcUrl: null + # -- Read the Ghost container's CFG_CHAIN_RPC_URLS from an existing Secret instead of `ghost.rpcUrl`, for URLs that carry credentials such as an `api_key` query parameter. When `name` is set, `ghost.rpcUrl` is ignored and `key` is required. The VAO container inherits it when it sets neither `vao.rpcUrlSecret` nor `vao.rpcUrl`. + rpcUrlSecret: + name: "" + key: "" # -- WATCHDOG onchain config address watchdogConfigReg: "0x94Fea534aef6df5cF66C2DAE5CE0A05d10C068F3" @@ -227,8 +231,12 @@ vao: image: repository: null tag: null - # -- Chain RPC URL(s) for the VAO container's target chain. Falls back to `ghost.rpcUrl` when unset (pre-0.8.0 behavior). + # -- Chain RPC URL(s) for the VAO container's target chain. When neither this nor `vao.rpcUrlSecret` is set, the VAO container uses the Ghost settings, `ghost.rpcUrlSecret` then `ghost.rpcUrl` (pre-0.8.0 behavior). rpcUrl: null + # -- Read the VAO container's CFG_CHAIN_RPC_URLS from an existing Secret instead of `vao.rpcUrl`. When `name` is set, `vao.rpcUrl` is ignored and `key` is required. + rpcUrlSecret: + name: "" + key: "" # -- WATCHDOG onchain config address watchdogConfigReg: "0x064358f9b6428C51F80511D73AFEb3A9e5Cf0213" # -- WATCHDOG polling interval (in seconds)