conduktor.io ↗

Retention Capped by Tenant Tier

retention.ms is capped by tenant-tier: free <= 7d, paid <= 30d, enterprise <= 90d.

“There's no, you know, noisy neighbors and all those types of things.”

Rationale

Free tenants storing data for a year is how SaaS Kafka platforms bankrupt themselves. Tiered retention caps make storage cost predictable per tier and become the contract you sell against. The starter's max-retention-bound (30d global cap) is too lax for a free tier and too strict for enterprise. This policy supersedes it for multi-tenant.

Pattern

retention.ms <= map[tenant-tier] (free:7d, paid:30d, enterprise:90d)

Examples

tenant-tier: free + retention.ms: 604800000 (7d)
tenant-tier: enterprise + retention.ms: 7776000000 (90d)
tenant-tier: free + retention.ms: 2592000000 (30d) — over free cap
tenant-tier: paid + retention.ms: -1 (infinite)

Parameters

NameDefaultDescription
free_max_ms 604800000 Max retention for tenant-tier=free (default 7d).
paid_max_ms 2592000000 Max retention for tenant-tier=paid (default 30d).
enterprise_max_ms 7776000000 Max retention for tenant-tier=enterprise (default 90d).

Governs

This policy relates to the following Kafka configuration keys:

Implementation

Drop this YAML into Conduktor Console as a ResourcePolicy, then link it from an ApplicationInstance, Application, or KafkaCluster.

Conduktor ResourcePolicy
# Conduktor self-service ResourcePolicy
# Schema: https://docs.conduktor.io/platform/reference/resource-reference/self-service/#resourcepolicy
# spec.configs values are strings — wrap with int(string(...)) before numeric compare.
---
apiVersion: self-serve/v1
kind: ResourcePolicy
metadata:
  name: tenant-retention-by-tier
spec:
  targetKind: Topic
  description: retention.ms is capped per tenant-tier (free 7d, paid 30d, enterprise 90d)
  rules:
    - condition: '"tenant-tier" in metadata.labels && metadata.labels["tenant-tier"] in ["free", "paid", "enterprise"]'
      errorMessage: "metadata.labels.tenant-tier must be one of free, paid, enterprise"
    - condition: '!("retention.ms" in spec.configs) || (int(string(spec.configs["retention.ms"])) != -1 && ((metadata.labels["tenant-tier"] == "free" && int(string(spec.configs["retention.ms"])) <= 604800000) || (metadata.labels["tenant-tier"] == "paid" && int(string(spec.configs["retention.ms"])) <= 2592000000) || (metadata.labels["tenant-tier"] == "enterprise" && int(string(spec.configs["retention.ms"])) <= 7776000000)))'
      errorMessage: "retention.ms exceeds the cap for this tenant-tier (free 7d, paid 30d, enterprise 90d) and infinite retention is never allowed"

Related policies

Try Conduktor Console

Enforce policies like this across your team — central audit history, pre-commit guardrails, ApplicationInstance bindings. 5-min Docker install.

Get Started →