Merge pull request #5015 from tariq1890/rm_k8s_dep

Remove k8s.io/kubernetes deps for simple pod and svc util methods
pull/5032/head
Taylor Thomas 7 years ago committed by GitHub
commit ed5297983a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,8 +29,6 @@ import (
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/kubernetes" "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" 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 { func (c *Client) podsReady(pods []v1.Pod) bool {
for _, pod := range pods { for _, pod := range pods {
if !podutil.IsPodReady(&pod) { if !isPodReady(&pod) {
c.Log("Pod is not ready: %s/%s", pod.GetNamespace(), pod.GetName()) c.Log("Pod is not ready: %s/%s", pod.GetNamespace(), pod.GetName())
return false 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 // 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()) c.Log("Service is not ready: %s/%s", s.GetNamespace(), s.GetName())
return false return false
} }
@ -259,3 +257,15 @@ func getPods(client kubernetes.Interface, namespace string, selector map[string]
}) })
return list.Items, err 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
}

Loading…
Cancel
Save