MCPcopy
hub / github.com/kubernetes/kubectl / GetFirstPod

Function GetFirstPod

pkg/polymorphichelpers/helpers.go:91–100  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

89// GetFirstPod returns a pod matching the namespace and label selector
90// and the number of all pods that match the label selector.
91func 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
103func SelectorsForObject(object runtime.Object) (namespace string, selector labels.Selector, err error) {

Callers 3

TestGetFirstPodFunction · 0.85
attachablePodForObjectFunction · 0.85
logsForObjectWithClientFunction · 0.85

Calls 1

GetPodListFunction · 0.85

Tested by 1

TestGetFirstPodFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…