How to create a Cronjob to prune Deployments/Builds in Openshift Container Platform

Solution Verified - Updated -

Issue

  • The documentation isn't reporting an easy way to prune old Builds/Deployments objects

  • My environment doesn't follow a declarative GitOps approach

  • I'm afraid of human-error typos in the Builds.spec.failedBuildsHistoryLimit or Builds.spec.successfulBuildsHistoryLimit values that will outgrow my ETCD

  • I want to automate the Using a Service Account to prune images and other resources in OpenShift article by following an imperative approach

Environment

  • Red Hat Openshift Container Platform (RHOCP)
    • 4.12+

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content