Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OwnerReference to generated Jobs #865

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ChristianCiach
Copy link

@ChristianCiach ChristianCiach commented Mar 14, 2025

Since #486 Reloader is able to trigger Jobs from existing CronJob, which is awesome 🎉

But I noticed that the generated Jobs are missing owner references to the CronJob that was used to create them. This creates some issues:

  • The created jobs are not deleted when the CronJob is deleted.
  • The created jobs are not displayed in tools like ArgoCD or K9s.

Prior art:

I successfully tested this change in one of our clusters.

@ChristianCiach ChristianCiach marked this pull request as draft March 18, 2025 13:10
@ChristianCiach ChristianCiach marked this pull request as ready for review March 18, 2025 13:19
@ChristianCiach
Copy link
Author

I've added a commit that adds the annotation cronjob.kubernetes.io/instantiate: manual to jobs that have been triggered by Reloader. This seems to be a convention, because every other tool mentioned above (except for K9s) adds this annotation to manually scheduled jobs that have been created from cronjobs. I think this annotation is necessary to avoid a warning from the cronjob controller if it sees a job that has been created by another controller.

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.

1 participant