How emberstack/kubernetes-reflector works
Reflector is a Kubernetes addon that watches Secrets, ConfigMaps, and Namespaces, then maintains annotated mirror resources in permitted namespaces. The principal workflow is Kubernetes watch events → shared watcher dispatch → resource-specific mirroring, including direct and automatic reflection. The graph includes the configuration and annotation/property model supporting that behavior. Secret implementation details and some mirror operations were not excerpted; their capabilities and wiring are documented or registered, but uncertain internal calls are omitted. Delpoyment packaging is excluded.
Main entry points: WatcherBackgroundService.cs Watcher service · ResourceMirror.cs Reflection coordinator · Program.cs Application startup · NamespaceWatcher.cs Namespace watcher
Components 22
Runtime and configuration
- Application startup
src/ES.Kubernetes.Reflector/Program.cs - Reflector options
src/ES.Kubernetes.Reflector/Configuration/ReflectorOptions.cs - Watcher options
src/ES.Kubernetes.Reflector/Configuration/WatcherOptions.cs
Watching and events
- Namespace watcher
src/ES.Kubernetes.Reflector/Watchers/NamespaceWatcher.cs - ConfigMap watcher
src/ES.Kubernetes.Reflector/Watchers/ConfigMapWatcher.cs - Secret watcher
src/ES.Kubernetes.Reflector/Watchers/SecretWatcher.cs - Watcher service
src/ES.Kubernetes.Reflector/Watchers/Core/WatcherBackgroundService.cs - Namespace glob matcher
src/ES.Kubernetes.Reflector/Watchers/Core/GlobMatcher.cs - Watcher event
src/ES.Kubernetes.Reflector/Watchers/Core/Events/WatcherEvent.cs - Watcher closed event
src/ES.Kubernetes.Reflector/Watchers/Core/Events/WatcherClosed.cs - Event handler contract
src/ES.Kubernetes.Reflector/Watchers/Core/Events/IWatcherEventHandler.cs - Closed handler contract
src/ES.Kubernetes.Reflector/Watchers/Core/Events/IWatcherClosedHandler.cs
Mirroring domain
- Reflection coordinator
src/ES.Kubernetes.Reflector/Mirroring/Core/ResourceMirror.cs - ConfigMap mirror
src/ES.Kubernetes.Reflector/Mirroring/ConfigMapMirror.cs - Secret mirror
src/ES.Kubernetes.Reflector/Mirroring/SecretMirror.cs - Reflection annotations
src/ES.Kubernetes.Reflector/Mirroring/Core/Annotations.cs - Mirror properties
src/ES.Kubernetes.Reflector/Mirroring/Core/MirroringProperties.cs - Property parsing and rules
src/ES.Kubernetes.Reflector/Mirroring/Core/MirroringPropertiesExtensions.cs
Kubernetes resources
- ConfigMap resources
- Secret resources
- Namespace resources
Other components
- Kubernetes operator
Connections 30
- Kubernetes operator → Application startup: starts
- Application startup → Namespace watcher: registers
src/ES.Kubernetes.Reflector/Program.cs - Application startup → Secret watcher: registers
src/ES.Kubernetes.Reflector/Program.cs - Application startup → ConfigMap watcher: registers
src/ES.Kubernetes.Reflector/Program.cs - Application startup → Secret mirror: registers
src/ES.Kubernetes.Reflector/Program.cs - Application startup → ConfigMap mirror: registers
src/ES.Kubernetes.Reflector/Program.cs - Application startup → Reflector options: configures
src/ES.Kubernetes.Reflector/Program.cs - Reflector options → Watcher options: contains
src/ES.Kubernetes.Reflector/Configuration/ReflectorOptions.cs - Namespace watcher → Watcher service: extends
src/ES.Kubernetes.Reflector/Watchers/NamespaceWatcher.cs - ConfigMap watcher → Watcher service: extends
src/ES.Kubernetes.Reflector/Watchers/ConfigMapWatcher.cs - Secret watcher → Watcher service: extends
- Watcher service → Reflector options: reads
src/ES.Kubernetes.Reflector/Watchers/Core/WatcherBackgroundService.cs - Watcher service → Namespace glob matcher: filters namespaces
src/ES.Kubernetes.Reflector/Watchers/Core/WatcherBackgroundService.cs - Watcher service → Watcher event: dispatches
src/ES.Kubernetes.Reflector/Watchers/Core/WatcherBackgroundService.cs - Watcher service → Watcher closed event: dispatches
src/ES.Kubernetes.Reflector/Watchers/Core/WatcherBackgroundService.cs - Watcher service → Event handler contract: calls handlers
src/ES.Kubernetes.Reflector/Watchers/Core/WatcherBackgroundService.cs - Watcher service → Closed handler contract: calls handlers
src/ES.Kubernetes.Reflector/Watchers/Core/WatcherBackgroundService.cs - Reflection coordinator → Event handler contract: implements
src/ES.Kubernetes.Reflector/Mirroring/Core/ResourceMirror.cs - Reflection coordinator → Closed handler contract: implements
src/ES.Kubernetes.Reflector/Mirroring/Core/ResourceMirror.cs - ConfigMap mirror → Reflection coordinator: specializes
src/ES.Kubernetes.Reflector/Mirroring/ConfigMapMirror.cs - Secret mirror → Reflection coordinator: specializes
- Reflection coordinator → Mirror properties: reads
src/ES.Kubernetes.Reflector/Mirroring/Core/ResourceMirror.cs - Property parsing and rules → Mirror properties: builds
src/ES.Kubernetes.Reflector/Mirroring/Core/MirroringPropertiesExtensions.cs - Property parsing and rules → Reflection annotations: reads
src/ES.Kubernetes.Reflector/Mirroring/Core/MirroringPropertiesExtensions.cs - Reflection coordinator → ConfigMap resources: reflects resources
- Reflection coordinator → Secret resources: reflects resources
- Reflection coordinator → Namespace resources: tracks namespaces
- Namespace watcher → Namespace resources: watches
src/ES.Kubernetes.Reflector/Watchers/NamespaceWatcher.cs - ConfigMap watcher → ConfigMap resources: watches
src/ES.Kubernetes.Reflector/Watchers/ConfigMapWatcher.cs - Secret watcher → Secret resources: watches