Skip to content

fix(api): honour Signals.Metrics/Logs/Traces toggles - #5

Merged
tdakkota merged 2 commits into
mainfrom
fix/signal-toggles
Jul 28, 2026
Merged

tdakkota merged 2 commits into
mainfrom
fix/signal-toggles

Conversation

@tdakkota

Copy link
Copy Markdown
Contributor

Bug

SignalsSpec declares four toggles, but only Profiles was ever read
(profilesEnabled). renderConfig emitted metrics_backend, traces_backend,
logs_backend and the prometheus/tempo/loki bind blocks unconditionally,
and apiPorts() did not look at the spec at all.

Impact

signals: {metrics: false} was accepted by the API server, stored in the CR, and
did nothing — the backend, the Prometheus API bind, the remote-write port and the
Service port all stayed wired, with no indication anywhere that the field was
ignored.

Fix

  • internal/controller/signals.go (new): metricsEnabled/logsEnabled/tracesEnabled/
    profilesEnabled share one signalEnabled(*bool) helper (nil = enabled, unchanged
    default), plus validateSignals.
  • renderConfig gates each *_backend key together with its API bind block on the
    matching toggle, exactly as profiles already did. health_check stays unconditional.
  • apiPorts now takes the CR and drops prom-rw/prom-http, tempo-http, loki-http
    and pyroscope for disabled signals, so both the container port list and the client
    Service lose them. OTLP ingest, self-metrics, health check and the peer port are
    always exposed. Port names moved to constants in naming.go.
  • Disabling every signal is rejected. Validation lives in renderConfig, matching the
    existing storage.s3.bucket is required check, so it propagates through
    buildConfigMap → reconcile → the Degraded condition the controller already sets.
    No CEL/webhook was added: the repo has no XValidation markers and no webhook package,
    so this follows existing practice.
  • Field godoc added for the four toggles (the +kubebuilder:default=true markers were
    already correct); README's "profiles is the meaningful toggle" note updated.

Tests in internal/controller/signals_test.go cover each signal individually disabled
(backend key, bind block, container ports, Service ports all gone, other signals intact),
nil toggles keeping everything, each signal working as the only enabled one, and
all-disabled being rejected at validateSignals, renderConfig and buildConfigMap.

make test and make lint (custom golangci-lint build) both pass.

Closes #2

🤖 Generated with Claude Code

tdakkota and others added 2 commits July 28, 2026 13:39
Only Signals.Profiles was read; the other three toggles were accepted and
ignored. Each signal now gates its *_backend key, its API bind block, and its
container/Service ports. Disabling every signal is rejected in renderConfig, so
it surfaces as a Degraded condition like the other spec validations.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@tdakkota
tdakkota merged commit 1592c7a into main Jul 28, 2026
5 checks passed
@tdakkota
tdakkota deleted the fix/signal-toggles branch July 28, 2026 11:39
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.

fix(api): Signals.Metrics/Logs/Traces are never read

1 participant