[feature] add a Kubernetes informer-based watcher for CRD policy updates (casbin-k8s-informer-watcher)
- Dominant language
- Go
- Stars
- 20.4k
- Forks
- 1.8k
- Avg merge
- 5d 11h
- Merged PRs (30d)
- 2
Description
add a Kubernetes informer-based watcher for CRD policy updates
Add a watcher implementation that reacts to CRD changes and keeps in-memory Casbin state up to date without periodic polling. This watcher should be compatible with Casbin’s watcher mechanism so it can be attached to an enforcer and trigger safe reload or incremental updates when roles or role mappings change in the cluster. The implementation should rely on Kubernetes informers (or equivalent watch primitives) and handle reconnects and resource version drift gracefully.
The watcher should be concurrency-safe when used with `SyncedEnforcer`, and tests should validate that create/update/delete events result in the expected policy changes being reflected in enforcement decisions. The goal is that a GitOps-applied CRD update becomes effective quickly across running instances with predictable behavior.
Contributor guide
Research direction
Start by reading Casbin's watcher mechanism and SyncedEnforcer integration, then identify the existing Kubernetes or CRD integration points; the issue names no files or tests. Done means informer events for CRD create, update, and delete changes are reflected in enforcement decisions, with reconnect and resource-version handling covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- authorization, backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100