ScheduledJob should apply a label to each created job #41633

Open
ankon opened this Issue Feb 17, 2017 · 2 comments

Projects

None yet

2 participants

@ankon
ankon commented Feb 17, 2017

What keywords did you search in Kubernetes issues before filing this one? (If you have found any duplicates, you should instead reply there.):

"scheduledjob" (and try to understand from the title whether this could be related to my issue)
"find job"


Is this a BUG REPORT or FEATURE REQUEST? (choose one): Feature request.

Kubernetes version (use kubectl version):

Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"2017-01-12T04:57:25Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.1+coreos.0", GitCommit:"cc65f5321f9230bf9a3fa171155c1213d6e3480e", GitTreeState:"clean", BuildDate:"2016-12-14T04:08:28Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: AWS via kube-aws 0.93-ish

What happened:
I'm using scheduled jobs, and then try to review the logs of the job executions. I have multiple scheduled jobs in the system. Generally this works via:

  1. kubectl get job ... search for the ones that seem to relate to my scheduled job name
  2. kubectl get pod -l job-name=(name of the job that looks most recent from the previous list)
  3. kubectl logs (name of the pod). Repeat this if there are more than one execution.
  4. Repeat the whole list for previous jobs

What you expected to happen:
I'd love to be able to filter the initial job list already to only include jobs created by a specific scheduled job, something like kubectl get job -l scheduledjob=NAME. For that to happen I need scheduledjob to label the created job, just like a job already labels the pods executing it.

@liggitt
Member
liggitt commented Feb 18, 2017

can you include labels in the cronjob's jobTemplate spec?

@ankon
ankon commented Feb 23, 2017

Yes, that is certainly possible.

I filed this ticket mainly because I think this should happen automatically: Any resource produced by a resource I created should be labeled such that I can find these resources back easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment