From f54a5c9728a91336433ad190e4323b44b4de86a0 Mon Sep 17 00:00:00 2001 From: Anthony Yeh Date: Thu, 23 Feb 2017 10:50:37 -0800 Subject: [PATCH] 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. --- .../core/internalversion/replicationcontroller_expansion.go | 4 +++- pkg/client/listers/core/v1/replicationcontroller_expansion.go | 4 +++- .../extensions/internalversion/replicaset_expansion.go | 4 +++- pkg/client/listers/extensions/v1beta1/replicaset_expansion.go | 4 +++- .../listers/core/v1/replicationcontroller_expansion.go | 4 +++- .../listers/extensions/v1beta1/replicaset_expansion.go | 4 +++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pkg/client/listers/core/internalversion/replicationcontroller_expansion.go b/pkg/client/listers/core/internalversion/replicationcontroller_expansion.go index e9070bd5abf..98ea3115ee2 100644 --- a/pkg/client/listers/core/internalversion/replicationcontroller_expansion.go +++ b/pkg/client/listers/core/internalversion/replicationcontroller_expansion.go @@ -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) diff --git a/pkg/client/listers/core/v1/replicationcontroller_expansion.go b/pkg/client/listers/core/v1/replicationcontroller_expansion.go index aa5202d5e42..d3adae7f5d2 100644 --- a/pkg/client/listers/core/v1/replicationcontroller_expansion.go +++ b/pkg/client/listers/core/v1/replicationcontroller_expansion.go @@ -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) diff --git a/pkg/client/listers/extensions/internalversion/replicaset_expansion.go b/pkg/client/listers/extensions/internalversion/replicaset_expansion.go index d2ab13ec7f7..d5f4031b8b7 100644 --- a/pkg/client/listers/extensions/internalversion/replicaset_expansion.go +++ b/pkg/client/listers/extensions/internalversion/replicaset_expansion.go @@ -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) diff --git a/pkg/client/listers/extensions/v1beta1/replicaset_expansion.go b/pkg/client/listers/extensions/v1beta1/replicaset_expansion.go index cfef9588406..3f3db42b67e 100644 --- a/pkg/client/listers/extensions/v1beta1/replicaset_expansion.go +++ b/pkg/client/listers/extensions/v1beta1/replicaset_expansion.go @@ -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) diff --git a/staging/src/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go b/staging/src/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go index 6a639868124..c0d667454b8 100644 --- a/staging/src/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go +++ b/staging/src/k8s.io/client-go/listers/core/v1/replicationcontroller_expansion.go @@ -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) diff --git a/staging/src/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go b/staging/src/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go index 8b92a32835c..8b0c5555f40 100644 --- a/staging/src/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go +++ b/staging/src/k8s.io/client-go/listers/extensions/v1beta1/replicaset_expansion.go @@ -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)