1
0
mirror of https://github.com/docker/cli.git synced 2026-01-26 15:41:42 +03:00

Remove k8s.io/kubernetes dependency

We are only using the `IsPodReady` function that can be rewritten easily.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
This commit is contained in:
Djordje Lukic
2020-12-04 00:27:40 +01:00
parent 98625314fa
commit 9f9c4b7f3b
25 changed files with 10 additions and 4399 deletions

View File

@@ -15,7 +15,6 @@ import (
runtimeutil "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
podutils "k8s.io/kubernetes/pkg/api/v1/pod"
)
type stackListWatch interface {
@@ -157,7 +156,7 @@ func (pw *podWatcher) updateServiceStatus(serviceName string) {
case apiv1.PodUnknown:
status.podsUnknown++
}
if podutils.IsPodReady(pod) {
if pw.isPodReady(pod) {
status.podsReady++
}
}
@@ -170,6 +169,15 @@ func (pw *podWatcher) updateServiceStatus(serviceName string) {
pw.services[serviceName] = status
}
func (pw *podWatcher) isPodReady(pod *apiv1.Pod) bool {
for _, condition := range pod.Status.Conditions {
if condition.Status == apiv1.ConditionTrue && condition.Type == apiv1.PodReady {
return true
}
}
return false
}
func (pw *podWatcher) allReady() bool {
for _, status := range pw.services {
if status.podsReady == 0 {