[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

Nobody has claimed this yet.

Assessment

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

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.

Description

enhancement

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.

Dominant language
Go
Stars
20.4k
Forks
1.8k
Avg merge
5d 11h
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/casbin

All issues in apache/casbin

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.