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.
This commit is contained in:
Anthony Yeh 2017-02-23 10:50:37 -08:00
parent ca13b9e532
commit f54a5c9728
6 changed files with 18 additions and 6 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 *api.Pod) ([]*api.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

@ -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 *api.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)

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)

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)