MAS GitOps GitOps Ansible CLI
Edit on GitHub
Home Job Cleaner Configuration Resources Created

Job Cleaner¤

Helm chart link: 000-job-cleaner

Deploys the mas-saas-job-cleaner-cron CronJob, responsible for cleaning up orphaned Job resources in the cluster. It works by grouping Jobs in the cluster according to the mas.ibm.com/job-cleanup-group label, then deleting all Jobs from each group except for the one with the latest creationTimestamp.

For safety, the CronJob is assigned a ServiceAccount that can only list and delete Job resources (so it can never delete any other type of resource). Furthermore, the logic ensures that only Job resources with the mas.ibm.com/job-cleanup-group label can be deleted.

The mas-devops-saas-job-cleaner command executed by this CronJob is defined in python-devops.

In MAS SaaS, Job resources are routinely orphaned (i.e. marked for deletion by ArgoCD) since, when an update is required to an immutable Job field (e.g. its image tag), a new version of the Job resource must be created with a different name. When auto_delete: false is set, ArgoCD will (by design) not perform this cleanup for us. Over time, Job resources will accumulate and put pressure on the K8S API server.

Configuration¤

Values¤

This chart has no configurable values. It deploys with default settings that work for all MAS SaaS environments.

The CronJob runs on a schedule and automatically cleans up orphaned Job resources that have the mas.ibm.com/job-cleanup-group label.

Resources Created¤

Resource Type Resource Name Namespace Condition Installed By
ClusterRole mas-saas-job-cleaner-role N/A (cluster-scoped) Always cluster_admin_role
ServiceAccount mas-saas-job-cleaner-sa job-cleaner Always cluster_admin_role
ClusterRoleBinding mas-saas-job-cleaner-rolebinding N/A (cluster-scoped) Always cluster_admin_role
CronJob mas-saas-job-cleaner-cron job-cleaner Always cluster_admin_role