mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
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.
This commit is contained in:
parent
067a8ff3c2
commit
ad026026e0
@ -28,13 +28,17 @@ import (
|
|||||||
// JobListerExpansion allows custom methods to be added to
|
// JobListerExpansion allows custom methods to be added to
|
||||||
// JobLister.
|
// JobLister.
|
||||||
type JobListerExpansion interface {
|
type JobListerExpansion interface {
|
||||||
// GetPodJobs returns a list of jobs managing a pod. An error is returned only
|
// GetPodJobs returns a list of Jobs that potentially
|
||||||
// if no matching jobs are found.
|
// 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 *api.Pod) (jobs []batch.Job, err error)
|
GetPodJobs(pod *api.Pod) (jobs []batch.Job, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPodJobs returns a list of jobs managing a pod. An error is returned only
|
// GetPodJobs returns a list of Jobs that potentially
|
||||||
// if no matching jobs are found.
|
// 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 *api.Pod) (jobs []batch.Job, err error) {
|
func (l *jobLister) GetPodJobs(pod *api.Pod) (jobs []batch.Job, err error) {
|
||||||
if len(pod.Labels) == 0 {
|
if len(pod.Labels) == 0 {
|
||||||
err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name)
|
err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name)
|
||||||
|
@ -28,13 +28,17 @@ import (
|
|||||||
// JobListerExpansion allows custom methods to be added to
|
// JobListerExpansion allows custom methods to be added to
|
||||||
// JobLister.
|
// JobLister.
|
||||||
type JobListerExpansion interface {
|
type JobListerExpansion interface {
|
||||||
// GetPodJobs returns a list of jobs managing a pod. An error is returned only
|
// GetPodJobs returns a list of Jobs that potentially
|
||||||
// if no matching jobs are found.
|
// 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(pod *v1.Pod) (jobs []batch.Job, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPodJobs returns a list of jobs managing a pod. An error is returned only
|
// GetPodJobs returns a list of Jobs that potentially
|
||||||
// if no matching jobs are found.
|
// 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) {
|
func (l *jobLister) GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) {
|
||||||
if len(pod.Labels) == 0 {
|
if len(pod.Labels) == 0 {
|
||||||
err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name)
|
err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name)
|
||||||
|
@ -28,13 +28,17 @@ import (
|
|||||||
// JobListerExpansion allows custom methods to be added to
|
// JobListerExpansion allows custom methods to be added to
|
||||||
// JobLister.
|
// JobLister.
|
||||||
type JobListerExpansion interface {
|
type JobListerExpansion interface {
|
||||||
// GetPodJobs returns a list of jobs managing a pod. An error is returned only
|
// GetPodJobs returns a list of Jobs that potentially
|
||||||
// if no matching jobs are found.
|
// 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(pod *v1.Pod) (jobs []batch.Job, err error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetPodJobs returns a list of jobs managing a pod. An error is returned only
|
// GetPodJobs returns a list of Jobs that potentially
|
||||||
// if no matching jobs are found.
|
// 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) {
|
func (l *jobLister) GetPodJobs(pod *v1.Pod) (jobs []batch.Job, err error) {
|
||||||
if len(pod.Labels) == 0 {
|
if len(pod.Labels) == 0 {
|
||||||
err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name)
|
err = fmt.Errorf("no jobs found for pod %v because it has no labels", pod.Name)
|
||||||
|
Loading…
Reference in New Issue
Block a user