// file included in the following:
//
// assembly-multi-tenancy-filter.adoc

[id='proc-multi-tenancy-{context}']
= (Preview) Setting up the Multi-tenancy filter

[role="_abstract"]
This procedure describes how to set up the Multi-tenancy filter by configuring it in Kroxylicious.
The filter dynamically prefixes resource names to create isolation between tenants using the same Kafka cluster.
The prefix representing a tenant is taken from the name of the virtual cluster representing the tenant. 
For example, if the virtual cluster is named `tenant-1`, the prefix is `tenant-1`.
Each tenant must be represented by a unique virtual cluster, and virtual cluster names must be globally unique within the Kroxylicious configuration. 
This means that the same virtual cluster name cannot be used to represent different Kafka clusters.

.Prerequisites

* An instance of Kroxylicious. 
For information on deploying Kroxylicious, see the link:{github}[samples and examples^].
* A config map for Kroxylicious that includes the configuration for creating virtual clusters and filters. 
* A virtual cluster definition for each tenant using the Kafka cluster. 
You need at least two virtual clusters to apply multi-tenancy.

.Procedure

. Configure a `MultiTenantTransformationFilterFactory` type filter.
+
[source, yaml]
----
filters:
  - type: MultiTenantTransformationFilterFactory
    config:
      prefixResourceNameSeparator: "." # <1>
----
<1> The separator used for the prefix. 
If a separator is not specified, `-` is the default.
+
NOTE: Currently, only the prefix with separator is validated.

. Verify that multi-tenancy filtering has been applied.
+
For example, create a topic through each virtual cluster and check that the topics are prefixed with the name of the corresponding virtual cluster.  
+
For more information, see the {github}/blob/main/kubernetes-examples/filters/multi-tenant/script.txt[example for a Kubernetes environment].