Skip to content

feat(charon-relay): split metrics port to ClusterIP-only Service#287

Open
apham0001 wants to merge 2 commits into
mainfrom
fix/charon-relay-split-metrics-port
Open

feat(charon-relay): split metrics port to ClusterIP-only Service#287
apham0001 wants to merge 2 commits into
mainfrom
fix/charon-relay-split-metrics-port

Conversation

@apham0001
Copy link
Copy Markdown
Contributor

Context

The default `charon-relay` Service exposes port 3620 (Charon `--monitoring-address`) on the public LoadBalancer alongside the P2P (3610) and HTTP (3640) ports. Metrics are only ever scraped in-cluster, so 3620 has no reason to be reachable from the public internet.

Ref: ObolNetwork/obol-infrastructure#2652

Changes

  • New `metricsService.enabled` toggle in `values.yaml` (default `false` to preserve existing behaviour).
  • When enabled:
    • Port 3620 is removed from the LoadBalancer Service.
    • A new ClusterIP-only Service `{release}-{i}-metrics` exposes 3620.
    • ServiceMonitor (when also enabled) selects the metrics Service via its dedicated label.
  • ServiceMonitor template fix: the endpoint `port` was hardcoded to `metrics` but the Service port name is `monitoring` (from `service.ports.monitoring.name`). Now uses `{{ .Values.service.ports.monitoring.name }}` so the two stay in sync regardless of mode.
  • Bump chart to `0.8.0`.

Verification

```bash

Legacy mode (default): port 3620 still on LB

helm template test charts/charon-relay --set clusterSize=1 | yq 'select(.kind == "Service")'

New mode: port 3620 off LB, separate ClusterIP Service exists

helm template test charts/charon-relay --set clusterSize=1 \
--set metricsService.enabled=true --set serviceMonitor.enabled=true \
| yq 'select(.kind == "Service" or .kind == "ServiceMonitor")'
```

Migration

Existing releases keep working unchanged. To opt-in:

```yaml
metricsService:
enabled: true
serviceMonitor:
enabled: true # if you have prometheus-operator
```

This is non-breaking. The metrics endpoint URL changes from `{lb-ip}:3620` to `{release}-{i}-metrics.{ns}.svc.cluster.local:3620` — only relevant for external scrapers, which shouldn't exist (the whole point of this change).

@apham0001 apham0001 requested a review from a team as a code owner May 26, 2026 07:27
@apham0001 apham0001 force-pushed the fix/charon-relay-split-metrics-port branch from 2a09597 to 916505c Compare May 26, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant