From 4c84996bc221566eded444173e3ac52154e183f6 Mon Sep 17 00:00:00 2001 From: Anthony Yeh Date: Sun, 26 Feb 2017 18:28:26 -0800 Subject: [PATCH] Job: Update Lister documentation for ControllerRef. The Job Listers still use selectors, because this is the behavior expected by callers. This clarifies the meaning of the returned list. Some callers may need to switch to using GetControllerOf() instead, but that is a separate, case-by-case issue. Kubernetes-commit: ad026026e0252469bab05f9adba4bb1b20a8f6a9 --- listers/batch/v1/job_expansion.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/listers/batch/v1/job_expansion.go b/listers/batch/v1/job_expansion.go index 4b602d0a..8c285e8d 100644 --- a/listers/batch/v1/job_expansion.go +++ b/listers/batch/v1/job_expansion.go @@ -28,13 +28,17 @@ import ( // JobListerExpansion allows custom methods to be added to // JobLister. type JobListerExpansion interface { - // GetPodJobs returns a list of jobs managing a pod. An error is returned only - // if no matching jobs are found. + // GetPodJobs returns a list of Jobs that potentially + // match a Pod. Only the one specified in the Pod's ControllerRef + // will actually manage it. + // Returns an error only if no matching Jobs are found. GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) } -// GetPodJobs returns a list of jobs managing a pod. An error is returned only -// if no matching jobs are found. +// GetPodJobs returns a list of Jobs that potentially +// match a Pod. Only the one specified in the Pod's ControllerRef +// will actually manage it. +// Returns an error only if no matching Jobs are found. func (l *jobLister) GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) { if len(pod.Labels) == 0 { err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name)