The Manage Admin-config builds uses ImageStreams to store images on ocp cluster image-registry. These images are not automatically pruned by the cluster pruner as they are referenced by a imagestream. Manage Image Streams needs to be deleted before purning the images, Manage Install on Long running cluster tend to break when image-registry is full . this also degrades the performance of the overall cluster.
Lets add a new ansible role to prune the manage build images from image-registry. here are the instructions on how to perform this cleanup.
Steps taken to clean up old manage admin-config builds from openshift-image-registry
in order free up the image registry PVC storage space, First delete the image stream for all the server bundles and then run the Prune job. Imagestreams are later automatically restored by the operator
Builds->Imagestreams
Handy script to delete all imagestreams
echo ""
echo "======================================================================"
echo "Delete image streams"
echo "======================================================================"
mng_projects=$(oc projects | awk '{print $1}' | grep mas | grep manage)
for mng_project in ${mng_projects[@]} ; do
echo ""
echo "Get image streams for $mng_project namespace"
echo "----------------------------------------------------------------------"
img_streams=$(oc get imagestreams -n $mng_project --no-headers | awk '{print $1}')
for img_stream in ${img_streams[@]} ; do
echo "Delete image stream $img_stream of $mng_project namespace"
oc delete imagestream $img_stream -n $mng_project
done
done
Attaching my sample Pruner Job used for the cleanup.
The Manage Admin-config builds uses ImageStreams to store images on ocp cluster image-registry. These images are not automatically pruned by the cluster pruner as they are referenced by a imagestream. Manage Image Streams needs to be deleted before purning the images, Manage Install on Long running cluster tend to break when image-registry is full . this also degrades the performance of the overall cluster.
Lets add a new ansible role to prune the manage build images from image-registry. here are the instructions on how to perform this cleanup.
Steps taken to clean up old manage admin-config builds from openshift-image-registry
Builds->Imagestreams Handy script to delete all imagestreams
prune.yml