From f14c8b4037021527b3c426c3c137b20d99c102c5 Mon Sep 17 00:00:00 2001 From: Mark Pim Date: Sat, 6 Feb 2021 18:46:06 +0000 Subject: [PATCH] chore:Remove usages of k8s.io/kubernetes Signed-off-by: Mark Pim --- controller/cache/info.go | 10 +++++++--- go.mod | 1 - server/account/account.go | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/controller/cache/info.go b/controller/cache/info.go index eaa40806100e8..56910344546ea 100644 --- a/controller/cache/info.go +++ b/controller/cache/info.go @@ -9,8 +9,7 @@ import ( v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime" - resourcehelper "k8s.io/kubernetes/pkg/api/v1/resource" - k8snode "k8s.io/kubernetes/pkg/util/node" + resourcehelper "k8s.io/kubectl/pkg/util/resource" "github.com/argoproj/argo-cd/common" "github.com/argoproj/argo-cd/pkg/apis/application/v1alpha1" @@ -306,7 +305,12 @@ func populatePodInfo(un *unstructured.Unstructured, res *ResourceInfo) { } } - if pod.DeletionTimestamp != nil && pod.Status.Reason == k8snode.NodeUnreachablePodReason { + // "NodeLost" = https://github.com/kubernetes/kubernetes/blob/cb8ad64243d48d9a3c26b11b2e0945c098457282/pkg/util/node/node.go#L46 + // But depending on the k8s.io/kubernetes package just for a constant + // is not worth it. + // See https://github.com/argoproj/argo-cd/issues/5173 + // and https://github.com/kubernetes/kubernetes/issues/90358#issuecomment-617859364 + if pod.DeletionTimestamp != nil && pod.Status.Reason == "NodeLost" { reason = "Unknown" } else if pod.DeletionTimestamp != nil { reason = "Terminating" diff --git a/go.mod b/go.mod index 2c26870053106..fc8f657ba2f5d 100644 --- a/go.mod +++ b/go.mod @@ -80,7 +80,6 @@ require ( k8s.io/klog v1.0.0 k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd k8s.io/kubectl v0.20.1 - k8s.io/kubernetes v1.20.1 k8s.io/utils v0.0.0-20201110183641-67b214c5f920 layeh.com/gopher-json v0.0.0-20190114024228-97fed8db8427 sigs.k8s.io/yaml v1.2.0 diff --git a/server/account/account.go b/server/account/account.go index aab73f0303359..8d6ac53160731 100644 --- a/server/account/account.go +++ b/server/account/account.go @@ -11,7 +11,7 @@ import ( "golang.org/x/net/context" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" - "k8s.io/kubernetes/pkg/util/slice" + "k8s.io/kubectl/pkg/util/slice" "github.com/argoproj/argo-cd/common" "github.com/argoproj/argo-cd/pkg/apiclient/account"