Uploaded image for project: 'OpenShift Pipelines'
  1. OpenShift Pipelines
  2. SRVKP-10008

tektonpruner not pruning pipelineRuns with updated values in tekton-pruner-namespace-spec configmap

XMLWordPrintable

    • False
    • Hide

      None

      Show
      None
    • False
    • Known Issue
    • Proposed
    • Hide

      Known Issue
      Updates to a namespace-level pruner ConfigMap are not fully applied to existing resources, even after additional PipelineRun or TaskRun completion events occur in the namespace.

      Cause
      The namespace-level pruner reconciler:

      • Reacts only to PipelineRun and TaskRun completion events
      • Does not watch ConfigMap updates
      • Re-evaluates retention limits on reconciliation
      • Applies TTL only at resource creation time

      Consequence

      • Updated retention limits are applied after a subsequent completion event
      • Updated TTL values are not applied to existing PipelineRun and TaskRun resources
      • TTL enforcement applies only to newly created resources
      • Existing resources may exceed TTL and remain until manually removed or limited by retention count

      Workaround

      • Trigger and complete a new PipelineRun to apply updated retention limits
      • Manually delete existing PipelineRun and TaskRun resources that exceed the updated TTL

      Result if the Workaround Is Not Performed

      • Retention limits are not enforced until a completion event occurs
      • TTL-based pruning is never applied to existing resources. Excess resources may remain indefinitely
      Show
      Known Issue Updates to a namespace-level pruner ConfigMap are not fully applied to existing resources, even after additional PipelineRun or TaskRun completion events occur in the namespace. Cause The namespace-level pruner reconciler: Reacts only to PipelineRun and TaskRun completion events Does not watch ConfigMap updates Re-evaluates retention limits on reconciliation Applies TTL only at resource creation time Consequence Updated retention limits are applied after a subsequent completion event Updated TTL values are not applied to existing PipelineRun and TaskRun resources TTL enforcement applies only to newly created resources Existing resources may exceed TTL and remain until manually removed or limited by retention count Workaround Trigger and complete a new PipelineRun to apply updated retention limits Manually delete existing PipelineRun and TaskRun resources that exceed the updated TTL Result if the Workaround Is Not Performed Retention limits are not enforced until a completion event occurs TTL-based pruning is never applied to existing resources. Excess resources may remain indefinitely

      Description of problem:

      tektonpruner not pruning pipelineRuns with updated values in tekton-pruner-namespace-spec configmap

      Prerequisites (if any, like setup, operators/versions):

      Install OSP 1.21.0

      Steps to Reproduce

      1. Create new project test-ns-cm
      2. Create the tekton-pruner-namespace-spec configmap in test-ns-cm
      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: tekton-pruner-namespace-spec  # Fixed name
        namespace: test-ns-cm  # User namespace only
        labels:
          app.kubernetes.io/part-of: tekton-pruner
          pruner.tekton.dev/config-type: namespace
      data:
        ns-config: |
          ttlSecondsAfterFinished: 3000
          failedHistoryLimit: 7 
          historyLimit: null
          successfulHistoryLimit: 8    
      1. Create few pipelineRuns in above namespace and validate the number of successful & failed pipelineRuns matches the configmap values
        successfulHistoryLimit -> 8 pipelineRuns
        failedHistoryLimit -> 7 pipelineRuns
      $ opc pr ls
      NAME                           STARTED        DURATION   STATUS
      tkn-version-run                1 minute ago   9s         Succeeded
      tkn-run-2                      1 minute ago   9s         Succeeded
      tkn-pac-run-2                  1 minute ago   10s        Succeeded
      skopeo-copy-run                1 minute ago   15s        Succeeded
      pull-request-pipeline-run      1 minute ago   8s         Failed
      opc-task-run                   1 minute ago   21s        Succeeded
      openshift-client-run           1 minute ago   9s         Succeeded
      nodejs-ex-git-pr               1 minute ago   1m1s       Failed
      kn-apply-run                   1 minute ago   1s         Failed(CouldntGetTask)
      maven-run2                     1 minute ago   1m0s       Failed(PipelineRunTimeout)
      kn-run                         1 minute ago   2s         Failed(CouldntGetTask)
      kn-pz-run                      1 minute ago   0s         Failed(CouldntGetTask)
      jib-maven-run                  1 minute ago   50s        Failed
      helm-upgrade-from-repo-run     1 minute ago   12s        Succeeded
      helm-upgrade-from-source-run   1 minute ago   32s        Succeeded 
      1. [08:16:15] smanthin@smanthin-thinkpadp16vgen1:~/Test/1_21/pruner/ns-config$ opc pr ls
        NAME                           STARTED         DURATION   STATUS
        tkn-version-run                5 minutes ago   9s         Succeeded
        tkn-run-2                      5 minutes ago   9s         Succeeded
        tkn-pac-run-2                  5 minutes ago   10s        Succeeded
        skopeo-copy-run                5 minutes ago   15s        Succeeded
        pull-request-pipeline-run      5 minutes ago   8s         Failed
        opc-task-run                   5 minutes ago   21s        Succeeded
        openshift-client-run           5 minutes ago   9s         Succeeded
        nodejs-ex-git-pr               5 minutes ago   1m1s       Failed
        kn-apply-run                   5 minutes ago   1s         Failed(CouldntGetTask)
        maven-run2                     5 minutes ago   1m0s       Failed(PipelineRunTimeout)
        kn-run                         5 minutes ago   2s         Failed(CouldntGetTask)
        kn-pz-run                      5 minutes ago   0s         Failed(CouldntGetTask)
        jib-maven-run                  5 minutes ago   50s        Failed
        helm-upgrade-from-repo-run     5 minutes ago   12s        Succeeded
        helm-upgrade-from-source-run   5 minutes ago   32s        Succeeded
        
        
        Now lower the values of all the fields in configmap such as TTL, successful & failed PRs limit.
        Updated TTl to 300 secs(5 mins), successful PRs to 3 & failed PRs to 4
        
        $ cat test-ns-cm.yaml 
        apiVersion: v1
        kind: ConfigMap
        metadata:
          name: tekton-pruner-namespace-spec  # Fixed name
          namespace: test-ns-cm  # User namespace only
          labels:
            app.kubernetes.io/part-of: tekton-pruner
            pruner.tekton.dev/config-type: namespace
        data:
          ns-config: |
            ttlSecondsAfterFinished: 300
            failedHistoryLimit: 4 
            historyLimit: null
            successfulHistoryLimit: 3  
        
        
        Even with ttlSecondsAfterFinished set to 5 minuntes, the pipelineRuns are not getting pruned.
        
          
        $ opc pr ls
        NAME                           STARTED         DURATION   STATUS
        tkn-version-run                9 minutes ago   9s         Succeeded
        tkn-run-2                      9 minutes ago   9s         Succeeded
        tkn-pac-run-2                  9 minutes ago   10s        Succeeded
        skopeo-copy-run                9 minutes ago   15s        Succeeded
        pull-request-pipeline-run      9 minutes ago   8s         Failed
        opc-task-run                   9 minutes ago   21s        Succeeded
        openshift-client-run           9 minutes ago   9s         Succeeded
        nodejs-ex-git-pr               9 minutes ago   1m1s       Failed
        kn-apply-run                   9 minutes ago   1s         Failed(CouldntGetTask)
        maven-run2                     9 minutes ago   1m0s       Failed(PipelineRunTimeout)
        kn-run                         9 minutes ago   2s         Failed(CouldntGetTask)
        kn-pz-run                      9 minutes ago   0s         Failed(CouldntGetTask)
        jib-maven-run                  9 minutes ago   50s        Failed
        helm-upgrade-from-repo-run     9 minutes ago   12s        Succeeded
        helm-upgrade-from-source-run   9 minutes ago   32s        Succeeded
        

      Actual results:

      tektonpruner not pruning pipelineRuns with updated values in tekton-pruner-namespace-spec configmap

      Expected results:

      pipelineRuns should be pruned based on the updated values in tekton-pruner-namespace-spec configmap

      Reproducibility (Always/Intermittent/Only Once):

      Always

      Acceptance criteria: 

       

      Definition of Done:

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

      PFA logs for reference

      tektonconfig.yaml
      tekton-pruner-controller-logs.log
      tekton-pruner-webhook-logs.log
      test-ns-cm.yaml

       *

        1. tektonconfig.yaml
          7 kB
          Sai Raju Manthina
        2. tekton-pruner-controller-logs.log
          203 kB
          Sai Raju Manthina
        3. tekton-pruner-webhook-logs.log
          18 kB
          Sai Raju Manthina
        4. test-ns-cm.yaml
          0.4 kB
          Sai Raju Manthina

              rh-ee-anataraj Anitha Natarajan
              rh-ee-smanthin Sai Raju Manthina
              Shubham Bhardwaj
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: