Skip to content

Conversation

@tomklapiscak
Copy link
Contributor

@tomklapiscak tomklapiscak commented Feb 13, 2025

Description

Adds the mas-saas-devops-job-cleaner script (and supporting mas.deploy.saas.jobcleaner library code for performing automated cleanup of orphaned Job resources when auto_delete: false is set in ArgoCD-managed MAS SaaS environments.

Job resources are routinely orphaned (i.e. marked for deletion by ArgoCD) since, when we need to apply an update to an immutable Job field (e.g. image tag), we must create a new version of the Job resource 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.

The mas-saas-devops-job-cleaner script is run by a cluster-level CronJob defined in ibm-mas/gitops#257.

https://jsw.ibm.com/browse/MASCORE-5637

Testing

Refer to ibm-mas/gitops#257 for details of testing performed when this script is run via a CronJob in a MAS SaaS cluster.

Unit tests

Unit tests for the library code are included in this PR.

@tomklapiscak tomklapiscak marked this pull request as ready for review April 14, 2025 10:45
@tomklapiscak tomklapiscak changed the title [minor] WIP: Automated SaaS Job cleanup when auto_delete: false is set [minor] Automated SaaS Job cleanup when auto_delete: false is set Apr 14, 2025
@whitfiea whitfiea added this pull request to the merge queue Apr 14, 2025
Merged via the queue into stable with commit dc26fac Apr 14, 2025
2 checks passed
@whitfiea whitfiea deleted the mascore5637 branch April 14, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants