Namespace Configuration
Configure different pruning policies per namespace for environment-specific retention needs.
TOC
Configuration HierarchyValidation BoundariesMethod 1: Inline Namespace Specs (Centralized)Method 2: Per-Namespace ConfigMaps (Self-Service)Validation Rules1. Explicit Global Limits2. System Default Limits3. Override DefaultsConfiguration InheritanceSelector SupportCommon PatternsBest PracticesNext StepsConfiguration Hierarchy
Settings flow: Global → Namespace → Resource Group
Set enforcedConfigLevel: namespace in global config to enable namespace-level overrides.
Validation Boundaries
CRITICAL - System Boundaries: Create namespace-level ConfigMaps ONLY in user namespaces where PipelineRuns/TaskRuns run.
FORBIDDEN namespaces (validation will reject):
- System:
kube-* - Tekton controllers:
tekton-pipelines,tekton-*
Required labels for all configs:
Namespace-level ConfigMaps are outside the TektonConfig lifecycle. If you need to back up or restore Tekton configuration later, save these ConfigMaps separately.
Method 1: Inline Namespace Specs (Centralized)
Define all namespace configs in the TektonConfig:
Inline namespaces entries are validated against the root-level global-config values in the same way as per-namespace ConfigMaps: a namespace value cannot exceed the corresponding global value, regardless of enforcedConfigLevel. See Validation Rules.
Method 2: Per-Namespace ConfigMaps (Self-Service)
Recommended for namespace isolation and team autonomy.
Step 1: Enable namespace-level config in TektonConfig:
Step 2: Create namespace-specific ConfigMap (fixed name: tekton-pruner-namespace-spec):
Benefits:
- Self-service for namespace owners
- Independent lifecycle management
- Takes priority over global config
Validation Rules
Namespace configurations are validated against limits to prevent resource exhaustion.
1. Explicit Global Limits
When the global config defines a limit, namespace configs cannot exceed it.
2. System Default Limits
When no global limit is defined, the system enforces these maximums:
Example:
3. Override Defaults
Cluster admins can set stricter limits via global config. When a global value is set, it replaces the system maximum as the upper bound for namespace configs. The global values themselves are not checked against the system maximums.
Configuration Inheritance
Unspecified settings inherit from higher levels:
Selector Support
IMPORTANT: Resource selectors (matchLabels, matchAnnotations) only work in namespace-level ConfigMaps (tekton-pruner-namespace-spec), NOT in global ConfigMap's inline namespace specs.
This works (namespace ConfigMap):
This is IGNORED (inline namespace in global ConfigMap):
For selector-based resource groups, use separate namespace ConfigMaps (Method 2).
Common Patterns
Environment-based:
Best Practices
- Use clear namespace naming conventions
- Start with permissive limits in development
- Implement stricter retention in production
- Document namespace configuration decisions
- Regularly review and adjust settings
- Test configurations before deployment
- Use namespace ConfigMaps for selector-based groups
Next Steps
- Learn about Resource Groups - Selector-based configurations
- Explore Time-based Pruning - TTL strategies
- Review History-based Pruning - Retention limits