mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-02 14:23:54 +00:00
test:Add volume condition test cases
This commit is contained in:
@@ -856,3 +856,14 @@ func WaitForContainerTerminated(ctx context.Context, c clientset.Interface, name
|
||||
return false, nil
|
||||
})
|
||||
}
|
||||
|
||||
func GetPodNodeName(ctx context.Context, c clientset.Interface, ns, name string) (string, error) {
|
||||
pod, err := c.CoreV1().Pods(ns).Get(ctx, name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if pod.Spec.NodeName == "" {
|
||||
return "", fmt.Errorf("pod %s/%s has no node name", ns, name)
|
||||
}
|
||||
return pod.Spec.NodeName, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user