mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-13 06:04:02 +00:00
use core client with explicit version globally
This commit is contained in:
@@ -539,7 +539,7 @@ func WaitForPodsSuccess(c clientset.Interface, ns string, successPodLabels map[s
|
||||
start, badPods, desiredPods := time.Now(), []v1.Pod{}, 0
|
||||
|
||||
if wait.PollImmediate(30*time.Second, timeout, func() (bool, error) {
|
||||
podList, err := c.Core().Pods(ns).List(metav1.ListOptions{LabelSelector: successPodSelector.String()})
|
||||
podList, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: successPodSelector.String()})
|
||||
if err != nil {
|
||||
Logf("Error getting pods in namespace %q: %v", ns, err)
|
||||
if IsRetryableAPIError(err) {
|
||||
@@ -601,7 +601,7 @@ func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods, allowedN
|
||||
// checked.
|
||||
replicas, replicaOk := int32(0), int32(0)
|
||||
|
||||
rcList, err := c.Core().ReplicationControllers(ns).List(metav1.ListOptions{})
|
||||
rcList, err := c.CoreV1().ReplicationControllers(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
Logf("Error getting replication controllers in namespace '%s': %v", ns, err)
|
||||
if IsRetryableAPIError(err) {
|
||||
@@ -627,7 +627,7 @@ func WaitForPodsRunningReady(c clientset.Interface, ns string, minPods, allowedN
|
||||
replicaOk += rs.Status.ReadyReplicas
|
||||
}
|
||||
|
||||
podList, err := c.Core().Pods(ns).List(metav1.ListOptions{})
|
||||
podList, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
Logf("Error getting pods in namespace '%s': %v", ns, err)
|
||||
if IsRetryableAPIError(err) {
|
||||
@@ -702,7 +702,7 @@ func kubectlLogPod(c clientset.Interface, pod v1.Pod, containerNameSubstr string
|
||||
}
|
||||
|
||||
func LogFailedContainers(c clientset.Interface, ns string, logFunc func(ftm string, args ...interface{})) {
|
||||
podList, err := c.Core().Pods(ns).List(metav1.ListOptions{})
|
||||
podList, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
logFunc("Error getting pods in namespace '%s': %v", ns, err)
|
||||
return
|
||||
@@ -716,7 +716,7 @@ func LogFailedContainers(c clientset.Interface, ns string, logFunc func(ftm stri
|
||||
}
|
||||
|
||||
func LogPodsWithLabels(c clientset.Interface, ns string, match map[string]string, logFunc func(ftm string, args ...interface{})) {
|
||||
podList, err := c.Core().Pods(ns).List(metav1.ListOptions{LabelSelector: labels.SelectorFromSet(match).String()})
|
||||
podList, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: labels.SelectorFromSet(match).String()})
|
||||
if err != nil {
|
||||
logFunc("Error getting pods in namespace %q: %v", ns, err)
|
||||
return
|
||||
@@ -728,7 +728,7 @@ func LogPodsWithLabels(c clientset.Interface, ns string, match map[string]string
|
||||
}
|
||||
|
||||
func LogContainersInPodsWithLabels(c clientset.Interface, ns string, match map[string]string, containerSubstr string, logFunc func(ftm string, args ...interface{})) {
|
||||
podList, err := c.Core().Pods(ns).List(metav1.ListOptions{LabelSelector: labels.SelectorFromSet(match).String()})
|
||||
podList, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: labels.SelectorFromSet(match).String()})
|
||||
if err != nil {
|
||||
Logf("Error getting pods in namespace %q: %v", ns, err)
|
||||
return
|
||||
@@ -743,7 +743,7 @@ func LogContainersInPodsWithLabels(c clientset.Interface, ns string, match map[s
|
||||
// Returns the list of deleted namespaces or an error.
|
||||
func DeleteNamespaces(c clientset.Interface, deleteFilter, skipFilter []string) ([]string, error) {
|
||||
By("Deleting namespaces")
|
||||
nsList, err := c.Core().Namespaces().List(metav1.ListOptions{})
|
||||
nsList, err := c.CoreV1().Namespaces().List(metav1.ListOptions{})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
var deleted []string
|
||||
var wg sync.WaitGroup
|
||||
@@ -773,7 +773,7 @@ OUTER:
|
||||
go func(nsName string) {
|
||||
defer wg.Done()
|
||||
defer GinkgoRecover()
|
||||
Expect(c.Core().Namespaces().Delete(nsName, nil)).To(Succeed())
|
||||
Expect(c.CoreV1().Namespaces().Delete(nsName, nil)).To(Succeed())
|
||||
Logf("namespace : %v api call to delete is complete ", nsName)
|
||||
}(item.Name)
|
||||
}
|
||||
@@ -790,7 +790,7 @@ func WaitForNamespacesDeleted(c clientset.Interface, namespaces []string, timeou
|
||||
//Now POLL until all namespaces have been eradicated.
|
||||
return wait.Poll(2*time.Second, timeout,
|
||||
func() (bool, error) {
|
||||
nsList, err := c.Core().Namespaces().List(metav1.ListOptions{})
|
||||
nsList, err := c.CoreV1().Namespaces().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -804,7 +804,7 @@ func WaitForNamespacesDeleted(c clientset.Interface, namespaces []string, timeou
|
||||
}
|
||||
|
||||
func waitForServiceAccountInNamespace(c clientset.Interface, ns, serviceAccountName string, timeout time.Duration) error {
|
||||
w, err := c.Core().ServiceAccounts(ns).Watch(metav1.SingleObject(metav1.ObjectMeta{Name: serviceAccountName}))
|
||||
w, err := c.CoreV1().ServiceAccounts(ns).Watch(metav1.SingleObject(metav1.ObjectMeta{Name: serviceAccountName}))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -815,7 +815,7 @@ func waitForServiceAccountInNamespace(c clientset.Interface, ns, serviceAccountN
|
||||
func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeout time.Duration, condition podCondition) error {
|
||||
Logf("Waiting up to %v for pod %q in namespace %q to be %q", timeout, podName, ns, desc)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(Poll) {
|
||||
pod, err := c.Core().Pods(ns).Get(podName, metav1.GetOptions{})
|
||||
pod, err := c.CoreV1().Pods(ns).Get(podName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if apierrs.IsNotFound(err) {
|
||||
Logf("Pod %q in namespace %q not found. Error: %v", podName, ns, err)
|
||||
@@ -842,7 +842,7 @@ func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeou
|
||||
func WaitForMatchPodsCondition(c clientset.Interface, opts metav1.ListOptions, desc string, timeout time.Duration, condition podCondition) error {
|
||||
Logf("Waiting up to %v for matching pods' status to be %s", timeout, desc)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(Poll) {
|
||||
pods, err := c.Core().Pods(metav1.NamespaceAll).List(opts)
|
||||
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -875,7 +875,7 @@ func WaitForDefaultServiceAccountInNamespace(c clientset.Interface, namespace st
|
||||
func WaitForPersistentVolumePhase(phase v1.PersistentVolumePhase, c clientset.Interface, pvName string, Poll, timeout time.Duration) error {
|
||||
Logf("Waiting up to %v for PersistentVolume %s to have phase %s", timeout, pvName, phase)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(Poll) {
|
||||
pv, err := c.Core().PersistentVolumes().Get(pvName, metav1.GetOptions{})
|
||||
pv, err := c.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
Logf("Get persistent volume %s in failed, ignoring for %v: %v", pvName, Poll, err)
|
||||
continue
|
||||
@@ -895,7 +895,7 @@ func WaitForPersistentVolumePhase(phase v1.PersistentVolumePhase, c clientset.In
|
||||
func WaitForPersistentVolumeDeleted(c clientset.Interface, pvName string, Poll, timeout time.Duration) error {
|
||||
Logf("Waiting up to %v for PersistentVolume %s to get deleted", timeout, pvName)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(Poll) {
|
||||
pv, err := c.Core().PersistentVolumes().Get(pvName, metav1.GetOptions{})
|
||||
pv, err := c.CoreV1().PersistentVolumes().Get(pvName, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
Logf("PersistentVolume %s found and phase=%s (%v)", pvName, pv.Status.Phase, time.Since(start))
|
||||
continue
|
||||
@@ -915,7 +915,7 @@ func WaitForPersistentVolumeDeleted(c clientset.Interface, pvName string, Poll,
|
||||
func WaitForPersistentVolumeClaimPhase(phase v1.PersistentVolumeClaimPhase, c clientset.Interface, ns string, pvcName string, Poll, timeout time.Duration) error {
|
||||
Logf("Waiting up to %v for PersistentVolumeClaim %s to have phase %s", timeout, pvcName, phase)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(Poll) {
|
||||
pvc, err := c.Core().PersistentVolumeClaims(ns).Get(pvcName, metav1.GetOptions{})
|
||||
pvc, err := c.CoreV1().PersistentVolumeClaims(ns).Get(pvcName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
Logf("Failed to get claim %q, retrying in %v. Error: %v", pvcName, Poll, err)
|
||||
continue
|
||||
@@ -951,7 +951,7 @@ func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]s
|
||||
var got *v1.Namespace
|
||||
if err := wait.PollImmediate(Poll, 30*time.Second, func() (bool, error) {
|
||||
var err error
|
||||
got, err = c.Core().Namespaces().Create(namespaceObj)
|
||||
got, err = c.CoreV1().Namespaces().Create(namespaceObj)
|
||||
if err != nil {
|
||||
Logf("Unexpected error while creating namespace: %v", err)
|
||||
return false, nil
|
||||
@@ -990,7 +990,7 @@ func CheckTestingNSDeletedExcept(c clientset.Interface, skip string) error {
|
||||
|
||||
Logf("Waiting for terminating namespaces to be deleted...")
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(15 * time.Second) {
|
||||
namespaces, err := c.Core().Namespaces().List(metav1.ListOptions{})
|
||||
namespaces, err := c.CoreV1().Namespaces().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
Logf("Listing namespaces failed: %v", err)
|
||||
continue
|
||||
@@ -1015,13 +1015,13 @@ func CheckTestingNSDeletedExcept(c clientset.Interface, skip string) error {
|
||||
// whether there are any pods remaining in a non-terminating state.
|
||||
func deleteNS(c clientset.Interface, clientPool dynamic.ClientPool, namespace string, timeout time.Duration) error {
|
||||
startTime := time.Now()
|
||||
if err := c.Core().Namespaces().Delete(namespace, nil); err != nil {
|
||||
if err := c.CoreV1().Namespaces().Delete(namespace, nil); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// wait for namespace to delete or timeout.
|
||||
err := wait.PollImmediate(2*time.Second, timeout, func() (bool, error) {
|
||||
if _, err := c.Core().Namespaces().Get(namespace, metav1.GetOptions{}); err != nil {
|
||||
if _, err := c.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{}); err != nil {
|
||||
if apierrs.IsNotFound(err) {
|
||||
return true, nil
|
||||
}
|
||||
@@ -1075,7 +1075,7 @@ func deleteNS(c clientset.Interface, clientPool dynamic.ClientPool, namespace st
|
||||
// logNamespaces logs the number of namespaces by phase
|
||||
// namespace is the namespace the test was operating against that failed to delete so it can be grepped in logs
|
||||
func logNamespaces(c clientset.Interface, namespace string) {
|
||||
namespaceList, err := c.Core().Namespaces().List(metav1.ListOptions{})
|
||||
namespaceList, err := c.CoreV1().Namespaces().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
Logf("namespace: %v, unable to list namespaces: %v", namespace, err)
|
||||
return
|
||||
@@ -1095,7 +1095,7 @@ func logNamespaces(c clientset.Interface, namespace string) {
|
||||
|
||||
// logNamespace logs detail about a namespace
|
||||
func logNamespace(c clientset.Interface, namespace string) {
|
||||
ns, err := c.Core().Namespaces().Get(namespace, metav1.GetOptions{})
|
||||
ns, err := c.CoreV1().Namespaces().Get(namespace, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if apierrs.IsNotFound(err) {
|
||||
Logf("namespace: %v no longer exists", namespace)
|
||||
@@ -1110,7 +1110,7 @@ func logNamespace(c clientset.Interface, namespace string) {
|
||||
// countRemainingPods queries the server to count number of remaining pods, and number of pods that had a missing deletion timestamp.
|
||||
func countRemainingPods(c clientset.Interface, namespace string) (int, int, error) {
|
||||
// check for remaining pods
|
||||
pods, err := c.Core().Pods(namespace).List(metav1.ListOptions{})
|
||||
pods, err := c.CoreV1().Pods(namespace).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
@@ -1346,7 +1346,7 @@ func waitTimeoutForPodRunningInNamespace(c clientset.Interface, podName, namespa
|
||||
|
||||
func podRunning(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||
return func() (bool, error) {
|
||||
pod, err := c.Core().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
pod, err := c.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -1372,7 +1372,7 @@ func WaitTimeoutForPodNoLongerRunningInNamespace(c clientset.Interface, podName,
|
||||
|
||||
func podCompleted(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||
return func() (bool, error) {
|
||||
pod, err := c.Core().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
pod, err := c.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -1390,7 +1390,7 @@ func waitTimeoutForPodReadyInNamespace(c clientset.Interface, podName, namespace
|
||||
|
||||
func podRunningAndReady(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||
return func() (bool, error) {
|
||||
pod, err := c.Core().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
pod, err := c.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -1413,7 +1413,7 @@ func WaitForPodNotPending(c clientset.Interface, ns, podName string) error {
|
||||
|
||||
func podNotPending(c clientset.Interface, podName, namespace string) wait.ConditionFunc {
|
||||
return func() (bool, error) {
|
||||
pod, err := c.Core().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
pod, err := c.CoreV1().Pods(namespace).Get(podName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -1497,7 +1497,7 @@ func WaitForRCToStabilize(c clientset.Interface, ns, name string, timeout time.D
|
||||
"metadata.name": name,
|
||||
"metadata.namespace": ns,
|
||||
}.AsSelector().String()}
|
||||
w, err := c.Core().ReplicationControllers(ns).Watch(options)
|
||||
w, err := c.CoreV1().ReplicationControllers(ns).Watch(options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1525,7 +1525,7 @@ func WaitForPodToDisappear(c clientset.Interface, ns, podName string, label labe
|
||||
return wait.PollImmediate(interval, timeout, func() (bool, error) {
|
||||
Logf("Waiting for pod %s to disappear", podName)
|
||||
options := metav1.ListOptions{LabelSelector: label.String()}
|
||||
pods, err := c.Core().Pods(ns).List(options)
|
||||
pods, err := c.CoreV1().Pods(ns).List(options)
|
||||
if err != nil {
|
||||
if IsRetryableAPIError(err) {
|
||||
return false, nil
|
||||
@@ -1551,7 +1551,7 @@ func WaitForPodToDisappear(c clientset.Interface, ns, podName string, label labe
|
||||
// WaitForService waits until the service appears (exist == true), or disappears (exist == false)
|
||||
func WaitForService(c clientset.Interface, namespace, name string, exist bool, interval, timeout time.Duration) error {
|
||||
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
|
||||
_, err := c.Core().Services(namespace).Get(name, metav1.GetOptions{})
|
||||
_, err := c.CoreV1().Services(namespace).Get(name, metav1.GetOptions{})
|
||||
switch {
|
||||
case err == nil:
|
||||
Logf("Service %s in namespace %s found.", name, namespace)
|
||||
@@ -1578,7 +1578,7 @@ func WaitForService(c clientset.Interface, namespace, name string, exist bool, i
|
||||
func WaitForServiceWithSelector(c clientset.Interface, namespace string, selector labels.Selector, exist bool, interval,
|
||||
timeout time.Duration) error {
|
||||
err := wait.PollImmediate(interval, timeout, func() (bool, error) {
|
||||
services, err := c.Core().Services(namespace).List(metav1.ListOptions{LabelSelector: selector.String()})
|
||||
services, err := c.CoreV1().Services(namespace).List(metav1.ListOptions{LabelSelector: selector.String()})
|
||||
switch {
|
||||
case len(services.Items) != 0:
|
||||
Logf("Service with %s in namespace %s found.", selector.String(), namespace)
|
||||
@@ -1605,7 +1605,7 @@ func WaitForServiceWithSelector(c clientset.Interface, namespace string, selecto
|
||||
func WaitForServiceEndpointsNum(c clientset.Interface, namespace, serviceName string, expectNum int, interval, timeout time.Duration) error {
|
||||
return wait.Poll(interval, timeout, func() (bool, error) {
|
||||
Logf("Waiting for amount of service:%s endpoints to be %d", serviceName, expectNum)
|
||||
list, err := c.Core().Endpoints(namespace).List(metav1.ListOptions{})
|
||||
list, err := c.CoreV1().Endpoints(namespace).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -1629,7 +1629,7 @@ func countEndpointsNum(e *v1.Endpoints) int {
|
||||
|
||||
func WaitForEndpoint(c clientset.Interface, ns, name string) error {
|
||||
for t := time.Now(); time.Since(t) < EndpointRegisterTimeout; time.Sleep(Poll) {
|
||||
endpoint, err := c.Core().Endpoints(ns).Get(name, metav1.GetOptions{})
|
||||
endpoint, err := c.CoreV1().Endpoints(ns).Get(name, metav1.GetOptions{})
|
||||
if apierrs.IsNotFound(err) {
|
||||
Logf("Endpoint %s/%s is not ready yet", ns, name)
|
||||
continue
|
||||
@@ -1665,7 +1665,7 @@ func PodProxyResponseChecker(c clientset.Interface, ns string, label labels.Sele
|
||||
func (r podProxyResponseChecker) CheckAllResponses() (done bool, err error) {
|
||||
successes := 0
|
||||
options := metav1.ListOptions{LabelSelector: r.label.String()}
|
||||
currentPods, err := r.c.Core().Pods(r.ns).List(options)
|
||||
currentPods, err := r.c.CoreV1().Pods(r.ns).List(options)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
for i, pod := range r.pods.Items {
|
||||
// Check that the replica list remains unchanged, otherwise we have problems.
|
||||
@@ -1682,7 +1682,7 @@ func (r podProxyResponseChecker) CheckAllResponses() (done bool, err error) {
|
||||
|
||||
var body []byte
|
||||
if subResourceProxyAvailable {
|
||||
body, err = r.c.Core().RESTClient().Get().
|
||||
body, err = r.c.CoreV1().RESTClient().Get().
|
||||
Context(ctx).
|
||||
Namespace(r.ns).
|
||||
Resource("pods").
|
||||
@@ -1691,7 +1691,7 @@ func (r podProxyResponseChecker) CheckAllResponses() (done bool, err error) {
|
||||
Do().
|
||||
Raw()
|
||||
} else {
|
||||
body, err = r.c.Core().RESTClient().Get().
|
||||
body, err = r.c.CoreV1().RESTClient().Get().
|
||||
Context(ctx).
|
||||
Prefix("proxy").
|
||||
Namespace(r.ns).
|
||||
@@ -1806,7 +1806,7 @@ func PodsCreatedByLabel(c clientset.Interface, ns, name string, replicas int32,
|
||||
options := metav1.ListOptions{LabelSelector: label.String()}
|
||||
|
||||
// List the pods, making sure we observe all the replicas.
|
||||
pods, err := c.Core().Pods(ns).List(options)
|
||||
pods, err := c.CoreV1().Pods(ns).List(options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1881,7 +1881,7 @@ func ServiceResponding(c clientset.Interface, ns, name string) error {
|
||||
By(fmt.Sprintf("trying to dial the service %s.%s via the proxy", ns, name))
|
||||
|
||||
return wait.PollImmediate(Poll, ServiceRespondingTimeout, func() (done bool, err error) {
|
||||
proxyRequest, errProxy := GetServicesProxyRequest(c, c.Core().RESTClient().Get())
|
||||
proxyRequest, errProxy := GetServicesProxyRequest(c, c.CoreV1().RESTClient().Get())
|
||||
if errProxy != nil {
|
||||
Logf("Failed to get services proxy request: %v:", errProxy)
|
||||
return false, nil
|
||||
@@ -2298,7 +2298,7 @@ func DumpEventsInNamespace(eventsLister EventsLister, namespace string) {
|
||||
|
||||
func DumpAllNamespaceInfo(c clientset.Interface, namespace string) {
|
||||
DumpEventsInNamespace(func(opts metav1.ListOptions, ns string) (*v1.EventList, error) {
|
||||
return c.Core().Events(ns).List(opts)
|
||||
return c.CoreV1().Events(ns).List(opts)
|
||||
}, namespace)
|
||||
|
||||
// If cluster is large, then the following logs are basically useless, because:
|
||||
@@ -2306,7 +2306,7 @@ func DumpAllNamespaceInfo(c clientset.Interface, namespace string) {
|
||||
// 2. there are so many of them that working with them are mostly impossible
|
||||
// So we dump them only if the cluster is relatively small.
|
||||
maxNodesForDump := 20
|
||||
if nodes, err := c.Core().Nodes().List(metav1.ListOptions{}); err == nil {
|
||||
if nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{}); err == nil {
|
||||
if len(nodes.Items) <= maxNodesForDump {
|
||||
dumpAllPodInfo(c)
|
||||
dumpAllNodeInfo(c)
|
||||
@@ -2332,7 +2332,7 @@ func (o byFirstTimestamp) Less(i, j int) bool {
|
||||
}
|
||||
|
||||
func dumpAllPodInfo(c clientset.Interface) {
|
||||
pods, err := c.Core().Pods("").List(metav1.ListOptions{})
|
||||
pods, err := c.CoreV1().Pods("").List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
Logf("unable to fetch pod debug info: %v", err)
|
||||
}
|
||||
@@ -2341,7 +2341,7 @@ func dumpAllPodInfo(c clientset.Interface) {
|
||||
|
||||
func dumpAllNodeInfo(c clientset.Interface) {
|
||||
// It should be OK to list unschedulable Nodes here.
|
||||
nodes, err := c.Core().Nodes().List(metav1.ListOptions{})
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
Logf("unable to fetch node list: %v", err)
|
||||
return
|
||||
@@ -2356,7 +2356,7 @@ func dumpAllNodeInfo(c clientset.Interface) {
|
||||
func DumpNodeDebugInfo(c clientset.Interface, nodeNames []string, logFunc func(fmt string, args ...interface{})) {
|
||||
for _, n := range nodeNames {
|
||||
logFunc("\nLogging node info for node %v", n)
|
||||
node, err := c.Core().Nodes().Get(n, metav1.GetOptions{})
|
||||
node, err := c.CoreV1().Nodes().Get(n, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
logFunc("Error getting node info %v", err)
|
||||
}
|
||||
@@ -2400,7 +2400,7 @@ func getNodeEvents(c clientset.Interface, nodeName string) []v1.Event {
|
||||
"source": "kubelet",
|
||||
}.AsSelector().String()
|
||||
options := metav1.ListOptions{FieldSelector: selector}
|
||||
events, err := c.Core().Events(metav1.NamespaceSystem).List(options)
|
||||
events, err := c.CoreV1().Events(metav1.NamespaceSystem).List(options)
|
||||
if err != nil {
|
||||
Logf("Unexpected error retrieving node events %v", err)
|
||||
return []v1.Event{}
|
||||
@@ -2413,7 +2413,7 @@ func waitListSchedulableNodesOrDie(c clientset.Interface) *v1.NodeList {
|
||||
var nodes *v1.NodeList
|
||||
var err error
|
||||
if wait.PollImmediate(Poll, SingleCallTimeout, func() (bool, error) {
|
||||
nodes, err = c.Core().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
nodes, err = c.CoreV1().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
"spec.unschedulable": "false",
|
||||
}.AsSelector().String()})
|
||||
if err != nil {
|
||||
@@ -2496,7 +2496,7 @@ func WaitForAllNodesSchedulable(c clientset.Interface, timeout time.Duration) er
|
||||
ResourceVersion: "0",
|
||||
FieldSelector: fields.Set{"spec.unschedulable": "false"}.AsSelector().String(),
|
||||
}
|
||||
nodes, err := c.Core().Nodes().List(opts)
|
||||
nodes, err := c.CoreV1().Nodes().List(opts)
|
||||
if err != nil {
|
||||
Logf("Unexpected error listing nodes: %v", err)
|
||||
if IsRetryableAPIError(err) {
|
||||
@@ -2549,7 +2549,7 @@ func GetPodSecretUpdateTimeout(c clientset.Interface) time.Duration {
|
||||
}
|
||||
|
||||
func GetNodeTTLAnnotationValue(c clientset.Interface) (time.Duration, error) {
|
||||
nodes, err := c.Core().Nodes().List(metav1.ListOptions{})
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{})
|
||||
if err != nil || len(nodes.Items) == 0 {
|
||||
return time.Duration(0), fmt.Errorf("Couldn't list any nodes to get TTL annotation: %v", err)
|
||||
}
|
||||
@@ -2576,7 +2576,7 @@ func AddOrUpdateLabelOnNode(c clientset.Interface, nodeName string, labelKey, la
|
||||
|
||||
func AddOrUpdateLabelOnNodeAndReturnOldValue(c clientset.Interface, nodeName string, labelKey, labelValue string) string {
|
||||
var oldValue string
|
||||
node, err := c.Core().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
node, err := c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
ExpectNoError(err)
|
||||
oldValue = node.Labels[labelKey]
|
||||
ExpectNoError(testutil.AddLabelsToNode(c, nodeName, map[string]string{labelKey: labelValue}))
|
||||
@@ -2585,7 +2585,7 @@ func AddOrUpdateLabelOnNodeAndReturnOldValue(c clientset.Interface, nodeName str
|
||||
|
||||
func ExpectNodeHasLabel(c clientset.Interface, nodeName string, labelKey string, labelValue string) {
|
||||
By("verifying the node has the label " + labelKey + " " + labelValue)
|
||||
node, err := c.Core().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
node, err := c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
ExpectNoError(err)
|
||||
Expect(node.Labels[labelKey]).To(Equal(labelValue))
|
||||
}
|
||||
@@ -2611,7 +2611,7 @@ func RemoveLabelOffNode(c clientset.Interface, nodeName string, labelKey string)
|
||||
|
||||
func VerifyThatTaintIsGone(c clientset.Interface, nodeName string, taint *v1.Taint) {
|
||||
By("verifying the node doesn't have the taint " + taint.ToString())
|
||||
nodeUpdated, err := c.Core().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
nodeUpdated, err := c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
ExpectNoError(err)
|
||||
if taintutils.TaintExists(nodeUpdated.Spec.Taints, taint) {
|
||||
Failf("Failed removing taint " + taint.ToString() + " of the node " + nodeName)
|
||||
@@ -2627,7 +2627,7 @@ func ExpectNodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint)
|
||||
}
|
||||
|
||||
func NodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint) (bool, error) {
|
||||
node, err := c.Core().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
node, err := c.CoreV1().Nodes().Get(nodeName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -2783,7 +2783,7 @@ func WaitForPodsWithLabelScheduled(c clientset.Interface, ns string, label label
|
||||
func WaitForPodsWithLabel(c clientset.Interface, ns string, label labels.Selector) (pods *v1.PodList, err error) {
|
||||
for t := time.Now(); time.Since(t) < PodListTimeout; time.Sleep(Poll) {
|
||||
options := metav1.ListOptions{LabelSelector: label.String()}
|
||||
pods, err = c.Core().Pods(ns).List(options)
|
||||
pods, err = c.CoreV1().Pods(ns).List(options)
|
||||
if err != nil {
|
||||
if IsRetryableAPIError(err) {
|
||||
continue
|
||||
@@ -2832,7 +2832,7 @@ func WaitForPodsWithLabelRunningReady(c clientset.Interface, ns string, label la
|
||||
func getRuntimeObjectForKind(c clientset.Interface, kind schema.GroupKind, ns, name string) (runtime.Object, error) {
|
||||
switch kind {
|
||||
case api.Kind("ReplicationController"):
|
||||
return c.Core().ReplicationControllers(ns).Get(name, metav1.GetOptions{})
|
||||
return c.CoreV1().ReplicationControllers(ns).Get(name, metav1.GetOptions{})
|
||||
case extensionsinternal.Kind("ReplicaSet"):
|
||||
return c.Extensions().ReplicaSets(ns).Get(name, metav1.GetOptions{})
|
||||
case extensionsinternal.Kind("Deployment"):
|
||||
@@ -2849,7 +2849,7 @@ func getRuntimeObjectForKind(c clientset.Interface, kind schema.GroupKind, ns, n
|
||||
func deleteResource(c clientset.Interface, kind schema.GroupKind, ns, name string, deleteOption *metav1.DeleteOptions) error {
|
||||
switch kind {
|
||||
case api.Kind("ReplicationController"):
|
||||
return c.Core().ReplicationControllers(ns).Delete(name, deleteOption)
|
||||
return c.CoreV1().ReplicationControllers(ns).Delete(name, deleteOption)
|
||||
case extensionsinternal.Kind("ReplicaSet"):
|
||||
return c.Extensions().ReplicaSets(ns).Delete(name, deleteOption)
|
||||
case extensionsinternal.Kind("Deployment"):
|
||||
@@ -3082,7 +3082,7 @@ func WaitForPodsReady(c clientset.Interface, ns, name string, minReadySeconds in
|
||||
label := labels.SelectorFromSet(labels.Set(map[string]string{"name": name}))
|
||||
options := metav1.ListOptions{LabelSelector: label.String()}
|
||||
return wait.Poll(Poll, 5*time.Minute, func() (bool, error) {
|
||||
pods, err := c.Core().Pods(ns).List(options)
|
||||
pods, err := c.CoreV1().Pods(ns).List(options)
|
||||
if err != nil {
|
||||
return false, nil
|
||||
}
|
||||
@@ -3098,7 +3098,7 @@ func WaitForPodsReady(c clientset.Interface, ns, name string, minReadySeconds in
|
||||
// Waits for the number of events on the given object to reach a desired count.
|
||||
func WaitForEvents(c clientset.Interface, ns string, objOrRef runtime.Object, desiredEventsCount int) error {
|
||||
return wait.Poll(Poll, 5*time.Minute, func() (bool, error) {
|
||||
events, err := c.Core().Events(ns).Search(legacyscheme.Scheme, objOrRef)
|
||||
events, err := c.CoreV1().Events(ns).Search(legacyscheme.Scheme, objOrRef)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("error in listing events: %s", err)
|
||||
}
|
||||
@@ -3117,7 +3117,7 @@ func WaitForEvents(c clientset.Interface, ns string, objOrRef runtime.Object, de
|
||||
// Waits for the number of events on the given object to be at least a desired count.
|
||||
func WaitForPartialEvents(c clientset.Interface, ns string, objOrRef runtime.Object, atLeastEventsCount int) error {
|
||||
return wait.Poll(Poll, 5*time.Minute, func() (bool, error) {
|
||||
events, err := c.Core().Events(ns).Search(legacyscheme.Scheme, objOrRef)
|
||||
events, err := c.CoreV1().Events(ns).Search(legacyscheme.Scheme, objOrRef)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("error in listing events: %s", err)
|
||||
}
|
||||
@@ -3352,7 +3352,7 @@ func RunHostCmdWithRetries(ns, name, cmd string, interval, timeout time.Duration
|
||||
// until it's Running
|
||||
func LaunchHostExecPod(client clientset.Interface, ns, name string) *v1.Pod {
|
||||
hostExecPod := NewHostExecPodSpec(ns, name)
|
||||
pod, err := client.Core().Pods(ns).Create(hostExecPod)
|
||||
pod, err := client.CoreV1().Pods(ns).Create(hostExecPod)
|
||||
ExpectNoError(err)
|
||||
err = WaitForPodRunningInNamespace(client, pod)
|
||||
ExpectNoError(err)
|
||||
@@ -3390,10 +3390,10 @@ func CreateExecPodOrFail(client clientset.Interface, ns, generateName string, tw
|
||||
if tweak != nil {
|
||||
tweak(execPod)
|
||||
}
|
||||
created, err := client.Core().Pods(ns).Create(execPod)
|
||||
created, err := client.CoreV1().Pods(ns).Create(execPod)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
err = wait.PollImmediate(Poll, 5*time.Minute, func() (bool, error) {
|
||||
retrievedPod, err := client.Core().Pods(execPod.Namespace).Get(created.Name, metav1.GetOptions{})
|
||||
retrievedPod, err := client.CoreV1().Pods(execPod.Namespace).Get(created.Name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
if IsRetryableAPIError(err) {
|
||||
return false, nil
|
||||
@@ -3426,13 +3426,13 @@ func CreatePodOrFail(c clientset.Interface, ns, name string, labels map[string]s
|
||||
},
|
||||
},
|
||||
}
|
||||
_, err := c.Core().Pods(ns).Create(pod)
|
||||
_, err := c.CoreV1().Pods(ns).Create(pod)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
|
||||
func DeletePodOrFail(c clientset.Interface, ns, name string) {
|
||||
By(fmt.Sprintf("Deleting pod %s in namespace %s", name, ns))
|
||||
err := c.Core().Pods(ns).Delete(name, nil)
|
||||
err := c.CoreV1().Pods(ns).Delete(name, nil)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
}
|
||||
|
||||
@@ -3628,7 +3628,7 @@ func IsNodeConditionUnset(node *v1.Node, conditionType v1.NodeConditionType) boo
|
||||
func WaitForNodeToBe(c clientset.Interface, name string, conditionType v1.NodeConditionType, wantTrue bool, timeout time.Duration) bool {
|
||||
Logf("Waiting up to %v for node %s condition %s to be %t", timeout, name, conditionType, wantTrue)
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(Poll) {
|
||||
node, err := c.Core().Nodes().Get(name, metav1.GetOptions{})
|
||||
node, err := c.CoreV1().Nodes().Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
Logf("Couldn't get node %s", name)
|
||||
continue
|
||||
@@ -3653,7 +3653,7 @@ func AllNodesReady(c clientset.Interface, timeout time.Duration) error {
|
||||
err := wait.PollImmediate(Poll, timeout, func() (bool, error) {
|
||||
notReady = nil
|
||||
// It should be OK to list unschedulable Nodes here.
|
||||
nodes, err := c.Core().Nodes().List(metav1.ListOptions{})
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
if IsRetryableAPIError(err) {
|
||||
return false, nil
|
||||
@@ -3697,7 +3697,7 @@ func WaitForAllNodesHealthy(c clientset.Interface, timeout time.Duration) error
|
||||
err := wait.PollImmediate(Poll, timeout, func() (bool, error) {
|
||||
notReady = nil
|
||||
// It should be OK to list unschedulable Nodes here.
|
||||
nodes, err := c.Core().Nodes().List(metav1.ListOptions{ResourceVersion: "0"})
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{ResourceVersion: "0"})
|
||||
if err != nil {
|
||||
if IsRetryableAPIError(err) {
|
||||
return false, nil
|
||||
@@ -3709,7 +3709,7 @@ func WaitForAllNodesHealthy(c clientset.Interface, timeout time.Duration) error
|
||||
notReady = append(notReady, node)
|
||||
}
|
||||
}
|
||||
pods, err := c.Core().Pods(metav1.NamespaceAll).List(metav1.ListOptions{ResourceVersion: "0"})
|
||||
pods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(metav1.ListOptions{ResourceVersion: "0"})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@@ -3901,7 +3901,7 @@ func sshRestartMaster() error {
|
||||
|
||||
func WaitForApiserverUp(c clientset.Interface) error {
|
||||
for start := time.Now(); time.Since(start) < time.Minute; time.Sleep(5 * time.Second) {
|
||||
body, err := c.Core().RESTClient().Get().AbsPath("/healthz").Do().Raw()
|
||||
body, err := c.CoreV1().RESTClient().Get().AbsPath("/healthz").Do().Raw()
|
||||
if err == nil && string(body) == "ok" {
|
||||
return nil
|
||||
}
|
||||
@@ -3970,7 +3970,7 @@ func CheckForControllerManagerHealthy(duration time.Duration) error {
|
||||
|
||||
// Returns number of ready Nodes excluding Master Node.
|
||||
func NumberOfReadyNodes(c clientset.Interface) (int, error) {
|
||||
nodes, err := c.Core().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
"spec.unschedulable": "false",
|
||||
}.AsSelector().String()})
|
||||
if err != nil {
|
||||
@@ -3989,7 +3989,7 @@ func NumberOfReadyNodes(c clientset.Interface) (int, error) {
|
||||
// By cluster size we mean number of Nodes excluding Master Node.
|
||||
func WaitForReadyNodes(c clientset.Interface, size int, timeout time.Duration) error {
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(20 * time.Second) {
|
||||
nodes, err := c.Core().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
"spec.unschedulable": "false",
|
||||
}.AsSelector().String()})
|
||||
if err != nil {
|
||||
@@ -4020,7 +4020,7 @@ func GenerateMasterRegexp(prefix string) string {
|
||||
// waitForMasters waits until the cluster has the desired number of ready masters in it.
|
||||
func WaitForMasters(masterPrefix string, c clientset.Interface, size int, timeout time.Duration) error {
|
||||
for start := time.Now(); time.Since(start) < timeout; time.Sleep(20 * time.Second) {
|
||||
nodes, err := c.Core().Nodes().List(metav1.ListOptions{})
|
||||
nodes, err := c.CoreV1().Nodes().List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
Logf("Failed to list nodes: %v", err)
|
||||
continue
|
||||
@@ -4058,7 +4058,7 @@ func WaitForMasters(masterPrefix string, c clientset.Interface, size int, timeou
|
||||
// address. Returns an error if the node the pod is on doesn't have an External
|
||||
// address.
|
||||
func GetHostExternalAddress(client clientset.Interface, p *v1.Pod) (externalAddress string, err error) {
|
||||
node, err := client.Core().Nodes().Get(p.Spec.NodeName, metav1.GetOptions{})
|
||||
node, err := client.CoreV1().Nodes().Get(p.Spec.NodeName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -4208,7 +4208,7 @@ func LookForString(expectedString string, timeout time.Duration, fn func() strin
|
||||
|
||||
// getSvcNodePort returns the node port for the given service:port.
|
||||
func getSvcNodePort(client clientset.Interface, ns, name string, svcPort int) (int, error) {
|
||||
svc, err := client.Core().Services(ns).Get(name, metav1.GetOptions{})
|
||||
svc, err := client.CoreV1().Services(ns).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -4234,7 +4234,7 @@ func GetNodePortURL(client clientset.Interface, ns, name string, svcPort int) (s
|
||||
// kube-proxy NodePorts won't work.
|
||||
var nodes *v1.NodeList
|
||||
if wait.PollImmediate(Poll, SingleCallTimeout, func() (bool, error) {
|
||||
nodes, err = client.Core().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
nodes, err = client.CoreV1().Nodes().List(metav1.ListOptions{FieldSelector: fields.Set{
|
||||
"spec.unschedulable": "false",
|
||||
}.AsSelector().String()})
|
||||
if err != nil {
|
||||
@@ -4273,7 +4273,7 @@ func getPreviousPodLogs(c clientset.Interface, namespace, podName, containerName
|
||||
|
||||
// utility function for gomega Eventually
|
||||
func getPodLogsInternal(c clientset.Interface, namespace, podName, containerName string, previous bool) (string, error) {
|
||||
logs, err := c.Core().RESTClient().Get().
|
||||
logs, err := c.CoreV1().RESTClient().Get().
|
||||
Resource("pods").
|
||||
Namespace(namespace).
|
||||
Name(podName).SubResource("log").
|
||||
@@ -4412,7 +4412,7 @@ func NodeProxyRequest(c clientset.Interface, node, endpoint string) (restclient.
|
||||
finished := make(chan struct{})
|
||||
go func() {
|
||||
if subResourceProxyAvailable {
|
||||
result = c.Core().RESTClient().Get().
|
||||
result = c.CoreV1().RESTClient().Get().
|
||||
Resource("nodes").
|
||||
SubResource("proxy").
|
||||
Name(fmt.Sprintf("%v:%v", node, ports.KubeletPort)).
|
||||
@@ -4420,7 +4420,7 @@ func NodeProxyRequest(c clientset.Interface, node, endpoint string) (restclient.
|
||||
Do()
|
||||
|
||||
} else {
|
||||
result = c.Core().RESTClient().Get().
|
||||
result = c.CoreV1().RESTClient().Get().
|
||||
Prefix("proxy").
|
||||
Resource("nodes").
|
||||
Name(fmt.Sprintf("%v:%v", node, ports.KubeletPort)).
|
||||
@@ -4485,7 +4485,7 @@ func LaunchWebserverPod(f *Framework, podName, nodeName string) (ip string) {
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
},
|
||||
}
|
||||
podClient := f.ClientSet.Core().Pods(f.Namespace.Name)
|
||||
podClient := f.ClientSet.CoreV1().Pods(f.Namespace.Name)
|
||||
_, err := podClient.Create(pod)
|
||||
ExpectNoError(err)
|
||||
ExpectNoError(f.WaitForPodRunning(podName))
|
||||
@@ -4534,7 +4534,7 @@ func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, pingC
|
||||
RestartPolicy: v1.RestartPolicyNever,
|
||||
},
|
||||
}
|
||||
podClient := f.ClientSet.Core().Pods(f.Namespace.Name)
|
||||
podClient := f.ClientSet.CoreV1().Pods(f.Namespace.Name)
|
||||
_, err := podClient.Create(pod)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -4577,12 +4577,12 @@ func CoreDump(dir string) {
|
||||
|
||||
func UpdatePodWithRetries(client clientset.Interface, ns, name string, update func(*v1.Pod)) (*v1.Pod, error) {
|
||||
for i := 0; i < 3; i++ {
|
||||
pod, err := client.Core().Pods(ns).Get(name, metav1.GetOptions{})
|
||||
pod, err := client.CoreV1().Pods(ns).Get(name, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Failed to get pod %q: %v", name, err)
|
||||
}
|
||||
update(pod)
|
||||
pod, err = client.Core().Pods(ns).Update(pod)
|
||||
pod, err = client.CoreV1().Pods(ns).Update(pod)
|
||||
if err == nil {
|
||||
return pod, nil
|
||||
}
|
||||
@@ -4594,7 +4594,7 @@ func UpdatePodWithRetries(client clientset.Interface, ns, name string, update fu
|
||||
}
|
||||
|
||||
func GetPodsInNamespace(c clientset.Interface, ns string, ignoreLabels map[string]string) ([]*v1.Pod, error) {
|
||||
pods, err := c.Core().Pods(ns).List(metav1.ListOptions{})
|
||||
pods, err := c.CoreV1().Pods(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return []*v1.Pod{}, err
|
||||
}
|
||||
@@ -4683,7 +4683,7 @@ func WaitForStableCluster(c clientset.Interface, masterNodes sets.String) int {
|
||||
timeout := 10 * time.Minute
|
||||
startTime := time.Now()
|
||||
|
||||
allPods, err := c.Core().Pods(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
allPods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
ExpectNoError(err)
|
||||
// API server returns also Pods that succeeded. We need to filter them out.
|
||||
currentPods := make([]v1.Pod, 0, len(allPods.Items))
|
||||
@@ -4698,7 +4698,7 @@ func WaitForStableCluster(c clientset.Interface, masterNodes sets.String) int {
|
||||
for len(currentlyNotScheduledPods) != 0 {
|
||||
time.Sleep(2 * time.Second)
|
||||
|
||||
allPods, err := c.Core().Pods(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
allPods, err := c.CoreV1().Pods(metav1.NamespaceAll).List(metav1.ListOptions{})
|
||||
ExpectNoError(err)
|
||||
scheduledPods, currentlyNotScheduledPods = GetPodsScheduled(masterNodes, allPods)
|
||||
|
||||
@@ -4714,7 +4714,7 @@ func WaitForStableCluster(c clientset.Interface, masterNodes sets.String) int {
|
||||
func GetMasterAndWorkerNodesOrDie(c clientset.Interface) (sets.String, *v1.NodeList) {
|
||||
nodes := &v1.NodeList{}
|
||||
masters := sets.NewString()
|
||||
all, _ := c.Core().Nodes().List(metav1.ListOptions{})
|
||||
all, _ := c.CoreV1().Nodes().List(metav1.ListOptions{})
|
||||
for _, n := range all.Items {
|
||||
if system.IsMasterNode(n.Name) {
|
||||
masters.Insert(n.Name)
|
||||
@@ -4726,7 +4726,7 @@ func GetMasterAndWorkerNodesOrDie(c clientset.Interface) (sets.String, *v1.NodeL
|
||||
}
|
||||
|
||||
func ListNamespaceEvents(c clientset.Interface, ns string) error {
|
||||
ls, err := c.Core().Events(ns).List(metav1.ListOptions{})
|
||||
ls, err := c.CoreV1().Events(ns).List(metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -4855,7 +4855,7 @@ func getMaster(c clientset.Interface) Address {
|
||||
master := Address{}
|
||||
|
||||
// Populate the internal IP.
|
||||
eps, err := c.Core().Endpoints(metav1.NamespaceDefault).Get("kubernetes", metav1.GetOptions{})
|
||||
eps, err := c.CoreV1().Endpoints(metav1.NamespaceDefault).Get("kubernetes", metav1.GetOptions{})
|
||||
if err != nil {
|
||||
Failf("Failed to get kubernetes endpoints: %v", err)
|
||||
}
|
||||
@@ -5035,7 +5035,7 @@ func PrintSummaries(summaries []TestDataSummary, testBaseName string) {
|
||||
}
|
||||
|
||||
func DumpDebugInfo(c clientset.Interface, ns string) {
|
||||
sl, _ := c.Core().Pods(ns).List(metav1.ListOptions{LabelSelector: labels.Everything().String()})
|
||||
sl, _ := c.CoreV1().Pods(ns).List(metav1.ListOptions{LabelSelector: labels.Everything().String()})
|
||||
for _, s := range sl.Items {
|
||||
desc, _ := RunKubectl("describe", "po", s.Name, fmt.Sprintf("--namespace=%v", ns))
|
||||
Logf("\nOutput of kubectl describe %v:\n%v", s.Name, desc)
|
||||
|
||||
Reference in New Issue
Block a user