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

Invalid pruner configmap requires some validation

XMLWordPrintable

    • 5
    • False
    • Hide

      None

      Show
      None
    • False
    • Hide
      Pruner now validates ConfigMaps at apply-time using a Kubernetes admission webhook. Invalid configurations (e.g., ttlSecondsAfterFinished: 2m instead of 60, negative values, or namespace configs exceeding global limits) are immediately rejected with clear error messages. This replaces the previous behavior where invalid configs were silently ignored and only logged errors in the controller. Users must label their pruner ConfigMaps with app.kubernetes.io/part-of: tekton-pruner and pruner.tekton.dev/config-type: global|namespace for validation to work.
      Show
      Pruner now validates ConfigMaps at apply-time using a Kubernetes admission webhook. Invalid configurations (e.g., ttlSecondsAfterFinished: 2m instead of 60, negative values, or namespace configs exceeding global limits) are immediately rejected with clear error messages. This replaces the previous behavior where invalid configs were silently ignored and only logged errors in the controller. Users must label their pruner ConfigMaps with app.kubernetes.io/part-of: tekton-pruner and pruner.tekton.dev/config-type: global|namespace for validation to work.
    • Enhancement
    • Proposed

      Description of problem:

      After applying config map with invalid values like(ttlSecondsAfterFinished: 60s) instead of 

       ttlSecondsAfterFinished: 60. there is currently no mechanism to validate the configmap applied is correct. unless the logs shows some error. But the previously applied correct configuration is applied to prune the pipelineruns.

      Users might not be aware if the invalid configmap applied with 2m is valid or not.

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

      Pruner with 1.19.0

      Steps to Reproduce

      1. Apply below config in pruner configmap

       

        global-config: |-
          enforcedConfigLevel: global
          ttlSecondsAfterFinished: 60

      2. Now it prunes the pipelinerun after 60sec

       

      3. Now apply a invalid configmap value

        global-config: |-
          enforcedConfigLevel: global
          ttlSecondsAfterFinished: 2m

      4. Now the configmap is applied without any error.

      5. Now the pipelineruns are pruned after 60sec

      6. Only the pruner logs shows the error.

      Actual results:

      Pipelinerun removed after 60sec

      Expected results:

      Some error mechanism to handle such issues

      Reproducibility (Always/Intermittent/Only Once):

      Always

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

      Error from pruner logs:

       

      Error loading pruner global config{error 26 0  error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go struct field PrunerConfig.SuccessfulHistoryLimit of type int32

       

              rh-ee-shubbhar Shubham Bhardwaj
              rhn-support-sselvan Sri Vignesh Selvan
              Anitha Natarajan
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: