From ac0f09c86bd3425011b21d3a8a2f8f2a3ddd3f7a Mon Sep 17 00:00:00 2001 From: Jinsoo Heo Date: Sat, 24 Oct 2026 15:40:34 +0900 Subject: [PATCH] feat(spectre): read CFG_CHAIN_RPC_URLS from a Secret [sc-22327] Add rpcUrlSecret {name, key}. When name is set, CFG_CHAIN_RPC_URLS comes from valueFrom.secretKeyRef and rpcUrl is ignored, so an RPC URL that carries an API key can stay out of plain Helm values. A name without a key fails the render. With the value unset the render is unchanged apart from the chart label, so current releases see no pod change. ci/secret-rpc-values.yaml installs the relay with an empty rpcUrl and the URL in a Secret, so ct install fails if the Secret path breaks. Bump spectre to 0.3.10. --- charts/spectre/Chart.yaml | 2 +- charts/spectre/README.md | 5 +- charts/spectre/ci/secret-rpc-values.yaml | 76 ++++++++++++++++++++++++ charts/spectre/templates/deployment.yaml | 8 +++ charts/spectre/values.yaml | 6 ++ 5 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 charts/spectre/ci/secret-rpc-values.yaml diff --git a/charts/spectre/Chart.yaml b/charts/spectre/Chart.yaml index 71ec0f59..ff25dff5 100644 --- a/charts/spectre/Chart.yaml +++ b/charts/spectre/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.3.9 +version: 0.3.10 # 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/spectre/README.md b/charts/spectre/README.md index d9bee0e3..177cfab7 100644 --- a/charts/spectre/README.md +++ b/charts/spectre/README.md @@ -1,6 +1,6 @@ # spectre -![Version: 0.3.9](https://img.shields.io/badge/Version-0.3.9-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.68.3](https://img.shields.io/badge/AppVersion-0.68.3-informational?style=flat-square) +![Version: 0.3.10](https://img.shields.io/badge/Version-0.3.10-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.68.3](https://img.shields.io/badge/AppVersion-0.68.3-informational?style=flat-square) A Helm chart for deploying Chronicle Spectre Relay on Kubernetes @@ -60,6 +60,9 @@ A Helm chart for deploying Chronicle Spectre Relay on Kubernetes | replicaCount | int | `1` | | | resources | object | `{}` | | | rpcUrl | string | `nil` | rpcUrl for the target chain | +| rpcUrlSecret | object | `{"key":"","name":""}` | Read CFG_CHAIN_RPC_URLS from an existing Secret instead of `rpcUrl`, for URLs that carry credentials such as an `api_key` query parameter. When `name` is set, `rpcUrl` is ignored and `key` is required. | +| rpcUrlSecret.key | string | `""` | Secret key holding the URL. Spectre takes exactly one URL, so store a single line with no trailing newline. | +| rpcUrlSecret.name | string | `""` | Secret name, in the release namespace | | securityContext | object | `{}` | | | service.annotations | object | `{}` | | | service.ports.listen.port | int | `8080` | | diff --git a/charts/spectre/ci/secret-rpc-values.yaml b/charts/spectre/ci/secret-rpc-values.yaml new file mode 100644 index 00000000..affd5aa5 --- /dev/null +++ b/charts/spectre/ci/secret-rpc-values.yaml @@ -0,0 +1,76 @@ +# Same as testnet-envs-values.yaml, but CFG_CHAIN_RPC_URLS comes from a Secret through rpcUrlSecret. +# rpcUrl is empty, so the relay only starts if the Secret path works. No CFG_ETH_* is set, +# so the inline config falls back to a random key. +rpcUrl: "" +# -- must match target chain +chainId: '11155111' +# -- can be one of `legacy`or `eip1559` +txType: legacy +# -- can be one of mainnet: `eth`, `arb`, `opt`, `gno`, `scr`, `zkevm`, `mantle`, or testnets: `gor`, `sep`, `ogor`, `mango`, `testnet-zkEVM-mango`, `mantle-testnet`, `scr-sepolia` +chainType: sep + +inlineConfig: | + variables { + separator = env("CFG_SEPARATOR", "\n") + target_chain_id = env("CFG_CHAIN_ID", "11155111") + } + ethereum { + rand_keys = env("CFG_ETH_FROM", "") == "" ? ["default"] : [] + dynamic "key" { + for_each = env("CFG_ETH_FROM", "") == "" ? [] : [1] + labels = ["default"] + content { + address = env("CFG_ETH_FROM", "") + keystore_path = env("CFG_ETH_KEYS", "") + passphrase_file = env("CFG_ETH_PASS", "") + } + } + client "default" { + ethereum_key = "default" + rpc_urls = explode(var.separator, env("CFG_CHAIN_RPC_URLS", "")) + chain_id = tonumber(env("CFG_CHAIN_ID", "11155111")) + tx_type = env("CFG_CHAIN_TX_TYPE", "legacy") + } + } + info { + ethereum_key = "default" + } + logger { + log_level = env("CFG_LOG_LEVEL", "debug") + log_format = env("CFG_LOG_FORMAT", "text") + metrics { + listen_host = "" + listen_port = 8080 + listen_path = "/healthz" + } + } + transport { + libp2p { + disable_discovery = true + ethereum_key = "default" + listen_addrs = explode(var.separator, env("CFG_LIBP2P_LISTEN_ADDRS", "/ip4/0.0.0.0/tcp/8000")) + feeds = [] + } + } + spectre { + scheduler = tonumber(env("CFG_SPECTRE_INTERVAL", "120")) + scribe { + ethereum_client = "default" + contract_addr = "0x0000000000000000000000000000000000000001" + spread = 1.0 + expiration = 86400 + } + } + +rpcUrlSecret: + name: spectre-ci-rpc + key: CFG_CHAIN_RPC_URLS + +extraObjects: + - apiVersion: v1 + kind: Secret + metadata: + name: spectre-ci-rpc + type: Opaque + stringData: + CFG_CHAIN_RPC_URLS: https://ethereum-sepolia.blockpi.network/v1/rpc/public diff --git a/charts/spectre/templates/deployment.yaml b/charts/spectre/templates/deployment.yaml index 8e9426db..f8818ae0 100644 --- a/charts/spectre/templates/deployment.yaml +++ b/charts/spectre/templates/deployment.yaml @@ -75,7 +75,15 @@ spec: - name: CFG_ENVIRONMENT value: "{{ .Values.environment | default "prod" }}" - name: CFG_CHAIN_RPC_URLS + {{- $rpcUrlSecret := .Values.rpcUrlSecret | default dict }} + {{- if $rpcUrlSecret.name }} + valueFrom: + secretKeyRef: + name: {{ $rpcUrlSecret.name | quote }} + key: {{ required "rpcUrlSecret.key is required when rpcUrlSecret.name is set" $rpcUrlSecret.key | quote }} + {{- else }} value: "{{ .Values.rpcUrl }}" + {{- end }} - name: CFG_CHAIN_ID value: "{{ .Values.chainId }}" - name: CFG_CHAIN_NAME diff --git a/charts/spectre/values.yaml b/charts/spectre/values.yaml index bdb57fb4..53db11d2 100644 --- a/charts/spectre/values.yaml +++ b/charts/spectre/values.yaml @@ -14,6 +14,12 @@ image: environment: stage # -- rpcUrl for the target chain rpcUrl: null +# -- Read CFG_CHAIN_RPC_URLS from an existing Secret instead of `rpcUrl`, for URLs that carry credentials such as an `api_key` query parameter. When `name` is set, `rpcUrl` is ignored and `key` is required. +rpcUrlSecret: + # -- Secret name, in the release namespace + name: "" + # -- Secret key holding the URL. Spectre takes exactly one URL, so store a single line with no trailing newline. + key: "" # -- must match target chain chainId: null # -- can be one of `legacy`or `eip1559`