Unverified Commit ed529798 authored by Taylor Thomas's avatar Taylor Thomas Committed by GitHub

Merge pull request #5015 from tariq1890/rm_k8s_dep

Remove k8s.io/kubernetes deps for simple pod and svc util methods
parents 158d6dbb dc186e12
......@@ -29,8 +29,6 @@ import (
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes"
podutil "k8s.io/kubernetes/pkg/api/v1/pod"
"k8s.io/kubernetes/pkg/apis/core/v1/helper"
deploymentutil "k8s.io/kubernetes/pkg/controller/deployment/util"
)
......@@ -203,7 +201,7 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
func (c *Client) podsReady(pods []v1.Pod) bool {
for _, pod := range pods {
if !podutil.IsPodReady(&pod) {
if !isPodReady(&pod) {
c.Log("Pod is not ready: %s/%s", pod.GetNamespace(), pod.GetName())
return false
}
......@@ -219,7 +217,7 @@ func (c *Client) servicesReady(svc []v1.Service) bool {
}
// Make sure the service is not explicitly set to "None" before checking the IP
if s.Spec.ClusterIP != v1.ClusterIPNone && !helper.IsServiceIPSet(&s) {
if s.Spec.ClusterIP != v1.ClusterIPNone && s.Spec.ClusterIP == "" {
c.Log("Service is not ready: %s/%s", s.GetNamespace(), s.GetName())
return false
}
......@@ -259,3 +257,15 @@ func getPods(client kubernetes.Interface, namespace string, selector map[string]
})
return list.Items, err
}
func isPodReady(pod *v1.Pod) bool {
if &pod.Status != nil && len(pod.Status.Conditions) > 0 {
for _, condition := range pod.Status.Conditions {
if condition.Type == v1.PodReady &&
condition.Status == v1.ConditionTrue {
return true
}
}
}
return false
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment