Area: Deployment
Sub-Area: Architecture
Applies to: OSS + Cloud
Issue
You run DataHub for several teams or customers and want to separate their metadata and control who can see it.
You Might Be Asking
- Can DataHub support multiple tenants?
- How do I isolate metadata between teams?
- Does a policy on a domain stop other teams from seeing that domain?
Cause
Policies only grant access. They never take it away. A policy that gives Team A privileges on a domain does not hide that domain from anyone else. To restrict what users can see, you must turn on view-based access control. Domains and platform instances organize your metadata, but they do not restrict access on their own.
Solution
1. Group assets with domains
Domains must already exist in DataHub before a transformer can assign them. Create each one in the UI, starting from the Domains tab. See Domains.
To assign assets to domains during ingestion, use the pattern domain transformer. Put transformers at the top level of the recipe. The config key is domain_pattern, and each rule key maps to a list of domain URNs or simple domain names.
transformers:
- type: "pattern_add_domain"
config:
domain_pattern:
rules:
".*marketing.*": ["urn:li:domain:TeamA"]
".*finance.*": ["urn:li:domain:TeamB"]
Rule keys match from the start of the string, so a key such as marketing.* does not match a dataset URN, which starts with urn:li:dataset:. The transformer rejects unknown config keys. PatternAddDatasetDomain is deprecated in favor of PatternAddDomain. See Dataset transformers.
2. Grant each team access with a policy
Create policies in the UI under Settings > Permissions > Policies (you need the Manage Policies privilege), or with the createPolicy GraphQL mutation. These are the resources and actors parts of the input for a domain-scoped policy:
resources: {
filter: {
criteria: [
{ field: "DOMAIN", condition: EQUALS, values: ["urn:li:domain:TeamA"] }
]
}
}
actors: {
resourceOwners: false
allUsers: false
allGroups: false
groups: ["urn:li:corpGroup:team-a"]
}
-
actorsrequiresresourceOwners,allUsersandallGroups. Leaving them out fails GraphQL validation. - Each criterion requires
field,valuesandcondition. - Privileges you can list include
VIEW_ENTITY_PAGE,EDIT_ENTITYandVIEW_DATASET_PROFILE.EDIT_ENTITYis the general edit privilege. Column-level privileges includeEDIT_DATASET_COL_TAGS,EDIT_DATASET_COL_GLOSSARY_TERMS,EDIT_DATASET_COL_DESCRIPTIONandEDIT_DATASET_COL_PROPERTIES.
See Managing policies.
3. Turn on view-based access control to restrict visibility
-
OSS: Set
VIEW_AUTHORIZATION_ENABLED=trueon GMS. The default is false. This gates entity pages. It does not filter search results at query time. - Cloud: Use Search Access Controls. They filter search at query time on the View Entity privilege. Your DataHub Cloud administrator enables them. See Search Access Controls.
- Remove the default policies that grant View Entity to all users. Otherwise everyone keeps access.
- Users with the Admin, Editor or Reader role see all entities regardless of view policies. Platform administrators bypass Search Access Controls.
DataHub formally supports two plugin types, Authentication and Authorization, so a custom search middleware function is not a supported way to filter results. Use view-based access control for visibility. See Policies and view-based access control and Plugins.
4. Namespace assets with platform instances
platform_instance prefixes the dataset name in the URN. Use it to keep the same platform from different tenants apart. The Snowflake key is account_id, which takes an account identifier such as xy12345.us-east-2.aws. The key account does not exist.
source:
type: snowflake
config:
platform_instance: "tenant1_snowflake"
account_id: "xy12345.us-east-2.aws"
This gives URNs like urn:li:dataset:(urn:li:dataPlatform:snowflake,tenant1_snowflake.db.table,PROD). Keep the instance name stable. See Platform instances.
5. Run separate deployments for the strongest separation
This applies to self-hosted DataHub only. Cloud customers can't edit Helm values. To ask about separate instances, contact DataHub Support.
For self-hosted Kubernetes, give each deployment its own database and its own index prefix. In charts/datahub/values.yaml, both settings sit under the global key:
global:
elasticsearch:
indexPrefix: "tenant1"
sql:
datasource:
db: "datahub_tenant1"
-
indexPrefixis in theelasticsearchblock. The chart shows it only as a commented example (# indexPrefix: "dh"), so uncomment it and set your value. With a prefix such astenant1, indices are named liketenant1_datasetindex_v2. By default the prefix is empty. - The database is set in
sql.datasource:host,url,db(defaultdatahub),username, andpassword.secretRefandsecretKey.
For the install commands, see Deploy on Kubernetes. For the setting defaults, see Environment variables.