RC/RS: Update Lister documentation for ControllerRef.

The RC/RS 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: f54a5c9728a91336433ad190e4323b44b4de86a0
This commit is contained in:
Anthony Yeh 2017-02-23 10:50:37 -08:00 committed by Kubernetes Publisher
parent 7395acc6da
commit c11b7bc45b
2 changed files with 6 additions and 2 deletions

View File

@ -33,7 +33,9 @@ type ReplicationControllerListerExpansion interface {
// ReplicationControllerNamespaeLister.
type ReplicationControllerNamespaceListerExpansion interface{}
// GetPodControllers returns a list of replication controllers managing a pod. Returns an error only if no matching controllers are found.
// GetPodControllers returns a list of ReplicationControllers 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 ReplicationControllers are found.
func (s *replicationControllerLister) GetPodControllers(pod *v1.Pod) ([]*v1.ReplicationController, error) {
if len(pod.Labels) == 0 {
return nil, fmt.Errorf("no controllers found for pod %v because it has no labels", pod.Name)

View File

@ -35,7 +35,9 @@ type ReplicaSetListerExpansion interface {
// ReplicaSetNamespaeLister.
type ReplicaSetNamespaceListerExpansion interface{}
// GetPodReplicaSets returns a list of ReplicaSets managing a pod. Returns an error only if no matching ReplicaSets are found.
// GetPodReplicaSets returns a list of ReplicaSets 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 ReplicaSets are found.
func (s *replicaSetLister) GetPodReplicaSets(pod *v1.Pod) ([]*extensions.ReplicaSet, error) {
if len(pod.Labels) == 0 {
return nil, fmt.Errorf("no ReplicaSets found for pod %v because it has no labels", pod.Name)