mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-13 13:14:05 +00:00
Merge pull request #10313 from yujuhong/kubelet_delete
Add an e2e test to verify that pods are deleted on nodes
This commit is contained in:
@@ -1851,6 +1851,23 @@ func (kl *Kubelet) GetPods() []*api.Pod {
|
||||
return kl.podManager.GetPods()
|
||||
}
|
||||
|
||||
// GetRunningPods returns all pods running on kubelet from looking at the
|
||||
// container runtime cache. This function converts kubecontainer.Pod to
|
||||
// api.Pod, so only the fields that exist in both kubecontainer.Pod and
|
||||
// api.Pod are considered meaningful.
|
||||
func (kl *Kubelet) GetRunningPods() ([]*api.Pod, error) {
|
||||
pods, err := kl.runtimeCache.GetPods()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
apiPods := make([]*api.Pod, 0, len(pods))
|
||||
for _, pod := range pods {
|
||||
apiPods = append(apiPods, pod.ToAPIPod())
|
||||
}
|
||||
return apiPods, nil
|
||||
}
|
||||
|
||||
func (kl *Kubelet) GetPodByFullName(podFullName string) (*api.Pod, bool) {
|
||||
return kl.podManager.GetPodByFullName(podFullName)
|
||||
}
|
||||
|
Reference in New Issue
Block a user