Skip to content

feat: Add sentry-options-sync sidecar and injector-based Minikube harness - #190

Draft
joshuarli wants to merge 2 commits into
mainfrom
josh/options-sync-sidecar
Draft

joshuarli wants to merge 2 commits into
mainfrom
josh/options-sync-sidecar

Conversation

@joshuarli

@joshuarli joshuarli commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

Kubelet refreshes ConfigMap volumes only on its periodic pod sync, so option changes take about a minute to reach running pods. This adds sentry-options-sync, a small native sidecar that watches each options ConfigMap by name and writes it into a shared emptyDir. It uses the same kubelet layout: a timestamped payload directory, an atomically swapped ..data symlink, and a values.json symlink through it. The client is unchanged; its mtime-based refresh picks up the new file.

  • The envoy-injector adds the sidecar for pods annotated options.sentry.io/delivery: sidecar. The companion injector change is getsentry/sentry-envoy-injector#76.
  • The startup probe (sentry-options-sync ready) holds the app container until the first sync. If the sync can't finish within 30s, the sidecar reports ready anyway and the app starts on schema defaults, matching a missing optional ConfigMap.
  • On each live update the sidecar sends sentry.options.sync.generation_to_write to DogStatsD (SENTRY_OPTIONS_SYNC_STATSD_ADDR, set by the injector to $(HOST_IP):8128). This is the time from generated_at to the write into the pod. Compared with the client's existing propagation_delay (generated_at to refresh), it separates deploy-to-pod time from the client's refresh-on-read lag, with no app or automator changes.
  • The app identity only needs get/list/watch on the named ConfigMaps. No pod patching and no app-side Kubernetes calls.

The Minikube harness is rebuilt to follow docs/architecture.md:

  • The real sentry-envoy-injector runs in-cluster behind TLS, with a webhook mirroring ops envoy-injector/webhook.yaml.
  • The app is an annotated getsentry-web Deployment with no volumes of its own.
  • Each update is generated with sentry-options-cli write --output-format configmap and applied with kubectl apply --server-side --force-conflicts from the host, like deploy-new-sentry-options.sh.

The old Pod annotation refresh mode from #186 is removed.

Measurement (local Minikube, Kubernetes 1.37)

Delivery Updates Mean Std dev Range
kubelet ConfigMap volume 5 77.1s 13.2s 58–90s
sidecar 3 4.5s 0.5s 3.9–4.9s

The sidecar number is dominated by the client's 5s refresh-on-read threshold. A later 5-update sidecar run measured a 4.64s mean end to end, while the sidecar's own generation_to_write was 0.14–0.45s, about the same as kubectl apply itself. Both runs verified:

  • the webhook injected the expected volumes and sidecar;
  • the first read returned the ConfigMap value, so startup gating works;
  • service-getsentry can watch only its named ConfigMaps and cannot list ConfigMaps or patch ConfigMaps or Pods.

Before production

  • Publish the sentry-options-sync image. The injector's default ghcr.io/getsentry/sentry-options-sync:latest is a placeholder.
  • Add a Role/RoleBinding in ops granting service-getsentry read on the named options ConfigMaps.
  • API server load: each sidecar downloads the full ConfigMap on every change. Check pod count × ConfigMap size per region before a wide rollout.

Checks

  • cargo test -p sentry-options-sync, cargo clippy -p sentry-options-sync --tests -- -D warnings
  • make test-minikube-propagation-latency and make test-minikube-propagation-latency-sidecar

🤖 Generated with Claude Code

joshuarli and others added 2 commits September 25, 2026 15:19
…ness

Add sentry-options-sync, a native sidecar that watches sentry-options
ConfigMaps by name and writes them into shared volumes kubelet-style
(timestamped payload, atomic ..data swap). The envoy-injector adds it for
pods annotated options.sentry.io/delivery: sidecar, so option changes no
longer wait on kubelet's periodic ConfigMap volume sync.

Rebuild the Minikube propagation harness around the real injector and
production deploy path: the injector runs in-cluster behind TLS with the
ops webhook config, the app is an annotated Deployment with no volumes of
its own, and each update is generated with sentry-options-cli and applied
with kubectl apply --server-side from the host. The harness compares
kubelet ConfigMap volumes with the sidecar and checks the app identity's
permissions. The Pod annotation refresh mode is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On each live update the sidecar sends sentry.options.sync.generation_to_write,
the seconds from the values' generated_at to writing them into the pod, to
DogStatsD at SENTRY_OPTIONS_SYNC_STATSD_ADDR. Compared with the client's
propagation_delay, this splits deploy-to-pod time from the client's
refresh-on-read lag without app or automator changes. The Minikube harness
reports the same measurement from the sidecar's log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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