apache / apache/casbin

[feature] add a Kubernetes CRD-backed persistence adapter (casbin-k8s-crd-adapter) for Go Casbin

Open
#1,674 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
20.4k
Forks
1.8k
Avg merge
5d 11h
Merged PRs (30d)
2

Description

add a Kubernetes CRD-backed persistence adapter for Go Casbin

Implement a Go adapter that loads Casbin policies from Kubernetes Custom Resources instead of a database. The adapter should satisfy Casbin’s persistence adapter contract and focus on read-only behavior: it must support loading policy into the model and should treat write operations as unsupported to keep CRDs as the source of truth. The code should use the Kubernetes client to list/watch CR instances and translate them into Casbin policy lines, including both permission rules and role/group bindings, so that common RBAC setups work without custom glue.

This needs unit tests that exercise policy loading using a fake Kubernetes client and cover namespace-scoped and cluster-scoped usage, duplicate handling, and deterministic ordering. The adapter should be integrated in a way that callers can plug it into a standard `Enforcer` and call `LoadPolicy` without any additional runtime database dependencies.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Casbin’s persistence adapter contract and the Enforcer LoadPolicy entry point, then inspect the Kubernetes client APIs for listing and watching CRD instances. Done means a read-only adapter loads permission rules and role/group bindings through a standard Enforcer, with fake-client tests covering namespace and cluster scope, duplicates, and deterministic ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, kubernetes
Domain
authorization, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.