Skip to content

Commit a839c2e

Browse files
committed
Create 011-user-namespace.md
Signed-off-by: Keith Wall <[email protected]>
1 parent 57b308e commit a839c2e

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

proposals/011-user-namespace.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!-- This template is provided as an example with sections you may wish to comment on with respect to your proposal. Add or remove sections as required to best articulate the proposal. -->
2+
3+
# User Namespace Filter
4+
5+
Proposes the additional of a "User Namespace Filter" to Kroxylicious's core filters.
6+
7+
The role of the user namespace filter is to give the client a private space within the kafka cluster space that is isolated from other users sharing the cluster. Namespacing can be applied selectively to different resource types. This allows
8+
the possibility for some resource types (probably topics) to be shared between users whereas only resource instances exist in the private space.
9+
10+
## Current situation
11+
12+
The project has a preview multi-tenancy filter, which is a similar idea to this one except that it applies unconditionally to all resource types.
13+
14+
## Motivation
15+
16+
We encountered a use-case where the desire was to share topics but maintain isolated spaces for groups and transactional-ids.
17+
18+
## Proposal
19+
20+
The role of the user namespace filter is to give the client the impression of a private kafka cluster space that is isolated from other clients sharing the cluster. Namespacing can be applied selectively to different resource types.
21+
22+
The filter will use a pluggable API to determine how to map the name of each resource. Operations that retrieve lists of resources will see only those that fall within the namespace.
23+
24+
For the initial release, the filter will need to support only namespacing for consumer group names and transactional ids. There will be scope for the filter to support prefixing of topic resources, but this won’t be supported in the initial release.
25+
26+
This proposal will deliver a simple implementation of the API that simply uses the principal as the prefix.
27+
The principal will be added to the resource as it is sent to the server, and removed as it is returned in the response.
28+
29+
### APIs
30+
31+
#### Filter Configuration
32+
33+
```yaml
34+
type: UserNamespaceFilter
35+
config:
36+
resourceNameMappers:
37+
- resourceTypes: [TRANSACTIONAL_ID, GROUP_ID]
38+
resourceNameMapper: SimplePrincipalPrefixingNameMapper
39+
```
40+
41+
#### Resource Name Mapper API
42+
43+
Asynchronous interface that lets the filter map from downstream names to upstream names and vice-versa. It also
44+
has the responsibility to filter the upstream view, removing resources that don't belong in the view.
45+
46+
```java
47+
interface ResourceNameMapper {
48+
/** Return a mapping of downstream names to upstream names. */
49+
CompletionStage<Map<String, String>> mapDownstreamResourceNames(String authorizationId, ResourceType resourceType, List<String> downstreamResourceNames);
50+
/** Return a filtered map of upstream resource names to downstream names. Any resources that do not form part of the view will be omitted from the map. */
51+
CompletionStage<Map<String, String>> mapUpstreamFilteredResourceNames(String authorizationId, ResourceType resourceType, List<String> upstreamResourceNames);
52+
}
53+
```
54+
55+
## Affected/not affected projects
56+
57+
Call out the projects in the Kroxylicious organisation that are/are not affected by this proposal.
58+
59+
## Compatibility
60+
61+
Call out any future or backwards compatibility considerations this proposal has accounted for.
62+
63+
## Rejected alternatives
64+
65+
Call out options that were considered while creating this proposal, but then later rejected, along with reasons why.
66+
67+
## Limitations
68+
69+
The name prefixing approach reduces the length of the name that the client may use for resource names. If the prefixed name exceeds the length permitted by Kafka the request must fail in an understandable way.

0 commit comments

Comments
 (0)