01 Tenants Domains And Environments

Tenants, Domains, And Environments

Klok uses tenant, domain, and environment boundaries to keep ownership, security, data, and operations clear.

Realm

A realm is the physical or infrastructure boundary. It maps to infrastructure such as a broker cluster, OpenSearch cluster, GitLab instance, and Keycloak realm. Most users do not create realms during normal integration work, but architects and platform admins should understand that realms are used for strong isolation, dedicated installations, or regulatory separation.

Tenant

A tenant is the organizational or legal boundary. A tenant may represent a customer, municipality, company, subsidiary, or platform-owned shared service.

Tenant rules:

  • Data never crosses tenants implicitly.
  • Tenant ownership influences topic location and access decisions.
  • Tenant-level roles decide who can create domains and projects.
  • GitLab, Vault, Pulsar, Keycloak, OpenSearch, and the admin GUI should all use consistent tenant naming.

Setting up a new tenant, and what klok.dev, Ansible and a person each do for it, is described in one place: Onboarding A Tenant in the Klok framework development guide.

Domain

A domain is the business or information boundary inside a tenant. Examples include finance, HR, logistics, common, and public.

Domain rules:

  • Domains own their data contracts.
  • Domain ACLs should control topic access.
  • Domain admins should be able to manage projects in their domain.
  • Common domain is used for tenant-shared assets.
  • Public domain is used for externally published artifacts.

Environment

An environment is the runtime scope, such as dev, test, stage, or prod. Environments separate deployment and operational state.

Pulsar tenant naming normally includes the environment:

<tenant>_<env>

A topic uses the environment as a suffix on the tenant part of the Pulsar URI, and production has no suffix:

persistent://<tenant>[_<env>]/<domain>/<InformationModelName>[_<event_purpose>]

Today each integration service is deployed once, in production: the deploy manifests hold one deployment per service, with no separate dev, test or stage deployments. klok.dev does not manage environments; its Environments page is a placeholder. Environment administration is tracked in frontend-klok-dev#68.

Ownership Questions

Before designing an integration, answer:

  • Which tenant owns the business capability?
  • Which domain owns the information contract?
  • Which tenant owns the source system?
  • Which tenant owns the target system?
  • Which environment is being deployed or tested?
  • Which service principal will run the route?
  • Which users should be able to inspect logs and context?

If these questions are unclear, route code will inherit unclear ownership.