本文整理匯總了Golang中k8s/io/client-go/1/4/kubernetes.Clientset.Core方法的典型用法代碼示例。如果您正苦於以下問題:Golang Clientset.Core方法的具體用法?Golang Clientset.Core怎麽用?Golang Clientset.Core使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類k8s/io/client-go/1/4/kubernetes.Clientset
的用法示例。
在下文中一共展示了Clientset.Core方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: waitForPodsOrDie
func waitForPodsOrDie(cs *release_1_4.Clientset, ns string, n int) {
By("Waiting for all pods to be running")
err := wait.PollImmediate(framework.Poll, 10*time.Minute, func() (bool, error) {
selector, err := labels.Parse("foo=bar")
framework.ExpectNoError(err, "Waiting for pods in namespace %q to be ready", ns)
pods, err := cs.Core().Pods(ns).List(api.ListOptions{LabelSelector: selector})
if err != nil {
return false, err
}
if pods == nil {
return false, fmt.Errorf("pods is nil")
}
if len(pods.Items) < n {
framework.Logf("pods: %v < %v", len(pods.Items), n)
return false, nil
}
ready := 0
for i := 0; i < n; i++ {
if pods.Items[i].Status.Phase == apiv1.PodRunning {
ready++
}
}
if ready < n {
framework.Logf("running pods: %v < %v", ready, n)
return false, nil
}
return true, nil
})
framework.ExpectNoError(err, "Waiting for pods in namespace %q to be ready", ns)
}