Skip to content

feat(runtime-config): Add default tenant ID for runtime config fallback#7501

Open
yeya24 wants to merge 1 commit into
masterfrom
default-runtime-config
Open

feat(runtime-config): Add default tenant ID for runtime config fallback#7501
yeya24 wants to merge 1 commit into
masterfrom
default-runtime-config

Conversation

@yeya24
Copy link
Copy Markdown
Contributor

@yeya24 yeya24 commented May 10, 2026

What this PR does

Adds a new experimental flag -runtime-config.default-tenant-id that enables a synthetic tenant entry in the runtime config overrides to serve as the default for all tenants without per-tenant overrides.

Motivation

Today, changing default limits for all tenants (e.g., max_global_series_per_user) requires a Cortex restart because defaults are set via CLI flags read at startup. Per-tenant overrides, by contrast, are hot-reloaded from the runtime config file without restart.

This feature allows operators to set default values in the runtime config file under a synthetic tenant ID, enabling default limit changes without pod restarts.

How it works

Resolution order when the flag is set:

per-tenant override → default tenant override → CLI flag defaults

When the flag is empty (default), the feature is disabled and behavior is unchanged.

Changes

  • pkg/util/validation/limits.go: Added defaultTenantID field to Overrides, new NewOverridesWithDefaultTenantID constructor, modified GetOverridesForUser to check default tenant before CLI flags
  • pkg/util/runtimeconfig/manager.go: Added -runtime-config.default-tenant-id flag
  • pkg/cortex/modules.go: Wired flag through to overrides initialization
  • docs/configuration/v1-guarantees.md: Listed as experimental feature

Example usage

# runtime-config.yml
overrides:
  __default__:
    max_global_series_per_user: 200000
    ingestion_rate: 25000
  real_tenant_123:
    max_global_series_per_user: 2000000
cortex -runtime-config.default-tenant-id=__default__ ...

All tenants without their own override get the __default__ values. Tenants with overrides are unaffected.

Checklist

  • Tests added
  • Documentation updated (make doc)
  • V1 guarantees doc updated (experimental)
  • Signed-off commit

Add -runtime-config.default-tenant-id flag that enables a synthetic tenant
entry in the runtime config overrides to serve as the default for all tenants
without per-tenant overrides. This allows changing default limits via the
config pipeline (hot-reloaded) instead of requiring a Cortex restart.

Resolution order: per-tenant override → default tenant → CLI flags.

When the flag is empty (default), the feature is disabled and behavior is
unchanged.

This is an experimental feature.

Signed-off-by: Ben Ye <benye@amazon.com>
@yeya24 yeya24 force-pushed the default-runtime-config branch from bdfc33b to beffda9 Compare May 10, 2026 23:44
Copy link
Copy Markdown
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 11, 2026
Copy link
Copy Markdown
Member

@SungJin1212 SungJin1212 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there might also be a way to match using regex without a new flag.
I like this method as well.

# runtime-config.yml
overrides:
  .*: // like default tenant
    max_global_series_per_user: 200000
    ingestion_rate: 25000
  cluster-prefix1-.+:
    // xxx
  cluster-prefix2-+:
    // xxx
  real_tenant_123:
    max_global_series_per_user: 2000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size/L type/feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants