GetFirstPod returns a pod matching the namespace and label selector and the number of all pods that match the label selector.
(client coreclient.PodsGetter, namespace string, selector string, timeout time.Duration, sortBy func([]*corev1.Pod) sort.Interface)
| 89 | // GetFirstPod returns a pod matching the namespace and label selector |
| 90 | // and the number of all pods that match the label selector. |
| 91 | func GetFirstPod(client coreclient.PodsGetter, namespace string, selector string, timeout time.Duration, sortBy func([]*corev1.Pod) sort.Interface) (*corev1.Pod, int, error) { |
| 92 | |
| 93 | podList, err := GetPodList(client, namespace, selector, timeout, sortBy) |
| 94 | if err != nil { |
| 95 | return nil, 0, err |
| 96 | } |
| 97 | |
| 98 | return &podList.Items[0], len(podList.Items), nil |
| 99 | |
| 100 | } |
| 101 | |
| 102 | // SelectorsForObject returns the pod label selector for a given object |
| 103 | func SelectorsForObject(object runtime.Object) (namespace string, selector labels.Selector, err error) { |
searching dependent graphs…