Skip to content

Conversation

@anithapriyanatarajan
Copy link
Contributor

Changes

This commit introduces support for configuring pruning policies using annotation and label selectors, enabling fine-grained control over resource cleanup based on resource metadata.

Previously, pruning configuration was limited to cluster-wide or namespace scoped matching. This enhancement allows users to define pruning policies that apply to resources matching specific annotations or labels, enabling different cleanup strategies for different types of workloads within the same namespace.

Key features added:

  • Annotation-based selectors for pruning configuration
  • Label-based selectors for pruning configuration
  • Selector-based field isolation (no fallback when selector matches)
  • Enhanced configuration hierarchy: selector > namespace > global

Changes made:

  • Add getFromPrunerConfigResourceLevelwithSelector function to support selector-based configuration lookup with proper fallback logic
  • Add checkIfResourceMatchesAnySelector function for determining if resources match any configured selector
  • Implement field isolation to prevent namespace/global fallback when resource matches a selector but specific field is undefined
  • Fix annotation-based resource filtering in history limiter by using in-memory filtering instead of invalid label selectors
  • Add support for fallback from specific history limits to generic historyLimit field in all matching scenarios

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Has Docs if any changes are user facing, including updates to minimum requirements e.g. Kubernetes version bumps
  • Has Tests included if any functionality added or changed
  • pre-commit Passed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (API changes, bug fixes, changes requiring upgrade notices or deprecation warnings). See some examples of good release notes.
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

Tekton Pruner now supports configuring pruning policies using annotation and label selectors, enabling fine-grained control over resource cleanup based on resource metadata.
Key features added:
- Annotation-based selectors for pruning configuration
- Label-based selectors for pruning configuration
- Selector-based field isolation (no fallback when selector matches)
- Enhanced configuration hierarchy: selector > namespace > global

…tion

This commit introduces support for configuring pruning policies using
annotation and label selectors, enabling fine-grained control over
resource cleanup based on resource metadata.

Previously, pruning configuration was limited to name-based matching.
This enhancement allows users to define pruning policies that apply to
resources matching specific annotations or labels, enabling different
cleanup strategies for different types of workloads within the same
namespace.

Key features added:
- Annotation-based selectors for pruning configuration
- Label-based selectors for pruning configuration
- Selector-based field isolation (no fallback when selector matches)
- Enhanced configuration hierarchy: selector > namespace > global

Changes made:
- Add getFromPrunerConfigResourceLevelwithSelector function to support
  selector-based configuration lookup with proper fallback logic
- Add checkIfResourceMatchesAnySelector function for determining if
  resources match any configured selector
- Implement field isolation to prevent namespace/global fallback when
  resource matches a selector but specific field is undefined
- Fix annotation-based resource filtering in history limiter by using
  in-memory filtering instead of invalid label selectors
- Add support for fallback from specific history limits to generic
  historyLimit field in all matching scenarios
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please ask for approval from anithapriyanatarajan after the PR has been reviewed.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 16, 2025
@pramodbindal
Copy link
Member

As discussed.

Should not be controlling the namespace level configuration from tekton-config as this will make tekton-config highly unreadable.

Although concept is fine but the configuration should be moved to namespace itself.

Secondly namespace level configuration limits should never exceed the global configuration so that admin has some say on the limits.

We can apply config related annotations on namespace itself just like we used to have with earlier pruner

@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 23, 2025
@tekton-robot
Copy link

@anithapriyanatarajan: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@anithapriyanatarajan
Copy link
Contributor Author

As discussed.

Should not be controlling the namespace level configuration from tekton-config as this will make tekton-config highly unreadable.

Although concept is fine but the configuration should be moved to namespace itself.

Secondly namespace level configuration limits should never exceed the global configuration so that admin has some say on the limits.

We can apply config related annotations on namespace itself just like we used to have with earlier pruner

@pramodbindal - Limit related comments are addressed with #30. Will update further on the annotations aspect. Thankyou

@anithapriyanatarajan anithapriyanatarajan deleted the annotation-labels branch November 7, 2025 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants