feat: Kubernetes ConfigMap watcher — event-driven config reload - #109
Merged
Conversation
…es #132) Watch a named ConfigMap via the K8s API and hot-reload Arbitus config on every Apply event, replacing the 30-second file polling loop with an event-driven reload. - Add `src/kubernetes.rs` (behind the `kubernetes` feature, on by default): subscribes to a ConfigMap with kube-runtime watcher, calls `reload::reload_from_yaml` on Apply/InitApply events - Add `src/reload.rs`: shared reload helpers (`build_live_config`, `reload_from_yaml`) used by both the file-based hot-reload loop and the ConfigMap watcher - Add `Config::from_yaml_str` — parse config from an in-memory YAML string with env-var interpolation, overrides, and validation - Add `KubernetesConfig` to `Config` (`kubernetes.configmap_name`, `.namespace`, `.key`); namespace defaults to the pod's own namespace via the SA token projection - Refactor `do_reload` in `arbitus.rs` to delegate to `reload::reload_from_yaml` - Add `kube 0.98` + `k8s-openapi 0.24/v1_31` as optional deps behind the `kubernetes` feature (default = on) - Helm: add `kubernetesWatcher` values section; when enabled, inject the `kubernetes:` config block into `gateway.yml` and create Role + RoleBinding (get/list/watch on the target ConfigMap by resourceName) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
nfvelten
force-pushed
the
feat/k8s-configmap-watcher
branch
from
April 6, 2026 19:50
c0885ca to
4f2af61
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
kubernetesfeature (on by default) that watches a named ConfigMap via the K8s API and hot-reloads Arbitus config on everyApplyevent — replacing the 30-second file polling loop with an event-driven reloadsrc/reload.rs(build_live_config,reload_from_yaml) used by both the file hot-reload loop and the new ConfigMap watcherConfig::from_yaml_strfor parsing config from in-memory YAML (used by the watcher)kubernetesWatcher.enabled: trueprovisions the Role + RoleBinding and injects thekubernetes:config block automaticallyUsage
Or directly in
gateway.yml:Test plan
cargo fmt --checkpassescargo clippy -- -D warningspassescargo test --lib— 419 tests passkubernetesWatcher.enabled: true, update the ConfigMap, verify the gateway reloads within seconds without a restartCloses #132